/*
 * Icana Bench (bench.icana.ai): header, footer, banner, cards and charts.
 * Brand tokens come from tokens.css (copied from the website's site-v3.css and
 * drift-checked); this file only adds the chart tokens and the aliases the
 * chart code uses. Light first, the site's dark set under the system setting
 * or the header toggle.
 */

/* ---------------------------------------------------------------- chart tokens and aliases */
:root {
  --card: var(--card-bg);
  --body: var(--body-color);
  --rule: var(--line);
  --title: var(--in-900);
  --shadow: var(--shadow-sm);
  --f-head: 'Raleway', 'Avenir Next', 'Segoe UI', sans-serif;
  --f-body: 'Outfit', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --r-box: 12px;
  /* model families: two indigo steps, then four; the human reference is one warm accent (validated all-pairs on white) */
  --ag1: #3146A3; --ag2: #647FF2; --ag3: #288B63; --ag4: #E449A5; --ag5: #8D2C52; --ag6: #8217E0;
  --ref: #B85C0A;
  --crit: #B4352C; --crit-wash: #FCEDEB; --good: #2F7A4F;
  --track: #EEF1FB; --zone1: #E6EBFD; --zone2: #F1F3FC; --zone3: #F8F9FE;
  --warn-bg: #FFF4D6; --warn-ink: #6B4A00; --warn-line: #E8C770;
  --preview-ink: #8A4B0B; --preview-bg: #FDF1E3;
}
/* dark: the family hues re-stepped for the dark surface and validated */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --title: var(--in-200); --accent: var(--in-400);
    --ag1: #3E57C2; --ag2: #748AD8; --ag3: #268631; --ag4: #D6459B; --ag5: #944561; --ag6: #B956FB; --ref: #F0A04B;
    --crit: #F2847A; --crit-wash: #3A1D22; --good: #6FCF97; --track: #1F2747; --zone1: #1E2750; --zone2: #19203F; --zone3: #141A34;
    --warn-bg: #3A2E10; --warn-ink: #F5D88A; --warn-line: #6B5520; --preview-ink: #F0B070; --preview-bg: #3A2A16;
  }
}
:root[data-theme="dark"] {
  --title: var(--in-200); --accent: var(--in-400);
  --ag1: #3E57C2; --ag2: #748AD8; --ag3: #268631; --ag4: #D6459B; --ag5: #944561; --ag6: #B956FB; --ref: #F0A04B;
  --crit: #F2847A; --crit-wash: #3A1D22; --good: #6FCF97; --track: #1F2747; --zone1: #1E2750; --zone2: #19203F; --zone3: #141A34;
  --warn-bg: #3A2E10; --warn-ink: #F5D88A; --warn-line: #6B5520; --preview-ink: #F0B070; --preview-bg: #3A2A16;
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box }
html { scroll-padding-top: 84px; -webkit-text-size-adjust: 100% }
body { margin: 0; background: var(--surface); color: var(--body); font-family: var(--f-body); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; overflow-wrap: break-word }
h1, h2, h3, h4 { font-family: var(--f-head); color: var(--ink-strong); line-height: 1.15; text-wrap: balance; margin: 0 }
h1 { font-size: clamp(2rem, 1.5rem + 2.2vw, 2.9rem); font-weight: 700; letter-spacing: -0.01em }
h3, h4 { font-size: 1.02rem; font-weight: 600 }
p { margin: 0 }
a { color: var(--link) }
a:hover { color: var(--link-hover) }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--in-300); outline-offset: 2px; border-radius: 4px }
[hidden] { display: none !important }
.skip { position: absolute; left: -9999px; top: 0 }
.skip:focus { left: 16px; top: 8px; z-index: 50; background: var(--card); padding: 6px 12px; border-radius: 8px }
.in { max-width: 1040px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)) }

/* ---------------------------------------------------------------- pre-release banner (every page) */
.prerelease { background: var(--warn-bg); color: var(--warn-ink); border-bottom: 1px solid var(--warn-line); font-size: 0.92rem; font-weight: 500 }
.prerelease .in { padding-block: 8px; display: flex; gap: 10px; align-items: baseline }
.prerelease b { font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.78rem; flex: none }

