/* ═══ Assessment — print frame (PDF report) ════════════════════════
   The AOI report on PAPER. Letter landscape, one tab → one or more fixed
   pages, plus a cover.

   WHY THIS FILE IS NOT IN static/css/pages/assessment/.
   That directory is the ordered split of the old 3,418-line assessment.css
   (audit C3) and tests/test_css_split.py holds its sequence and its
   "Part N of 9" headers. This file is not part of that split -- it describes
   PAPER, not the app -- so folding it in would mean renumbering nine headers
   for a stylesheet that never competes with them. It is linked immediately
   AFTER the nine parts, which is the only ordering constraint it has: the
   print rules must be able to override the screen rules they sit on top of.

   THE FRAME. `@page { margin: 0 }` and every page carries its own padding,
   header and footer as ordinary flow children. The alternative -- a page
   margin plus `position: fixed` running heads -- gives the browser a say in
   where the header lands, and the browser's answer differs per engine and per
   the user's print dialog. Here the page box is ours end to end.

   TRAP: `.aoi-pg` height must be EXACTLY the page height with border-box
   sizing. One pixel over and Chrome emits a blank page after every real one.
   `overflow:hidden` is load-bearing for the same reason -- content that
   overflows a page must be CUT (the page plan decides what moves to the next
   page), never allowed to spill into a page the plan did not create.

   PALETTE. Paper has its own, deliberately: --pr-*. The app's tokens are
   theme-dependent and some aliases do not follow `body.light` at all (see
   WORKLOG open item 14). Ink on white must not depend on which theme the user
   happened to have open. Content cloned out of the app still resolves app
   tokens -- print-report.js flips the document to the light theme before it
   clones, so those land on their light values.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Paper palette + metrics ──────────────────────────────────────── */
#aoiPrintDoc {
  --pr-page-w:   11in;      /* Letter landscape */
  --pr-page-h:   8.5in;
  --pr-pad:      0.5in;
  --pr-pad-b:    0.38in;
  --pr-gap:      0.22in;

  --pr-paper:    #ffffff;
  --pr-ink:      #14181f;   /* headings, values */
  --pr-body:     #333b47;   /* body copy */
  --pr-mute:     #6b7484;   /* labels, meta, footer */
  --pr-faint:    #9aa2b0;   /* placeholder text */
  --pr-line:     #d7dbe2;   /* hairlines */
  --pr-line-2:   #eaedf2;   /* inner hairlines, table zebra */
  --pr-acc:      #1f4e79;   /* the one accent — section bars, cover rule */
  --pr-wash:     #f4f6f9;   /* card / stat fill */

  --pr-sans:     'IBM Plex Sans', sans-serif;
  --pr-head:     'Barlow Semi Condensed', 'IBM Plex Sans', sans-serif;
  --pr-num:      'Inter', 'IBM Plex Sans', sans-serif;

  color: var(--pr-body);
  font-family: var(--pr-sans);
  /* Backgrounds and fills are information here (stat wash, accent bars), not
     decoration — without this Chrome drops them from the print job. */
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* ══ On-screen preview ═════════════════════════════════════════════
   The frame is reviewed here, not in the browser's print dialog: edit →
   reload → look is two seconds, and the user can approve the layout before
   a dialog is ever opened. The same DOM is what prints. */
#aoiPrintDoc {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  background: #5b6270;               /* light-box backdrop, not a theme colour */
}

.aoi-prv-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: #22262e;
  color: #e7eaef;
  border-bottom: 1px solid #000;
}
.aoi-prv-title {
  font-family: var(--pr-head);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
}
.aoi-prv-meta {
  font-size: 11px;
  color: #99a1ae;
  letter-spacing: .02em;
}
.aoi-prv-spacer { flex: 1 1 auto; }

.aoi-prv-status {
  font-size: 11px;
  letter-spacing: .03em;
  color: #7fb2ef;
}

.aoi-prv-zoom {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #99a1ae;
}
.aoi-prv-zoom button {
  width: 22px;
  height: 22px;
  border: 1px solid #454b56;
  background: #2c313a;
  color: #d5dae1;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.aoi-prv-zoom button:hover { background: #3a404a; }
.aoi-prv-zoom-val { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }

.aoi-prv-scroll {
  flex: 1 1 auto;
  overflow: auto;
  padding: 24px 0 48px;
}
/* Pages are laid out at true paper size and scaled to fit the viewport. Scaling
   the STACK (not each page) keeps the gaps proportional, and transform does not
   reflow — so what is measured for print is what was measured on screen. */
.aoi-prv-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  transform: scale(var(--pr-zoom, 1));
  transform-origin: top center;
  width: max-content;
  margin: 0 auto;
}

