/* ============================================================
   components — hero, page head, buttons, tiles, tables,
   filters, grids, findings, panels, taxonomy, pipeline, code.
   Everything belonging to a figure — the card, legend, tooltip
   and SVG primitives — lives in charts.css.
   ============================================================ */

/* ---- hero -------------------------------------------------- */
.hero {
  position: relative;
  padding-block: clamp(3.5rem, 2rem + 7vw, 8rem) var(--s-section);
  overflow: hidden;
}
/* A single soft jade bloom, offset from center — depth without
   a stock gradient blob behind a centered headline. */
.hero::after {
  content: "";
  position: absolute;
  top: -22%;
  right: -12%;
  width: 62vw;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    var(--bloom),
    transparent 62%
  );
  pointer-events: none;
}
.hero__in {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 1rem + 4vw, 5rem);
  align-items: start;
}
.hero h1 {
  margin-top: var(--s-5);
  max-width: 17ch;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent-strong);
}
.hero .lede {
  margin-top: var(--s-5);
  max-width: 44ch;
}
.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  margin-top: var(--s-6);
  padding-top: var(--s-4);
  border-top: 1px solid var(--hair);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.hero__meta b {
  color: var(--text-1);
  font-weight: 500;
}
.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-6);
}
@media (max-width: 980px) {
  .hero__in {
    grid-template-columns: 1fr;
  }
}

/* ---- page head (every page except the overview) -------------
   The bloom and the hero figure belong to the overview alone —
   "exactly one hero per view" is only true if the inner pages
   decline to have one. This is the quieter form: a title, a
   lede, and the run conditions, over a hairline. */
.page-head {
  padding-block: clamp(2.5rem, 1.5rem + 4vw, 4.5rem) var(--s-7);
  border-bottom: 1px solid var(--hair);
}
.page-head__in {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 1rem + 3vw, 4rem);
  align-items: end;
}
.page-head h1 {
  margin-top: var(--s-4);
  max-width: 24ch;
  font-size: var(--t-h1-sm);
}
.page-head h1 em {
  font-style: italic;
  color: var(--accent-strong);
}
.page-head .lede {
  margin-top: var(--s-5);
}
@media (max-width: 860px) {
  .page-head__in {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

/* Panels that explain the figure immediately above them. They are
   part of the figure's argument, so they sit closer to it than a
   new section would. */
.figure-aside {
  margin-top: var(--s-7);
}

/* ---- hero figure (exactly one per view) --------------------- */
.hero-figure {
  font-family: var(--font-sans);
  font-size: var(--t-hero);
  line-height: 0.88;
  font-weight: 600;
  letter-spacing: -0.045em;
  /* proportional figures on purpose — tabular looks loose here */
  font-variant-numeric: proportional-nums;
}
.hero-figure sub {
  font-size: 0.22em;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  vertical-align: baseline;
  margin-left: 0.5em;
  font-family: var(--font-mono);
  bottom: 0;
}
/* ---- buttons ----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 2.5rem;
  padding: 0 var(--s-5);
  border: 1px solid var(--hair-2);
  border-radius: 3px;
  background: transparent;
  color: var(--text-1);
  font-size: var(--t-small);
  cursor: pointer;
  transition: border-color var(--d-fast) var(--ease),
    background var(--d-fast) var(--ease), transform var(--d-fast) var(--ease);
}
.btn:hover {
  border-color: var(--accent-line);
  background: var(--accent-tint);
}
.btn:active {
  transform: translateY(1px);
}
.btn--primary {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--accent-on-fill);
  font-weight: 600;
}
.btn--primary:hover {
  background: var(--accent-fill-hi);
  border-color: var(--accent-fill-hi);
}
.btn__arrow {
  transition: transform var(--d-norm) var(--ease);
}
.btn:hover .btn__arrow {
  transform: translateX(3px);
}

/* ---- stat tiles -------------------------------------------- */
.kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  border-top: 1px solid var(--hair);
  border-left: 1px solid var(--hair);
}
.tile {
  padding: var(--s-5) var(--s-5) var(--s-5);
  border-right: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  display: grid;
  gap: var(--s-2);
  align-content: start;
  transition: background var(--d-norm) var(--ease);
}
.tile:hover {
  background: var(--ink-raised);
}
.tile__label {
  font-size: var(--t-fine);
  color: var(--text-3);
}
.tile__value {
  font-family: var(--font-sans);
  font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: proportional-nums;
}
.tile__value small {
  font-size: 0.44em;
  font-weight: 400;
  color: var(--text-3);
  letter-spacing: 0;
  margin-left: 0.24em;
}
.tile__foot {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-fine);
  color: var(--text-3);
  min-height: 1.4em;
}
/* ---- data tables -------------------------------------------- */
.tbl-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-fine);
  font-variant-numeric: tabular-nums;
}
table.data caption {
  text-align: left;
  font-size: var(--t-fine);
  color: var(--text-3);
  padding: 0 var(--s-5) var(--s-3);
}
table.data th,
table.data td {
  padding: 0.62rem var(--s-4);
  text-align: right;
  border-bottom: 1px solid var(--hair);
  white-space: nowrap;
}
table.data thead th {
  position: sticky;
  top: 0;
  background: var(--ink-raised);
  color: var(--text-3);
  font-weight: 500;
  font-size: var(--t-micro);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--hair-2);
  z-index: 2;
}
table.data th:first-child,
table.data td:first-child {
  text-align: left;
}
table.data td.t-l,
table.data th.t-l {
  text-align: left;
}
/* A column of figures is the one place equal-width digits earn their
   keep: 57.3 above 6.1 lines up on the decimal. The hero figure and
   the KPI tiles deliberately do the opposite — a standalone number at
   display size reads loose in tabular. */
