/* Agentiquette - precision instrument. Dark-first, one accent, mono for data. */

@font-face {
  font-family: 'Geist'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/public/fonts/geist-sans-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist Mono'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/public/fonts/geist-mono-var.woff2') format('woff2');
}

:root {
  --bg: #0b0d0c; --bg-2: #101312; --bg-3: #151917; --bg-code: #0e1110;
  --border: #232927; --border-strong: #313834;
  --text: #e7ebe8; --text-strong: #f4f7f4; --muted: #97a19b; --faint: #6b756f;
  --accent: #3fd68c; --accent-ink: #0b0d0c; --accent-dim: rgba(63, 214, 140, 0.13);
  --warn: #e5484d; --amber: #d8a642;
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --r: 8px; --r-lg: 12px;
  --shell: 1180px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #fafaf7; --bg-2: #f1f2ee; --bg-3: #e9ebe6; --bg-code: #f1f2ee;
    --border: #dcdfd9; --border-strong: #c6cbc3;
    --text: #1d2420; --text-strong: #0e1411; --muted: #59645e; --faint: #828c86;
    --accent: #0e8a52; --accent-ink: #ffffff; --accent-dim: rgba(14, 138, 82, 0.10);
    --warn: #c93a40; --amber: #9a7420;
    color-scheme: light;
  }
}
:root[data-theme='light'] {
  --bg: #fafaf7; --bg-2: #f1f2ee; --bg-3: #e9ebe6; --bg-code: #f1f2ee;
  --border: #dcdfd9; --border-strong: #c6cbc3;
  --text: #1d2420; --text-strong: #0e1411; --muted: #59645e; --faint: #828c86;
  --accent: #0e8a52; --accent-ink: #ffffff; --accent-dim: rgba(14, 138, 82, 0.10);
  --warn: #c93a40; --amber: #9a7420;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.mono { font-family: var(--mono); font-size: 0.86em; }
.muted { color: var(--muted); }
a { color: var(--text-strong); text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
h1, h2, h3 { color: var(--text-strong); line-height: 1.2; letter-spacing: -0.015em; font-weight: 620; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 0.5rem; }
h2 { font-size: 1.35rem; margin: 2.2rem 0 0.8rem; }
h3 { font-size: 1.05rem; margin: 1.4rem 0 0.5rem; }
code { font-family: var(--mono); font-size: 0.88em; background: var(--bg-3); padding: 0.1em 0.35em; border-radius: 4px; }
.shell { max-width: var(--shell); margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: 8px 16px; z-index: 100; border-radius: 0 0 var(--r) 0; }
.skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 680; font-size: 1.02rem; text-decoration: none; color: var(--text-strong); letter-spacing: -0.01em; }
.brand-bg { fill: var(--bg-3); }
.brand-mark { stroke: var(--accent); }
.site-nav { display: flex; gap: 4px; flex: 1; }
.site-nav a { text-decoration: none; color: var(--muted); font-size: 0.92rem; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.site-nav a:hover { color: var(--text-strong); background: var(--bg-2); }
.site-nav a[aria-current='page'] { color: var(--text-strong); background: var(--bg-3); }
.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.theme-toggle { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 6px; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; }
.theme-toggle:hover { color: var(--text-strong); border-color: var(--border-strong); }
:root[data-theme='light'] .icon-moon, :root:not([data-theme='light']) .icon-sun { display: none; }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .icon-sun { display: none !important; } :root:not([data-theme]) .icon-moon { display: block !important; } }
.nav-burger { display: none; background: none; border: 1px solid var(--border); border-radius: 6px; width: 32px; height: 32px; cursor: pointer; padding: 7px; flex-direction: column; justify-content: space-between; }
.nav-burger span { display: block; height: 2px; background: var(--muted); border-radius: 2px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--sans); font-size: 0.94rem; font-weight: 560; padding: 10px 18px; border-radius: var(--r); border: 1px solid transparent; text-decoration: none; cursor: pointer; white-space: nowrap; transition: transform 120ms ease, background 120ms ease, border-color 120ms ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text-strong)); color: var(--accent-ink); }
.btn-ghost { border-color: var(--border-strong); color: var(--text-strong); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-sm { padding: 6px 12px; font-size: 0.86rem; }

/* hero */
.hero { padding: 72px 0 56px; border-bottom: 1px solid var(--border); }
.hero-grid { display: grid; grid-template-columns: 7fr 5fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); letter-spacing: -0.03em; margin: 0 0 18px; white-space: nowrap; }
@media (max-width: 767px) { .hero h1 { white-space: normal; } }
.hero-sub { font-size: 1.08rem; color: var(--muted); max-width: 54ch; margin: 0 0 26px; }
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 26px; }
.stat-strip { color: var(--faint); font-size: 0.8rem; margin: 0; }
.stack-diagram { width: 100%; max-width: 360px; justify-self: end; }
.stack-diagram rect { fill: var(--bg-2); stroke: var(--border-strong); rx: 5; }
.stack-diagram text { fill: var(--muted); font-family: var(--mono); font-size: 12.5px; }
.stack-layer:nth-child(5) rect, .stack-layer:nth-child(6) rect { stroke: var(--accent); }
.stack-layer:nth-child(5) text, .stack-layer:nth-child(6) text { fill: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .stack-layer { opacity: 0; animation: layer-in 420ms ease forwards; animation-delay: calc(var(--i) * 70ms); }
  @keyframes layer-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

/* sections */
.section { padding: 56px 0; }
.section-tint { background: var(--bg-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-slim { margin: 40px 0; }
.section h2 { margin-top: 0; font-size: 1.5rem; }
.section-sub { color: var(--muted); max-width: 62ch; margin: 6px 0 28px; }
.section-more { margin-top: 22px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* stack strip */
.stack-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.stack-cell { padding: 18px 16px; border-right: 1px solid var(--border); background: var(--bg); display: flex; flex-direction: column; gap: 2px; }
.stack-cell:last-child { border-right: 0; }
.stack-term { font-weight: 640; color: var(--text-strong); text-decoration: none; }
a.stack-term:hover { color: var(--accent); }
.stack-rest { color: var(--muted); font-size: 0.86rem; }
.stack-cta { margin: 14px 2px 0; }

/* cards */
.data-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); text-decoration: none; color: var(--text); transition: border-color 130ms ease, transform 130ms ease; }
.data-card:hover { border-color: var(--accent); transform: translateY(-1px); color: var(--text); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-name { font-weight: 640; color: var(--text-strong); font-family: var(--mono); font-size: 0.92rem; }
.card-desc { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.card-facts { display: flex; gap: 14px; flex-wrap: wrap; color: var(--faint); font-size: 0.76rem; }
.card-agents { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-sm { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); border: 1px solid var(--border); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.chip { font-size: 0.74rem; color: var(--muted); border: 1px solid var(--border); background: var(--bg-2); padding: 3px 10px; border-radius: 999px; }
.fresh { display: inline-flex; align-items: center; gap: 5px; }
.fresh .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.fresh-green .dot { background: var(--accent); }
.fresh-yellow .dot { background: var(--amber); }
.fresh-gray .dot { background: var(--faint); }

/* tier badges */
.tier { font-family: var(--mono); font-size: 0.7rem; font-weight: 640; padding: 3px 9px; border-radius: 5px; letter-spacing: 0.04em; white-space: nowrap; }
.tier-s { background: var(--accent); color: var(--accent-ink); }
.tier-a { background: var(--bg-3); color: var(--text-strong); border: 1px solid var(--border-strong); }
.tier-b { background: var(--bg-2); color: var(--muted); border: 1px solid var(--border); }
.tier-exp { background: transparent; color: var(--amber); border: 1px dashed color-mix(in srgb, var(--amber) 55%, transparent); }
.tier-partial { background: transparent; color: var(--muted); border: 1px dashed var(--border-strong); }
.tier-dep { background: transparent; color: var(--warn); border: 1px solid var(--warn); }
.tier-lg { font-size: 0.82rem; padding: 5px 12px; }

/* ranking cards */
.ranking-card { display: block; padding: 22px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); text-decoration: none; color: var(--text); transition: border-color 130ms ease; }
.ranking-card:hover { border-color: var(--accent); }
.ranking-card h3 { margin: 0 0 14px; }
.ranking-top { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ranking-top li { display: flex; align-items: center; gap: 10px; font-size: 0.92rem; }
.rank-score { color: var(--accent); font-weight: 640; min-width: 2ch; }
.ranking-foot { color: var(--faint); font-size: 0.74rem; }

/* lab */
.lab-feature { display: grid; grid-template-columns: 3fr 2fr; gap: 40px; align-items: start; }
.lab-title { font-size: 1.15rem; font-weight: 620; }
.lab-title a { text-decoration: none; }
.lab-status { color: var(--faint); font-size: 0.8rem; margin-bottom: 18px; }
.lab-method-box { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r); padding: 18px 20px; background: var(--bg); }
.lab-method-box h3 { margin-top: 0; }
.lab-method-box p { margin-bottom: 0; color: var(--muted); font-size: 0.92rem; }

/* templates strip */
.template-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); text-decoration: none; color: var(--text); overflow: hidden; transition: border-color 130ms ease; }
.template-card:hover { border-color: var(--accent); }
.template-name { font-weight: 620; color: var(--text-strong); font-size: 0.92rem; }
.template-preview { margin: 0; font-family: var(--mono); font-size: 0.62rem; line-height: 1.5; color: var(--faint); background: var(--bg-code); border: 1px solid var(--border); border-radius: 6px; padding: 10px; max-height: 110px; overflow: hidden; white-space: pre; }
.template-open { color: var(--accent); font-size: 0.74rem; }

/* newsletter */
.newsletter-block { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-2); padding: 30px; margin: 48px 0; }
.newsletter-block h2 { margin: 0 0 6px; font-size: 1.2rem; }
.newsletter-block p { margin: 0; color: var(--muted); font-size: 0.94rem; }
.newsletter-form { display: flex; gap: 10px; }
.newsletter-form input[type='email'] { flex: 1; min-width: 0; }
.hp { position: absolute; left: -9999px; }
input, select, textarea { font-family: var(--sans); font-size: 0.95rem; color: var(--text-strong); background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--r); padding: 10px 12px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }

