@font-face {
  font-family: "Archivo Cabinet";
  src: url("../fonts/archivo-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Plex Mono Cabinet";
  src: url("../fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f2eee6;
  --ink: #1a1916;
  --muted: #6e6b64;
  --rule: #1a1916;
  --accent: #1a1916;
  --prompt: #e8e3d8;
  --gutter: clamp(20px, 4.2vw, 52px);
  --header-h: 64px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --stroke: 1.6px;
}

[data-theme="dark"] {
  --paper: #171614;
  --ink: #efeae2;
  --muted: #a8a49c;
  --rule: #efeae2;
  --accent: #efeae2;
  --prompt: #211f1c;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo Cabinet", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: 0.01em;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
  color: inherit;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

[data-theme="dark"] .grain {
  opacity: 0.22;
  mix-blend-mode: overlay;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 var(--gutter);
  background: var(--paper);
  border-bottom: var(--stroke) solid var(--ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 0.95rem;
}

.brand-mark {
  width: 14px;
  height: 21px;
  color: var(--ink);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.site-nav a,
.theme-toggle {
  position: relative;
  background: none;
  border: 0;
  padding: 0.35rem 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: 0.92rem;
  cursor: pointer;
}

.site-nav a:hover,
.theme-toggle:hover,
.brand:hover {
  text-decoration: underline;
  text-underline-offset: 5px;
}

.site-nav a[aria-current="page"] {
  padding-left: 1.15rem;
}

.site-nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 11px;
  height: 16px;
  transform: translateY(-50%);
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='8' cy='4.5' r='3'/%3E%3Cpath d='M8 7.5 V15 M8 15 L4 22 M8 15 L12 22 M8 10.5 L3 13 M8 10.5 L13 13'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='8' cy='4.5' r='3'/%3E%3Cpath d='M8 7.5 V15 M8 15 L4 22 M8 15 L12 22 M8 10.5 L3 13 M8 10.5 L13 13'/%3E%3C/svg%3E") center / contain no-repeat;
}

.theme-toggle {
  min-width: 2.5rem;
  justify-content: flex-end;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.6rem var(--gutter) 2.4rem;
  border-bottom: var(--stroke) solid var(--ink);
}

.hero-art {
  width: min(100%, 640px);
  color: var(--ink);
}

.hero-art svg {
  width: 100%;
  height: auto;
  max-height: 34vh;
  display: block;
}

.ink-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: ink-draw 0.9s var(--ease) forwards;
}

.ink-draw.d2 { animation-delay: 70ms; }
.ink-draw.d3 { animation-delay: 120ms; }
.ink-draw.d4 { animation-delay: 160ms; }
.ink-draw.d5 { animation-delay: 200ms; }
.ink-draw.d6 { animation-delay: 260ms; }
.ink-draw.d7 { animation-delay: 340ms; }
.ink-draw.d8 { animation-delay: 420ms; }
.ink-draw.d9 { animation-delay: 480ms; }
.ink-draw.d10 { animation-delay: 540ms; }

@keyframes ink-draw {
  to { stroke-dashoffset: 0; }
}

.hero-copy {
  max-width: 34rem;
  margin-top: 0.4rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.06;
  letter-spacing: -0.045em;
  font-weight: 800;
  padding-bottom: 0.12em;
}

.hero-sub {
  margin: 0.9rem 0 1.4rem;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  border-radius: 0;
  box-shadow: 0 0 0 var(--ink);
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease), background-color 220ms var(--ease), color 220ms var(--ease);
}

.btn:hover {
  box-shadow: 4px 4px 0 var(--ink);
  transform: translate(-2px, -2px);
}

.btn:active {
  transform: translate(0, 0);
  box-shadow: 0 0 0 var(--ink);
}

.btn.is-copied,
.btn:not(.btn-ghost):focus-visible {
  background: var(--ink);
  color: var(--paper);
}

.btn-ghost {
  background: var(--paper);
  color: var(--ink);
}

.notice {
  margin: 0 0 1.4rem;
  max-width: 62ch;
  color: var(--muted);
  font-size: 0.92rem;
}

.method {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: var(--stroke) solid var(--ink);
}

.method article {
  padding: 2.6rem var(--gutter) 3rem;
}

.method article + article {
  border-left: var(--stroke) solid var(--ink);
}

.method-fig {
  width: 148px;
  height: auto;
  margin-bottom: 1rem;
  color: var(--ink);
}

.method h2 {
  margin: 0 0 0.7rem;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  letter-spacing: -0.04em;
  font-weight: 700;
  line-height: 1.12;
}

.method p {
  margin: 0;
  max-width: 38ch;
  color: var(--muted);
}

.catalog {
  padding: 3rem var(--gutter) 5rem;
}

.catalog-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: 1.1rem;
}

.catalog-head h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.045em;
  font-weight: 800;
  line-height: 1;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.05rem;
}

