/* AI Adoption Index — page styles. Chart colors validated with the dataviz palette checker
   (2 slots, light on #ffffff and dark on #161a20: all checks pass). */
:root {
  --series-1: #008f7e;   /* AI use now */
  --series-2: #eb6834;   /* expected within 6 months */
  --grid: #ebe8e1;
  --axis: #c9c5bb;
  --ink-muted: #7a7f8a;
  --bar-track: #f2f0ea;
  --band-opacity: 0.16;
}
@media (prefers-color-scheme: dark) {
  :root {
    --series-1: #16a594;
    --series-2: #d95926;
    --grid: #252b34;
    --axis: #3a414c;
    --ink-muted: #8d93a0;
    --bar-track: #1f252e;
    --band-opacity: 0.22;
  }
}

.ai-hero { padding-block: clamp(48px, 9vw, 104px) clamp(32px, 5vw, 56px); }
.ai-hero h1 { max-width: 20ch; }
.data-note { font-size: var(--step--1); color: var(--muted); }

/* Stat tiles */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); margin-top: 32px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.stat-value { font-family: var(--font-body); font-weight: 700; font-size: clamp(2rem, 5vw, 2.6rem); line-height: 1.1; letter-spacing: -0.02em; }
.stat-label { color: var(--muted); font-size: var(--step--1); margin-top: 6px; }
.stat-label strong { color: var(--text); font-weight: 600; }

/* Chart cards */
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(16px, 3vw, 28px); box-shadow: var(--shadow); }
.chart-card h3 { font-family: var(--font-body); font-size: var(--step-1); font-weight: 600; margin-bottom: 4px; }
.chart-sub { color: var(--muted); font-size: var(--step--1); margin-bottom: 16px; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: var(--step--1); color: var(--muted); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 18px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.band { height: 10px; border-radius: 3px; opacity: 0.4; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart svg:focus { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
.chart text { font-family: var(--font-body); font-size: 12px; fill: var(--ink-muted); font-variant-numeric: tabular-nums; }
.chart .end-label { font-size: 12px; font-weight: 600; fill: var(--text); font-variant-numeric: normal; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; }

.tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
  padding: 10px 12px; font-size: 13px; line-height: 1.45; min-width: 160px;
  transform: translate(-50%, calc(-100% - 12px));
}
.tooltip .tt-title { font-weight: 600; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; }
.tooltip .tt-row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.tooltip .tt-row b { font-variant-numeric: tabular-nums; font-weight: 600; }
.tooltip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tooltip .tt-note { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* Filter row */
.filters { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-bottom: 20px; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 999px; padding: 3px; background: var(--surface); }
.seg button {
  font: inherit; font-size: var(--step--1); font-weight: 500; color: var(--muted);
  background: none; border: 0; border-radius: 999px; padding: 6px 14px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* HTML bar chart */
.bars { display: grid; gap: 2px; }
.bar-row {
  display: grid; grid-template-columns: minmax(120px, 34%) 1fr 56px; align-items: center; gap: 12px;
  padding: 5px 6px; border-radius: 8px; cursor: default;
}
.bar-row:hover, .bar-row:focus-visible { background: var(--bar-track); outline: none; }
.bar-label { font-size: 13px; line-height: 1.3; color: var(--text); }
.bar-label .flag { color: var(--muted); }
.bar-track { position: relative; height: 14px; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series-1); border-radius: 0 4px 4px 0; }
.bar-row.is-limited .bar-fill { opacity: 0.45; }
.bar-zero { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 1px solid var(--axis); }
.bar-ref { position: absolute; top: -6px; bottom: -6px; width: 0; border-left: 1.5px solid var(--text); opacity: 0.55; }
.bar-value { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.bars-ref-note { font-size: var(--step--1); color: var(--muted); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.bars-ref-note i { display: inline-block; width: 0; height: 14px; border-left: 1.5px solid var(--text); opacity: 0.55; }
@media (max-width: 560px) {
  .bar-row { grid-template-columns: 1fr 52px; grid-template-areas: "label value" "track track"; gap: 4px 10px; }
  .bar-label { grid-area: label; } .bar-value { grid-area: value; } .bar-track { grid-area: track; }
}

details.table-view { margin-top: 16px; font-size: var(--step--1); }
details.table-view summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.table-wrap { overflow-x: auto; margin-top: 10px; max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.data th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Benchmark tool */
.bench-form { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); align-items: end; max-width: none; }
.bench-form .btn { justify-self: start; }
.gate { margin-top: 24px; border: 1px solid var(--accent); border-radius: var(--radius); padding: clamp(18px, 3vw, 28px); background: var(--surface); }
.gate h3 { font-family: var(--font-body); font-size: var(--step-1); font-weight: 600; }
.gate form { max-width: 560px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--muted); }
.check input { width: auto; margin-top: 4px; }
.form-msg { font-size: var(--step--1); color: var(--muted); min-height: 1.2em; }
.form-msg.error { color: #c2410c; }

.results { margin-top: 28px; }
.result-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); margin-bottom: 24px; }
.result-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; background: var(--surface); }
.result-card .rc-kind { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.result-card .rc-label { font-weight: 600; margin: 4px 0 8px; line-height: 1.3; }
.result-card .rc-value { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.result-card .rc-diff { font-size: var(--step--1); color: var(--muted); margin-top: 4px; }
.result-card .rc-diff b { color: var(--text); }
.result-card .rc-note { font-size: 12px; color: var(--muted); margin-top: 6px; }
.result-card.is-na .rc-value { font-size: 1rem; font-weight: 500; color: var(--muted); }

.method { font-size: var(--step--1); color: var(--muted); }
.method h3 { font-family: var(--font-body); font-size: var(--step-0); font-weight: 600; color: var(--text); margin-top: 1.2em; }
.method ul { padding-left: 1.1em; }
