/* ============================================================
   GRAIN — the visual intent compiler
   Design tokens + global styles
   ============================================================ */

:root {
  /* base — near-black, cool charcoal, technical */
  --bg:            #0A0B0D;
  --surface:       #131519;
  --surface-2:     #1A1D23;
  --surface-3:     #21252C;
  --hairline:      #262A31;
  --hairline-soft: #1C2026;

  /* ink */
  --text:          #ECEEF1;
  --text-soft:     #9BA1AC;
  --text-faint:    #5C636E;

  /* the warm material accent — "grain" */
  --grain:         #E8893B;
  --grain-bright:  #FFA85C;
  --grain-deep:    #B5611F;
  --grain-glow:    rgba(232,137,59,0.22);

  /* cool counter-accent — "structure / wireframe" */
  --wire:          #5BA8D4;
  --wire-soft:     rgba(91,168,212,0.4);

  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 26px;
  --shadow:    0 12px 40px rgba(0,0,0,0.45);
  --shadow-lg: 0 32px 90px rgba(0,0,0,0.6);

  /* motion */
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --spring-soft: cubic-bezier(0.22, 1.2, 0.36, 1);
  --ease:   cubic-bezier(0.2, 0.8, 0.2, 1);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-ui:      "Hanken Grotesk", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;

  --maxw: 1200px;
  --maxw-text: 62ch;
  --section-y: 120px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* subtle film-grain texture over everything */
.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* faint vignette + cool tint glow */
.bg-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1100px 700px at 78% -8%, rgba(232,137,59,0.07), transparent 60%),
    radial-gradient(900px 600px at 8% 8%, rgba(91,168,212,0.05), transparent 55%),
    radial-gradient(1200px 900px at 50% 120%, rgba(0,0,0,0.6), transparent 60%);
}

::selection { background: var(--grain-glow); color: var(--grain-bright); }

a { color: inherit; text-decoration: none; }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 40px; position: relative; z-index: 1; }

.section { padding: var(--section-y) 0; position: relative; z-index: 1; }
.section-tight { padding: 72px 0; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.eyebrow .idx { color: var(--grain); white-space: nowrap; }

/* hairline ornaments */
.rule { height: 1px; background: var(--hairline); width: 100%; }

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; line-height: 1.02; }
.display {
  font-size: clamp(46px, 6vw, 88px);
  font-weight: 600;
  letter-spacing: -0.042em;
  line-height: 0.95;
  text-wrap: balance;
}
.h2 {
  font-size: clamp(34px, 4.6vw, 58px);
  letter-spacing: -0.032em;
  line-height: 1.0;
  font-weight: 600;
  text-wrap: balance;
}
.lead { font-size: clamp(17px, 1.4vw, 20px); color: var(--text-soft); line-height: 1.6; max-width: var(--maxw-text); text-wrap: pretty; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-soft); }
.faint { color: var(--text-faint); }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 12px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  position: relative;
  transition: transform 0.5s var(--spring), background 0.25s var(--ease), box-shadow 0.35s var(--ease), border-color 0.25s, color 0.2s;
  user-select: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.975); }