.filters button {
  background: none;
  border: 0;
  padding: 0.45rem 0;
  min-height: 44px;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.filters button[aria-pressed="true"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.8rem 1.35rem;
  align-items: start;
}

.plate {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.plate:focus-visible,
.filters button:focus-visible,
.btn:focus-visible,
.theme-toggle:focus-visible,
.site-nav a:focus-visible,
.brand:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.plate-frame {
  position: relative;
  border: 2px solid var(--ink);
  background: var(--paper);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.plate-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.plate-peek {
  position: absolute;
  left: 10px;
  bottom: 8px;
  width: 22px;
  height: 28px;
  color: var(--ink);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 280ms var(--ease), transform 280ms var(--ease);
  pointer-events: none;
  filter: drop-shadow(0 0 0 var(--paper)) drop-shadow(0 0 2px var(--paper));
}

.plate:hover .plate-peek,
.plate:focus-visible .plate-peek {
  opacity: 1;
  transform: none;
}

.plate-name {
  font-weight: 700;
  letter-spacing: -0.03em;
}

.plate-also {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.site-footer {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 2rem var(--gutter) 2.6rem;
  border-top: var(--stroke) solid var(--ink);
  color: var(--muted);
  font-size: 0.92rem;
}

.footer-fig {
  width: 14px;
  height: 21px;
  flex: none;
  color: var(--ink);
  margin-top: 0.15rem;
}

.site-footer p {
  margin: 0;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  background: color-mix(in srgb, var(--ink) 22%, transparent);
}

.drawer.is-open {
  display: block;
}

.drawer-sheet {
  position: absolute;
  inset: 0;
  background: var(--paper);
  overflow: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
  min-height: 100dvh;
}

.drawer-visual {
  padding: clamp(1.5rem, 4vw, 3rem);
  border-right: var(--stroke) solid var(--ink);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.8rem;
}

.drawer-visual img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 2px solid var(--ink);
  background: var(--paper);
}

.drawer-copy {
  padding: clamp(1.8rem, 5vw, 4.2rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.drawer-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.6rem;
}

.drawer-family {
  color: var(--muted);
  font-size: 0.92rem;
}

.drawer-copy h2 {
  margin: 0 0 0.35rem;
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  font-weight: 800;
  padding-bottom: 0.08em;
}

.drawer-also {
  margin: 0 0 1.4rem;
  color: var(--muted);
}

.meaning {
  margin: 0 0 1.6rem;
  max-width: 38ch;
  font-size: 1.08rem;
}

.prompt-block {
  border: 2px solid var(--ink);
  background: var(--prompt);
  padding: 1rem 1rem 1.1rem;
}

.prompt-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.prompt-text {
  margin: 0;
  font-family: "Plex Mono Cabinet", "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

::view-transition-old(specimen),
::view-transition-new(specimen) {
  animation-duration: 0.55s;
  animation-timing-function: var(--ease);
  mix-blend-mode: normal;
  height: 100%;
  overflow: clip;
}

::view-transition-old(specimen) {
  animation-name: vt-out;
}

::view-transition-new(specimen) {
  animation-name: vt-in;
}

@keyframes vt-out {
  to { opacity: 0; }
}

@keyframes vt-in {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ink-draw {
    animation: none;
    stroke-dashoffset: 0;
  }

  .btn,
  .plate-peek {
    transition: none;
  }

  .btn:hover {
    transform: none;
  }

  .plate:hover .plate-peek,
  .plate:focus-visible .plate-peek {
    transform: none;
  }

  ::view-transition-old(specimen),
  ::view-transition-new(specimen) {
    animation: none;
  }
}

@media (max-width: 900px) {
  .hero-art svg {
    max-height: 28vh;
  }

  .method,
  .drawer-sheet {
    grid-template-columns: 1fr;
  }

  .method article + article,
  .drawer-visual {
    border-left: 0;
    border-top: var(--stroke) solid var(--ink);
  }

  .catalog-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .site-header {
    height: 58px;
  }

  .site-nav {
    gap: 0.8rem;
  }

  .hero h1 {
    font-size: clamp(2.2rem, 12vw, 3.2rem);
  }

  .method-fig {
    width: 120px;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .drawer {
    background: var(--ink);
  }
}
