/* Hallmark · genre: modern-minimal · macrostructure: Workbench (table-first) · theme: custom "warm paper, paw-orange signal" · nav: N1b · footer: Ft2
 * paper oklch(98.5% 0.006 70) · accent oklch(68% 0.19 42) paw-orange · Geist + Geist Mono (tabular numbers)
 */

:root {
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --color-paper: oklch(98.5% 0.006 70);
  --color-paper-2: oklch(96.2% 0.008 70);
  --color-paper-3: oklch(92.5% 0.01 70);
  --color-ink: oklch(21% 0.012 60);
  --color-ink-2: oklch(42% 0.012 60);
  --color-ink-3: oklch(55% 0.01 60);
  --color-rule: oklch(89% 0.01 70);
  --color-accent: oklch(64% 0.19 42);
  --color-accent-ink: oklch(99% 0.005 70);
  --color-accent-soft: oklch(94% 0.04 50);
  --color-good: oklch(55% 0.13 155);
  --color-focus: oklch(55% 0.2 42);
  --color-bar: oklch(64% 0.19 42 / 0.18);

  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4.5rem;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-display: clamp(2.25rem, 4.5vw + 0.5rem, 4rem);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-pill: 999px;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 120ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-paper: oklch(17% 0.008 60);
    --color-paper-2: oklch(21% 0.01 60);
    --color-paper-3: oklch(26% 0.012 60);
    --color-ink: oklch(95% 0.006 70);
    --color-ink-2: oklch(78% 0.01 70);
    --color-ink-3: oklch(64% 0.01 70);
    --color-rule: oklch(30% 0.012 60);
    --color-accent: oklch(72% 0.17 45);
    --color-accent-ink: oklch(17% 0.008 60);
    --color-accent-soft: oklch(30% 0.06 45);
    --color-good: oklch(72% 0.13 155);
    --color-focus: oklch(76% 0.16 45);
    --color-bar: oklch(72% 0.17 45 / 0.22);
  }
}
:root[data-theme="dark"] {
  --color-paper: oklch(17% 0.008 60);
  --color-paper-2: oklch(21% 0.01 60);
  --color-paper-3: oklch(26% 0.012 60);
  --color-ink: oklch(95% 0.006 70);
  --color-ink-2: oklch(78% 0.01 70);
  --color-ink-3: oklch(64% 0.01 70);
  --color-rule: oklch(30% 0.012 60);
  --color-accent: oklch(72% 0.17 45);
  --color-accent-ink: oklch(17% 0.008 60);
  --color-accent-soft: oklch(30% 0.06 45);
  --color-good: oklch(72% 0.13 155);
  --color-focus: oklch(76% 0.16 45);
  --color-bar: oklch(72% 0.17 45 / 0.22);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font: 400 var(--text-md)/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: var(--color-rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--color-accent); }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-style: normal; letter-spacing: -0.025em; line-height: 1.1; margin: 0; overflow-wrap: anywhere; min-width: 0; }