/* submit cta */
.submit-cta { text-align: center; max-width: 620px; }
.submit-cta h2 { margin-top: 0; }
.submit-cta p { color: var(--muted); margin-bottom: 22px; }

/* page head + index */
.page-head { padding: 48px 0 8px; }
.page-sub { color: var(--muted); max-width: 64ch; }
.page-meta { color: var(--faint); font-size: 0.78rem; }
.index-layout { display: grid; grid-template-columns: 230px 1fr; gap: 36px; padding: 28px 24px 64px; }
.index-filters { position: sticky; top: 84px; align-self: start; display: flex; flex-direction: column; gap: 18px; }
.filter-group { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.filter-group legend { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); margin-bottom: 8px; padding: 0; }
.filter-chip { font-size: 0.82rem; text-decoration: none; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; transition: border-color 120ms ease; }
.filter-chip:hover { border-color: var(--border-strong); color: var(--text-strong); }
.filter-chip.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.result-count { color: var(--faint); font-size: 0.78rem; margin: 0 0 14px; }
.index-search { margin-bottom: 14px; }
.index-search input { width: 100%; font-family: var(--mono); font-size: 0.86rem; }
.empty-state { border: 1px dashed var(--border-strong); border-radius: var(--r-lg); padding: 40px; text-align: center; color: var(--muted); }

