/* ————————————————————————————————— fonts (self-hosted, latin) */
@font-face { font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/instrumentserif-400.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url('/fonts/instrumentserif-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/ibmplexmono-400.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: italic; font-weight: 400; font-display: swap; src: url('/fonts/ibmplexmono-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/ibmplexmono-500.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/ibmplexsans-400.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/ibmplexsans-500.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/ibmplexsans-600.woff2') format('woff2'); }

/* ————————————————————————————————— tokens */
:root {
  --bg: #0b0812;
  --bg-raise: #131022;
  --bg-deep: #0a0714;
  --line: rgba(168, 140, 250, 0.14);
  --line-strong: rgba(168, 140, 250, 0.32);
  --ink: #eae5f6;
  --muted: #a89fc2;
  --dim: #746c8f;
  --accent: #a06bff;
  --accent-hot: #c084fc;
  --green: #22c55e;
  --amber: #eab308;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'IBM Plex Sans', -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: rgba(160, 107, 255, 0.35); color: #fff; }

/* scan-room atmosphere: rings + grain + vignette */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(1200px 800px at 50% -200px, rgba(140, 80, 255, 0.13), transparent 65%),
    repeating-radial-gradient(circle at 50% -10%, transparent 0 119px, rgba(168, 140, 250, 0.045) 119px 120px),
    linear-gradient(180deg, #0d0a16 0%, var(--bg) 40%);
}
body::after {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.035 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--accent-hot); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

code {
  font-family: var(--mono); font-size: 0.85em;
  background: rgba(168, 140, 250, 0.09);
  border: 1px solid var(--line);
  border-radius: 4px; padding: 0.1em 0.35em;
  color: var(--ink);
}

/* ————————————————————————————————— header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(20px, 5vw, 48px);
  background: rgba(11, 8, 18, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-weight: 500; font-size: 13px;
  letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--accent-hot);
}
.wordmark:hover { text-decoration: none; color: #d8b4fe; }
.glyph { width: 20px; height: 20px; color: var(--accent); }
.site-header nav { display: flex; align-items: center; gap: clamp(14px, 2.5vw, 28px); }
.site-header nav a {
  font-family: var(--mono); font-size: 12.5px; color: var(--muted);
  letter-spacing: 0.04em;
}
.site-header nav a:hover { color: var(--ink); text-decoration: none; }

/* ————————————————————————————————— buttons */
.btn {
  display: inline-block;
  font-family: var(--mono); font-size: 13.5px; font-weight: 500;
  padding: 10px 20px; border-radius: 6px;
  border: 1px solid var(--line-strong);
  letter-spacing: 0.02em;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: linear-gradient(180deg, #8d5cf6, #7440e0);
  border-color: #a06bff;
  color: #fff;
  box-shadow: 0 0 24px rgba(140, 80, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover { background: linear-gradient(180deg, #9d70ff, #8250f0); box-shadow: 0 0 34px rgba(150, 90, 255, 0.5), inset 0 1px 0 rgba(255,255,255,0.18); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { color: var(--ink); border-color: var(--accent); }
.site-header .btn-ghost { padding: 7px 14px; font-size: 12.5px; }

/* ————————————————————————————————— hero */
.hero {
  max-width: 980px; margin: 0 auto;
  padding: clamp(64px, 10vh, 120px) 24px 40px;
  text-align: center;
}
.entry {
  font-family: var(--serif);
  font-size: clamp(44px, 8vw, 84px);
  line-height: 1.05; letter-spacing: -0.01em;
}
.headword { color: var(--ink); }
.entry .gram { font-family: var(--serif); font-style: italic; color: var(--dim); font-size: 0.5em; margin-left: 0.35em; }
.definition {
  font-family: var(--serif); font-style: normal;
  font-size: clamp(19px, 2.6vw, 24px);
  color: var(--muted); margin-top: 14px;
}
.definition em { color: var(--dim); }
.tagline {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(30px, 4.6vw, 46px);
  line-height: 1.12; letter-spacing: -0.005em;
  margin-top: clamp(40px, 6vh, 64px);
  background: linear-gradient(100deg, #e9ddff 20%, #b07aff 65%, #7c5cff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.lede {
  max-width: 720px; margin: 24px auto 0;
  color: var(--muted); font-size: 16.5px;
}
.lede strong { color: var(--ink); font-weight: 600; }
.cta-row { margin-top: 32px; display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
.cta-meta { font-family: var(--mono); font-size: 12px; color: var(--dim); letter-spacing: 0.08em; }

/* the scan viewer */
.viewer {
  position: relative;
  margin: clamp(48px, 8vh, 80px) auto 0;
  max-width: 920px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 40px 18px 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 60px rgba(140, 80, 255, 0.08);
}
.viewer img { display: block; width: 100%; height: auto; border-radius: 4px; }
.viewer .c {
  position: absolute; width: 16px; height: 16px;
  border: 2px solid var(--accent); opacity: 0.8;
}
.c1 { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.c2 { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.c3 { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.c4 { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.viewer-hud {
  position: absolute; top: 14px; left: 20px; right: 20px;
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.18em; color: var(--dim);
}
.hud-bottom { top: auto; bottom: 44px; padding: 0 8px; color: rgba(116, 108, 143, 0.85); }
.scanline {
  position: absolute; left: 18px; right: 18px; top: 40px; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(192, 132, 252, 0.5), transparent);
  animation: sweep 7s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  pointer-events: none;
}
@keyframes sweep {
  0%, 12% { transform: translateY(0); opacity: 0; }
  16% { opacity: 1; }
  55% { transform: translateY(min(48vw, 445px)); opacity: 1; }
  60%, 100% { transform: translateY(min(48vw, 445px)); opacity: 0; }
}
.viewer figcaption {
  margin-top: 12px; padding: 0 8px 6px;
  font-size: 13px; color: var(--dim); text-align: left;
}

/* ————————————————————————————————— sections */
.section {
  max-width: 980px; margin: 0 auto;
  padding: clamp(56px, 9vh, 104px) 24px 0;
}
.kicker {
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--accent);
}
.section h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(34px, 5vw, 52px);
  letter-spacing: -0.01em; line-height: 1.1;
  margin: 10px 0 30px;
}
.section-lede { color: var(--muted); max-width: 640px; margin: -12px 0 30px; }

/* the loop */
.loop { list-style: none; counter-reset: step; position: relative; }
.loop li {
  counter-increment: step;
  position: relative;
  padding: 20px 24px 20px 84px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(19, 16, 34, 0.55);
  margin-bottom: 12px;
}
.loop li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 24px; top: 22px;
  font-family: var(--mono); font-size: 13px; color: var(--dim);
}
.loop li::after {
  content: ''; position: absolute; left: 56px; top: 18px; bottom: 18px;
  width: 1px; background: var(--line);
}
.loop .step {
  display: block;
  font-family: var(--mono); font-weight: 500; font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.22em;
  color: var(--accent-hot); margin-bottom: 6px;
}
.loop p { color: var(--muted); max-width: 700px; }
.loop li:hover { border-color: var(--line-strong); }

.decay {
  display: flex; gap: 6px; margin-top: 14px; max-width: 480px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
}
.decay span { flex: 1; text-align: center; padding: 7px 0; border-radius: 4px; border: 1px solid transparent; }
.d-fresh   { background: rgba(34, 197, 94, 0.16); color: #6ee7a0; border-color: rgba(34,197,94,0.3) !important; }
.d-aging   { background: rgba(234, 179, 8, 0.13); color: #e5c453; border-color: rgba(234,179,8,0.26) !important; }
.d-stale   { background: rgba(249, 115, 22, 0.10); color: #d99266; border-color: rgba(249,115,22,0.2) !important; }
.d-dormant { background: rgba(116, 108, 143, 0.10); color: #746c8f; border-color: rgba(116,108,143,0.2) !important; }

/* types */
.types { margin-top: 40px; padding: 26px 28px; border: 1px dashed var(--line-strong); border-radius: 10px; }
.types-title { font-family: var(--serif); font-size: 24px; margin-bottom: 14px; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; }
.chips li {
  font-family: var(--mono); font-size: 13px;
  padding: 6px 14px 6px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-deep);
  display: flex; align-items: center; gap: 8px;
}
.chips li::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--dot); box-shadow: 0 0 8px var(--dot);
}
.types-note { color: var(--dim); font-size: 14px; margin-top: 14px; max-width: 700px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat {
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(19, 16, 34, 0.55);
  padding: 26px 24px 22px;
}
.stat-num {
  font-family: var(--serif); font-size: clamp(34px, 4vw, 46px);
  line-height: 1; color: var(--ink); letter-spacing: -0.01em;
}
.stat-num span { color: var(--dim); font-size: 0.62em; }
.stat-cap { margin-top: 14px; font-size: 13.5px; color: var(--muted); }
.stat-warn { border-color: rgba(234, 179, 8, 0.35); background: rgba(234, 179, 8, 0.05); }
.stat-warn .stat-num { color: #e5c453; }
.caveat {
  margin-top: 18px; font-family: var(--mono); font-size: 12.5px;
  color: var(--dim); letter-spacing: 0.04em;
}

/* client cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.card {
  position: relative;
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(19, 16, 34, 0.55);
  padding: 22px;
  transition: border-color 160ms ease, transform 160ms ease;
}
.card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.card h3 { font-family: var(--serif); font-weight: 400; font-size: 24px; margin-bottom: 14px; }
.card pre {
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: 6px;
  padding: 12px 14px; overflow-x: auto; margin-bottom: 14px;
}
.card pre code { background: none; border: 0; padding: 0; font-size: 12.5px; color: #cdb8f4; }
.card p { font-size: 13.5px; color: var(--muted); }
.mcp-row { margin-top: 18px; font-size: 14px; color: var(--muted); }
.mcp-row code { font-size: 12.5px; }
.mcp-row .dim { color: var(--dim); }

/* manifest */
.manifest { list-style: none; border-top: 1px solid var(--line); }
.manifest li {
  display: grid; grid-template-columns: 200px 1fr; gap: 20px;
  padding: 18px 4px; border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 15px;
}
.m-key {
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--accent-hot); padding-top: 3px;
}

/* quick start */
.codeblock {
  position: relative;
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: 10px;
  padding: 22px 24px;
}
.codeblock pre { overflow-x: auto; }
.codeblock code { background: none; border: 0; padding: 0; font-size: 13.5px; line-height: 1.8; color: #d7c9f6; }
.codeblock .cm { color: var(--dim); }
.copy {
  position: absolute; top: 12px; right: 12px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em;
  color: var(--muted); background: var(--bg-raise);
  border: 1px solid var(--line); border-radius: 5px;
  padding: 5px 12px; cursor: pointer;
}
.copy:hover { color: var(--ink); border-color: var(--accent); }
.req { margin-top: 16px; font-size: 13.5px; color: var(--dim); max-width: 720px; }

/* faq */
details {
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(19, 16, 34, 0.55);
  margin-bottom: 10px; overflow: hidden;
}
summary {
  cursor: pointer; list-style: none;
  font-family: var(--serif); font-size: 21px;
  padding: 16px 22px;
  position: relative;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: '+'; position: absolute; right: 22px; top: 14px;
  font-family: var(--mono); color: var(--accent); font-size: 18px;
  transition: transform 160ms ease;
}
details[open] summary::after { transform: rotate(45deg); }
summary:hover { color: var(--accent-hot); }
details p { padding: 0 22px 20px; color: var(--muted); font-size: 15px; max-width: 780px; }

/* ————————————————————————————————— footer */
.site-footer {
  margin-top: clamp(72px, 12vh, 130px);
  border-top: 1px solid var(--line);
  padding: 44px 24px 60px;
  text-align: center;
}
.foot-def { font-family: var(--serif); font-size: 21px; color: var(--muted); }
.foot-def strong { color: var(--ink); font-weight: 400; }
.foot-def i { color: var(--dim); }
.site-footer nav { display: flex; gap: 26px; justify-content: center; margin: 20px 0 14px; flex-wrap: wrap; }
.site-footer nav a { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.site-footer nav a:hover { color: var(--ink); }
.foot-note { font-family: var(--mono); font-size: 11.5px; color: var(--dim); letter-spacing: 0.06em; }

/* ————————————————————————————————— reveal + motion */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 600ms ease, transform 600ms ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .scanline { animation: none; opacity: 0; }
  .card, .card:hover { transform: none; transition: none; }
}

/* ————————————————————————————————— responsive */
@media (max-width: 860px) {
  .stats, .cards { grid-template-columns: 1fr; }
  .manifest li { grid-template-columns: 1fr; gap: 6px; }
  .site-header nav a:not(.btn) { display: none; }
  .loop li { padding-left: 24px; }
  .loop li::before { position: static; display: block; margin-bottom: 4px; }
  .loop li::after { display: none; }
  .hud-bottom { display: none; }
}