/* ---------------------------------------------------------------- header */
.bar { border-bottom: 1px solid var(--line); background: var(--surface) }
.bar .in { display: flex; align-items: center; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; padding-block: 12px }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none }
.brand img { display: block; height: 27px; width: auto }
.brand .word { font-family: var(--f-head); font-weight: 700; font-size: 1.05rem; color: var(--ink-strong); padding-left: 10px; border-left: 1px solid var(--line); line-height: 1.6 }
.logo-dark { display: none !important }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none !important }
  :root:not([data-theme="light"]) .logo-dark { display: block !important }
}
:root[data-theme="dark"] .logo-light { display: none !important }
:root[data-theme="dark"] .logo-dark { display: block !important }
.links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; font-size: 0.95rem; font-weight: 500 }
.links a { color: var(--body); text-decoration: none; padding-block: 4px; border-bottom: 2px solid transparent }
.links a:hover { color: var(--link) }
.links a[aria-current="page"] { color: var(--ink-strong); border-bottom-color: var(--accent) }
.links .home { color: var(--muted) }
.toggle { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--body); cursor: pointer; padding: 0 }
.toggle:hover { background: var(--wash) }
.toggle svg { width: 18px; height: 18px }
.toggle .moon { display: none }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toggle .sun { display: none } :root:not([data-theme="light"]) .toggle .moon { display: block } }
:root[data-theme="dark"] .toggle .sun { display: none }
:root[data-theme="dark"] .toggle .moon { display: block }
@media (max-width: 480px) { .links { width: 100%; justify-content: space-between; gap: 4px 12px } }

/* ---------------------------------------------------------------- footer (the site's dark band) */
.foot { background: var(--grad-dark); color: #C7CDE1; font-size: 0.92rem; line-height: 1.6 }
.foot .in { padding-block: 32px 40px; display: grid; gap: 10px }
.foot p { margin: 0 }
.foot strong { color: #F4F6FF; font-weight: 600 }
.foot a { color: #C7D2FF }
.foot a:hover { color: #FFFFFF }
.foot .fine { color: #A4ABC6; font-size: 0.84rem }
.foot img { height: 24px; width: auto; display: block }

/* ---------------------------------------------------------------- the results page */
.wrap { max-width: 1040px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 40px 64px; display: grid; gap: 44px; min-width: 0 }
.eyebrow { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--accent-text); display: inline-flex; gap: 10px; align-items: center }
.eyebrow::before { content: ""; width: 22px; height: 2px; border-radius: 2px; background: var(--grad) }
.lead { font-size: 1.12rem; font-weight: 300; color: var(--muted); max-width: 44rem }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-box); box-shadow: var(--shadow); padding: 22px; min-width: 0 }
.section { display: grid; gap: 16px; min-width: 0 }
.takeaway { font-size: 1.05rem; color: var(--ink); max-width: 48rem }
.summary { font-size: 1.18rem; line-height: 1.55; color: var(--ink); max-width: 50rem; padding: 18px 22px; background: var(--tint); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--r-box) }
.note { font-size: 0.88rem; color: var(--muted); max-width: 50rem }
.num { font-variant-numeric: tabular-nums }
.right { text-align: right }
header.top { display: grid; gap: 14px }
.load-error { border-left: 4px solid var(--crit); background: var(--tint); color: var(--ink) }

/* release block */
.release { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 14px 22px; padding: 18px 22px; background: var(--tint); border: 1px solid var(--line); border-radius: var(--r-box); margin: 0 }
.release dt { font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500 }
.release dd { margin: 2px 0 0; color: var(--ink); font-weight: 500 }
.release .wide { grid-column: 1 / -1; font-size: 0.9rem; color: var(--body) }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 500; background: var(--wash); color: var(--accent-text); border: 1px solid var(--line); white-space: nowrap }
.pill.crit { background: var(--crit-wash); color: var(--crit); border-color: transparent }
.pill.ok, .pill.measured { color: var(--good) }
.pill.preview { color: var(--preview-ink); background: var(--preview-bg); border-color: transparent }
.pill.coming { color: var(--muted); background: transparent; border: 1px dashed var(--muted) }