table.data td.n,
table.data td.rank {
  font-variant-numeric: tabular-nums;
}
table.data tbody tr {
  transition: background var(--d-fast) var(--ease);
}
table.data tbody tr:hover {
  background: var(--row-hover);
}
table.data tbody tr.is-ours {
  background: var(--ours-tint);
}
table.data tbody tr.is-ours:hover {
  background: var(--ours-tint-hi);
}
table.data tbody tr.is-baseline td {
  color: var(--text-3);
  border-top: 1px solid var(--hair-2);
}
.rank {
  font-family: var(--font-mono);
  color: var(--text-3);
  width: 3ch;
}
.model-cell {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.model-cell__name {
  color: var(--text-1);
  font-weight: 500;
  white-space: nowrap;
}
.model-cell__org {
  color: var(--text-3);
  font-size: 0.94em;
}
.swatch {
  width: 3px;
  height: 1.05rem;
  border-radius: 2px;
  flex: none;
}
th[aria-sort] {
  cursor: pointer;
  user-select: none;
}
th[aria-sort]:hover {
  color: var(--text-1);
}
th[aria-sort] .arrow {
  opacity: 0;
  margin-left: 0.3em;
}
/* An unsorted header shows its arrow faintly on hover or focus, so
   the column reads as sortable before it has been sorted. */
th[aria-sort="none"]:hover .arrow,
th[aria-sort="none"]:focus-visible .arrow {
  opacity: 0.5;
}
th[aria-sort="descending"] .arrow,
th[aria-sort="ascending"] .arrow {
  opacity: 1;
  color: var(--accent);
}
th[aria-sort="ascending"] .arrow {
  display: inline-block;
  transform: rotate(180deg);
}
/* ---- filter row (one row above everything it scopes) -------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--s-4) var(--s-5);
  padding: var(--s-4) 0;
  border-block: 1px solid var(--hair);
  margin-bottom: var(--s-6);
  position: sticky;
  top: 4rem;
  z-index: 30;
  background: var(--scrim-2);
  backdrop-filter: blur(12px);
}
.filter {
  display: grid;
  gap: var(--s-2);
}
.filter__label {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.chip {
  background: none;
  border: 1px solid var(--hair-2);
  border-radius: 999px;
  color: var(--text-2);
  font-size: var(--t-fine);
  min-height: 1.9rem;
  padding: 0 0.72rem;
  cursor: pointer;
  transition: all var(--d-fast) var(--ease);
}
.chip:hover {
  color: var(--text-1);
  border-color: var(--hair-3);
}
.chip[aria-pressed="true"] {
  background: var(--accent-fill-soft);
  border-color: var(--accent-line);
  color: var(--accent-on-soft);
}
.filters__count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding-bottom: 0.4rem;
}
@media (max-width: 860px) {
  .filters {
    position: static;
  }
}

/* ---- grids -------------------------------------------------- */
/* `min(Xpx, 100%)` rather than a bare track minimum: auto-fit honours
   the minimum even when one column no longer fits, so a bare 360px
   track pushes 60px of panel past a 320px viewport. The min() lets
   the last surviving column shrink to the container instead. */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: var(--s-5);
}
/* editorial bento: a wide lead cell + two stacked companions */
.case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: var(--s-5);
  margin-top: var(--s-4);
}
.bento {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr);
  gap: var(--s-5);
}
/* Two columns of prose panels never balance to the pixel, and a
   stretched panel whose surface runs 200px past its last line reads
   as a rendering fault. This modifier lets each column end where its
   content ends; the default stretch stays for the overview, where the
   wide column is a chart that should fill its box. */