/* detail pages */
.detail, .article { padding: 36px 24px 72px; }
.article { max-width: 780px; }
.breadcrumbs { font-size: 0.8rem; color: var(--faint); margin-bottom: 22px; display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.crumb-sep { color: var(--border-strong); }
.detail-head, .article-head { margin-bottom: 20px; }
.detail-badges { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.direct-answer { border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--accent-dim); border-radius: var(--r); padding: 16px 20px; margin: 20px 0 28px; }
.direct-answer p { margin: 0; font-size: 1.02rem; line-height: 1.65; }
.takeaways { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px 24px; margin: 24px 0; background: var(--bg-2); }
.takeaways h2 { margin: 0 0 10px; font-size: 1rem; }
.takeaways ul { margin: 0; padding-left: 20px; }
.takeaways li { margin: 6px 0; font-size: 0.94rem; }

/* scorecard */
.scorecard { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px 22px; margin: 24px 0; background: var(--bg-2); }
.scorecard-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.overall { font-size: 1.15rem; font-weight: 680; color: var(--text-strong); }
.scorecard-meta { color: var(--faint); font-size: 0.76rem; }
.score-rows { display: flex; flex-direction: column; gap: 9px; }
.score-row { display: grid; grid-template-columns: 170px 1fr 44px 36px; align-items: center; gap: 12px; }
.score-label { font-size: 0.84rem; color: var(--muted); }
.score-track { height: 5px; border-radius: 3px; background: var(--bg-3); overflow: hidden; }
.score-fill { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.score-null .score-fill { background: transparent; }
.score-val { text-align: right; color: var(--text-strong); font-size: 0.8rem; }
.score-null .score-val { color: var(--faint); font-size: 0.7rem; }
.score-w { text-align: right; color: var(--faint); font-size: 0.7rem; }

/* tables */
.table-wrap { overflow-x: auto; margin: 14px 0; border: 1px solid var(--border); border-radius: var(--r); }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { font-family: var(--mono); font-size: 0.72rem; font-weight: 560; color: var(--faint); background: var(--bg-2); position: sticky; top: 0; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg-2) 55%, transparent); }
.facts-table th { width: 220px; color: var(--muted); font-weight: 540; }
td.win { color: var(--accent); font-weight: 640; }
.ranking-table td, .ranking-table th { white-space: nowrap; }

