/* =====================================================================
   CLANKCAT // styles.css
   Layout: a terminal broadsheet. Content sits on a 12-column grid,
   frames are ASCII boxes (hairlines with "+" corner marks), and every
   moving visual on the page is drawn with characters (see script.js).
   Rule of the house: DOM ornaments stay 7-bit ASCII.
   ===================================================================== */

:root {
  color-scheme: dark;

  /* Color: sampled from clankcat.png. Charcoal ground, warm-gray glyphs,
     and the brightest glyph pushed to paper white for highlights. */
  --bg: #1b1b1d;
  --bg-raise: #222224;
  --bg-glass: rgb(27 27 29 / 0.82);
  --fg: #d2cecb;
  --dim: #979491;
  --faint: #5a5856;
  --line: rgb(210 206 203 / 0.13);
  --line-strong: rgb(210 206 203 / 0.27);
  --accent: #f4f1ec;
  --accent-rgb: 244 241 236;
  --ink: #1b1b1d;

  /* Type: Martian Mono for display (condensed), JetBrains Mono for text and UI */
  --font-display: "Martian Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --fs-label: 0.75rem;
  --fs-small: 0.875rem;
  --fs-body: 1rem;
  --fs-lead: clamp(1.125rem, 0.95rem + 0.7vw, 1.5rem);
  --fs-h3: clamp(1.375rem, 1.1rem + 1vw, 1.875rem);
  --fs-h2: clamp(2.375rem, 1.25rem + 4.5vw, 5.25rem);
  --track: 0.14em;

  /* Layout */
  --maxw: 1360px;
  --gutter: clamp(16px, 4vw, 48px);
  --header-h: 64px;
  --section-pad: clamp(88px, 11vw, 160px);
}


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

html {
  background: var(--bg);
  scroll-padding-top: calc(var(--header-h) + 24px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: rgb(var(--accent-rgb) / 0.5) var(--bg);
}

@media (prefers-reduced-motion: no-preference) {
  html[data-motion="on"] { scroll-behavior: smooth; }
}

html.is-booting, html.nav-open { overflow: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: var(--fs-body);
  line-height: 1.65;
  font-variant-ligatures: none;
  font-feature-settings: "calt" 0, "liga" 0;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--ink); }
:focus-visible { outline: 2px dashed var(--accent); outline-offset: 3px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.accent { color: var(--accent); }
.dim { color: var(--dim); }
.nocase { text-transform: none; }
.label {
  font-size: var(--fs-label);
  letter-spacing: var(--track);
  text-transform: uppercase;
}

.icon {
  width: 1em; height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: square;
}
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }

.skip-link {
  position: fixed;
  left: 16px; top: 12px;
  z-index: 300;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-180%);
}
.skip-link:focus { transform: none; }

/* ---------- global layers ---------- */
.bg-field {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  max-width: none;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.bg-field.is-live { opacity: 1; }

.fx-layer {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  max-width: none;
  z-index: 90;
  pointer-events: none;
}

.crt {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgb(0 0 0 / 0.13) 2px 3px);
}
.crt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(130% 95% at 50% 42%, transparent 58%, rgb(0 0 0 / 0.45) 100%);
}

main, .site-footer { position: relative; z-index: 1; }
/* headline lines slide in sideways; keep that motion from widening the page on phones */
main { overflow-x: hidden; overflow-x: clip; }

.cursor-tag {
  position: fixed;
  left: 0; top: 0;
  z-index: 96;
  padding: 4px 7px 3px;
  background: var(--accent);
  color: var(--ink);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-200px, -200px, 0);
}
.cursor-tag.is-on { opacity: 1; }

