/* Placar de IA na medicina: bloco da home (#benchmarks), benchmarks.html e benchmarks-metodologia.html.
   Gerado por scripts/benchmarks/generate.mjs. Usa os tokens de alpha121.css. Protótipo, não publicado.
   Versão 4: uma cor por modelo (variante escura e clara) e tema claro só nas páginas do placar. */

/* ---------- tokens do placar (tema escuro, padrão) ---------- */
#benchmarks,
.page-bench main {
  --bench-card: #07132b;
  --bench-link: #d1e0ff;
  --bench-tip-bg: #0d1d3d;
  --bench-quad: rgba(197, 165, 103, 0.13);
  --bench-quad-line: rgba(197, 165, 103, 0.45);
  --bench-heat: 158, 189, 255;
  --bench-gold-text: var(--gold);
  --bench-select: var(--night);
}

/* uma cor por modelo, igual em todos os gráficos (contraste AA contra o fundo do cartão) */
.m-opus { --co: #9ebdff; }
.m-sonnet { --co: #c7b8ff; }
.m-haiku { --co: #7fd6e8; }
.m-sol { --co: #f4f2ec; }
.m-luna { --co: #f0c27b; }
.m-argon { --co: #a5ddbd; }

.co-dot {
  display: inline-block;
  flex: none;
  width: 0.62rem;
  height: 0.62rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--co);
  vertical-align: 0.05em;
}

.bench-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 var(--space-xl);
  padding: 0;
  list-style: none;
  font-size: var(--step--1);
}

.bench-meta li {
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
}

.bench-meta .bench-flag,
.page-hero-meta .flag {
  border-color: var(--gold);
  color: var(--bench-gold-text, var(--gold));
  font-weight: 600;
}

.page-hero-meta .flag { padding: 0 0.6rem; border: 1px solid var(--gold); border-radius: 999px; }

/* ---------- barras do índice ---------- */

.ix-bars {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-variant-numeric: tabular-nums;
}

.ix-bars li {
  display: grid;
  grid-template-columns: 2.6rem minmax(9rem, 22rem) minmax(0, 1fr) 3.4rem;
  align-items: center;
  gap: 0.9rem;
  min-height: 3.25rem;
  border-bottom: 1px solid var(--line);
}

.ix-rank { display: grid; color: var(--ink-soft); font-size: var(--step--1); font-weight: 600; line-height: 1.15; }
.ix-rank small { font-size: 0.68rem; font-weight: 600; }

.ix-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-weight: 600;
  line-height: 1.25;
}

.ix-esf { margin-left: 0.25rem; font-weight: 400; white-space: nowrap; }

.ix-name small {
  flex-basis: 100%;
  padding-left: 1.12rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 400;
}

.ix-track {
  height: 0.7rem;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.ix-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--co);
}

.ix-val { font-size: var(--step-1); font-weight: 600; text-align: right; }

/* ---------- blocos ---------- */

.bench-page > .section { padding-top: clamp(1rem, 3vw, 2rem); }
.bench-section { padding-block: clamp(2.5rem, 6vw, 4.5rem); border-top: 1px solid var(--line); }
.page-hero + .bench-section { border-top: 0; }

.block-head { display: grid; gap: 0.6rem; margin-bottom: var(--space-xl); }
.block-head h2 { margin: 0; font-size: var(--step-2); }
.block-head p { max-width: var(--measure); margin: 0; color: var(--ink-soft); }
.block-head .block-link { margin-top: -0.4rem; }
.inline-link { display: inline-flex; align-items: center; min-height: 2.75rem; color: var(--bench-link); font-weight: 600; text-underline-offset: 0.2em; }

h3.sub { margin: var(--space-2xl) 0 var(--space-md); font-size: var(--step-1); }

/* ---------- gráficos ---------- */

.chart-trio {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1rem, 2vw, 1.5rem);
}

@media (min-width: 62rem) {
  .chart-trio { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.bench-chart {
  position: relative;
  margin: 0;
  padding: clamp(0.75rem, 1.6vw, 1.1rem);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bench-card);
}

.bench-chart svg { display: block; width: 100%; height: auto; }
.chart-title { margin-bottom: 0.5rem; font-weight: 600; }
.chart-note { margin: 0.75rem 0 0; color: var(--ink-soft); font-size: var(--step--1); line-height: 1.5; }

.bench-chart .axis, .bench-chart .tick { stroke: var(--line-blue); stroke-width: 1; }
.bench-chart .gridline { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 5; }
.bench-chart text { fill: var(--ink-soft); font-family: var(--font-body); font-size: 12.5px; }
.bench-chart .axis-title { fill: var(--ink); font-size: 12.5px; font-weight: 600; }
.bench-chart .pt-label { paint-order: stroke; stroke: var(--bench-card); stroke-width: 3.5px; stroke-linejoin: round; }
.bench-chart .pt-label .pt-esf { fill: var(--co, var(--ink)); font-size: 12.5px; font-weight: 500; }
.bench-chart .pt-label .pt-name { fill: var(--co); font-size: 13.5px; font-weight: 700; }
.bench-chart .quad { fill: var(--bench-quad); stroke: var(--bench-quad-line); stroke-dasharray: 4 4; }
.bench-chart .pt { fill: var(--co); stroke: var(--bench-card); stroke-width: 1.5; }
.bench-chart .pt-nd { stroke: var(--co); stroke-width: 2; fill-opacity: 0.35; }
.bench-chart .mline { fill: none; stroke: var(--co); stroke-width: 1.6; stroke-opacity: 0.75; }

.chart-key { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; margin: 0.6rem 0 0; padding: 0; list-style: none; font-size: 0.8rem; }
.chart-key li { display: inline-flex; align-items: center; gap: 0.4rem; }
.chart-key small { color: var(--ink-soft); }
.key-sw { display: inline-block; width: 1.1rem; height: 0.7rem; border-radius: 3px; background: var(--co); }
.key-quad { display: inline-block; width: 1.1rem; height: 0.7rem; border: 1px dashed var(--bench-quad-line); background: var(--bench-quad); }

/* balão do hover (feito em JS, sem biblioteca) */
.bench-tip {
  position: absolute;
  z-index: 5;
  max-width: 16rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line-blue);
  border-radius: 10px;
  background: var(--bench-tip-bg);
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.35);
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.4;
  pointer-events: none;
}
.bench-tip[hidden] { display: none; }
.bench-tip strong { display: block; font-size: 0.82rem; }
.bench-tip .tip-row + .tip-row { margin-top: 0.4rem; padding-top: 0.4rem; border-top: 1px solid var(--line); }

