/* Licasa benchmark pages (/benchmarks/ and /formats/). Same type and palette as the landing page.
   Every size, radius and spacing comes from the tokens below; similar blocks share one component style:
   panels (card, timeline, dialog), tiles (link block, test-file card), pills (chips, menus, search, tags),
   labels (small capitals) and a four-step heading scale. */

/* --- tokens ----------------------------------------------------------------------------------------------- */
:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;

  /* type scale */
  --fs-2xs: 11px;     /* labels, tags, footer */
  --fs-xs: 12px;      /* chart text, secondary details */
  --fs-sm: 13px;      /* body text in cards, controls, tables, tooltips */
  --fs-base: 14px;    /* descriptions */
  --fs-md: 15px;      /* item names */
  --fs-lg: 18px;      /* card and dialog-section titles */
  --fs-xl: 28px;      /* section and dialog titles */
  --fs-lede: 17px;
  --fs-display: clamp(36px, calc(5vw / var(--zoom)), 56px);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* shape and space */
  --radius-lg: 14px;  /* panels */
  --radius-md: 10px;  /* tiles */
  --radius-sm: 6px;   /* keys, tooltips */
  --radius-pill: 999px;
  --pad-panel: 24px;
  --pad-tile: 16px;
  --control-h: 32px;
  --gap: 16px;        /* between a block's parts */
  --gap-section: 48px;

  /* color */
  --bg: #ffffff;
  --card: #fcfcfb;
  --tile: #f3f5f7;
  --tile-strong: #e3e8ed;
  --ink: #16191c;
  --ink-2: #555c62;
  --ink-3: #7a8187;
  --rule: #e4e6e8;
  --grid: #eceeef;
  --chip-on: #171a1c;
  --chip-on-ink: #ffffff;
  --series-cand: #2a78d6;    /* newer Licasa release */
  --series-base: #eb6834;    /* older Licasa release */
  --good: #0c7d0c;
  --warn: #a35f00;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111518;
    --card: #171c1f;
    --tile: #1d2428;
    --tile-strong: #2c363c;
    --ink: #f2f4f5;
    --ink-2: #b7c0c5;
    --ink-3: #8e989e;
    --rule: #2b3439;
    --grid: #232b30;
    --chip-on: #f2f4f5;
    --chip-on-ink: #111518;
    --series-cand: #3987e5;
    --series-base: #d95926;
    --good: #3cc23c;
    --warn: #e2a23b;
  }
}

/* Large screens: scale the whole page the way browser zoom would, so a 2560×1440 or 4K screen shows the same
   layout as 1920×1080, just bigger. The step is taken from width and height together (an ultrawide 3440×1440
   scales like 2560×1440). Viewport units elsewhere are divided by --zoom so they stay relative to the screen. */
:root { --zoom: 1; zoom: var(--zoom); }
@media (min-width: 2100px) and (min-height: 1045px) { :root { --zoom: 1.1; } }
@media (min-width: 2300px) and (min-height: 1140px) { :root { --zoom: 1.2; } }
@media (min-width: 2500px) and (min-height: 1250px) { :root { --zoom: 1.333; } }
@media (min-width: 2850px) and (min-height: 1400px) { :root { --zoom: 1.5; } }
@media (min-width: 3300px) and (min-height: 1650px) { :root { --zoom: 1.75; } }
@media (min-width: 3700px) and (min-height: 1880px) { :root { --zoom: 2; } }

/* --- page ------------------------------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); }
a { color: inherit; }
code { font-family: var(--mono); font-size: var(--fs-2xs); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.skip-link { position: absolute; top: -100px; left: 20px; z-index: 10; padding: 8px 12px; background: var(--ink); color: var(--bg); }
.skip-link:focus { top: 14px; }
.site-header { display: flex; align-items: center; height: 76px; padding: 0 clamp(16px, calc(4vw / var(--zoom)), 64px); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 25px; font-weight: 750; letter-spacing: -.07em; text-decoration: none; }
.brand img { width: 36px; height: 36px; }
main { width: min(1120px, 100% - 32px); margin: 0 auto; padding-bottom: 48px; }
.site-footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 8px 20px 20px; color: var(--ink-3); font-size: var(--fs-2xs); }
.site-footer a:hover { color: var(--ink); }

/* --- type: headings, labels, text ---------------------------------------------------------------------------- */
h1 { margin: 0; font-size: var(--fs-display); font-weight: 650; letter-spacing: -.05em; line-height: 1.05; }
.section-title, .dlg-head h2 { margin: 0 0 16px; font-size: var(--fs-xl); font-weight: 650; letter-spacing: -.025em; line-height: 1.15; }
.card-title, .dlg h3 { margin: 0; font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.01em; line-height: 1.3; }