/* board */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.8rem; color: var(--muted); align-items: center }
.legend b { color: var(--ink); font-weight: 500 }
.legend .key { display: inline-flex; gap: 6px; align-items: center; color: var(--ink) }
.board { display: grid; gap: 0; margin-top: 14px }
.row { display: grid; grid-template-columns: 54px minmax(170px, 1.1fr) 120px minmax(240px, 2.4fr) 92px; gap: 18px; align-items: center; padding-block: 18px; border-top: 1px solid var(--rule) }
.row.head { padding-block: 0 8px; border-top: 0; font-size: 0.74rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); font-weight: 500 }
.rank { font-family: var(--f-head); font-weight: 700; font-size: 1.6rem; color: var(--ink-strong); line-height: 1 }
.rank small { display: block; font-family: var(--f-body); font-size: 0.72rem; font-weight: 400; color: var(--muted); margin-top: 4px }
.agent { display: grid; gap: 4px; min-width: 0 }
.agent .name { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; font-size: 1.04rem }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; display: inline-block }
.swatch.off { background: transparent !important; box-shadow: inset 0 0 0 2px currentColor }
.agent .meta { font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere }
.agent .meta code { white-space: normal }
.agent .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px }
.score { font-family: var(--f-head); font-weight: 700; font-size: 2rem; color: var(--ink-strong); line-height: 1 }
.score small { display: block; font-family: var(--f-body); font-weight: 400; font-size: 0.78rem; color: var(--muted); margin-top: 6px }
.barcell { min-width: 0; display: grid; gap: 6px }
.parts { font-size: 0.78rem; color: var(--muted); line-height: 1.5 }
.parts b { color: var(--ink); font-weight: 500 }
.cost { text-align: right; color: var(--ink); font-weight: 500 }
.cost small { display: block; font-weight: 400; color: var(--muted); font-size: 0.74rem }
svg { display: block; overflow: visible }
svg text { font-family: var(--f-body); font-variant-numeric: tabular-nums }
.legend svg, .toggle svg { display: inline-block }
.t-ink { fill: var(--ink) } .t-muted { fill: var(--muted) } .t-body { fill: var(--body) } .t-crit { fill: var(--crit) } .t-accent { fill: var(--accent-text) }
.halo, .halo2, .halo3 { paint-order: stroke; stroke-width: 4px; stroke-linejoin: round } .halo { stroke: var(--tint) } .halo2 { stroke: var(--zone2) } .halo3 { stroke: var(--card) }
.chart { width: 100%; min-width: 0 }
.scroll { overflow-x: auto; min-width: 0; -webkit-overflow-scrolling: touch }
.scroll-gap { margin-top: 10px }

/* method cards and tables */
ul.plain { margin: 0; padding-left: 1.1rem; display: grid; gap: 4px; max-width: 50rem }
.method { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px }
code { font-size: .78rem; white-space: nowrap }
.method .card { padding: 18px; display: grid; gap: 8px; align-content: start }
.method p { font-size: 0.92rem }
.card h3.inner { margin-bottom: 12px }
details { margin-top: 14px; font-size: 0.88rem }
summary { cursor: pointer; color: var(--accent-text); font-weight: 500 }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; margin-top: 8px }
th, td { text-align: left; padding: 7px 10px; border-top: 1px solid var(--rule) }
thead th { border-top: 0; font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); font-weight: 500 }
tbody th { color: var(--ink); font-weight: 500 }

/* score against cost and speed: two charts stacked, each at full card width */
.pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px }
.pair .card { display: grid; gap: 10px; align-content: start; margin: 0 }
.pair .takeaway { font-size: 0.98rem }

.tip { position: fixed; z-index: 30; pointer-events: none; background: var(--card); color: var(--body); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 8px; padding: 6px 10px; font-size: 0.8rem; max-width: 280px; line-height: 1.4 }

/* the overall figure */
.overall table { margin-top: 4px }
.overall td, .overall th { padding: 10px 10px; vertical-align: middle }
.overall td.big { font-family: var(--f-head); font-weight: 700; font-size: 1.3rem; color: var(--ink-strong) }
.overall tbody th { min-width: 150px }
.overall .who { display: inline-flex; gap: 8px; align-items: center; color: var(--ink); font-weight: 500 }
.overall .soft, .soft { color: var(--muted); font-size: 0.82rem }
.lacks { border-left: 4px solid var(--ref); background: var(--tint); display: grid; gap: 8px }
.lacks ul { margin: 0; padding-left: 1.1rem }
.domain-body { display: grid; gap: 44px; min-width: 0 }