.num, td.n, .score { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.wrap { width: min(1200px, 100% - 2 * var(--space-md)); margin-inline: auto; }

/* Nav */
.nav { position: sticky; top: 0; z-index: 10; background: color-mix(in oklch, var(--color-paper) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--color-rule); }
.nav .wrap { display: flex; align-items: center; gap: var(--space-lg); height: 56px; }
.brand { display: flex; align-items: center; gap: var(--space-xs); font-weight: 650; letter-spacing: -0.02em; text-decoration: none; white-space: nowrap; }
.brand img { width: 26px; height: 26px; }
.nav-links { display: flex; gap: var(--space-md); font-size: var(--text-sm); color: var(--color-ink-2); overflow-x: auto; scrollbar-width: none; }
.nav-links a { text-decoration: none; white-space: nowrap; }
.nav-links a:hover, .nav-links a[aria-current] { color: var(--color-ink); }
.nav-end { margin-left: auto; display: flex; gap: var(--space-xs); align-items: center; }
.icon-btn { border: 1px solid var(--color-rule); background: var(--color-paper); color: var(--color-ink-2); border-radius: var(--radius-pill); height: 32px; min-width: 32px; padding: 0 var(--space-sm); font: inherit; font-size: var(--text-sm); cursor: pointer; white-space: nowrap; }
.icon-btn:hover { background: var(--color-paper-2); color: var(--color-ink); }
@media (max-width: 720px) { .nav-links { display: none; } }

/* Hero */
.hero { padding: var(--space-2xl) 0 var(--space-lg); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--space-xl); align-items: end; }
.hero h1 { font-size: var(--text-display); font-weight: 650; }
.hero p { color: var(--color-ink-2); font-size: var(--text-lg); margin: 0; max-width: 46ch; }
.meta { font-size: var(--text-sm); color: var(--color-ink-3); margin-top: var(--space-sm); }
.meta .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--color-good); margin-right: 6px; vertical-align: 1px; }
@media (max-width: 820px) { .hero { grid-template-columns: minmax(0, 1fr); gap: var(--space-md); padding-top: var(--space-xl); } }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-xl); padding-bottom: var(--space-3xl); }
@media (max-width: 1000px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.side { display: flex; flex-direction: column; gap: var(--space-lg); }
.panel { border: 1px solid var(--color-rule); border-radius: var(--radius-md); padding: var(--space-md); background: var(--color-paper); }
.panel h2 { font-size: var(--text-md); margin-bottom: var(--space-sm); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-md); margin: var(--space-xl) 0 var(--space-sm); flex-wrap: wrap; }
.section-head h2 { font-size: var(--text-xl); }

/* Tabs (links, not JS) */
.tabs { display: flex; gap: var(--space-2xs); overflow-x: auto; scrollbar-width: none; padding-bottom: var(--space-xs); }
.tabs a { text-decoration: none; font-size: var(--text-sm); padding: 6px 12px; border-radius: var(--radius-pill); color: var(--color-ink-2); white-space: nowrap; border: 1px solid transparent; }
.tabs a:hover { background: var(--color-paper-2); }
.tabs a[aria-current] { background: var(--color-ink); color: var(--color-paper); }

/* Tools row */
.tools { display: flex; gap: var(--space-xs); margin-bottom: var(--space-sm); flex-wrap: wrap; }
.tools input, .tools select { font: inherit; font-size: var(--text-sm); height: 36px; border: 1px solid var(--color-rule); background: var(--color-paper); color: var(--color-ink); border-radius: var(--radius-sm); padding: 0 var(--space-sm); }
.tools input { flex: 1 1 220px; min-width: 0; }

/* Ranking table */
.table-wrap { border: 1px solid var(--color-rule); border-radius: var(--radius-md); overflow-x: auto; }
table.rank { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.rank th { text-align: left; font-weight: 550; color: var(--color-ink-3); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 10px; border-bottom: 1px solid var(--color-rule); background: var(--color-paper-2); white-space: nowrap; }
.rank th[data-sort] { cursor: pointer; user-select: none; }
.rank th[data-sort]:hover { color: var(--color-ink); }
.rank th[aria-sort="descending"]::after { content: " ↓"; }
.rank th[aria-sort="ascending"]::after { content: " ↑"; }
.rank td { padding: 9px 10px; border-bottom: 1px solid var(--color-rule); white-space: nowrap; }
.rank tr:last-child td { border-bottom: 0; }
.rank tbody tr:hover { background: var(--color-paper-2); }
.rank td.n, .rank th.n { text-align: right; }
.rank .pos { color: var(--color-ink-3); width: 2.5rem; }
.rank .model a { font-weight: 550; text-decoration: none; }
.rank td.model { position: sticky; left: 0; background: var(--color-paper); z-index: 1; }
.rank tbody tr:hover td.model { background: var(--color-paper-2); }
.rank .model a:hover { text-decoration: underline; }
.rank .prov { color: var(--color-ink-3); font-size: var(--text-xs); display: block; }
.bar { position: relative; display: inline-block; min-width: 3.75rem; text-align: right; padding: 2px 6px; border-radius: 4px; }
.bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w, 0%); background: var(--color-bar); border-radius: 4px; }
.bar span { position: relative; }
.paw { font-weight: 650; color: var(--color-ink); }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: var(--radius-pill); background: var(--color-accent-soft); color: var(--color-ink); margin-left: 6px; vertical-align: 1px; }
.muted { color: var(--color-ink-3); }
.ad-row td { padding: var(--space-sm); background: var(--color-paper-2); }