/* small capitals: group titles, detail labels, table headers */
.case-group h4, .file-meta dt, thead th {
  color: var(--ink-3); font-size: var(--fs-2xs); font-weight: 650; letter-spacing: .1em; text-transform: uppercase;
}

.intro { max-width: 760px; padding: 32px 0; }
.lede { margin: 16px 0 0; color: var(--ink-2); font-size: var(--fs-lede); line-height: 1.55; text-wrap: pretty; }
.sub { margin: 8px 0 0; color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.5; }
.muted-text { color: var(--ink-3); }
.more { display: inline-block; margin-top: 4px; color: var(--ink); font-weight: 600; text-underline-offset: 3px; }

/* --- panels and tiles ---------------------------------------------------------------------------------------- */
.card, .timeline, #format-dialog { border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--card); }
.card { margin: 0 0 16px; padding: var(--pad-panel); }
.timeline { margin: 0; padding: var(--pad-panel); background: linear-gradient(180deg, var(--tile), var(--card)); }
.cta, .file { padding: var(--pad-tile); border-radius: var(--radius-md); background: var(--tile); }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px; }
.card-head > div:first-child { max-width: 680px; }
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-up .card { display: flex; flex-direction: column; }
.two-up .chart { margin-bottom: 16px; }

/* --- pills: chips, menus, search, status, tags ------------------------------------------------------------- */
/* Control boxes start on the same left edge as the block's text. */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .select-wrap select, .search, .pending {
  min-height: var(--control-h); padding: 0 12px; border: 1px solid var(--rule); border-radius: var(--radius-pill);
  font: inherit; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
}
.chip { background: transparent; color: var(--ink-2); cursor: pointer; }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"] { border-color: var(--chip-on); background: var(--chip-on); color: var(--chip-on-ink); }
.chip.view { border-color: var(--ink-3); color: var(--ink); }
.select-wrap { position: relative; display: inline-flex; }
.select-wrap::after { content: ""; position: absolute; top: 50%; right: 13px; width: 6px; height: 6px; margin-top: -5px; pointer-events: none;
  border-right: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2); transform: rotate(45deg); }
.select-wrap select { appearance: none; max-width: 240px; padding-right: 32px; background: var(--card); color: var(--ink); cursor: pointer; }
.select-wrap option, .select-wrap optgroup { background: var(--card); color: var(--ink); }
.select-wrap option:disabled { color: var(--ink-3); }
.search { width: 220px; max-width: 100%; background: var(--card); color: var(--ink); font-weight: 400; }
.select-wrap select:hover, .search:hover { border-color: var(--ink-3); }
.button { display: inline-flex; align-items: center; min-height: var(--control-h); margin-left: auto; padding: 0 16px;
  border-radius: var(--radius-pill); background: var(--series-cand); color: #fff; font-size: var(--fs-sm); font-weight: 650;
  text-decoration: none; white-space: nowrap; box-shadow: 0 1px 2px rgb(0 0 0 / .05); }