.btn-grain {
  background: linear-gradient(180deg, var(--grain-bright) 0%, var(--grain) 48%, var(--grain-deep) 130%);
  color: #1c0f04;
  border-color: rgba(255,170,92,0.5);
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px -8px var(--grain-glow);
}
.btn-grain:hover { box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, 0 2px 4px rgba(0,0,0,0.4), 0 14px 36px -8px var(--grain-glow); transform: translateY(-1.5px); }
.btn-grain:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
  color: var(--text);
  border-color: var(--hairline);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 1px 2px rgba(0,0,0,0.25);
}
.btn-ghost:hover { border-color: #353b46; background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03)); transform: translateY(-1.5px); }

.btn-bare { background: transparent; color: var(--text-soft); padding: 9px 13px; border-radius: 9px; }
.btn-bare:hover { color: var(--text); background: rgba(255,255,255,0.04); }

/* ---------- brand mark (GrainMark) ---------- */
.gm { display: block; overflow: visible; flex: none; }
.gm .gm-dot { transform-box: fill-box; transform-origin: center; }
.badge-pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 6px 14px 6px 12px; border-radius: 999px;
  border: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.008));
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-soft); transition: border-color 0.25s, color 0.25s; white-space: nowrap;
}
.badge-pill:hover { border-color: #343a45; color: var(--text); }

@media (prefers-reduced-motion: no-preference) {
  /* form once on mount */
  .gm-draw .gm-g  { animation: gmDraw 0.95s var(--ease) 0.15s; }
  .gm-draw .gm-dot { animation: gmPop 0.6s var(--spring) 0.78s backwards; }
  /* form on hover (logo + inside buttons) */
  .gm-interactive:hover .gm-g,
  .btn:hover .gm .gm-g   { animation: gmDraw 0.6s var(--ease); }
  .gm-interactive:hover .gm-dot,
  .btn:hover .gm .gm-dot { animation: gmPop 0.5s var(--spring) 0.32s backwards; }
  /* resting life in the hero */
  .gm-hero .gm-dot { animation: gmGlow 3.6s ease-in-out infinite; }
}
.gm-hero .gm-dot { filter: drop-shadow(0 0 4px var(--grain)); }
@keyframes gmDraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes gmPop  { 0% { transform: scale(0); } 58% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes gmGlow { 0%, 100% { filter: drop-shadow(0 0 3px rgba(232,137,59,0.55)); } 50% { filter: drop-shadow(0 0 9px rgba(232,137,59,0.9)); } }

/* ---------- hero: interactive lens reveal ---------- */
.hero {
  position: relative; overflow: hidden;
  padding-top: 168px; padding-bottom: 84px;
  --mx: 71%; --my: 49%; --r: 150px;
}
.hero-surface, .hero-structure {
  position: absolute; inset: 0; z-index: 0;
  background-position: center; background-size: cover; background-repeat: no-repeat;
  pointer-events: none;
}
.hero-surface { background-image: url("assets/hero-surface.jpg"); }
.hero-surface::after { content: ""; position: absolute; inset: 0; background: rgba(9,10,12,0.52); }
.hero-structure {
  z-index: 1;
  background-image: url("assets/hero-structure.jpg");
  -webkit-mask-image: radial-gradient(circle var(--r) at var(--mx) var(--my), #000 0, #000 calc(var(--r) - 26px), transparent var(--r));
  mask-image: radial-gradient(circle var(--r) at var(--mx) var(--my), #000 0, #000 calc(var(--r) - 26px), transparent var(--r));
  will-change: mask-image;
}
/* protect headline: deepen the left + fade edges into the page */
.hero-vignette {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(100deg, var(--bg) 4%, rgba(9,10,12,0.86) 26%, rgba(9,10,12,0.30) 50%, transparent 66%),
    linear-gradient(0deg, var(--bg) 0%, transparent 18%),
    radial-gradient(120% 80% at 50% -10%, transparent 60%, rgba(9,10,12,0.5));
}
/* the lens ring — echoes the aperture logo, follows the cursor */
.hero-lens {
  position: absolute; z-index: 3; left: var(--mx); top: var(--my);
  width: calc(var(--r) * 2); height: calc(var(--r) * 2);
  transform: translate(-50%, -50%);
  border-radius: 50%; pointer-events: none;
  border: 1.5px solid rgba(232,137,59,0.85);
  box-shadow:
    0 0 28px rgba(232,137,59,0.30),
    inset 0 0 36px rgba(232,137,59,0.12),
    inset 0 0 0 1px rgba(232,137,59,0.10);
  will-change: left, top;
}
.hero-lens::before {
  content: ""; position: absolute; inset: 12px; border-radius: 50%;
  border: 1px solid rgba(232,137,59,0.22);
}
.hero-lens-cross {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 14px;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(currentColor, currentColor) center / 1.5px 14px no-repeat,
    linear-gradient(currentColor, currentColor) center / 14px 1.5px no-repeat;
  color: rgba(232,137,59,0.7);
}
.hero .hero-grid {
  position: relative; z-index: 4;
  display: grid; grid-template-columns: 1.12fr 0.88fr; gap: 56px; align-items: center;
  min-height: 460px;
}
@media (prefers-reduced-motion: reduce) { .hero-structure { will-change: auto; } }

/* ---------- section head + aperture motif ---------- */
.sec-head-row { display: flex; align-items: center; justify-content: space-between; gap: 52px; }
.sec-head-text { flex: 1 1 auto; max-width: 680px; }
.sec-motif {
  flex: none; width: 156px; height: 156px; border-radius: 50%;
  background-size: cover; background-position: center; position: relative;
  box-shadow:
    0 0 0 1px var(--hairline),
    0 22px 56px -20px rgba(0,0,0,0.8),
    0 0 70px -22px var(--accent);
}
.sec-motif::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.07), inset 0 0 34px rgba(0,0,0,0.45);
}
.sec-motif-ring {
  position: absolute; inset: -7px; border-radius: 50%;
  border: 1px solid color-mix(in oklab, var(--accent) 45%, transparent);
  opacity: 0.6;
}
@media (max-width: 860px) {
  .sec-motif { width: 104px; height: 104px; }
  .sec-head-row { gap: 28px; }
}
@media (max-width: 600px) {
  .sec-motif { display: none; }
}

/* ---------- panel ---------- */
.panel {
  background: linear-gradient(180deg, var(--surface) 0%, #101216 100%);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 30px 80px -34px rgba(0,0,0,0.75),
    0 50px 130px -70px rgba(232,137,59,0.18);
  position: relative;
  overflow: hidden;
}
.panel::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), transparent 30%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(255,255,255,0.012);
}
.panel-dots { display: flex; gap: 7px; }
.panel-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); display: block; }
.panel-title { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--text-faint); }