/* ---------- boot screen ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: var(--bg);
  color: var(--dim);
  cursor: pointer;
}
.boot.is-leaving { background: transparent; }
.boot-inner { position: relative; z-index: 1; width: min(640px, 100%); font-size: clamp(0.7rem, 0.55rem + 0.7vw, 0.875rem); }
.boot.is-leaving .boot-inner { visibility: hidden; }
.boot-head { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px dashed var(--line-strong); color: var(--fg); letter-spacing: 0.1em; text-transform: uppercase; }
.boot-head span:first-child { color: var(--accent); }
.boot-log { margin: 0; min-height: 11.5em; white-space: pre-wrap; font: inherit; line-height: 1.75; }
.boot-log .ok { color: var(--accent); }
.boot-log .cmd { color: var(--fg); }
.boot-bar { display: flex; justify-content: space-between; gap: 16px; margin-top: 16px; color: var(--fg); }
.boot-bar b { color: var(--accent); font-weight: 400; }
.boot-skip { margin-top: 22px; font-size: 0.6875rem; letter-spacing: var(--track); text-transform: uppercase; color: var(--dim); }
.boot-canvas { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  border-bottom: 1px solid var(--line);
}
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--bg-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.header-inner { display: flex; align-items: center; gap: 20px; height: var(--header-h); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 87.5%;
  font-size: 1.0625rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand-mark { color: var(--accent); font-family: var(--font-mono); font-weight: 700; letter-spacing: 0; }
.brand-caret { color: var(--accent); animation: blink 1.1s steps(1) infinite; }

.desktop-nav { display: flex; gap: 2px; margin-inline: auto; }
.desktop-nav a {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 14px;
  color: var(--dim);
  font-size: var(--fs-small);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s steps(2);
}
.desktop-nav .nav-idx { color: var(--faint); font-size: var(--fs-label); transition: color 0.2s steps(2); }
.desktop-nav a::before,
.desktop-nav a::after {
  position: absolute;
  top: 50%;
  color: var(--accent);
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.15s steps(2), transform 0.2s steps(3);
}
.desktop-nav a::before { content: "["; left: 0; transform: translate(4px, -50%); }
.desktop-nav a::after { content: "]"; right: 0; transform: translate(-4px, -50%); }
.desktop-nav a:hover,
.desktop-nav a[aria-current="true"] { color: var(--fg); }
.desktop-nav a:hover::before, .desktop-nav a:hover::after,
.desktop-nav a[aria-current="true"]::before, .desktop-nav a[aria-current="true"]::after { opacity: 1; transform: translate(0, -50%); }
.desktop-nav a[aria-current="true"] .nav-idx,
.desktop-nav a:hover .nav-idx { color: var(--accent); }

.header-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.scroll-meter { margin-right: 6px; font-size: var(--fs-label); color: var(--faint); white-space: nowrap; letter-spacing: 0.02em; }
.scroll-meter b { color: var(--accent); font-weight: 400; }
.scroll-meter .pct { margin-left: 6px; color: var(--dim); }

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  font-size: var(--fs-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s steps(2), color 0.2s steps(2);
}
.tool-btn:hover { border-color: var(--accent); color: var(--accent); }
.motion-glyph { color: var(--accent); }
.motion-toggle[aria-checked="false"] .motion-glyph { color: var(--faint); }
.header-social { width: 38px; padding: 0; font-size: 0.9375rem; }
.menu-toggle { display: none; }

.mobile-nav {
  position: fixed;
  top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  left: 0; right: 0; bottom: 0;
  z-index: 49;
  display: flex;
  flex-direction: column;
  padding: 20px var(--gutter) calc(28px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  background: var(--bg);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.25s steps(5), transform 0.25s steps(5);
}
.mobile-nav.is-open { opacity: 1; transform: none; }
.m-link {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: clamp(1.875rem, 8.5vw, 3rem);
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
}
.m-idx { font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 400; color: var(--accent); letter-spacing: 0.1em; }
.m-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

@media (max-width: 1100px) { .scroll-meter { display: none; } }
@media (max-width: 920px) {
  .desktop-nav { display: none; }
  .menu-toggle { display: inline-flex; }
  .header-tools { margin-left: auto; }
}
@media (max-width: 460px) {
  .brand { font-size: 0.9375rem; gap: 8px; }
  .motion-toggle [data-motion-label] { display: none; }
  .header-tools { gap: 6px; }
}
@media (max-width: 400px) {
  .header-inner { gap: 12px; }
  .mt-text { display: none; }
  .brand-caret { display: none; }
}

/* ---------- buttons & links ---------- */
.btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 0.75ch;
  min-height: 54px;
  padding: 0 20px;
  border: 1px solid currentColor;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.3s steps(4), transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.42s steps(9);
}
.btn:hover::before, .btn:focus-visible::before { transform: scaleX(1); }
.btn .br { transition: transform 0.25s steps(3); }
.btn:hover .br-l { transform: translateX(-4px); }
.btn:hover .br-r { transform: translateX(4px); }
.btn .arr { display: inline-block; }
.btn:hover .arr { animation: nudge 0.7s steps(3) infinite; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.btn-primary::before { background: var(--bg); }
.btn-primary:hover, .btn-primary:focus-visible { color: var(--accent); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--accent); }
.btn-dark::before { background: var(--bg-raise); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--fg); }
.btn-ghost::before { background: var(--accent); }
.btn-ghost:hover { color: var(--ink); }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75ch;
  padding: 0 0 5px;
  border: 0;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-size 0.45s steps(12);
}
.text-link:hover, .text-link:focus-visible { background-size: 100% 1px; }
.text-link:hover .arr { animation: nudge 0.7s steps(3) infinite; }