/* ══ The page box ══════════════════════════════════════════════════ */
.aoi-pg {
  box-sizing: border-box;
  width: var(--pr-page-w);
  height: var(--pr-page-h);
  padding: var(--pr-pad) var(--pr-pad) var(--pr-pad-b);
  background: var(--pr-paper);
  color: var(--pr-body);
  display: flex;
  flex-direction: column;
  overflow: hidden;                  /* see header: never spill a new page */
  box-shadow: 0 6px 26px rgba(0, 0, 0, .45);   /* screen only; print drops it */
}

/* ── Running header ───────────────────────────────────────────────── */
.aoi-pg-hd {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--pr-line);
  margin-bottom: 12px;
}
.aoi-pg-hd-name {
  font-family: var(--pr-head);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--pr-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46%;
}
.aoi-pg-hd-meta {
  font-size: 9.5px;
  color: var(--pr-mute);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.aoi-pg-hd-sp { flex: 1 1 auto; }
.aoi-pg-hd-brand {
  font-family: var(--pr-head);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--pr-acc);
}

/* ── Section title (the accent bar the app's report tabs use) ─────── */
.aoi-pg-sec {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 10px;
}
.aoi-pg-sec::before {
  content: '';
  width: 3px;
  align-self: stretch;
  background: var(--pr-acc);
}
.aoi-pg-sec-t {
  font-family: var(--pr-head);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .005em;
  color: var(--pr-ink);
}
.aoi-pg-sec-s {
  font-size: 10.5px;
  color: var(--pr-mute);
}

/* ── Body + footer ────────────────────────────────────────────────── */
.aoi-pg-body {
  flex: 1 1 auto;
  min-height: 0;                     /* the height chain: without this the grid
                                        children measure by content and the page
                                        grows past 8.5in */
}
.aoi-pg-ft {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
  margin-top: 10px;
  border-top: 1px solid var(--pr-line-2);
  font-size: 8.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--pr-mute);
}
.aoi-pg-ft-sp { flex: 1 1 auto; }
.aoi-pg-ft-n {
  font-family: var(--pr-num);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

/* ══ Slide types ═══════════════════════════════════════════════════
   Five, and only five. Every page is one of these. A page that needs a
   sixth layout is a page that has not decided what it is about — and a
   per-tab layout is how a print stylesheet turns back into a screenshot
   of the screen. */

/* T1 — map + rail. The map is the argument; the rail annotates it. */
.pg-t1 .aoi-pg-body,
.aoi-pg-body.pg-t1 {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: var(--pr-gap);
}

/* T2 — an even grid of equal-weight cells. Three across for Region and
   Analysis; four across and two down for the Routes comparison, which is the
   same form (small multiples read left-to-right) at a different count. Two
   named types for that would be two vocabularies for one idea, so the shape is
   a variable and the type stays one. */
.aoi-pg-body.pg-t2 {
  display: grid;
  grid-template-columns: repeat(var(--pr-cols, 3), 1fr);
  grid-template-rows: repeat(var(--pr-rows, 1), 1fr);
  gap: var(--pr-gap);
}

/* T3 — a strip over one or more full-width charts stacked down the page. The
   count is a variable for the same reason T2's is: Price shows two exhibits
   (prompt settlement, basis vs Henry) and they are the same form twice, not
   two forms. */
.aoi-pg-body.pg-t3 {
  display: grid;
  grid-template-rows: auto repeat(var(--pr-rows, 1), 1fr);
  gap: var(--pr-gap);
}

/* T4 — a table that flows onto continuation pages. A column, not a block, so
   the table starts at the top and whatever follows it can be told to take the
   rest of the page rather than leaving the sheet half empty. */
.aoi-pg-body.pg-t4 {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* T5 — cover. */
.aoi-pg-body.pg-t5 {
  display: flex;
  flex-direction: column;
}

/* ── Cover ────────────────────────────────────────────────────────── */
.aoi-pg-cover { padding-top: 0.62in; }
.aoi-pr-cv-brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--pr-acc);
}
.aoi-pr-cv-brand-n {
  font-family: var(--pr-head);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--pr-acc);
}
.aoi-pr-cv-brand-s {
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--pr-mute);
}

/* The title block sits in the lower third, directly above the numbers it is
   introducing. Centring it instead leaves a void between the description and
   the KPI row that reads as a layout that ran out of content rather than one
   that chose its white space. */