/* ---------- abas ---------- */

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--space-lg);
}

.tab {
  min-height: 2.75rem;
  padding: 0 1.1rem;
  border: 1px solid var(--line-blue);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--step--1);
  font-weight: 600;
  cursor: pointer;
}

.tab small { color: var(--ink-soft); font-weight: 400; }
.tab[aria-selected="true"] { border-color: var(--ink); background: var(--ink); color: var(--bench-card); }
.tab[aria-selected="true"] small { color: var(--bench-card); }
.tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.tab-panel + .tab-panel { margin-top: var(--space-xl); }
.js-tabs .tab-panel + .tab-panel { margin-top: 0; }
.js-tabs .tab-panel[hidden] { display: none; }
.panel-meta { color: var(--ink-soft); font-size: var(--step--1); }
.panel-meta a { display: inline-flex; align-items: center; min-height: 2.75rem; color: var(--bench-link); }
.soon { max-width: var(--measure); padding: 1.25rem; border: 1px dashed var(--line-blue); border-radius: 16px; color: var(--ink-soft); }

/* ---------- tabelas ---------- */

.bench-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.bench-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.bench-table caption {
  margin-bottom: 0.75rem;
  color: var(--ink-soft);
  font-size: var(--step--1);
  text-align: left;
}

.bench-table th,
.bench-table td {
  padding: 0.8rem 0.6rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.bench-table thead th {
  padding-block: 0.5rem;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
}

.bench-table thead small { display: block; letter-spacing: 0; text-transform: none; }
.bench-table tbody th { font-weight: 400; }
.bench-table .num { text-align: right; white-space: nowrap; }
.bench-table .strong { font-weight: 700; }
.bench-table .muted { color: var(--ink-soft); }

.bench-model { font-weight: 600; }
.bench-sub { display: block; padding-left: 1.12rem; color: var(--ink-soft); font-size: 0.78rem; }
.price-note { max-width: 22rem; white-space: normal; }

.bench-tag {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--line-blue);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.heat td { background: rgba(var(--bench-heat), calc(var(--heat, 0) * 0.32)); }

.compare { min-width: 56rem; }
.bench-table.compare thead th { white-space: normal; max-width: 9rem; vertical-align: bottom; }
@media (max-width: 70rem) {
  .compare tbody th { position: sticky; left: 0; z-index: 1; background: var(--bench-card); }
}
.compare tr[hidden] { display: none; }
.compare td:nth-child(2) { white-space: nowrap; }

/* ---------- filtros ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-bottom: var(--space-lg);
  font-size: var(--step--1);
}

.filters label { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; }

.filters select {
  min-height: 2.75rem;
  padding: 0 0.8rem;
  border: 1px solid var(--line-blue);
  border-radius: 999px;
  background: var(--bench-select);
  color: var(--ink);
  font: inherit;
}

.filters input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--gold); }
.filters output { color: var(--ink-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.filters[hidden], .tab-list[hidden] { display: none; }
.table-note { margin: 0 0 0.75rem; color: var(--ink-soft); font-size: var(--step--1); }
.bench-scroll:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- cartões ---------- */

.model-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
}

