:root {
  --ink: #0a0a0a;
  --paper: #f4f0e8;
  --accent: #ff5e2b;
  --muted: #8a857c;
  --line: rgba(244, 240, 232, 0.12);
}
* { -webkit-tap-highlight-color: transparent; }
::selection { background: var(--accent); color: #0a0a0a; }
html { scroll-behavior: smooth; }
body {
  background: var(--ink);
  color: var(--paper);
  font-family: 'Space Grotesk', sans-serif;
  overflow-x: hidden;
  cursor: default;
}
#particles { pointer-events: none; opacity: 0.9; }
.grain {
  position: fixed; inset: -50%; z-index: 60; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.035; mix-blend-mode: overlay;
}
.vignette { position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 0%, transparent 55%, rgba(0,0,0,0.55) 100%); }
.display { font-family: 'Instrument Serif', serif; font-weight: 400; letter-spacing: -0.01em; line-height: 0.94; }
.italic-accent { font-style: italic; color: var(--accent); }
.line-mask {
  display: block;
  overflow: hidden;
  /* Preserve serif descenders (y, g, p, q) inside the reveal mask without
     changing the heading's external line spacing or alignment. */
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
}
#cursor { position: fixed; top:0; left:0; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); z-index: 80; pointer-events: none; transform: translate(-50%,-50%); mix-blend-mode: difference; transition: width .25s ease, height .25s ease, background .25s ease; }
#cursor.big { width: 46px; height: 46px; background: rgba(255,94,43,0.25); }
@media (hover: none) { #cursor { display: none; } }
.marquee { display: flex; width: max-content; animation: scroll 32s linear infinite; }
.marquee:hover { animation-play-state: paused; }
@keyframes scroll { to { transform: translateX(-50%); } }
.field { background: rgba(244,240,232,0.03); border: 1px solid var(--line); color: var(--paper); transition: border-color .25s ease, background .25s ease; }
.field:focus { outline: none; border-color: var(--accent); background: rgba(244,240,232,0.06); }
.field::placeholder { color: #5f5b53; }
.ember { background: var(--accent); color: #0a0a0a; transition: box-shadow .3s ease; }
.ember:hover { box-shadow: 0 0 0 1px var(--accent), 0 18px 50px -12px rgba(255,94,43,0.6); }
.ghost { border: 1px solid var(--line); transition: border-color .25s ease, background .25s ease; }
.ghost:hover { border-color: var(--paper); background: rgba(244,240,232,0.04); }

/* Glassmorphism secondary button (hero "The method") */
.glass-btn {
  border: 1px solid rgba(244, 240, 232, 0.14);
  background: rgba(244, 240, 232, 0.05);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  color: var(--paper);
  transition: border-color .25s ease, background .25s ease, box-shadow .25s ease;
}
.glass-btn:hover {
  border-color: rgba(255, 94, 43, 0.4);
  background: rgba(244, 240, 232, 0.08);
  box-shadow: 0 8px 30px -12px rgba(0,0,0,0.6);
}
.pcard { border: 1px solid var(--line); transition: border-color .25s ease, background .25s ease, transform .25s ease; }
.pcard.on { border-color: var(--accent); background: rgba(255,94,43,0.06); }
.snode { border: 1px solid var(--line); color: var(--muted); transition: all .35s ease; font-family: 'Instrument Serif', serif; }
.snode.on { border-color: var(--accent); color: var(--accent); }
.snode.done { border-color: var(--paper); color: var(--paper); }
.pill { border: 1px solid var(--line); transition: all .18s ease; }
.pill:hover { border-color: rgba(255,94,43,0.5); }
.pill.on { border-color: var(--accent); background: rgba(255,94,43,0.1); }
.scroll-slim::-webkit-scrollbar { width: 6px; }
.scroll-slim::-webkit-scrollbar-thumb { background: rgba(244,240,232,0.15); border-radius: 6px; }
#toast { transition: transform .4s cubic-bezier(.34,1.56,.64,1), opacity .3s ease; }
.ul { background-image: linear-gradient(var(--accent),var(--accent)); background-size: 0% 1px; background-position: 0 100%; background-repeat: no-repeat; transition: background-size .3s ease; }
.ul:hover { background-size: 100% 1px; }
/* Generic scroll reveal - CSS driven so it fires once and never flashes. */
[data-reveal] { opacity: 0; transform: translateY(24px); will-change: transform, opacity; }
[data-reveal].shown { opacity: 1; transform: none; transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.2,1); }
@media (prefers-reduced-motion: reduce) { [data-reveal] { opacity: 1; transform: none; } }

/* ---------- Stat cells ---------- */
.stat { transition: background .3s ease; }
.stat:hover { background: rgba(255, 94, 43, 0.04); }
.stat::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 0;
  background: var(--accent); transition: width .4s cubic-bezier(.2,.8,.2,1);
}
.stat:hover::after { width: 100%; }

/* ---------- Format cards ---------- */
.format-card { transition: border-color .3s ease, transform .3s ease, background .3s ease; }
.format-card:hover { border-color: rgba(255, 94, 43, 0.4); transform: translateY(-3px); background: rgba(255, 94, 43, 0.03); }
.format-card::before {
  content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity .4s ease;
  background: radial-gradient(120% 80% at 100% 0%, rgba(255,94,43,0.12), transparent 60%);
  pointer-events: none;
}
.format-card:hover::before { opacity: 1; }

/* ---------- Pipeline + stack cards ---------- */
.pipe { transition: border-color .3s ease, transform .3s ease, background .3s ease; }
.pipe:hover { border-color: rgba(255, 94, 43, 0.4); transform: translateY(-3px); }
.stack-card { transition: border-color .3s ease, transform .3s ease, background .3s ease; }
.stack-card:hover { border-color: rgba(255, 94, 43, 0.35); transform: translateY(-3px); background: rgba(255, 94, 43, 0.03); }

/* ---------- Method cards ---------- */
.method-card {
  transition: border-color .35s ease, transform .35s ease, background .35s ease;
}
.method-card:hover { border-color: rgba(255,94,43,0.35); transform: translateY(-4px); background: rgba(255,94,43,0.03); }
.method-card::before {
  content: ''; position: absolute; left: 0; top: 0; height: 100%; width: 3px;
  background: var(--accent); transform: scaleY(0); transform-origin: top;
  transition: transform .4s cubic-bezier(.2,.8,.2,1);
}
.method-card:hover::before { transform: scaleY(1); }
/* Staggered entrance (JS toggles .in) — no layout-shift glitch */
.method-card { opacity: 0; transform: translateY(28px); }
.method-card.in { opacity: 1; transform: translateY(0); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.2,1); }