.quiet-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  font-size: var(--fs-small);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
}
.quiet-link:hover { color: var(--accent); }

/* ---------- frames ---------- */
.frame { position: relative; border: 1px solid var(--line-strong); background: var(--bg); }
.frame-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px 16px;
  flex-wrap: wrap;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-size: var(--fs-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.frame-bar .live { color: var(--accent); }
.cm {
  position: absolute;
  z-index: 3;
  width: 11px; height: 11px;
  pointer-events: none;
  background:
    linear-gradient(var(--accent), var(--accent)) center / 100% 1px no-repeat,
    linear-gradient(var(--accent), var(--accent)) center / 1px 100% no-repeat;
}
.cm-tl { top: -6px; left: -6px; }
.cm-tr { top: -6px; right: -6px; }
.cm-bl { bottom: -6px; left: -6px; }
.cm-br { bottom: -6px; right: -6px; }

/* scan sweep: content stays visible, a print head passes once */
[data-scan] { position: relative; }
[data-scan]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(to bottom,
      transparent 0%,
      rgb(var(--accent-rgb) / 0) 42%,
      rgb(var(--accent-rgb) / 0.12) 49.4%,
      rgb(var(--accent-rgb) / 0.75) 50%,
      transparent 50.5%) 0 100% / 100% 300% no-repeat;
}
html[data-motion="on"] .is-scanned[data-scan]::after { animation: scan 1s steps(20) 1 both; }

/* ---------- hero ---------- */
.hero { position: relative; padding-block: clamp(16px, 2.2vw, 28px) clamp(36px, 5vw, 64px); }
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
  color: var(--dim);
  font-size: var(--fs-label);
  letter-spacing: var(--track);
  text-transform: uppercase;
}
.hero-meta .accent { margin-right: 1ch; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(24px, 3.4vw, 56px);
  padding-top: clamp(22px, 3vw, 40px);
}
.hero-copy { display: flex; flex-direction: column; gap: clamp(22px, 2.4vw, 32px); min-width: 0; }

.wordmark {
  --wm-lines: 2;
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 42 / 26;
  margin: 0;
  font-weight: inherit;
}
.wordmark-text {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: clamp(3.5rem, 13vw, 8.25rem);
  line-height: 0.88;
  letter-spacing: -0.04em;
}
.wordmark-text span { display: block; }
.wordmark-text span + span { text-align: right; }
.wordmark-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.wordmark.is-live .wordmark-canvas { opacity: 1; }
.wordmark.is-live .wordmark-text {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.definition { display: grid; gap: 12px; }
.def-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  font-size: var(--fs-label);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--dim);
}
.def-head .accent { font-size: var(--fs-small); letter-spacing: 0.06em; text-transform: none; font-weight: 700; }
.def-body { max-width: 34ch; font-size: var(--fs-lead); line-height: 1.42; font-weight: 500; }
.def-body strong { color: var(--accent); font-weight: 700; }