.aoi-pr-cv-mid {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 0;
  padding-bottom: 0.32in;
}
.aoi-pr-cv-eyebrow {
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--pr-mute);
  margin-bottom: 10px;
}
.aoi-pr-cv-title {
  font-family: var(--pr-head);
  font-size: 46px;
  line-height: 1.06;
  font-weight: 600;
  letter-spacing: -.005em;
  color: var(--pr-ink);
  margin-bottom: 14px;
}
.aoi-pr-cv-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 10px;
  font-size: 12.5px;
  color: var(--pr-body);
}
.aoi-pr-cv-dot { color: var(--pr-line); }
.aoi-pr-cv-desc {
  margin-top: 16px;
  max-width: 6.6in;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--pr-body);
}

/* Cover KPI row — the SAME five the Overview stat strip carries, read from the
   same nodes. Printing three of them was an arbitrary cut: price character
   (seasonality, volatility) is half of what makes one outlet better than
   another, and the cover is where that argument starts. */
.aoi-pr-cv-kpis {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--pr-line);
  border: 1px solid var(--pr-line);
  margin-bottom: 0.18in;
}
.aoi-pr-kpi {
  background: var(--pr-wash);
  padding: 12px 14px;
}
.aoi-pr-kpi-l {
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--pr-mute);
  margin-bottom: 5px;
}
.aoi-pr-kpi-v {
  font-family: var(--pr-num);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.05;
  color: var(--pr-ink);
  font-variant-numeric: tabular-nums;
}
.aoi-pr-kpi-s {
  margin-top: 4px;
  font-size: 10px;
  color: var(--pr-mute);
}

.aoi-pr-cv-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--pr-line);
  font-size: 9.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--pr-mute);
}
.aoi-pr-cv-foot-sp { flex: 1 1 auto; }

/* ── Composed cells ───────────────────────────────────────────────
   A cell is a titled box the app's own output is copied into. The title bar
   is where the CAPTION lives, and the caption is the whole answer to "the
   screen had a toggle and paper does not": `5Y window`, `Basis vs Henry`,
   `radius 100 mi`. Without it a printed chart is a number with no conditions
   attached, which is worse than no chart. */
.aoi-pr-cell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--pr-line-2);
}
.aoi-pr-ch {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--pr-line-2);
}
.aoi-pr-ch-t {
  font-family: var(--pr-head);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--pr-ink);
  white-space: nowrap;
}
.aoi-pr-ch-c {
  font-size: 9px;
  color: var(--pr-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aoi-pr-cbody {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  position: relative;
}
/* A grid cell holding more than one box (the Overview rail: operators over
   takeaways). Ratios are per-box because the two are not equal arguments. */
.aoi-pr-split {
  display: flex;
  flex-direction: column;
  gap: var(--pr-gap);
  min-width: 0;
  min-height: 0;
}
/* A cell that spans whatever grid it is in — used when a section has nothing to
   show and the page carries one explanation instead of a row of empty boxes. */
.aoi-pr-cell-wide { grid-column: 1 / -1; grid-row: 1 / -1; }

.aoi-pr-note {
  padding: 10px;
  font-size: 10px;
  line-height: 1.5;
  color: var(--pr-faint);
}
/* When the note IS the cell, centre it. Left-aligned at the top of an otherwise
   empty box, an empty state looks like the first line of content that never
   finished arriving. */
.aoi-pr-cbody > .aoi-pr-note:only-child {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14%;
  text-align: center;
}

/* Nothing on paper moves. CSS half; print-capture.js strips the SMIL half. */
#aoiPrintDoc *,
#aoiPrintDoc *::before,
#aoiPrintDoc *::after {
  animation: none !important;
  transition: none !important;
}

/* ── News summary (Region · Flow & signals) ───────────────────────
   Built for paper rather than copied: the screen's feed is a scroll, and a
   scroll cut off at five items reads as broken rather than as a summary. */
.aoi-pr-lately {
  padding: 8px 9px;
  background: var(--pr-wash);
  border-bottom: 1px solid var(--pr-line-2);
}
.aoi-pr-lately-h {
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--pr-mute);
  margin-bottom: 3px;
}
.aoi-pr-lately-t {
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--pr-body);
}
.aoi-pr-heads { padding: 4px 9px 0; }
.aoi-pr-head-i {
  padding: 6px 0;
  border-bottom: 1px solid var(--pr-line-2);
}
.aoi-pr-head-i:last-child { border-bottom: 0; }
.aoi-pr-head-t {
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--pr-ink);
}
.aoi-pr-head-m {
  margin-top: 2px;
  font-size: 8.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--pr-mute);
}