.button:hover { filter: brightness(1.08); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pending { display: inline-block; border-style: dashed; color: var(--ink-3); line-height: calc(var(--control-h) - 2px); }
.size, kbd { display: inline-block; padding: 2px 6px; font-family: inherit; font-size: var(--fs-2xs); font-weight: 600; line-height: 1.5; color: var(--ink); }
.size { border-radius: var(--radius-pill); background: var(--tile-strong); }
.size.off { border: 1px dashed var(--rule); background: none; color: var(--ink-3); text-decoration: line-through; }
kbd { min-width: 24px; margin-left: 8px; border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: var(--radius-sm);
  background: var(--card); text-align: center; vertical-align: 1px; }

/* --- "What is measured?": timeline and cases -------------------------------------------------------------- */
.measured { margin: 16px 0 var(--gap-section); }
.timeline svg { display: block; width: 100%; height: auto; overflow: visible; }
.timeline text { font-family: inherit; }
.tl-axis { stroke: var(--ink-3); stroke-width: 1.5; }
.tl-preview { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.tl-note { fill: var(--ink-3); font-size: var(--fs-2xs); }
.tl-dot { fill: var(--ink); stroke: var(--card); stroke-width: 3; }
.tl-start { fill: var(--card); stroke: var(--ink); stroke-width: 2; }
.tl-cursor { fill: var(--card); stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
.tl-thumb { image-rendering: pixelated; }
.tl-frame { fill: none; stroke: var(--rule); stroke-width: 1; }
.tl-name { fill: var(--ink); font-size: var(--fs-sm); font-weight: 650; }
.tl-val { fill: var(--ink-2); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.tl-bracket { fill: none; stroke: var(--ink-3); stroke-width: 1.2; }
.tl-span { fill: var(--ink-2); font-size: var(--fs-xs); }

.cases-title { margin: 40px 0 0; }
.case-groups { display: grid; grid-template-columns: 4fr 3fr; gap: 24px var(--gap-section); margin-top: 16px; }
.case-group h4 { display: inline; margin: 0; color: var(--ink); }
.group-action { display: inline; margin: 0 0 0 8px; color: var(--ink-3); font-size: var(--fs-sm); }
.case-list { margin: 12px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.case-list li { display: grid; grid-template-columns: 24px 1fr; gap: 0 12px; align-items: start; padding: var(--gap) 0; border-bottom: 1px solid var(--rule); }
.case-list b { display: block; color: var(--ink); font-size: var(--fs-md); font-weight: 650; line-height: 1.35; }
.case-list p { margin: 4px 0 0; color: var(--ink-2); font-size: var(--fs-base); line-height: 1.5; }
.glyph { width: 24px; height: 24px; fill: none; stroke: var(--ink-2); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* --- legend, link block, test machine ------------------------------------------------------------------------ */
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: var(--gap); color: var(--ink-2); font-size: var(--fs-sm); }
.key { display: inline-flex; align-items: center; gap: 8px; }
.sw { display: inline-block; width: 14px; height: 10px; border-radius: 3px; }
.sw-cand { background: var(--series-cand); }
.sw-base { background: var(--series-base); }

.cta { display: block; margin-top: auto; text-decoration: none; }
.cta:hover { background: var(--tile-strong); }
.cta-title { display: block; color: var(--ink); font-size: var(--fs-md); font-weight: 650; }
.cta-text { display: block; margin-top: 4px; color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.5; }

.machine { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: var(--gap) 0 0; font-size: var(--fs-sm); line-height: 1.45; }
.machine dt { padding-top: 1px; color: var(--ink-3); }
.machine dd { margin: 0; color: var(--ink); }
.machine dd span { display: block; color: var(--ink-3); font-size: var(--fs-xs); }
.machine .disk + .disk { margin-top: 8px; }

/* --- charts and tooltip ------------------------------------------------------------------------------------- */
.chart { width: 100%; margin-top: var(--gap); }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: inherit; font-size: var(--fs-xs); fill: var(--ink-2); }
.chart .lbl { fill: var(--ink); font-size: var(--fs-sm); }
.chart .muted { fill: var(--ink-3); }
.chart .val { fill: var(--ink); font-variant-numeric: tabular-nums; }
.chart .delta { fill: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .cand { fill: var(--series-cand); }
.chart .base { fill: var(--series-base); }
.chart .s-cand { stroke: var(--series-cand); }
.chart .s-base { stroke: var(--series-base); }
.chart .ring { stroke: var(--card); stroke-width: 2; }
.chart .span { stroke-width: 6; stroke-linecap: round; opacity: .35; }       /* first image to full detail */
.chart .hollow { fill: var(--card); stroke-width: 2.5; }                       /* full-detail marker */
.chart .link { stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; opacity: .55; }
.chart .hit { fill: transparent; }
.chart g:hover > .mark { opacity: .85; }
.rank-axis { margin-bottom: 4px; }
.chart .row-rule { stroke: var(--rule); stroke-width: 1; shape-rendering: crispEdges; }
.chart .rank { font-variant-numeric: tabular-nums; }
/* Labelled menus: label above, menu box on the same left edge as the block's text. */
.fields { display: flex; flex-wrap: wrap; gap: 16px 24px; margin-top: var(--gap); }
.field { display: grid; gap: 4px; color: var(--ink-2); font-size: var(--fs-xs); font-weight: 600; }
.rank-more { padding: 12px 0 4px; color: var(--ink-3); font-size: var(--fs-xs); text-align: center; }
.link-btn { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 600; text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer; }

.tooltip { position: fixed; z-index: 20; max-width: 280px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink); font-size: var(--fs-sm); line-height: 1.45; box-shadow: 0 6px 24px #0000001f; pointer-events: none; }
.tooltip b { font-weight: 650; }
.tt-row { display: flex; align-items: center; gap: 8px; }
.tt-row span + span { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; }

/* --- tables ----------------------------------------------------------------------------------------------- */
.table-wrap { margin-top: var(--gap); overflow-x: auto; scrollbar-color: var(--rule) transparent; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 0; text-align: left; }
th:last-child, td:last-child { padding-right: 0; }

/* --- supported-formats page ------------------------------------------------------------------------------- */
table.formats th, table.formats td { padding: 12px 12px 12px 0; text-align: left; vertical-align: top; }
table.formats tbody th { color: var(--ink); font-weight: 600; }
table.formats td.made { min-width: 280px; color: var(--ink-2); line-height: 1.5; white-space: normal; }
table.formats td.act { padding-right: 0; text-align: right; }
.fmt, .ext { display: block; }
.ext { color: var(--ink-3); font-size: var(--fs-xs); font-weight: 500; }
.px { color: var(--ink); font-weight: 600; }
.sizes { display: flex; flex-wrap: wrap; gap: 4px; }
.support { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 600; white-space: nowrap; }
.support i { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: var(--bg);
  font-size: var(--fs-2xs); font-style: normal; font-weight: 600; }
.s-yes i { background: var(--good); }
.s-partial i, .s-fail i { background: var(--warn); }
.s-no i { background: var(--ink-3); }

#format-dialog { width: min(980px, calc(100% - 24px)); max-height: calc(100% - 40px); padding: 0; color: var(--ink); box-shadow: 0 24px 80px #0000004d; }
#format-dialog::backdrop { background: #0b0e1099; }
.dlg { max-height: calc(100vh / var(--zoom) - 42px); padding: var(--pad-panel); overflow-y: auto; }
.dlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.dlg-head h2 { margin: 0; }
.dlg-head .sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 8px; }
.dlg h3 { margin-top: 32px; }
.perf th, .perf td { padding-right: 8px; padding-left: 8px; }
.perf thead th { white-space: normal; vertical-align: bottom; }
.close { flex: none; width: var(--control-h); height: var(--control-h); border: 1px solid var(--rule); border-radius: 50%; background: transparent;
  color: var(--ink-2); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.close:hover { border-color: var(--ink-3); color: var(--ink); }

.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: var(--gap); }
.file { display: flex; flex-direction: column; gap: 12px; font-size: var(--fs-sm); line-height: 1.5; }
.file p { margin: 0; }
.file-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.file-head b { color: var(--ink); font-size: var(--fs-md); font-weight: 650; }
.file-head span { color: var(--ink-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.file-made { color: var(--ink-2); }
.file-meta { display: grid; grid-template-columns: 64px 1fr; gap: 8px 12px; margin: 0; padding-top: 12px; border-top: 1px solid var(--rule); }
.file-meta dt { padding-top: 2px; }
.file-meta dd { margin: 0; min-width: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.file-meta code { color: var(--ink); }

/* --- narrow screens and forced colors --------------------------------------------------------------------- */
@media (max-width: 900px) {
  .case-groups, .two-up { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  table.formats thead { display: none; }
  table.formats tr { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: var(--gap) 0; border-bottom: 1px solid var(--rule); }
  table.formats th, table.formats td { display: block; padding: 0; border: 0; white-space: normal; }
  table.formats tbody th { grid-column: 1; }
  table.formats td.act { grid-column: 2; grid-row: 1; }
  table.formats td[data-label] { display: grid; grid-column: 1 / -1; grid-template-columns: 104px 1fr; gap: 12px; min-width: 0; }
  table.formats td[data-label]::before { content: attr(data-label); color: var(--ink-3); font-size: var(--fs-xs); }
}
@media (max-width: 560px) {
  :root { --pad-panel: 16px; --fs-xl: 24px; }
  .fields { display: grid; gap: 12px; }
  .field .select-wrap, .field select { width: 100%; max-width: none; }
  .button { justify-content: center; width: 100%; margin-left: 0; }
}
@media (forced-colors: active) {
  .chart .cand, .chart .base { fill: CanvasText; }
  .chart .base { fill-opacity: .5; }
}