.bento--top {
  align-items: start;
}
@media (max-width: 980px) {
  .bento {
    grid-template-columns: 1fr;
  }
}
.stack {
  display: grid;
  gap: var(--s-5);
  align-content: start;
}
/* ---- findings feed (editorial numbered list) ---------------- */
.findings {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--hair);
}
.finding {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) minmax(0, 1.1fr);
  gap: var(--s-5);
  padding: var(--s-5) 0;
  border-bottom: 1px solid var(--hair);
  align-items: start;
}
.finding__n {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--text-4);
  line-height: 1;
  font-variant-numeric: proportional-nums;
}
.finding h3 {
  font-size: var(--t-h4);
  max-width: 24ch;
}
.finding__body {
  font-size: var(--t-small);
  color: var(--text-2);
  max-width: 56ch;
}
.finding__body b {
  color: var(--text-1);
  font-weight: 600;
}
.finding:hover .finding__n {
  color: var(--accent-fill-hi);
  transition: color var(--d-norm) var(--ease);
}
@media (max-width: 860px) {
  .finding {
    grid-template-columns: 2.5rem minmax(0, 1fr);
  }
  .finding__body {
    grid-column: 2;
  }
}
/* ---- panels, badges, meters --------------------------------- */
.panel {
  background: var(--ink-raised);
  border: 1px solid var(--hair);
  border-radius: 4px;
  padding: var(--s-5);
}
/* Panels hold authored prose in whatever order a page needs, and
   every margin is reset in base.css — so the rhythm between a
   panel's own children is declared once, here, instead of being
   re-guessed per page. */
.panel > * + * {
  margin-top: var(--s-4);
}
.panel--quote {
  background: var(--ink-quote);
  border-left: 2px solid var(--accent-line);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.34em;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.46rem;
  border-radius: 3px;
  border: 1px solid var(--hair-2);
  color: var(--text-3);
}
.badge--ours {
  border-color: var(--accent-line);
  background: var(--accent-fill-softer);
  color: var(--accent-strong);
}
.badge--l1 { color: var(--seq-900); }
.badge--l2 { color: var(--seq-800); }
.badge--l3 { color: var(--seq-700); }
.badge--l4 { color: var(--status-serious); }
.badge--l5 { color: var(--status-critical); }

