/* AVC-1.8M — avc.gg */

:root {
  --bg: #fbfbfc;
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --ink: #16181d;
  --ink-2: #444b56;
  --muted: #6b7280;
  --border: #e4e7ec;
  --border-strong: #d3d8e0;
  --accent: #0a66c2;
  --accent-ink: #0a5cb0;
  --code-bg: #14161b;
  --code-ink: #e6e9ef;
  --code-muted: #8b93a3;
  /* modality hues (Okabe–Ito) — dot swatches keep the canonical hue,
     text variants meet contrast on this theme's surface */
  --asr: #0072b2;      --asr-text: #005f96;
  --ocr: #e69f00;      --ocr-text: #8f6300;
  --vis: #009e73;      --vis-text: #00775a;
  --dense: #cc79a7;    --dense-text: #a34f7e;
  --entity: #6b7280;   --entity-text: #565d68;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1015;
    --surface: #14171d;
    --surface-2: #1a1e26;
    --ink: #e8eaf0;
    --ink-2: #b7bdc9;
    --muted: #868e9c;
    --border: #262b35;
    --border-strong: #333a47;
    --accent: #58a6ff;
    --accent-ink: #6cb2ff;
    --code-bg: #0a0c10;
    --code-ink: #dde1e9;
    --code-muted: #7c8494;
    --asr-text: #56b4e9;
    --ocr-text: #f0b849;
    --vis-text: #2ec99c;
    --dense-text: #e39cc2;
    --entity-text: #9aa2af;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

code, pre, .mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 24px; }

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 56px;
}
.nav-brand {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}
.nav-brand:hover { text-decoration: none; }
.nav-brand .dotset { display: inline-flex; gap: 3px; }
.nav-brand .dotset i {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block;
}
.nav-links {
  display: flex;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 7px;
  white-space: nowrap;
}
.nav-links a:hover {
  color: var(--ink);
  background: var(--surface-2);
  text-decoration: none;
}

/* ---------- hero ---------- */