.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 26px; }

.hero-specs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: auto 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.hero-specs dt { color: var(--dim); font-size: var(--fs-label); letter-spacing: var(--track); text-transform: uppercase; }
.hero-specs dd { margin: 4px 0 0; font-family: var(--font-display); font-weight: 700; font-stretch: 87.5%; font-size: clamp(0.875rem, 0.75rem + 0.45vw, 1.0625rem); overflow-wrap: anywhere; }

.viewport { display: flex; flex-direction: column; min-width: 0; }
.vp-stage {
  position: relative;
  flex: 1;
  min-height: 440px;
  overflow: hidden;
  cursor: crosshair;
  touch-action: pan-y;
  background: radial-gradient(70% 60% at 50% 45%, rgb(var(--accent-rgb) / 0.05), transparent 70%), var(--bg);
}
.vp-stage > img,
.vp-stage > canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.vp-stage > img { object-fit: contain; padding: 5%; transition: opacity 0.6s steps(6); }
.viewport.is-live .vp-stage > img { opacity: 0; }
.vp-scan {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to bottom, transparent 0, rgb(var(--accent-rgb) / 0.07) 63px, rgb(var(--accent-rgb) / 0.55) 63px 64px, transparent 64px);
  pointer-events: none;
  opacity: 0;
}
html[data-motion="on"] .viewport.is-live .vp-scan { opacity: 0.5; animation: vscan 7s linear infinite; }
.reticle {
  position: absolute;
  z-index: 2;
  color: var(--accent);
  font-size: 0.875rem;
  line-height: 1;
  pointer-events: none;
}
.reticle-tl { top: 12px; left: 14px; }
.reticle-tr { top: 12px; right: 14px; }
.reticle-bl { bottom: 12px; left: 14px; }
.reticle-br { bottom: 12px; right: 14px; }
.vp-foot { border-top: 1px solid var(--line); border-bottom: 0; }
.vp-coords { font-variant-numeric: tabular-nums; }

.vp-hint { color: var(--fg); }

.hero-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 24px;
  margin-top: clamp(24px, 3vw, 40px);
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--dim);
  font-size: var(--fs-label);
  letter-spacing: var(--track);
  text-transform: uppercase;
}
.boot-line { color: var(--fg); text-transform: none; letter-spacing: 0.04em; }
.boot-line .accent { margin-right: 1ch; }
.caret {
  display: inline-block;
  width: 0.6em; height: 1.15em;
  margin-left: 3px;
  vertical-align: -0.22em;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
.scroll-cue { color: var(--fg); text-decoration: none; }
.scroll-cue .arr { display: inline-block; margin-left: 6px; color: var(--accent); animation: bob 1.6s steps(4) infinite; }

/* ---------- marquee ---------- */
.marquee {
  position: relative;
  overflow: hidden;
  padding-block: clamp(10px, 1.4vw, 18px);
  border-block: 1px solid var(--line);
  background: var(--bg);
  user-select: none;
}
.marquee-row {
  display: flex;
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: clamp(1.75rem, 1rem + 3.4vw, 4rem);
  line-height: 1.14;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.marquee-row + .marquee-row { color: var(--faint); }
.marquee-track { display: flex; flex: none; will-change: transform; }
.marquee-group { display: flex; flex: none; align-items: center; gap: 0.55em; padding-right: 0.55em; }
.marquee-group b { color: var(--accent); }

/* ---------- sections ---------- */
.section { position: relative; padding-block: var(--section-pad); }
.section + .section { border-top: 1px solid var(--line); }

.section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: clamp(40px, 6vw, 84px);
  color: var(--dim);
  font-size: var(--fs-label);
  letter-spacing: var(--track);
  text-transform: uppercase;
}
.sh-idx { color: var(--accent); }
.sh-name { color: var(--fg); }
.sh-rule {
  flex: 1;
  min-width: 24px;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 6px, transparent 6px 10px);
  transform-origin: left center;
}
html[data-motion="on"] .section-head.is-scanned .sh-rule { animation: rule-draw 0.9s steps(24) both; }
@media (max-width: 640px) { .sh-note { display: none; } }