.meter {
  display: grid;
  gap: var(--s-2);
  padding-block: var(--s-3);
  border-bottom: 1px solid var(--hair);
}
.meter__top {
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  font-size: var(--t-fine);
}
.meter__top b {
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
/* track = a lighter step of the fill's own ramp */
.meter__track {
  height: 6px;
  border-radius: 3px;
  background: var(--seq-200);
  overflow: hidden;
}
.meter__fill {
  height: 100%;
  border-radius: 3px;
  background: var(--seq-700);
}

/* ---- task taxonomy ------------------------------------------ */
.tax {
  display: grid;
  gap: var(--s-5);
}
.tax__cat {
  border: 1px solid var(--hair);
  border-radius: 4px;
  overflow: hidden;
  background: var(--ink-raised);
}
.tax__catHead {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--hair);
  /* The blurb is a full sentence and the stage name is up to
     nineteen characters, so at 320 the row cannot stay one line.
     Wrapping is declared rather than left to overflow, and
     `margin-left: auto` on the meta still right-aligns it on the
     wide layout because a flex line with one item honours it. */
  flex-wrap: wrap;
}
.tax__catNo {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.16em;
  color: var(--accent);
}
.tax__catName {
  font-family: var(--font-display);
  font-size: var(--t-h4);
}
.tax__catMeta {
  margin-left: auto;
  font-size: var(--t-fine);
  color: var(--text-3);
}
.tax__rows {
  display: grid;
}
.tax__row {
  border-bottom: 1px solid var(--hair);
}
.tax__row:last-child {
  border-bottom: 0;
}
.tax__row summary {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr) auto auto;
  gap: var(--s-4);
  align-items: center;
  padding: var(--s-3) var(--s-5);
  cursor: pointer;
  list-style: none;
  transition: background var(--d-fast) var(--ease);
}
.tax__row summary::-webkit-details-marker {
  display: none;
}
.tax__row summary:hover {
  background: var(--ink-inset);
}
.tax__id {
  font-family: var(--font-mono);
  font-size: var(--t-fine);
  color: var(--text-3);
}
.tax__name {
  font-size: var(--t-small);
  color: var(--text-1);
}
.tax__row[open] summary {
  background: var(--ink-inset);
}
.tax__detail {
  padding: var(--s-4) var(--s-5) var(--s-5) calc(var(--s-5) + 3.4rem);
  background: var(--ink-page);
  display: grid;
  gap: var(--s-4);
  font-size: var(--t-small);
  color: var(--text-2);
}
.tax__q {
  font-family: var(--font-display);
  font-size: var(--t-lead);
  color: var(--text-1);
  max-width: 60ch;
  text-wrap: pretty;
}
/* Which released task the quoted question is actually from — ticker,
   cutoff and measured hop count. Mono because every field in it is a
   literal, and it sits ABOVE the question so the question is never
   read as a generic template. The negative bottom margin pulls it
   against the question it labels; the grid gap alone would set it
   the same distance from the question as from the objective below. */
.tax__src {
  font-family: var(--font-mono);
  font-size: var(--t-fine);
  color: var(--text-3);
  margin-bottom: calc(-1 * var(--s-3));
}
/* The contract's own rubric_objective, verbatim. Wider than the
   question because it is prose about scoring, not the thing being
   asked. */
.tax__obj {
  max-width: 74ch;
  text-wrap: pretty;
}
.tax__obj b {
  color: var(--text-1);
}
.tax__rubric {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
@media (max-width: 720px) {
  .tax__row summary {
    grid-template-columns: 3rem minmax(0, 1fr);
    row-gap: var(--s-2);
  }
  .tax__detail {
    padding-left: var(--s-5);
  }
}

/* ---- pipeline diagram (hand-built, no images) ---------------- */
.pipe {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: var(--s-4);
  align-items: stretch;
}
.pipe__node {
  border: 1px solid var(--hair-2);
  border-radius: 4px;
  padding: var(--s-4);
  background: var(--ink-raised);
  display: grid;
  gap: var(--s-2);
  align-content: start;
  position: relative;
  transition: border-color var(--d-norm) var(--ease),
    transform var(--d-norm) var(--ease);
}
.pipe__node:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
}
.pipe__node h4 {
  font-family: var(--font-mono);
  font-size: var(--t-fine);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.pipe__node p {
  font-size: var(--t-fine);
  color: var(--text-3);
  line-height: 1.55;
}

/* ---- code / spec blocks -------------------------------------- */
.code {
  background: var(--ink-void);
  border: 1px solid var(--hair);
  border-radius: 4px;
  overflow: hidden;
  /* A grid item's automatic minimum is min-content, and a <pre> has a
     very wide one — without this the whole column stretched to the
     longest prompt line and ran past a 320px viewport. */
  min-width: 0;
}
.code__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--hair);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.code pre {
  margin: 0;
  padding: var(--s-4);
  overflow-x: auto;
  /* The prompt's own line breaks are meaningful, so they are kept;
     but a line too long for the measure wraps rather than scrolling
     sideways. Its list items open with `·`, so a continuation line
     is distinguishable from a new instruction. */
  white-space: pre-wrap;
  overflow-wrap: break-word;
  font-family: var(--font-mono);
  font-size: var(--t-fine);
  line-height: 1.72;
  color: var(--text-2);
  tab-size: 2;
}
.code pre b {
  color: var(--accent-strong);
  font-weight: 400;
}
.code pre i {
  color: var(--text-4);
  font-style: normal;
}