.hero {
  padding: 84px 0 64px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(1100px 480px at 12% -12%,
      color-mix(in srgb, var(--accent) 7%, transparent), transparent 62%),
    radial-gradient(900px 420px at 95% -18%,
      color-mix(in srgb, var(--dense) 6%, transparent), transparent 60%);
}
.hero .eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}
.hero h1 {
  font-size: clamp(38px, 6vw, 60px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 800;
  margin: 0 0 20px;
}
.hero h1 .thin { color: var(--muted); font-weight: 600; }
.hero .lede {
  font-size: clamp(17px, 2.2vw, 20px);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 46em;
  margin: 0 0 30px;
}
.hero .lede strong { color: var(--ink); font-weight: 600; }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 48px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: transform 0.05s ease, box-shadow 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--ink) 25%, transparent); }
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-secondary:hover { border-color: var(--muted); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px 16px;
}
.stat .num {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.stat .label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* ---------- sections ---------- */

section { padding: 68px 0 8px; }
section:target { scroll-margin-top: 70px; }
[id] { scroll-margin-top: 76px; }

.section-head { margin-bottom: 28px; max-width: 52em; }
.section-head .kicker {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.section-head h2 {
  font-size: clamp(26px, 3.6vw, 34px);
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.15;
  margin: 0 0 12px;
}
.section-head p { color: var(--ink-2); margin: 0; font-size: 16.5px; }

h3 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 36px 0 10px;
}

p { color: var(--ink-2); }
p strong { color: var(--ink); }
section > .wrap > p, .prose { max-width: 52em; }

.small { font-size: 13.5px; color: var(--muted); }

/* ---------- anatomy ---------- */

.anatomy {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px 26px 22px;
  margin-top: 6px;
}
.frame-strip {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
}
.frame-strip img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 5px;
  display: block;
}
.frame-caption {
  font-size: 12.5px;
  color: var(--muted);
  margin: 10px 2px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.anatomy-body {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 34px;
  margin-top: 26px;
}
.layer-stack { display: flex; flex-direction: column; gap: 15px; }
.layer { display: grid; grid-template-columns: 108px 1fr; gap: 14px; }
.layer .tag {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding-top: 3px;
  white-space: nowrap;
}
.layer .txt { font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.layer .txt em { color: var(--muted); font-style: normal; }

.tag-asr    { color: var(--asr-text); }
.tag-ocr    { color: var(--ocr-text); }
.tag-vis    { color: var(--vis-text); }
.tag-dense  { color: var(--dense-text); }
.tag-entity { color: var(--entity-text); }

.queries h4 {
  font-size: 14px;
  font-weight: 650;
  margin: 0 0 14px;
  letter-spacing: -0.005em;
}
.query { margin-bottom: 15px; }
.query .qtag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}
.query .qtag i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.query .qtext { font-size: 14px; color: var(--ink-2); line-height: 1.45; }

.dot-asr   { background: var(--asr); }
.dot-ocr   { background: var(--ocr); }
.dot-vis   { background: var(--vis); }
.dot-dense { background: var(--dense); }

.layer-roll {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 11px;
  white-space: nowrap;
}
.chip b { color: var(--ink); font-weight: 600; }

.layer-roll.standalone {
  border-top: none;
  padding-top: 0;
  margin-top: 20px;
}

/* ---------- charts ---------- */

.chart-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 18px;
  align-items: start;
}
.chart {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px 18px;
}
.chart figcaption {
  font-size: 14.5px;
  font-weight: 650;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.chart-total {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.bar-row {
  display: grid;
  grid-template-columns: 128px 1fr 64px;
  align-items: center;
  gap: 10px;
  margin: 7px 0;
}
.bar-row.tall { grid-template-columns: 92px 1fr 110px; margin: 13px 0; }
.bar-label {
  font-size: 12.5px;
  color: var(--ink-2);
  text-align: right;
  line-height: 1.25;
}
.bar-track {
  display: block;
  height: 10px;
  border-radius: 5px;
  background: var(--surface-2);
  overflow: hidden;
}
.bar {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: var(--accent);
}
.bar-val {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink);
  line-height: 1.3;
}
.bar-sub {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}
.chart-note {
  font-size: 12.5px;
  color: var(--muted);
  margin: 14px 0 0;
}

/* ---------- example records ---------- */

details.example {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 10px;
  overflow: hidden;
}
details.example summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 13px 18px;
}
details.example summary::-webkit-details-marker { display: none; }
details.example summary::after {
  content: "+";
  font-family: "JetBrains Mono", monospace;
  color: var(--muted);
  margin-left: auto;
}
details.example[open] summary::after { content: "–"; }
details.example summary code {
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1.5px 6px;
}
.ex-hint { font-size: 12.5px; color: var(--muted); }
.ex-hint code { font-size: 11.5px; }
details.example .codeblock {
  margin: 0;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
}
details.example pre {
  white-space: pre-wrap;
  word-break: break-word;
}
.jk { color: #7fb3ff; }

/* ---------- sortable table ---------- */

th.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
th.th-sort::after { content: " ↕"; color: var(--border-strong); }
th.th-sort[data-dir="asc"]::after { content: " ↑"; color: var(--accent-ink); }
th.th-sort[data-dir="desc"]::after { content: " ↓"; color: var(--accent-ink); }
td .qtag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11.5px;
  font-weight: 600;
}
td .qtag i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* ---------- code ---------- */