.title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: var(--fs-h2);
  line-height: 0.96;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  text-wrap: balance;
}
.title-md { font-size: clamp(2.25rem, 1.2rem + 3.3vw, 4.25rem); }
.title .line { display: block; }
html[data-motion="on"] .title .line { will-change: transform; }
.title .muted { color: var(--dim); }
.title .accent {
  padding: 0 0.08em;
  background: var(--accent);
  color: var(--ink);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.bracket-label {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--accent);
  font-size: var(--fs-label);
  letter-spacing: var(--track);
  text-transform: uppercase;
}
.lead { font-size: var(--fs-lead); line-height: 1.42; font-weight: 500; color: var(--fg); }
.copy { display: grid; gap: 18px; align-content: start; }
.copy > p:not(.lead) { max-width: 56ch; color: var(--dim); }

/* lore */
.lore-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 5vw, 88px); align-items: start; }
.footnote { margin-top: 26px; color: var(--dim); font-size: var(--fs-label); letter-spacing: var(--track); text-transform: uppercase; }
.signature { display: flex; align-items: center; gap: 16px; margin-top: 12px; padding-top: 22px; border-top: 1px dashed var(--line); }
.sig-glyph { font-family: var(--font-display); font-weight: 800; font-size: 2.25rem; line-height: 1; color: var(--accent); }
.signature .label { line-height: 1.75; }

.strip-foot { border-top: 1px dashed var(--line); border-bottom: 0; }

.dna { margin-top: clamp(56px, 7vw, 100px); }
.dna-stage { position: relative; height: clamp(120px, 12vw, 160px); }
.dna-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.dna-traits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.dna-traits li { display: grid; gap: 6px; padding: 18px 20px 20px; font-family: var(--font-display); font-weight: 700; font-stretch: 87.5%; font-size: var(--fs-lead); line-height: 1.2; }
.dna-traits li + li { border-left: 1px solid var(--line); }
.gene { font-family: var(--font-mono); font-weight: 400; font-size: var(--fs-label); letter-spacing: var(--track); color: var(--accent); }

/* play: Clank Run */
.game-head { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 32px; align-items: end; margin-bottom: clamp(36px, 4.5vw, 64px); }
.game-head p { color: var(--dim); font-size: var(--fs-lead); line-height: 1.45; }
.game-stage {
  position: relative;
  height: clamp(270px, 26vw, 370px);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  background: radial-gradient(80% 70% at 50% 100%, rgb(var(--accent-rgb) / 0.05), transparent 70%), var(--bg);
}
.game-stage:focus-visible { outline: none; }
.game:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.game-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.game-fallback { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--dim); }
.game.is-live .game-fallback { display: none; }
.game-hi { color: var(--accent); font-variant-numeric: tabular-nums; }
.game.is-playing .game-hi { color: var(--dim); }
.game-foot { border-top: 1px dashed var(--line); border-bottom: 0; }
.game-keys { text-transform: none; letter-spacing: 0.04em; }
.game-keys kbd { padding: 1px 6px; border: 1px solid var(--line-strong); color: var(--fg); font: inherit; }
.game-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.btn-sm { min-height: 36px; padding: 0 16px; font-size: var(--fs-label); }

/* token */
.token-grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: clamp(32px, 5vw, 80px); align-items: center; }
.coin-stage { position: relative; aspect-ratio: 1 / 1; max-width: 100%; }
.coin-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
.coin-stage canvas:active { cursor: grabbing; }
.coin-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 18%; }
.coin-fallback img { width: 100%; height: auto; border-radius: 50%; opacity: 0.85; }
.coin-frame.is-live .coin-fallback { display: none; }
.coin-readout { font-variant-numeric: tabular-nums; }

