/* /sheet/ — the data page. Static SVG charts, one printable sheet.
   Loaded after atlas.css; every rule lives in the `pages` layer. */
@layer pages {
  .sheet-wrap { padding-bottom: var(--section); }
  .sheet .page-head { gap: 1.1rem; }
  .sheet .page-head .callout { max-width: 46rem; }
  .sheet-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
  .sheet-actions [hidden] { display: none; }

  /* Census: same look as the home census, kept in page CSS. */
  .sheet-census {
    margin-top: clamp(0.5rem, 1vw, 1rem);
    padding: 2rem 0 1.5rem;
    border-block: 1px solid var(--rule);
  }
  .sheet-census-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sheet-census-row > div { padding: 0.25rem 1.5rem; border-left: 1px solid var(--rule); }
  .sheet-census-row > div:first-child { border-left: 0; padding-left: 0; }
  .sheet-census dt {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
  }
  .sheet-census dd {
    margin-top: 0.35rem;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-family: var(--font-display);
    font-stretch: 45%;
    font-weight: 720;
    font-size: var(--step-4);
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }
  .sheet-census .of { font-size: 0.42em; font-weight: 500; color: var(--ink-3); }
  .sheet-census > .fine { margin-top: 1.25rem; }

  .sheet-section { padding-top: clamp(2.75rem, 2rem + 4vw, 5rem); }
  .sheet-section > .section-head { margin-bottom: 1.75rem; }
  .sheet-section h2 { font-size: var(--step-3); }

  /* Cheapest open targets */
  .sheet-targets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
  .sheet-target { display: grid; gap: 0.5rem; align-content: start; border-top-width: 4px; }
  .sheet-target--scan { border-top-color: var(--open); }
  .sheet-target--key { border-top-color: var(--key); }
  .sheet-kicker {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .sheet-target--scan .sheet-kicker { color: var(--open-ink); }
  .sheet-target--key .sheet-kicker { color: var(--key-ink); }
  .sheet-target-id {
    font-family: var(--font-display);
    font-stretch: 45%;
    font-weight: 760;
    font-size: var(--step-3);
    line-height: 1;
  }
  .sheet-target-id a { text-decoration: none; }
  .sheet-target--scan .sheet-target-id a { color: var(--open-ink); }
  .sheet-target--key .sheet-target-id a { color: var(--key-ink); }
  .sheet-target-id a:hover { color: var(--ink); }

  /* Chart blocks: figure + a short reading column */
  .sheet-block {
    display: grid;
    grid-template-columns: minmax(0, 30rem) minmax(0, 1fr);
    gap: 1.5rem clamp(2rem, 1rem + 4vw, 4.5rem);
    align-items: start;
  }
  .sheet-figure { margin: 0; }
  .sheet-side { display: grid; gap: 1rem; align-content: start; }
  .sheet-side-title {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
  }
  .sheet-kv { grid-template-columns: 1fr; }
  .sheet-kv > div { padding-block: 0.8rem; }
  .sheet-figure--buckets { max-width: 30rem; }
  .sheet-figure > figcaption.fine { margin-top: 0.6rem; }

  .chart { width: 100%; height: auto; overflow: visible; }
  .chart text { font-family: var(--font-mono); fill: var(--ink-2); }
  .chart-tick { font-size: 11px; fill: var(--ink-3); }
  .chart-axis { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; fill: var(--ink-3); }
  .chart-value { font-size: 12px; font-weight: 500; fill: var(--ink); }
  .chart-value--zero { fill: var(--ink-3); font-weight: 400; }
  .chart-grid line { stroke: var(--rule); stroke-width: 1; }
  .chart-grid .chart-vline { stroke-dasharray: 2 4; }
  .chart .bar { fill: var(--ink-2); }
  .chart .bar:hover { fill: var(--ink); }
  .chart .dot { fill: var(--ink-2); fill-opacity: 0.78; stroke: var(--paper); stroke-width: 0.8; }
  .chart .dot:hover { fill: var(--ink); fill-opacity: 1; }
  .chart-mean { stroke: var(--ink); stroke-width: 1.25; stroke-dasharray: 5 4; }
  .chart .chart-mean-label { font-size: 11px; fill: var(--ink); }

  .pos-list {
    columns: 9rem;
    column-gap: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    list-style: none;
    padding: 0;
  }
  .pos-list li { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.15rem 0; border-bottom: 1px solid var(--rule); break-inside: avoid; }
  .pos-list a { text-decoration: none; }
  .pos-list a:hover { color: var(--open-ink); }
  .pos-list span { color: var(--ink-2); font-variant-numeric: tabular-nums; }

  /* Attribution table */
  .sheet-table th[scope="row"] {
    position: static;
    padding: 0.75rem 1rem 0.75rem 0;
    border-bottom: 1px solid var(--rule);
    text-align: left;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink);
    white-space: normal;
  }
  /* The table lives in an overflow container, where the shared sticky header
     is offset by the masthead height and covers the first row. */
  .sheet-table { min-width: 44rem; }
  .sheet-table th { position: static; }
  .sheet-table .who { min-width: 11rem; }
  .sheet-table td.mono { white-space: nowrap; }
  .sheet-table td.ids { white-space: normal; }
  .sheet-table .ids { display: table-cell; max-width: 22rem; line-height: 1.7; }
  /* ≥24px tap targets (WCAG 2.5.8): ids sit close together in the credit table. */
  .sheet-table .ids a { display: inline-flex; align-items: center; min-height: 24px; min-width: 24px; padding: 0 0.25rem; margin-right: 0.2rem; white-space: nowrap; }
  .sheet-table td.num { white-space: nowrap; }
  .sheet-table tfoot th[scope="row"], .sheet-table tfoot td {
    padding: 0.9rem 1rem 0.9rem 0;
    border-top: 2px solid var(--ink);
    font-weight: 600;
    text-align: left;
  }
  .sheet-table tfoot td.num { text-align: right; padding-right: 0; }
  .sheet-tx { margin-top: 1rem; font-family: var(--font-mono); overflow-wrap: anywhere; }

  .sheet-act ul { margin-top: 1rem; padding-left: 1.2em; display: grid; gap: 0.35rem; max-width: 42rem; color: var(--ink-2); }
  .sheet-act p { margin-top: 1rem; }

  @media (max-width: 62rem) {
    .sheet-block { grid-template-columns: minmax(0, 1fr); }
    .sheet-figure, .sheet-figure--buckets { max-width: 34rem; }
    .sheet-side { max-width: 34rem; }
  }
  @media (max-width: 48rem) {
    .sheet-census-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 0; }
    .sheet-census-row > div:nth-child(3) { border-left: 0; padding-left: 0; }
    .sheet-targets { grid-template-columns: minmax(0, 1fr); }
  }
}