.model-card {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bench-card);
}

.model-card header h3 { display: flex; align-items: center; margin: 0; font-size: var(--step-1); }
.model-card header p { margin: 0.2rem 0 0; color: var(--ink-soft); font-size: var(--step--1); }
.model-index { margin: 1rem 0; color: var(--ink-soft); font-size: var(--step--1); }
.model-index > span:first-child { margin-right: 0.35rem; color: var(--ink); font-size: var(--step-2); font-weight: 700; line-height: 1; }
.model-card dl { display: grid; gap: 0.55rem; margin: 0; font-size: var(--step--1); }
.model-card dl div { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 0.5rem; }
.model-card dt { color: var(--ink-soft); }
.model-card dd { margin: 0; }
.model-card dd small { display: block; margin-top: 0.25rem; color: var(--ink-soft); }

.bench-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
  margin-top: var(--space-xl);
}

.bench-prose h2 { margin: var(--space-2xl) 0 var(--space-sm); font-size: var(--step-2); }
.bench-prose h2:first-child { margin-top: 0; }
.bench-prose > p, .bench-list { max-width: var(--measure); color: var(--ink-soft); }
.bench-list { padding-left: 1.2rem; }
.bench-list li { margin-bottom: 0.6rem; }

@media (max-width: 40rem) {
  .ix-bars li { grid-template-columns: 2.2rem minmax(0, 1fr) 3rem; gap: 0.25rem 0.6rem; padding-block: 0.6rem; }
  .ix-track { grid-column: 2 / 4; grid-row: 2; }
  .ix-val { grid-column: 3; grid-row: 1; font-size: 1.15rem; }
  .heat { font-size: 0.78rem; }
  .heat th, .heat td { padding: 0.6rem 0.2rem; }
  .heat thead th { font-size: 0.6rem; letter-spacing: 0.02em; }
  .heat tbody th { font-size: 0.78rem; line-height: 1.25; }
  .heat .co-dot { display: none; }
  .heat .bench-sub { padding-left: 0; }
  .compare tbody th { min-width: 8.5rem; }
  .compare .bench-model { font-size: 0.85rem; }
  .model-card dl div { grid-template-columns: 1fr; gap: 0; }
  .bench-actions .button { width: 100%; justify-content: center; }
}

@media (forced-colors: active) {
  .ix-fill, .co-dot, .key-sw { background: CanvasText; }
}

/* ---------- custo ---------- */