/* editorial + misc blocks */
.editorial { border-left: 3px solid var(--border-strong); padding-left: 20px; margin: 28px 0; }
.editorial h2, .editorial h3 { margin-top: 0.6em; }
.evidence { color: var(--faint); font-size: 0.78rem; line-height: 1.6; }
.byline { color: var(--faint); font-size: 0.82rem; }
.methodology-box { border: 1px solid var(--border); border-radius: var(--r); background: var(--bg-2); padding: 12px 16px; font-size: 0.86rem; color: var(--muted); }
.claim-line { color: var(--muted); font-size: 0.88rem; margin-top: 28px; }
.status-note { border: 1px dashed var(--amber); border-radius: var(--r); padding: 12px 16px; color: var(--muted); font-size: 0.9rem; margin: 18px 0; }
.privacy-box { border: 1px solid var(--border); border-left: 3px solid var(--warn); border-radius: var(--r); padding: 4px 18px 8px; margin: 20px 0; }
.flash-ok { border: 1px solid var(--accent); background: var(--accent-dim); border-radius: var(--r); padding: 10px 16px; margin-bottom: 18px; }
.flash-ok p { margin: 0; }

/* code blocks */
.codeblock { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; margin: 16px 0; background: var(--bg-code); }
.codeblock-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--bg-2); font-family: var(--mono); font-size: 0.7rem; color: var(--faint); }
.copy-btn { font-family: var(--mono); font-size: 0.7rem; background: none; border: 1px solid var(--border-strong); color: var(--muted); border-radius: 5px; padding: 2px 10px; cursor: pointer; }
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.codeblock pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.codeblock code { background: none; padding: 0; font-size: 0.8rem; line-height: 1.6; }
.template-block pre { max-height: 520px; overflow: auto; }

/* prose */
.prose p { max-width: 68ch; }
.prose ul, .prose ol { max-width: 66ch; padding-left: 22px; }
.prose li { margin: 5px 0; }
.prose blockquote { border-left: 3px solid var(--accent); margin: 20px 0; padding: 4px 20px; color: var(--muted); background: var(--bg-2); border-radius: 0 var(--r) var(--r) 0; }
.prose h2 { border-bottom: 1px solid var(--border); padding-bottom: 8px; }