/* sections on one page under a sticky menu */
.menu { position: sticky; top: 0; z-index: 25; display: flex; gap: 4px; padding: 6px; overflow-x: auto; scrollbar-width: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-box); box-shadow: var(--shadow); min-width: 0 }
.menu::-webkit-scrollbar { display: none }
.menu a { flex: 1 0 auto; display: grid; gap: 0; padding: 7px 14px; border-radius: 9px; text-decoration: none; color: var(--body); white-space: nowrap; line-height: 1.3 }
.menu a b { font-family: var(--f-head); font-weight: 700; font-size: 1rem; color: var(--ink-strong) }
.menu a span { font-size: 0.74rem; color: var(--muted) }
.menu a:hover { background: var(--tint) }
.menu a[aria-current="true"] { background: var(--wash); box-shadow: inset 0 -2px 0 var(--accent) }
.menu a[aria-current="true"] b { color: var(--accent-text) }
.top-section { display: grid; gap: 44px; min-width: 0 }
.sec-title { display: grid; gap: 6px; padding-top: 20px; border-top: 2px solid var(--line) }
.sec-title h2 { font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.3rem); font-weight: 700; color: var(--ink-strong) }
.sec-title .subtitle { font-size: 1.02rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; align-items: center }
h3.h2 { font-size: clamp(1.35rem, 1.15rem + 0.9vw, 1.75rem); font-weight: 600; color: var(--title); border-left: 4px solid var(--accent); padding-left: 16px }
.domains { display: grid; gap: 72px; min-width: 0 }

@media (max-width: 760px) {
  .row { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px 14px }
  .row.head { display: none }
  .rank { font-size: 1.35rem }
  .barcell { grid-column: 1 / -1 }
  .cost { grid-column: 1 / -1; text-align: left; display: flex; gap: 8px; align-items: baseline }
  .cost small { display: inline }
  .score { font-size: 1.7rem; text-align: right }
  .card { padding: 16px }
  .overall td.big { font-size: 1.1rem }
  .summary { font-size: 1.06rem; padding: 14px 16px }
}
@media (max-width: 480px) { .menu { gap: 2px; padding: 4px } .menu a { flex: 1 1 0; min-width: 0; padding: 6px 4px; text-align: center } .menu a b { font-size: 0.9rem } .menu a span { display: none } }

/* ---------------------------------------------------------------- Method, Changelog and 404: one reading column */
.doc { max-width: 760px; margin: 0 auto; padding: 40px max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px)); font-size: 17px; line-height: 1.65 }
.doc h1 { font-size: clamp(1.9rem, 1.5rem + 1.6vw, 2.5rem); margin: 0 0 12px }
.doc h2 { font-size: 1.35rem; font-weight: 600; color: var(--title); margin: 40px 0 10px; padding-left: 14px; border-left: 4px solid var(--accent); line-height: 1.2 }
.doc h3 { font-size: 1.05rem; margin: 24px 0 6px }
.doc p, .doc ul, .doc ol { margin: 0 0 14px }
.doc ul, .doc ol { padding-left: 1.3em }
.doc li { margin-bottom: 6px }
.doc strong { color: var(--ink) }
.doc .lead-doc { font-size: 1.1rem; color: var(--body) }
.doc .eyebrow { margin-bottom: 8px }
.doc .note-doc { font-size: 0.92rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 24px }
.doc .statement { background: var(--tint); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--r-box); padding: 14px 18px; color: var(--ink) }
.doc table { font-size: 0.95rem; margin: 0 }
.doc th, .doc td { border-top: 0; border-bottom: 1px solid var(--line); vertical-align: top; padding: 8px 10px }
.doc .release-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-box); padding: 20px 22px; margin-bottom: 20px }
.doc .release-card h2 { margin-top: 0 }
.doc .date { color: var(--muted); font-size: 0.92rem; margin-bottom: 10px }
.doc .scroll { margin: 0 0 16px }