/* ---------- inputs ---------- */
.field {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 0 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field:focus-within { border-color: var(--grain-deep); box-shadow: 0 0 0 3px var(--grain-glow); }
.field .prefix { font-family: var(--font-mono); font-size: 13px; color: var(--text-faint); }
.field input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--font-mono); font-size: 14px; padding: 13px 0; letter-spacing: -0.01em;
}
.field input::placeholder { color: var(--text-faint); }

.chip {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap;
}
.chip:hover { border-color: #353b46; color: var(--text); }
.chip.active { border-color: var(--grain-deep); color: var(--grain-bright); background: rgba(232,137,59,0.08); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.7; }

/* ---------- viewport (reconstruction frame) ---------- */
.viewport {
  position: relative;
  background:
    radial-gradient(120% 90% at 50% 0%, #15181d 0%, #0c0e11 70%);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  overflow: hidden;
}
.vp-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.028) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(120% 90% at 50% 40%, #000 30%, transparent 80%);
}
.vp-label {
  position: absolute; top: 12px; left: 12px; z-index: 5;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.18em;
  color: var(--text-faint);
  display: flex; align-items: center; gap: 8px;
}
.vp-tick { position: absolute; width: 14px; height: 14px; z-index: 5; }
.vp-tick::before, .vp-tick::after { content:""; position:absolute; background: var(--hairline); }
.vp-tick::before { width: 14px; height: 1px; }
.vp-tick::after  { width: 1px; height: 14px; }
.vp-tick.tl { top: 10px; left: 10px; } .vp-tick.tr { top: 10px; right: 10px; } .vp-tick.tr::before { right:0; } .vp-tick.tr::after { right:0; }
.vp-tick.bl { bottom: 10px; left: 10px; } .vp-tick.bl::before{bottom:0;} .vp-tick.bl::after{bottom:0;}
.vp-tick.br { bottom: 10px; right: 10px; } .vp-tick.br::before{bottom:0;right:0;} .vp-tick.br::after{bottom:0;right:0;}

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--grain); box-shadow: 0 0 0 0 var(--grain-glow); animation: livepulse 2s infinite; }
@keyframes livepulse {
  0% { box-shadow: 0 0 0 0 var(--grain-glow); } 70% { box-shadow: 0 0 0 7px rgba(232,137,59,0); } 100% { box-shadow: 0 0 0 0 rgba(232,137,59,0); }
}