/* ── Market chips (Price) ─────────────────────────────────────────
   The screen makes these toggle buttons. On paper they are a legend: the dot
   wears the series colour so the strip and the chart below it read as one
   exhibit, and the markets NOT on the chart stay listed but recede — they are
   still markets this acreage can reach, which is worth knowing. */
.aoi-pr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 7px 8px;
}
.aoi-pr-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid var(--pr-line-2);
  font-size: 9.5px;
  color: var(--pr-mute);
}
.aoi-pr-chip.on {
  border-color: var(--pr-line);
  background: var(--pr-wash);
  color: var(--pr-ink);
}
.aoi-pr-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  align-self: center;
  opacity: .35;
}
.aoi-pr-chip.on .dot { opacity: 1; }
.aoi-pr-chip .nm { font-weight: 600; }
.aoi-pr-chip .mt { font-size: 8.5px; color: var(--pr-faint); }

/* ── Ranked table (Routes · Network) ──────────────────────────────
   The screen ranks routes as a scrolling column of cards. Paper cannot scroll,
   and a ranking cut off at the fold hides the rows it exists to show — so on
   paper the same data is a table, which fits every route this app is likely to
   produce in the space one screenful of cards took. */
.aoi-pr-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  table-layout: fixed;
}
.aoi-pr-tbl th {
  padding: 5px 7px;
  text-align: left;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--pr-mute);
  border-bottom: 1px solid var(--pr-line);
  white-space: nowrap;
}
.aoi-pr-tbl td {
  padding: 4px 7px;
  vertical-align: top;
  color: var(--pr-body);
  border-bottom: 1px solid var(--pr-line-2);
  overflow-wrap: anywhere;
}
.aoi-pr-tbl th.n, .aoi-pr-tbl td.n { text-align: right; white-space: nowrap; }
.aoi-pr-tbl th.n:first-child, .aoi-pr-tbl td.n:first-child { width: 8%; }
.aoi-pr-tbl td.op { color: var(--pr-mute); font-size: 9.5px; }
.aoi-pr-tbl td.num {
  font-family: var(--pr-num);
  font-variant-numeric: tabular-nums;
  color: var(--pr-ink);
}
/* The best outlet is the report's answer — it should be findable without
   reading the column. A tint, not a rule: a heavier border here would fight
   the hairlines the rest of the page is built from. */
.aoi-pr-tbl tr.best td { background: var(--pr-wash); font-weight: 600; }
.aoi-pr-tbl td .sub {
  margin-top: 2px;
  font-size: 8.5px;
  line-height: 1.4;
  color: var(--pr-faint);
}

/* ── Frame placeholder (sections not yet composed) ────────────────── */
.aoi-pr-slot {
  flex: 1 1 0;                       /* fills a T4/T5 column; ignored in a grid,
                                        where the default stretch already does it */
  border: 1px dashed var(--pr-line);
  background: repeating-linear-gradient(
    135deg, transparent 0 9px, rgba(31, 78, 121, .035) 9px 18px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 0;
  padding: 10px;
  text-align: center;
}
.aoi-pr-slot-t {
  font-family: var(--pr-head);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--pr-faint);
}
.aoi-pr-slot-s {
  font-size: 9.5px;
  line-height: 1.5;
  color: var(--pr-faint);
  max-width: 3.2in;
}

/* ══ Print ═════════════════════════════════════════════════════════ */
@page { size: 11in 8.5in; margin: 0; }

@media print {
  /* The app is not printed — the print document is. Hiding the app rather than
     restyling it is what keeps the page plan authoritative: nothing reaches the
     paper that the plan did not put there. */
  body.aoi-printing > *:not(#aoiPrintDoc) { display: none !important; }
  body.aoi-printing {
    background: #fff !important;
    margin: 0;
    padding: 0;
    overflow: visible !important;
  }

  #aoiPrintDoc {
    position: static;
    display: block;
    background: none;
    inset: auto;
  }
  .aoi-prv-bar { display: none !important; }
  .aoi-prv-scroll { overflow: visible; padding: 0; }
  .aoi-prv-stack {
    display: block;
    transform: none !important;       /* paper is already paper-sized */
    width: auto;
    gap: 0;
  }

  .aoi-pg {
    box-shadow: none;
    break-after: page;
    page-break-after: always;         /* legacy engines */
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .aoi-pg:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}