.token-info { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.token-info .bracket-label { margin-bottom: 0; }
.token-info > p { max-width: 46ch; color: var(--dim); }

.id-rows { margin: 0; }
.id-row { display: flex; align-items: baseline; gap: 10px; padding: 11px 16px; border-bottom: 1px dashed var(--line); }
.id-row dt {
  display: flex;
  flex: 1 1 auto;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  color: var(--dim);
  font-size: var(--fs-label);
  letter-spacing: var(--track);
  text-transform: uppercase;
  white-space: nowrap;
}
.id-row dt::after {
  content: "........................................................................................";
  flex: 1;
  overflow: hidden;
  color: var(--faint);
  letter-spacing: 0.25em;
}
.id-row dd { flex: none; margin: 0; font-weight: 700; text-align: right; }

.ca { display: grid; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
.ca-label { display: flex; justify-content: space-between; color: var(--dim); font-size: var(--fs-label); letter-spacing: var(--track); text-transform: uppercase; }
.ca-code {
  display: block;
  padding: 14px;
  border: 1px dashed rgb(var(--accent-rgb) / 0.4);
  background: rgb(var(--accent-rgb) / 0.06);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: clamp(0.8125rem, 0.6rem + 0.75vw, 1.0625rem);
  font-weight: 500;
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.ca-code .chunk { margin-right: 0.45ch; }
.ca-code .chunk:last-child { margin-right: 0; }
.ca-code .chunk:first-child, .ca-code .chunk:last-child { color: var(--accent); font-weight: 700; }
.btn-copy { justify-content: center; width: 100%; }
.term-foot { border-top: 0; border-bottom: 0; }
.spinner { color: var(--accent); }

/* join */
.join-head { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 32px; align-items: end; margin-bottom: clamp(40px, 5vw, 72px); }
.join-head p { color: var(--dim); font-size: var(--fs-lead); line-height: 1.45; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(18px, 2vw, 28px); margin: 0; padding: 0; list-style: none; }
.step { display: flex; flex-direction: column; transition: border-color 0.25s steps(3), transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
.step:hover, .step:focus-within { border-color: rgb(var(--accent-rgb) / 0.6); transform: translateY(-4px); }
.step-num { height: clamp(66px, 6.4vw, 96px); width: auto; max-width: calc(100% - 36px); margin: 22px 18px 4px; }
.step-body { display: flex; flex: 1; flex-direction: column; gap: 12px; padding: 8px 18px 22px; }
.step h3 { margin: 0; font-family: var(--font-display); font-weight: 700; font-stretch: 87.5%; font-size: var(--fs-h3); line-height: 1.1; letter-spacing: -0.01em; }
.step p { color: var(--dim); }
.step .text-link { align-self: flex-start; margin-top: auto; padding-top: 8px; }
.step-cmd { color: var(--fg); text-transform: none; letter-spacing: 0.04em; }

/* community */
.community { position: relative; overflow: hidden; padding-block: var(--section-pad); background: var(--accent); color: var(--ink); }
.community ::selection { background: var(--ink); color: var(--accent); }
.community :focus-visible { outline-color: var(--ink); }
.community-wall {
  position: absolute;
  inset: -20% -10%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transform: rotate(-7deg);
  color: var(--ink);
  opacity: 0.075;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: clamp(3rem, 8vw, 7.5rem);
  line-height: 0.92;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}
.wall-row { display: flex; width: max-content; animation: wall 46s linear infinite; }
.wall-row:nth-child(even) { animation-direction: reverse; animation-duration: 58s; }
.community-grid { position: relative; display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(48px, 6vw, 96px); align-items: center; }
.community .bracket-label, .community .title { color: var(--ink); }
.community .title .hl { display: inline-block; padding: 0 0.12em; background: var(--ink); color: var(--accent); }
.community-copy > p { margin: 24px 0 32px; font-size: var(--fs-lead); font-weight: 500; }
.handle { display: block; margin-top: 16px; font-size: var(--fs-label); letter-spacing: var(--track); text-transform: uppercase; }

.card-wrap { display: grid; place-items: center; perspective: 1100px; }
.member-card {
  --rx: 0deg;
  --ry: 0deg;
  --gx: 50%;
  --gy: 30%;
  position: relative;
  width: min(100%, 380px);
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--fg);
  box-shadow: 16px 16px 0 var(--ink);
  transform: rotateX(var(--rx)) rotateY(var(--ry)) rotate(-2.5deg);
  transform-style: preserve-3d;
}
html[data-motion="on"] .card-wrap.is-floating .member-card { animation: float 6s ease-in-out infinite; }
.member-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at var(--gx) var(--gy), rgb(255 255 255 / 0.17), transparent 46%),
    repeating-linear-gradient(115deg, transparent 0 6px, rgb(var(--accent-rgb) / 0.05) 6px 7px);
}
.card-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; font-size: var(--fs-label); letter-spacing: var(--track); text-transform: uppercase; }
.card-row:first-child { border-bottom: 1px solid var(--line); }
.card-row:last-child { border-top: 1px solid var(--line); }
.card-photo { padding: 16px 16px 12px; }
.card-photo img { width: 100%; height: auto; aspect-ratio: 1 / 1; }
.card-meta { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 0 16px 14px; color: var(--dim); font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; }
.barcode {
  height: 26px;
  margin: 0 16px 14px;
  background: repeating-linear-gradient(90deg,
    var(--fg) 0 2px, transparent 2px 4px, var(--fg) 4px 5px, transparent 5px 8px,
    var(--fg) 8px 11px, transparent 11px 12px, var(--fg) 12px 13px, transparent 13px 16px,
    var(--fg) 16px 17px, transparent 17px 19px, var(--fg) 19px 22px, transparent 22px 25px);
  opacity: 0.85;
}