/* ---------- atmospheric per-section glows ---------- */
#eye-a, #eye-b, #eye-c, #vision { isolation: isolate; }
#eye-a::before, #eye-b::before, #eye-c::before, #vision::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
}
#eye-a::before { background: radial-gradient(58% 46% at 80% 38%, rgba(232,137,59,0.09), transparent 70%); }
#eye-b::before { background: radial-gradient(58% 46% at 82% 36%, rgba(91,168,212,0.09), transparent 70%); }
#eye-c::before { background: radial-gradient(56% 46% at 80% 40%, rgba(87,196,192,0.08), transparent 70%); }
#vision::before { background: radial-gradient(60% 48% at 50% 26%, rgba(232,137,59,0.06), transparent 70%); }

/* ---------- editor tab strip ---------- */
.editor-tabs {
  display: flex; align-items: stretch; gap: 2px;
  padding: 0 12px; border-bottom: 1px solid var(--hairline);
  background: rgba(255,255,255,0.014);
}
.editor-tab {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint);
  padding: 11px 14px; border-bottom: 1.5px solid transparent;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}
.editor-tab .tdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.editor-tab.on { color: var(--text); border-bottom-color: var(--grain); }
.editor-tab.on .tdot { background: var(--grain); opacity: 1; box-shadow: 0 0 8px var(--grain); }
.editor-tab.muted { opacity: 0.55; }

/* ---------- reconstruction viewport: rendered material ---------- */
.vp-scene { position: absolute; inset: 0; }
.vp-objglow, .vp-core, .vp-floor { position: absolute; left: 50%; pointer-events: none; transition: background 0.4s var(--ease), box-shadow 0.4s var(--ease); }
.vp-objglow {
  top: 46%; width: 256px; height: 256px; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, color-mix(in oklab, var(--mc) 42%, transparent), transparent 60%);
  filter: blur(24px);
}
.vp-core {
  top: 46%; width: 150px; height: 150px; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, rgba(255,255,255,0.55), color-mix(in oklab, var(--mc) 62%, transparent) 26%, color-mix(in oklab, var(--mc) 20%, #0b0d10) 64%, #0a0c0f 100%);
  box-shadow: inset -10px -14px 32px rgba(0,0,0,0.55), 0 0 46px -6px color-mix(in oklab, var(--mc) 55%, transparent);
}
.vp-floor {
  top: 73%; width: 232px; height: 26px; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(ellipse, color-mix(in oklab, var(--mc) 26%, transparent), transparent 70%);
  filter: blur(8px);
}
.vp-wire { position: relative; filter: drop-shadow(0 0 13px color-mix(in oklab, var(--mc) 45%, transparent)); }
.param-val { margin-left: auto; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.02em; }

/* ---------- parameter controls ---------- */
.param { display: grid; grid-template-columns: 116px 1fr; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--hairline-soft); }
.param:last-child { border-bottom: none; }
.param-label { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-soft); letter-spacing: -0.01em; }
.param-label .sig { color: var(--text-faint); }

.slider { position: relative; height: 30px; display: flex; align-items: center; }
.slider input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 3px; background: var(--surface-3); border-radius: 3px; outline: none; }
.slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: var(--grain); cursor: pointer; border: 2px solid #0c0e11;
  box-shadow: 0 0 0 1px var(--grain-deep), 0 0 14px var(--grain-glow);
  transition: transform 0.3s var(--spring);
}
.slider input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.25); }
.slider input[type=range]::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--grain); cursor: pointer; border: 2px solid #0c0e11; }
.slider .fill { position: absolute; left: 0; height: 3px; background: var(--grain); border-radius: 3px; pointer-events: none; }