/* faq */
.faq { margin: 32px 0; }
.faq details { border: 1px solid var(--border); border-radius: var(--r); margin: 8px 0; background: var(--bg-2); }
.faq summary { cursor: pointer; padding: 12px 16px; font-weight: 560; color: var(--text-strong); }
.faq details p { padding: 0 16px 14px; margin: 0; color: var(--muted); }

/* machine summary */
.machine-summary { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 22px; margin: 28px 0; background: var(--bg-2); }
.machine-summary h2 { margin: 0 0 10px; font-size: 0.95rem; }
.machine-summary dl { display: grid; grid-template-columns: 150px 1fr; gap: 6px 16px; margin: 0; font-size: 0.88rem; }
.machine-summary dt { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); padding-top: 2px; }
.machine-summary dd { margin: 0; color: var(--muted); }

/* go deeper */
.go-deeper { margin: 32px 0; }
.go-deeper h2 { font-size: 1rem; }
.deeper-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.deeper-links a { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; text-decoration: none; color: var(--text-strong); font-size: 0.88rem; transition: border-color 120ms ease; }
.deeper-links a:hover { border-color: var(--accent); }
.deeper-kind { color: var(--faint); font-size: 0.68rem; }

/* guide hub */
.guide-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.guide-row { display: grid; grid-template-columns: 300px 1fr 130px; gap: 20px; align-items: baseline; padding: 16px 20px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); background: var(--bg); transition: background 120ms ease; }
.guide-row:last-child { border-bottom: 0; }
.guide-row:hover { background: var(--bg-2); }
.guide-title { font-weight: 620; color: var(--text-strong); }
.guide-row:hover .guide-title { color: var(--accent); }
.guide-desc { color: var(--muted); font-size: 0.88rem; }
.guide-meta { color: var(--faint); font-size: 0.72rem; text-align: right; }

/* glossary */
.glossary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0 64px; }
.glossary-item { display: flex; flex-direction: column; gap: 5px; border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; text-decoration: none; color: var(--text); background: var(--bg); transition: border-color 120ms ease; }
.glossary-item:hover { border-color: var(--accent); }
.glossary-term { font-weight: 620; color: var(--text-strong); font-size: 0.94rem; }
.glossary-def { color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-link { font-size: 0.84rem; text-decoration: none; color: var(--text-strong); border: 1px solid var(--border); border-radius: 999px; padding: 5px 14px; }
.chip-link:hover { border-color: var(--accent); color: var(--accent); }
.plain-links { padding-left: 20px; }
.cite-line { color: var(--faint); font-size: 0.78rem; margin-top: 32px; }
.related-terms { margin: 28px 0; }

/* changelog */
.changelog { display: flex; flex-direction: column; gap: 0; border-left: 2px solid var(--border); margin: 28px 0; }
.changelog-entry { display: flex; gap: 14px; align-items: baseline; padding: 12px 0 12px 20px; position: relative; }
.changelog-entry::before { content: ''; position: absolute; left: -5px; top: 20px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.changelog-date { color: var(--faint); font-size: 0.76rem; white-space: nowrap; }
.changelog-entry p { margin: 0; font-size: 0.92rem; }

/* forms */
.submit-form { display: flex; flex-direction: column; gap: 18px; max-width: 560px; margin: 24px 0 48px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-weight: 580; color: var(--text-strong); font-size: 0.92rem; }
.form-help { color: var(--faint); font-size: 0.78rem; }
.submit-form .btn { align-self: flex-start; }

/* footer */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-2); padding: 44px 0 32px; margin-top: 40px; }
.footer-mantra { color: var(--muted); font-size: 0.9rem; max-width: 68ch; margin: 0 0 28px; }
.footer-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 28px; }
.footer-cols h3 { font-size: 0.78rem; font-family: var(--mono); font-weight: 560; color: var(--faint); margin: 0 0 10px; }
.footer-cols a { display: block; color: var(--muted); text-decoration: none; font-size: 0.88rem; padding: 3px 0; }
.footer-cols a:hover { color: var(--accent); }
.footer-meta { color: var(--faint); font-size: 0.74rem; border-top: 1px solid var(--border); padding-top: 18px; margin: 0; }
.footer-meta a { color: var(--muted); text-decoration: none; }
.footer-meta a:hover { color: var(--accent); }