/* faq */
.faq-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(36px, 5vw, 88px); align-items: start; }
.faq-tree { margin: 28px 0 0; color: var(--dim); font-size: var(--fs-small); line-height: 1.8; white-space: pre; overflow-x: auto; }
.faq-tree .accent { color: var(--accent); }
.faq-item { border-top: 1px solid var(--line); }
.faq-item:last-child { border-bottom: 1px solid var(--line); }
.faq-item summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 18px;
  padding: 22px 4px;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-stretch: 87.5%;
  font-size: var(--fs-lead);
  line-height: 1.3;
  transition: color 0.2s steps(2);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--accent); }
.faq-idx { font-family: var(--font-mono); font-weight: 400; font-size: var(--fs-label); letter-spacing: 0.12em; color: var(--accent); }
.faq-icon { font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-small); color: var(--accent); }
.faq-icon::before { content: "[+]"; }
.faq-item[open] .faq-icon::before { content: "[-]"; }
.faq-item.is-closing .faq-icon::before { content: "[+]"; }
.faq-a { overflow: hidden; }
.faq-a p { max-width: 60ch; padding: 0 4px 26px calc(5ch + 22px); color: var(--dim); }
.faq-a a { color: var(--accent); }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); background: var(--bg); }
.ripple-stage { position: relative; height: clamp(200px, 20vw, 290px); border-bottom: 1px solid var(--line); cursor: crosshair; touch-action: pan-y; }
.ripple-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ripple-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--faint);
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: clamp(3rem, 15vw, 13rem);
  line-height: 1;
}
.ripple-stage.is-live .ripple-fallback { display: none; }