.swatches { display: flex; gap: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 7px; cursor: pointer; border: 1px solid rgba(255,255,255,0.12); transition: transform 0.3s var(--spring); position: relative; }
.swatch:hover { transform: scale(1.12); }
.swatch.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--text); }

.segmented { display: flex; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 3px; gap: 3px; }
.segmented button {
  flex: 1; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-soft);
  background: transparent; border: none; border-radius: 6px; padding: 7px 6px; cursor: pointer;
  transition: all 0.25s var(--ease); white-space: nowrap;
}
.segmented button:hover { color: var(--text); }
.segmented button.on { background: var(--surface-3); color: var(--grain-bright); box-shadow: inset 0 0 0 1px var(--hairline); }

.text-param input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-sm);
  color: var(--text); font-family: var(--font-mono); font-size: 13px; padding: 9px 11px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.text-param input:focus { border-color: var(--grain-deep); box-shadow: 0 0 0 3px var(--grain-glow); }

/* ---------- terminal / reasoning feed ---------- */
.feed {
  font-family: var(--font-mono); font-size: 13px; line-height: 1.75;
  color: var(--text-soft);
  background:
    radial-gradient(100% 60% at 0% 0%, rgba(91,168,212,0.04), transparent 60%),
    #0c0e11;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 16px 18px;
  overflow-y: auto;
  position: relative;
}
.feed-line { display: flex; align-items: flex-start; gap: 9px; animation: feedin 0.45s var(--spring-soft); }
.feed-line > .body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.feed-line .arrow { color: var(--grain); flex-shrink: 0; }
.feed-line .em { color: var(--text); }
.feed-line .wire { color: var(--wire); }
.feed-line.done .arrow { color: var(--text-faint); }
@keyframes feedin { from { transform: translateY(7px); } to { transform: translateY(0); } }
.feed-cursor { display: inline-block; width: 8px; height: 15px; background: var(--grain); vertical-align: middle; animation: blink 1.05s steps(1) infinite; border-radius: 1px; }
@keyframes blink { 50% { opacity: 0; } }

/* scrollbar */
.feed::-webkit-scrollbar, .node-stage::-webkit-scrollbar { width: 8px; height: 8px; }
.feed::-webkit-scrollbar-thumb, .node-stage::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }

/* ---------- layout grids ---------- */
.eyea-grid { display: grid; grid-template-columns: 0.92fr 1.08fr; }
.eyea-left { padding: 26px 26px 26px 26px; border-right: 1px solid var(--hairline); }
.eyea-right { padding: 26px; }
.eyea-feed { height: 232px; }
.eyea-vp { aspect-ratio: 16 / 10; margin-bottom: 18px; }
.param-block { }

.eyeb-grid { display: grid; grid-template-columns: 0.78fr 1.22fr; }
.eyeb-left { padding: 26px; border-right: 1px solid var(--hairline); display: flex; flex-direction: column; }
.eyeb-right { padding: 26px; }
.eyeb-feed { height: 180px; }
.node-vp { aspect-ratio: 16 / 10; }

.eyec-grid { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 28px; align-items: stretch; }
.eyec-vp { width: 100%; height: 100%; min-height: 380px; }
.eyec-copy { align-self: center; }