.stack-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin: 0 0 var(--space-md); padding: 0; list-style: none; color: var(--ink-soft); font-size: var(--step--1); }
.stack-legend li { display: inline-flex; align-items: center; gap: 0.45rem; }
.stack-legend .seg { display: inline-block; width: 0.9rem; height: 0.6rem; border-radius: 3px; }
.stack-bars li { grid-template-columns: minmax(9rem, 20rem) minmax(0, 1fr) 13rem; min-height: 3.5rem; }
.stack { display: flex; height: 0.8rem; border-radius: 999px; background: var(--line); overflow: hidden; }
.seg { display: block; height: 100%; }
.s-in { background: #5d7fb8; }
.s-out { background: var(--petal); }
.s-raz { background: var(--gold); }
.stack-vals { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; text-align: right; line-height: 1.25; }
.stack-vals span { color: var(--ink-soft); font-size: 0.78rem; }
.stack-vals strong { display: block; color: var(--ink); font-size: 0.95rem; font-weight: 700; }
.bench-table td small { display: block; color: var(--ink-soft); font-size: 0.72rem; }

@media (max-width: 40rem) {
  .stack-bars li { grid-template-columns: minmax(0, 1fr) auto; }
  .stack-bars .stack { grid-column: 1 / 3; grid-row: 2; }
  .stack-vals { grid-column: 2; grid-row: 1; }
}
.cost-q { min-width: 52rem; }
.cost-q tbody th, .compare tbody th, .prices tbody th { white-space: nowrap; }
.prices td a { display: inline-flex; align-items: center; min-height: 2.75rem; color: var(--bench-link); }

/* ---------- vista 3D ---------- */
.bench-3d { margin-top: clamp(1rem, 3vw, 2rem); overflow: hidden; }
.v3d-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.v3d-tools[hidden], .v3d-stage[hidden], .v3d-mobile[hidden] { display: none; }
.v3d-stage svg { display: block; width: 100%; max-width: 54rem; height: auto; margin-inline: auto; overflow: visible; }
.v3d-stage svg.is-3d { cursor: grab; touch-action: none; }
.v3d-stage svg.is-3d:active { cursor: grabbing; }
.v3d-stage svg:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.bench-3d .stem { stroke: var(--ink-soft); stroke-width: 1.2; stroke-dasharray: 3 3; }
.bench-3d .foot { fill: var(--co); fill-opacity: 0.55; }
.bench-3d .wall-major { stroke: var(--line-blue); stroke-width: 1; }
.bench-3d .wall-minor { stroke: var(--line); stroke-width: 0.8; stroke-dasharray: 2 4; }
.bench-3d .floor { fill: var(--bench-quad); }
.bench-3d .leader { stroke: var(--co); stroke-width: 1; stroke-opacity: 0.7; }
.bench-3d text { paint-order: stroke; stroke: var(--bench-card); stroke-width: 4px; stroke-linejoin: round; }
.bench-3d text { font-size: 14px; }
.bench-3d .axis-title { font-size: 15px; }
.bench-3d .pt-label .pt-esf { font-size: 14px; }
.bench-3d .pt-label .pt-name { font-size: 15px; }
.v3d-copy svg { display: block; width: 100%; height: auto; }
.v3d-copy .pt-label .pt-esf { font-size: 12.5px; }
.v3d-copy .pt-label .pt-name { font-size: 13.5px; }
.v3d-copy text { font-size: 12.5px; stroke-width: 3.5px; }

.review-note {
  max-width: var(--measure);
  margin: 1.25rem 0 0;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--gold);
  border-radius: 10px;
  color: var(--bench-gold-text, var(--gold));
  font-size: var(--step--1);
  font-weight: 600;
}

/* ---------- tema claro: só nas páginas do placar (cabeçalho e rodapé continuam escuros) ---------- */
@media (prefers-color-scheme: light) {
  body.page-bench main {
    position: relative;
    z-index: 1;
    background: #f6f7fa;
    color: #172238;
    --ink: #172238;
    --ink-soft: #46546d;
    --line: #d6dce6;
    --line-blue: #9fb0c8;
    --bench-card: #ffffff;
    --bench-link: #1d4fa8;
    --bench-tip-bg: #ffffff;
    --bench-quad: rgba(154, 112, 30, 0.09);
    --bench-quad-line: rgba(122, 88, 22, 0.55);
    --bench-heat: 36, 85, 177;
    --bench-gold-text: #7a5816;
    --bench-select: #ffffff;
  }
  body.page-bench main .m-opus { --co: #2455b1; }
  body.page-bench main .m-sonnet { --co: #6a4fc4; }
  body.page-bench main .m-haiku { --co: #0d7286; }
  body.page-bench main .m-sol { --co: #1f2a3d; }
  body.page-bench main .m-luna { --co: #9a5a12; }
  body.page-bench main .m-argon { --co: #2e7d4f; }
  body.page-bench .page-hero { color: #172238; }
  body.page-bench .page-hero::before { background: linear-gradient(180deg, #e7ecf5, #f6f7fa); mask-image: none; }
  body.page-bench .page-hero .lead { color: #2c3a52; }
  body.page-bench .page-hero .eyebrow { color: #7a5816; }
  body.page-bench .page-hero-meta { border-color: var(--line); color: var(--ink-soft); }
  body.page-bench main .text-link { color: var(--bench-link); }
  body.page-bench main .method-note { color: var(--ink-soft); }
  body.page-bench main .bench-tip { box-shadow: 0 0.5rem 1.5rem rgba(23, 34, 56, 0.18); }
  body.page-bench main .button { color: #172238; }
  body.page-bench main .s-in { background: #6f8fc4; }
  body.page-bench main .s-out { background: #2455b1; }
  body.page-bench main .s-raz { background: #9a7a2e; }
}
.v3d-copy .axis-title { font-size: 12.5px; }
@media (max-width: 40rem) {
  .ix-esf { flex-basis: 100%; margin-left: 0; padding-left: 1.12rem; white-space: normal; }
  .ix-sep { display: none; }
}
.filters .check { color: var(--ink); font-weight: 400; }
.prices .price-note { min-width: 16rem; }
.ix-esf--nd { flex-basis: 100%; margin-left: 0; padding-left: 1.12rem; }
.ix-esf--nd .ix-sep { display: none; }