.footer-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px; padding-block: 28px; border-bottom: 1px solid var(--line); }
.footer-motto { color: var(--dim); font-size: var(--fs-label); letter-spacing: var(--track); text-transform: uppercase; }
.back-top { color: var(--fg); font-size: var(--fs-label); letter-spacing: var(--track); text-decoration: none; text-transform: uppercase; }
.back-top:hover { color: var(--accent); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 32px; padding-top: 22px; color: var(--dim); font-size: var(--fs-label); letter-spacing: 0.08em; }
.footer-bottom p { max-width: 52ch; }
.footer-links { display: flex; gap: 22px; }
.footer-links a { text-decoration: none; text-transform: uppercase; letter-spacing: var(--track); }
.footer-links a:hover { color: var(--accent); }

.footer-cat {
  position: relative;
  display: inline-grid;
  padding: 6px 10px;
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
}
.footer-cat:hover { border-color: var(--accent); }
.footer-cat pre { margin: 0; font: 700 0.8125rem/1.25 var(--font-mono); text-align: left; }
.footer-cat .eye { display: inline-block; color: var(--accent); transform: translate(var(--ex, 0px), var(--ey, 0px)); }
.cat-say {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  padding: 4px 8px;
  border: 1px solid var(--accent);
  background: var(--bg);
  color: var(--accent);
  font-size: var(--fs-label);
  letter-spacing: 0.1em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 6px);
}
.footer-cat.is-saying .cat-say { animation: say 1.4s steps(6) both; }

/* ---------- toast & dialog ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 120;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border: 1px solid var(--accent);
  background: var(--bg-raise);
  color: var(--fg);
  font-size: var(--fs-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s steps(4), transform 0.2s steps(4);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast b { color: var(--accent); font-weight: 700; }

dialog {
  width: min(560px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--accent);
  background: var(--bg-raise);
  color: var(--fg);
}
dialog::backdrop { background: rgb(0 0 0 / 0.72); }
.dialog-form { display: grid; gap: 16px; padding: 22px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.dialog-heading h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-stretch: 87.5%; font-size: 1.25rem; }
.dialog-close { width: 36px; height: 36px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; }
.dialog-form p { color: var(--dim); }
.dialog-form input {
  width: 100%;
  padding: 12px;
  border: 1px dashed rgb(var(--accent-rgb) / 0.5);
  background: var(--bg);
  color: var(--fg);
  font: 500 0.9375rem/1.4 var(--font-mono);
}

/* ---------- responsive ---------- */
@media (min-width: 560px) and (max-width: 920px) {
  .wordmark { --wm-lines: 1; aspect-ratio: 67 / 12; }
  .wordmark-text span { display: inline; }
}
@media (max-width: 920px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .vp-stage { flex: none; aspect-ratio: 1 / 1; min-height: 0; }
  .hero-specs { margin-top: 0; }
  .lore-grid, .token-grid, .join-head, .game-head, .faq-grid, .community-grid { grid-template-columns: minmax(0, 1fr); }
  .token-grid .coin-frame { order: 2; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .card-wrap { padding-block: 8px 24px; }
}
@media (max-width: 700px) {
  .dna-traits { grid-template-columns: minmax(0, 1fr); }
  .dna-traits li + li { border-left: 0; border-top: 1px solid var(--line); }
  .hero-specs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hero-specs div:last-child { grid-column: 1 / -1; }
  .faq-a p { padding-left: 4px; }
  .vp-foot .vp-status { display: none; }
}
@media (max-width: 420px) {
  .hero-actions .btn { width: 100%; justify-content: center; }
  .crt { background: none; }
}

/* ---------- keyframes ---------- */
@keyframes blink { 50% { opacity: 0; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }
@keyframes vscan { from { transform: translateY(-64px); } to { transform: translateY(100%); } }
@keyframes wall { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes rule-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes scan {
  0% { opacity: 1; background-position: 0 100%; }
  92% { opacity: 1; }
  100% { opacity: 0; background-position: 0 0; }
}
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
@keyframes say {
  0% { opacity: 0; transform: translate(-50%, 6px); }
  15%, 75% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -6px); }
}

/* Motion off: everything rests on its final frame */
html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  animation-delay: 0s !important;
  transition-duration: 0.001ms !important;
}