/* eye C demo — compile.screen (intent picker) */
.compile-grid { display: grid; grid-template-columns: 0.82fr 1.18fr; gap: 28px; padding: 24px; align-items: start; }
.capture-frame {
  --cc: #57C4C0; position: relative; aspect-ratio: 16 / 10; border-radius: var(--r-md); overflow: hidden;
  border: 1px solid color-mix(in oklab, var(--cc) 30%, var(--hairline)); display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% 0%, color-mix(in oklab, var(--cc) 12%, transparent), transparent 70%), var(--surface-2);
}
.capture-tag { position: absolute; top: 8px; left: 10px; font-size: 10px; z-index: 2; letter-spacing: 0.04em; color: color-mix(in oklab, var(--cc) 70%, var(--text)); }
.cap-render { display: grid; place-items: center; }
.cap-ui { width: 62%; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 7px; box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.cap-ui .cu-bar { height: 8px; width: 38%; border-radius: 3px; background: var(--cc); opacity: 0.85; }
.cap-ui .cu-line { height: 6px; border-radius: 3px; background: var(--hairline); }
.cap-ui .cu-line.short { width: 60%; }
.cap-ui .cu-cta { height: 16px; width: 50%; border-radius: 5px; background: var(--cc); margin-top: 4px; }

.eyec-out-vp { width: 100%; min-height: 300px; }
.eyec-lib { border: 1px solid var(--hairline); border-radius: var(--r-lg); background: linear-gradient(180deg, var(--surface), #101216); padding: 18px; }
.component-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.component-card { --cc: #5BA8D4; border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 11px; background: var(--surface-2); display: flex; flex-direction: column; gap: 9px; }
.component-card.fresh { animation: ccpop 0.6s var(--spring); border-color: color-mix(in oklab, var(--cc) 50%, var(--hairline)); box-shadow: 0 0 28px -10px var(--cc); }
@keyframes ccpop { from { transform: translateY(10px) scale(0.96); } to { transform: none; } }
.cc-preview { background: var(--surface-3); border-radius: 7px; padding: 10px; display: flex; flex-direction: column; gap: 5px; min-height: 62px; }
.cc-bar { height: 6px; width: 34%; border-radius: 3px; background: var(--cc); opacity: 0.85; }
.cc-line { height: 5px; border-radius: 3px; background: var(--hairline); }
.cc-cta { height: 13px; width: 46%; border-radius: 4px; background: var(--cc); margin-top: 3px; }
.cc-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.cc-name { font-size: 12px; color: var(--text); }
.cc-tokens { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.cc-swatch { width: 13px; height: 13px; border-radius: 4px; border: 1px solid var(--hairline); }
.cc-state { font-size: 9.5px; color: var(--text-faint); border: 1px solid var(--hairline); border-radius: 4px; padding: 1px 5px; }
@media (max-width: 820px) { .compile-grid { grid-template-columns: 1fr; } }

.ladder-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.ladder-card {
  background: linear-gradient(180deg, var(--surface), #101216);
  border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 26px;
  min-height: 190px; display: flex; flex-direction: column; justify-content: space-between;
}

/* ---------- overview · the three eyes (icon-led) ---------- */
.eye-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.eye-card {
  --accent: var(--grain);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
  padding: 44px 28px 30px; text-decoration: none; position: relative; overflow: hidden;
  border: 1px solid var(--hairline); border-radius: var(--r-xl);
  background:
    radial-gradient(120% 76% at 50% 0%, color-mix(in oklab, var(--accent) 9%, transparent), transparent 66%),
    linear-gradient(180deg, var(--surface), #101216);
  transition: transform 0.45s var(--spring), border-color 0.3s var(--ease), box-shadow 0.45s var(--ease);
}
.eye-card:hover {
  transform: translateY(-6px);
  border-color: color-mix(in oklab, var(--accent) 38%, var(--hairline));
  box-shadow: 0 32px 80px -42px rgba(0,0,0,0.8), 0 0 100px -52px var(--accent);
}
.eye-orb {
  width: 132px; height: 132px; border-radius: 50%; margin-bottom: 6px;
  background-size: cover; background-position: center; position: relative;
  box-shadow: 0 0 0 1px var(--hairline), 0 22px 56px -20px rgba(0,0,0,0.8), 0 0 70px -24px var(--accent);
  transition: transform 0.5s var(--spring), box-shadow 0.45s var(--ease);
}
.eye-orb::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.07), inset 0 0 34px rgba(0,0,0,0.45);
}
.eye-orb-ring {
  position: absolute; inset: -8px; border-radius: 50%;
  border: 1px solid color-mix(in oklab, var(--accent) 45%, transparent);
  opacity: 0.6; transition: inset 0.5s var(--spring), opacity 0.45s var(--ease);
}
.eye-card:hover .eye-orb { transform: scale(1.05); box-shadow: 0 0 0 1px var(--hairline), 0 22px 60px -20px rgba(0,0,0,0.8), 0 0 96px -18px var(--accent); }
.eye-card:hover .eye-orb-ring { inset: -13px; opacity: 0.92; }
.eye-card-tag { font-size: 11px; letter-spacing: 0.16em; }
.eye-card-src { font-size: 13px; margin: 0; }
.eye-card-verb { font-family: var(--font-display); font-size: 34px; font-weight: 600; letter-spacing: -0.03em; color: var(--text); margin: 1px 0 0; }
.eye-card-go {
  font-size: 11px; letter-spacing: 0.06em; color: var(--accent); margin-top: 5px;
  opacity: 0; transform: translateY(4px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.eye-card:hover .eye-card-go { opacity: 0.92; transform: none; }
@media (prefers-reduced-motion: no-preference) { .eye-card.in { animation: revealUp 0.7s var(--spring); } }
@media (max-width: 860px) { .eye-orb { width: 108px; height: 108px; } }
@media (max-width: 760px) { .eye-cards { grid-template-columns: 1fr; max-width: 360px; margin: 0 auto; } }

/* ---------- transact flow (branching two-rail proof diagram) ---------- */
.txstage-wrap { width: 100%; display: flex; justify-content: center; }
.txstage {
  position: relative; width: 990px; height: 320px; flex: none;
  transform-origin: top center;
}
.tx-node {
  position: absolute; transform: translate(-50%, -26px);
  display: flex; flex-direction: column; align-items: center; gap: 11px;
  width: 150px; text-align: center;
}
.tx-chip {
  width: 52px; height: 52px; border-radius: 13px;
  background: var(--surface-2); border: 1px solid var(--hairline);
  display: grid; place-items: center; position: relative;
  color: var(--text-faint);
  transition: border-color 0.45s var(--ease), background 0.45s var(--ease), color 0.45s var(--ease), box-shadow 0.45s var(--ease), transform 0.5s var(--spring);
}
.tx-node.lit .tx-chip { color: var(--node-c); border-color: var(--node-c); background: color-mix(in oklab, var(--node-c) 13%, var(--surface-2)); box-shadow: 0 0 22px -4px var(--node-c); }
.tx-node.gate.lit .tx-chip { animation: gateBreathe 1.7s var(--ease) infinite; }
@keyframes gateBreathe {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--node-c) 55%, transparent), 0 0 18px -4px var(--node-c); transform: scale(1); }
  50%      { box-shadow: 0 0 0 8px transparent, 0 0 30px -2px var(--node-c); transform: scale(1.08); }
}
.tx-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.03em; color: var(--text-faint); line-height: 1.45; transition: color 0.45s var(--ease); }
.tx-node.lit .tx-label { color: var(--node-c); }
.tx-label .seq { display: block; font-size: 9px; letter-spacing: 0.22em; color: var(--text-faint); margin-bottom: 3px; opacity: 0.7; }

/* connectors svg */
.tx-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.tx-base { stroke: var(--hairline); stroke-width: 2; fill: none; }
.tx-flow { stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-dashoffset: 1; transition: stroke-dashoffset 0.55s var(--ease); }
.tx-flow.on { stroke-dashoffset: 0; }

/* traveling token (motion path) */
.tx-tok { position: absolute; left: 0; top: 0; width: 9px; height: 9px; border-radius: 50%; offset-anchor: center; offset-rotate: 0deg; }
.tx-tok.run { animation: tokRun var(--d, 0.8s) cubic-bezier(0.45,0,0.55,1) forwards; }
@keyframes tokRun { from { offset-distance: 0%; } to { offset-distance: 100%; } }

/* branch junction marker */
.tx-junction { position: absolute; width: 9px; height: 9px; transform: translate(-50%, -50%) rotate(45deg); border: 1px solid var(--hairline); background: var(--bg); border-radius: 2px; }

/* lane end captions — base visible (capture-safe); mounted only when lane completes */
.tx-cap { position: absolute; transform: translateY(-50%); width: 300px; }
@media (prefers-reduced-motion: no-preference) {
  .tx-cap { animation: capIn 0.5s var(--spring); }
}
@keyframes capIn { from { transform: translateY(-50%) translateX(-10px); } to { transform: translateY(-50%) translateX(0); } }
.tx-cap .cap-state { font-family: var(--font-mono); font-size: 11px; display: flex; align-items: center; gap: 6px; letter-spacing: 0.01em; white-space: nowrap; }
.tx-cap .cap-desc { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); margin-top: 5px; letter-spacing: 0.02em; white-space: nowrap; }

.tx-summary { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-soft); margin-top: 38px; text-align: center; letter-spacing: 0.01em; line-height: 1.6; max-width: 60ch; }
.tx-summary .dim { color: var(--text-faint); }
.tx-summary b { color: var(--grain); font-weight: 500; }
.tx-summary .wireb { color: var(--wire); font-weight: 500; }

/* ---------- reveal animations ----------
   Base state is VISIBLE; entrance is a one-shot keyframe (no fill-mode) so
   content never stays hidden if a transition/animation is throttled while the
   iframe is backgrounded (capture/verify), and below-fold items are off-screen
   anyway until .in triggers the entrance. */
.sec-head, .ladder-card, .vision-line, .eyea-panel, .panel { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .sec-head.in, .vision-line.in { animation: revealUp 0.7s var(--spring); }
  .ladder-card.in { animation: revealUp 0.7s var(--spring); }
  .eyea-panel.in, .panel.in { animation: revealPanel 0.8s var(--spring); }
}
/* transform-only (no opacity) so a throttled/frozen frame is still visible */
@keyframes revealUp { from { transform: translateY(20px); } to { transform: none; } }
@keyframes revealPanel { from { transform: translateY(26px) scale(0.99); } to { transform: none; } }

.nav-link { font-size: 14px; }
.pulse-accent { animation: accentpulse 1.2s ease infinite; }
@keyframes accentpulse { 50% { box-shadow: 0 0 22px var(--grain); } }
@keyframes winpulse { 50% { box-shadow: 0 0 0 1px var(--bg), 0 0 44px var(--grain-glow); } }

/* hero motif fade-in — base state is VISIBLE; entrance is enhancement only
   (never leave content hidden if the keyframe is throttled while backgrounded) */
.hero-copy, .hero-motif { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .hero-copy { animation: heroIn 0.9s var(--spring); }
  .hero-motif { animation: heroIn 1s var(--spring) 0.1s; }
}
@keyframes heroIn { from { transform: translateY(24px); } to { transform: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1040px) {
  :root { --section-y: 96px; }
}
@media (max-width: 940px) {
  :root { --section-y: 80px; }
  .wrap { padding: 0 24px; }
  .hero { padding-top: 132px; }
  .hero .hero-grid { grid-template-columns: 1fr !important; min-height: 420px; }
  .hero-vignette {
    background:
      linear-gradient(0deg, var(--bg) 2%, rgba(9,10,12,0.55) 40%, rgba(9,10,12,0.78) 100%),
      linear-gradient(0deg, var(--bg) 0%, transparent 22%);
  }
  .eyea-grid, .eyeb-grid, .eyec-grid { grid-template-columns: 1fr; }
  .eyea-left, .eyeb-left { border-right: none; border-bottom: 1px solid var(--hairline); }
  .ladder-grid { grid-template-columns: 1fr; }
  .eyec-vp { min-height: 300px; }
  nav .nav-link { display: none; }
}
@media (max-width: 560px) {
  .param { grid-template-columns: 92px 1fr; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.05s !important; }
}