/* ───────────────────────── print: one sheet, black on white ───────────────────────── */
@media print {
  @page { margin: 14mm 12mm; }
  @layer pages {
    :root {
      color-scheme: light;
      --paper: #fff;
      --paper-2: #fff;
      --surface: #fff;
      --ink: #000;
      --ink-2: #222;
      --ink-3: #444;
      --rule: #bbb;
      --rule-strong: #888;
      --open-ink: #000;
      --key-ink: #000;
    }
    html, body { background: #fff; color: #000; }
    body { font-size: 10.5pt; line-height: 1.45; min-height: 0; display: block; }
    .masthead, .colophon, .breadcrumbs, .skip-link, .sheet-noprint { display: none !important; }
    .sheet-wrap { width: 100%; padding-bottom: 0; }
    .sheet .page-head { padding-block: 0 0.4rem; gap: 0.5rem; }
    .sheet .page-head h1 { font-size: 30pt; max-width: none; }
    .sheet .page-head .lede { font-size: 11pt; }
    .sheet .callout { border-color: #000; background: #fff; font-size: 9.5pt; color: #000; break-inside: avoid; }
    .sheet .callout::before { border-color: #000; color: #000; }
    .sheet-census { padding: 0.6rem 0; margin-top: 0.4rem; }
    .sheet-census dd { font-size: 30pt; }
    .sheet-section { padding-top: 1.2rem; }
    .sheet-section > .section-head { margin-bottom: 0.6rem; gap: 0.3rem; break-after: avoid; }
    .sheet-section h2 { font-size: 17pt; break-after: avoid; }
    .section-head p { color: #222; font-size: 10pt; }
    .sheet-block, .sheet-block--pos { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem 1.5rem; }
    .sheet-figure, .sheet-figure--buckets { max-width: none; }
    .sheet-side { max-width: none; }
    .sheet-target-id { font-size: 20pt; }
    .sheet-target { border-top-color: #000; border-color: #000; padding: 0.7rem 0.9rem; }
    .sheet-targets { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
    .panel { background: #fff; border-color: #888; }
    .sheet-block, .sheet-figure, .sheet-targets, .sheet-act { break-inside: avoid; }
    .chart { max-height: 105mm; }
    .chart .bar { fill: #000; }
    .chart .dot { fill: #000; fill-opacity: 1; stroke: #fff; }
    .chart-grid line { stroke: #bbb; }
    .table-scroll { overflow: visible; border-top-color: #000; }
    .data-table { font-size: 8.5pt; }
    .data-table th { position: static; background: #fff; color: #000; border-bottom-color: #000; }
    .data-table td { padding-block: 0.3rem; }
    .sheet-table thead { display: table-header-group; }
    .sheet-table tfoot { display: table-row-group; }
    .sheet-table tr { break-inside: avoid; }
    .sheet-table .ids { max-width: none; }
    a { text-decoration: none; color: #000; }
    .addr { color: #000; }
    .fine { color: #333; }
  }
}