/* Alternating feature row entrance */
.feature-row { opacity: 0; transition: opacity .7s ease, transform .8s cubic-bezier(.2,.8,.2,1); }
.feature-row[data-side="left"] { transform: translateX(-64px); }
.feature-row[data-side="right"] { transform: translateX(64px); }
.feature-row.in { opacity: 1; transform: translateX(0); }
@media (prefers-reduced-motion: reduce) {
  .feature-row { opacity: 1; transform: none !important; }
}

/* ---------- Under the hood: signal flow ---------- */
.flow-pulse {
  left: 8%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 12px rgba(255, 94, 43, 0.6);
  animation: flowMove 3.6s cubic-bezier(.45,0,.55,1) infinite;
  opacity: 0.9;
}
@keyframes flowMove {
  0%   { transform: translateX(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateX(760px); opacity: 0; }
}
.flow-node .fdot { transition: border-color .3s ease, transform .3s ease, box-shadow .3s ease; }
.flow-node:hover .fdot { transform: translateY(-4px); box-shadow: 0 0 22px -6px rgba(255,94,43,0.5); }
.fdot-end { box-shadow: 0 0 20px -4px rgba(255,94,43,0.45); }
@media (max-width: 640px) {
  #flow { margin-left: -0.25rem; margin-right: -0.25rem; }
  #flow > .min-w-\[720px\] { min-width: 620px; }
  #flow .fdot { width: 2.75rem; height: 2.75rem; }
  #flow .flow-node p { max-width: 88px; margin-left: auto; margin-right: auto; }
  #flow .flow-node p:last-child { line-height: 1.25; }
}

/* ---------- Under the hood: bento ---------- */
.bento { transition: border-color .3s ease, transform .3s ease, background .3s ease; }
.bento:hover { border-color: rgba(255,94,43,0.4); transform: translateY(-3px); background: rgba(255,94,43,0.03); }
.bento::before {
  content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity .4s ease; pointer-events: none;
  background: radial-gradient(130% 90% at 100% 0%, rgba(255,94,43,0.12), transparent 55%);
}
.bento:hover::before { opacity: 1; }
.bento-tags { transition: border-color .3s ease; }
.bento-tags:hover { border-color: rgba(255,94,43,0.25); }

.hood-row { transition: background .25s ease, padding-left .25s ease; border-radius: 10px; }
.hood-row:hover { background: rgba(255,94,43,0.04); padding-left: 8px; }

/* Docs scroll-spy */
.doc-link { position: relative; transition: color .25s ease, transform .25s ease; }
.doc-link::before { content: ''; position: absolute; left: -1.3125rem; top: 50%; width: 0; height: 1.5rem; transform: translateY(-50%); background: var(--accent); transition: width .25s ease; }
.doc-link.active { color: var(--accent); transform: translateX(4px); }
.doc-link.active::before { width: 2px; }

.source-link {
  display: inline-grid;
  grid-template-columns: 2rem auto 1rem;
  align-items: center;
  column-gap: 0.625rem;
  min-height: 2.75rem;
  padding: 0.3125rem 0.75rem 0.3125rem 0.3125rem;
  border: 1px solid var(--line);
  border-radius: 0.875rem;
  background: rgba(244, 240, 232, 0.025);
  color: var(--paper);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: border-color .25s ease, background .25s ease, transform .25s ease;
}
.source-link:hover {
  border-color: rgba(255, 94, 43, 0.45);
  background: rgba(255, 94, 43, 0.05);
  transform: translateY(-1px);
}
.source-link-icon {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.625rem;
  background: rgba(255, 94, 43, 0.1);
  color: var(--accent);
}
.source-link-icon svg {
  display: block;
  width: 1rem !important;
  height: 1rem !important;
  stroke-width: 2;
}
.source-link-label {
  display: block;
  line-height: 1;
}
.source-link-arrow {
  display: block;
  width: 0.875rem !important;
  height: 0.875rem !important;
  color: var(--muted);
}
@media (max-width: 640px) {
  .source-link {
    min-height: 2.5rem;
    grid-template-columns: 1.75rem auto 0.875rem;
    padding: 0.25rem 0.625rem 0.25rem 0.25rem;
  }
  .source-link-icon { width: 1.75rem; height: 1.75rem; }
}

/* ---------- Glass navbar ---------- */
#nav { border-bottom: 1px solid transparent; }
#nav.scrolled {
  background: rgba(10, 10, 10, 0.55);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--line);
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}