/* Ads: reserved boxes, so filling them never shifts layout */
.ad { display: block; position: relative; border-radius: var(--radius-md); overflow: hidden; background: var(--color-paper-2); }
.ad-label { position: absolute; top: 6px; right: 10px; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-ink-3); z-index: 1; }
.ad-top { min-height: 90px; margin: var(--space-md) 0; }
.ad-inline { min-height: 100px; }
.ad-side { min-height: 250px; }
.house { display: flex; gap: var(--space-md); align-items: center; padding: var(--space-md) var(--space-lg); height: 100%; min-height: inherit; text-decoration: none; }
.house-mark { width: 44px; height: 44px; flex: none; background: var(--color-ink); -webkit-mask: url(/agentcat-mark.svg) center / contain no-repeat; mask: url(/agentcat-mark.svg) center / contain no-repeat; }
.house strong { display: block; font-size: var(--text-md); }
.house span { color: var(--color-ink-2); font-size: var(--text-sm); }
.ad-side .house { flex-direction: column; align-items: flex-start; justify-content: center; }

/* News list */
.news { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.news li { padding: var(--space-sm) 0; border-bottom: 1px solid var(--color-rule); }
.news li:last-child { border-bottom: 0; }
.news a { text-decoration: none; font-weight: 500; }
.news a:hover { text-decoration: underline; }
.news .src { display: block; font-size: var(--text-xs); color: var(--color-ink-3); margin-top: 2px; }
.news p { margin: 4px 0 0; color: var(--color-ink-2); font-size: var(--text-sm); }

/* Model page */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-sm); margin: var(--space-lg) 0; }
.kv div { border: 1px solid var(--color-rule); border-radius: var(--radius-md); padding: var(--space-sm) var(--space-md); }
.kv dt { font-size: var(--text-xs); color: var(--color-ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.kv dd { margin: 2px 0 0; font-size: var(--text-xl); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.alts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-sm); }
.alt { border: 1px solid var(--color-rule); border-radius: var(--radius-md); padding: var(--space-md); text-decoration: none; display: block; }
.alt:hover { border-color: var(--color-accent); }
.alt strong { display: block; }
.alt span { font-size: var(--text-sm); color: var(--color-ink-2); }
.crumbs { font-size: var(--text-sm); color: var(--color-ink-3); padding-top: var(--space-lg); }
.crumbs a { text-decoration: none; }
.prose { max-width: 70ch; color: var(--color-ink-2); }
.prose h2 { color: var(--color-ink); font-size: var(--text-xl); margin: var(--space-xl) 0 var(--space-sm); }
.prose code { font-family: var(--font-mono); font-size: 0.9em; background: var(--color-paper-2); padding: 1px 5px; border-radius: 4px; }
.vs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-md); }

/* Agent Cat band */
.cta-pill { text-decoration: none; font-size: var(--text-sm); font-weight: 600; height: 32px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: var(--radius-pill); background: var(--color-accent); color: var(--color-accent-ink); white-space: nowrap; }
.cta-pill:hover { filter: brightness(1.06); }
.ac-band { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--space-xl); padding: var(--space-xl); margin: var(--space-md) 0 var(--space-xl); border-radius: var(--radius-md); background: var(--color-accent-soft); }
.ac-band h2 { font-size: var(--text-2xl); margin: var(--space-sm) 0; }
.ac-band p { margin: 0 0 var(--space-md); color: var(--color-ink-2); max-width: 54ch; }
.ac-mark { display: block; width: 40px; height: 40px; }
.ac-actions { display: flex; gap: var(--space-xs); flex-wrap: wrap; margin-bottom: var(--space-sm); }
.btn { display: inline-flex; align-items: center; height: 40px; padding: 0 18px; border-radius: var(--radius-pill); border: 1px solid var(--color-ink); color: var(--color-ink); text-decoration: none; font-weight: 600; font-size: var(--text-sm); white-space: nowrap; }
.btn:hover { background: var(--color-paper); }
.btn-primary { background: var(--color-ink); color: var(--color-paper); }
.btn-primary:hover { background: var(--color-ink-2); }
.btn-ghost { border-color: transparent; }
.ac-usage { background: var(--color-paper); border-radius: var(--radius-md); padding: var(--space-md) var(--space-lg); align-self: start; }
.ac-usage h3 { font-size: var(--text-md); margin-bottom: var(--space-sm); }
.ac-usage ol { list-style: none; margin: 0 0 var(--space-xs); padding: 0; }
.ac-usage li { display: grid; grid-template-columns: minmax(0, 9rem) minmax(0, 1fr) 2.5rem; gap: var(--space-sm); align-items: center; padding: 6px 0; font-size: var(--text-sm); }
.ac-usage li a { text-decoration: none; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-usage .num { text-align: right; color: var(--color-ink-2); }
.ac-bar { height: 8px; border-radius: 4px; background: var(--color-paper-3); position: relative; overflow: hidden; }
.ac-bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--color-accent); border-radius: 4px; }
@media (max-width: 820px) { .ac-band { grid-template-columns: minmax(0, 1fr); padding: var(--space-lg); } }