/* responsive */
@media (max-width: 1023px) {
  .site-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--border); padding: 10px 20px 16px; gap: 2px; box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.45); }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px 10px; font-size: 1rem; border-bottom: 1px solid var(--border); border-radius: 0; }
  .site-nav a:last-child { border-bottom: 0; }
  .nav-burger { display: flex; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .lab-feature { grid-template-columns: 1fr; }
  .glossary-grid { grid-template-columns: repeat(2, 1fr); }
  .stack-strip { grid-template-columns: repeat(3, 1fr); }
  .stack-cell:nth-child(3n) { border-right: 0; }
  .stack-cell:nth-child(-n+3) { border-bottom: 1px solid var(--border); }
}
@media (max-width: 767px) {
  .hero { padding: 44px 0 44px; }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .stack-diagram { justify-self: start; max-width: 300px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .index-layout { grid-template-columns: 1fr; gap: 20px; }
  .index-filters { position: static; }
  .newsletter-block { grid-template-columns: 1fr; }
  .newsletter-form { flex-direction: column; }
  .guide-row { grid-template-columns: 1fr; gap: 4px; }
  .guide-meta { text-align: left; }
  .glossary-grid { grid-template-columns: 1fr; }
  .stack-strip { grid-template-columns: 1fr; }
  .stack-cell { border-right: 0; border-bottom: 1px solid var(--border); }
  .stack-cell:last-child { border-bottom: 0; }
  .score-row { grid-template-columns: 110px 1fr 40px; }
  .score-w { display: none; }
  .score-label { font-size: 0.76rem; }
  .machine-summary dl { grid-template-columns: 1fr; gap: 2px; }
  .machine-summary dd { margin-bottom: 8px; }
  .deeper-links { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   v2 refinement layer: mobile alignment + 2026 design elevation
   ============================================================ */

::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--text-strong); }

/* --- atmosphere: hero wash + fine grid, section transitions --- */
.hero { position: relative; overflow: hidden; padding: 88px 0 68px; border-bottom: 1px solid var(--border); }
.hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(52% 62% at 78% 30%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%),
    radial-gradient(40% 50% at 12% 85%, color-mix(in srgb, var(--accent) 4%, transparent), transparent 70%);
}
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image: radial-gradient(color-mix(in srgb, var(--text) 9%, transparent) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(70% 90% at 65% 40%, black, transparent 78%);
  -webkit-mask-image: radial-gradient(70% 90% at 65% 40%, black, transparent 78%);
}
.hero-grid { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(2rem, 3.6vw, 2.95rem); font-weight: 660; letter-spacing: -0.035em; }
.hero-sub { font-size: 1.1rem; line-height: 1.7; }
.stack-diagram { filter: drop-shadow(0 12px 32px color-mix(in srgb, var(--accent) 10%, transparent)); }

/* --- typographic rhythm --- */
.section { padding: 76px 0; }
.section h2, .page-head h1 { letter-spacing: -0.025em; }
.section h2 { font-size: clamp(1.5rem, 2.4vw, 1.85rem); }
.section-sub { font-size: 1rem; margin-top: 8px; }
.page-head { padding: 56px 0 10px; }
.footer-mantra { font-size: 1.02rem; color: var(--text); max-width: 60ch; line-height: 1.7; }
.site-footer { padding: 52px 0 36px; }

/* --- cards: top highlight, tinted hover lift --- */
.data-card, .ranking-card, .template-card, .glossary-item, .deeper-links a, .lab-method-box {
  position: relative; background: linear-gradient(180deg, color-mix(in srgb, var(--text) 3%, var(--bg)) 0%, var(--bg) 42%);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 6%, transparent);
}
.data-card:hover, .ranking-card:hover, .template-card:hover, .glossary-item:hover, .deeper-links a:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 8%, transparent), 0 10px 28px -14px color-mix(in srgb, var(--accent) 24%, transparent);
}
.data-card, .ranking-card, .template-card, .glossary-item, .deeper-links a {
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.card-name { letter-spacing: -0.01em; overflow-wrap: anywhere; }
.detail-head h1, .article h1 { overflow-wrap: anywhere; }

/* --- buttons --- */
.btn { border-radius: 9px; }
.btn-primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 6px 18px -8px color-mix(in srgb, var(--accent) 55%, transparent); }
.btn-primary:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 8px 22px -8px color-mix(in srgb, var(--accent) 65%, transparent); }