.codeblock {
  position: relative;
  background: var(--code-bg);
  border: 1px solid color-mix(in srgb, var(--border-strong) 55%, transparent);
  border-radius: 12px;
  margin: 14px 0 22px;
  overflow: hidden;
}
.codeblock .cb-title {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--code-muted);
  padding: 9px 16px 0;
  letter-spacing: 0.04em;
}
.codeblock pre {
  margin: 0;
  padding: 13px 16px 15px;
  overflow-x: auto;
  font-size: 13.2px;
  line-height: 1.6;
  color: var(--code-ink);
}
.codeblock .cmt { color: var(--code-muted); }
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--code-muted);
  background: color-mix(in srgb, var(--code-ink) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--code-ink) 14%, transparent);
  border-radius: 7px;
  padding: 4px 10px;
  cursor: pointer;
}
.copy-btn:hover { color: var(--code-ink); }

/* ---------- tables ---------- */

.table-scroll { overflow-x: auto; margin: 14px 0 22px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
}
tr:last-child td { border-bottom: none; }
td code {
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1.5px 6px;
  white-space: nowrap;
}
td.num, .tnum {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  white-space: nowrap;
}

/* inline code outside tables */
p code, li code, .faq code {
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1.5px 6px;
}

/* ---------- cards / misc ---------- */

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 18px 0 8px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
}
.card h4 { margin: 0 0 8px; font-size: 15.5px; font-weight: 650; }
.card p { margin: 0; font-size: 14.5px; }
.card ul { margin: 8px 0 0; padding-left: 20px; font-size: 14.5px; color: var(--ink-2); }
.card li { margin: 4px 0; }

.callout {
  display: flex;
  gap: 12px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 14.5px;
  color: var(--ink-2);
  margin: 18px 0;
  max-width: 52em;
}
.callout strong { color: var(--ink); }

ul.checklist { padding-left: 0; list-style: none; max-width: 52em; }
ul.checklist li {
  padding-left: 26px;
  position: relative;
  margin: 8px 0;
  color: var(--ink-2);
  font-size: 15px;
}
ul.checklist li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--vis);
}
ul.checklist li.no::before { background: var(--dense); }

/* ---------- citation ---------- */

.bib {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 0 0 14px;
}
.bib .bib-title { font-weight: 600; font-size: 15px; color: var(--ink); }
.bib .bib-venue { font-size: 13.5px; color: var(--muted); margin: 2px 0 10px; }
.bib pre {
  margin: 0;
  font-size: 12.3px;
  line-height: 1.55;
  overflow-x: auto;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

/* ---------- faq ---------- */

.faq { max-width: 52em; }
.faq details {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 10px;
  padding: 0 20px;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 15.5px;
  padding: 15px 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-family: "JetBrains Mono", monospace;
  font-size: 17px;
  color: var(--muted);
  flex-shrink: 0;
}
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 16px; font-size: 14.8px; }

/* ---------- changelog ---------- */

.timeline { max-width: 52em; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline .entry { position: relative; padding: 0 0 26px 26px; }
.timeline .entry::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.timeline .when {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.timeline h4 { margin: 3px 0 6px; font-size: 16px; }
.timeline p { margin: 0; font-size: 14.5px; }

/* ---------- footer ---------- */

footer {
  margin-top: 80px;
  border-top: 1px solid var(--border);
  padding: 34px 0 44px;
  font-size: 13.5px;
  color: var(--muted);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
footer a { color: var(--ink-2); }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .anatomy-body { grid-template-columns: 1fr; gap: 26px; }
  .frame-strip { grid-template-columns: repeat(5, 1fr); }
  .card-grid { grid-template-columns: 1fr; }
  .hero { padding: 56px 0 44px; }
  section { padding: 52px 0 8px; }
  .chip { white-space: normal; }
  .chart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .bar-row { grid-template-columns: 96px 1fr 58px; }
  .bar-row.tall { grid-template-columns: 76px 1fr 96px; }
  .bar-label { font-size: 11.5px; }
}
@media (max-width: 480px) {
  .layer { grid-template-columns: 1fr; gap: 3px; }
  .nav-links a { padding: 6px 7px; }
}

@media print {
  .nav, .copy-btn { display: none; }
}