/* Ranking pages: the table gets the full width; panels sit underneath */
.side-wide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-lg); margin: var(--space-xl) 0 var(--space-3xl); align-items: start; }
@media (max-width: 1000px) { .side-wide { grid-template-columns: minmax(0, 1fr); } }

/* A11y + i18n */
.skip { position: absolute; left: -9999px; top: 8px; z-index: 20; background: var(--color-ink); color: var(--color-paper); padding: 8px 12px; border-radius: var(--radius-sm); }
.skip:focus { left: 8px; }
.lang { position: relative; }
.lang summary { list-style: none; cursor: pointer; height: 32px; min-width: 40px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--color-rule); border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.04em; color: var(--color-ink-2); }
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover { background: var(--color-paper-2); color: var(--color-ink); }
.lang ul { position: absolute; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: var(--color-paper); border: 1px solid var(--color-rule); border-radius: var(--radius-md); box-shadow: 0 8px 24px oklch(0% 0 0 / 0.12); min-width: 140px; z-index: 30; }
.lang a { display: block; padding: 8px 10px; border-radius: var(--radius-sm); text-decoration: none; font-size: var(--text-sm); white-space: nowrap; }
.lang a:hover, .lang a[aria-current] { background: var(--color-paper-2); }
.house-copy { display: block; }
.house-copy strong { display: block; }
.wrap-cell { white-space: normal !important; min-width: 12rem; }
.faq { margin: var(--space-2xl) 0 var(--space-lg); max-width: 820px; }
.faq h2 { font-size: var(--text-xl); margin-bottom: var(--space-sm); }
.faq details { border-bottom: 1px solid var(--color-rule); padding: var(--space-sm) 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; padding-right: 1.5rem; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 0; top: 0; color: var(--color-ink-3); }
.faq details[open] summary::after { content: "–"; }
.faq p { margin: var(--space-xs) 0 0; color: var(--color-ink-2); }
.vs-table th[scope="row"] { text-transform: none; letter-spacing: 0; font-size: var(--text-sm); color: var(--color-ink-2); background: transparent; border-bottom: 1px solid var(--color-rule); }
@media (max-width: 720px) {
  .nav .wrap { gap: var(--space-sm); }
  .cta-pill { padding: 0 10px; font-size: var(--text-xs); }
  .hero h1 { font-size: clamp(2rem, 9vw, 2.75rem); }
  .ac-usage li { grid-template-columns: minmax(0, 7.5rem) minmax(0, 1fr) 2rem; }
}
/* Smallest phones: the theme follows the OS, so the toggle is the one control we can drop */
@media (max-width: 400px) {
  .nav .wrap { gap: var(--space-xs); }
  .nav-end { gap: 6px; }
  [data-theme-toggle] { display: none; }
  .brand { font-size: var(--text-sm); }
}

/* Footer */
.foot { border-top: 1px solid var(--color-rule); padding: var(--space-lg) 0 var(--space-2xl); font-size: var(--text-sm); color: var(--color-ink-3); }
.foot .wrap { display: flex; gap: var(--space-md); justify-content: space-between; flex-wrap: wrap; }
.foot a { white-space: nowrap; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Korean breaks between words, not syllables; CJK punctuation stays attached */
:lang(ko) { word-break: keep-all; overflow-wrap: anywhere; }
:lang(ja), :lang(zh-Hans) { line-break: strict; }