/* --- scorecard polish + bar draw-in --- */
.scorecard { background: linear-gradient(180deg, color-mix(in srgb, var(--text) 3%, var(--bg-2)) 0%, var(--bg-2) 40%); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 6%, transparent); }
@media (prefers-reduced-motion: no-preference) {
  .js .score-fill { transform: scaleX(0); transform-origin: left; transition: transform 700ms cubic-bezier(0.22, 1, 0.36, 1); }
  .js .in-view .score-fill { transform: scaleX(1); }
}

/* --- scroll reveal (JS-gated so content never hides without it) --- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity 500ms ease, transform 500ms cubic-bezier(0.22, 1, 0.36, 1); }
  .js [data-reveal].in-view { opacity: 1; transform: none; }
}

/* --- tables: pinned first column where rows are wide --- */
@media (max-width: 767px) {
  .table-wrap table td:first-child, .table-wrap table th:first-child {
    position: sticky; left: 0; background: var(--bg); z-index: 1;
    box-shadow: 1px 0 0 var(--border);
  }
  .table-wrap thead th:first-child { background: var(--bg-2); }
  tbody tr:nth-child(even) td:first-child { background: color-mix(in srgb, var(--bg-2) 55%, var(--bg)); }
}

/* --- mobile alignment fixes --- */
@media (max-width: 767px) {
  .hero { padding: 52px 0 48px; }
  .hero h1 { font-size: clamp(1.9rem, 8vw, 2.2rem); }
  .hero-ctas { flex-direction: column; align-items: stretch; }
  .hero-ctas .btn { width: 100%; }
  .stack-diagram { max-width: 100%; margin: 0 auto; display: block; }
  .hero-visual { display: flex; justify-content: center; }
  .section { padding: 52px 0; }
  .newsletter-block { padding: 22px; margin: 36px 0; }
  .detail, .article { padding: 28px 20px 56px; }
  .shell { padding: 0 20px; }
  .scorecard { padding: 16px; }
  .scorecard-head { flex-direction: column; gap: 6px; }
  .overall { font-size: 1rem; }
  .filter-chip { padding: 7px 14px; font-size: 0.85rem; }
  .btn { padding: 12px 18px; }
  .codeblock pre { padding: 12px; }
  .codeblock code { font-size: 0.74rem; }
  .direct-answer { padding: 14px 16px; }
  .direct-answer p { font-size: 0.98rem; }
  .takeaways { padding: 16px 18px; }
  .footer-cols { gap: 18px 24px; }
  .submit-cta { max-width: 100%; }
}

/* index filters: compact horizontal rails on mobile instead of a filter wall */
@media (max-width: 767px) {
  .index-layout { padding-top: 18px; }
  .index-filters { gap: 10px; }
  .filter-group { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
  .filter-group::-webkit-scrollbar { display: none; }
  .filter-group legend { float: left; margin: 7px 10px 0 0; white-space: nowrap; min-width: 62px; }
  .filter-chip { white-space: nowrap; flex: 0 0 auto; }
}

/* very narrow devices */
@media (max-width: 359px) {
  .brand span { display: none; }
  .header-inner { gap: 12px; }
}

/* fieldsets ignore width constraints by default (min-width:min-content);
   without this the nowrap filter rails force the whole page wide on mobile */
fieldset { min-width: 0; }
.index-layout > * { min-width: 0; }
.grid > * { min-width: 0; }

/* data integrity block (repo + ranking pages) */
.integrity-block { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r); background: var(--bg-2); padding: 16px 20px; margin: 28px 0; }
.integrity-block h2 { margin: 0 0 8px; font-size: 0.95rem; }
.integrity-block ul { margin: 0; padding-left: 18px; }
.integrity-block li { font-size: 0.86rem; color: var(--muted); margin: 3px 0; }
.stale-flag { color: var(--warn); }
