/* ==========================================================================
   Quarterly: executive reporting
   MiniBytez product demonstration

   This is not an application. It is a report.

   No sidebar, no cards, no KPI row, no filter bar, no app chrome of any kind.
   A masthead, a period control, a long editorial scroll, and a floating section
   index. Serif display type over a sans body on cream paper. Every chart is a
   numbered figure with a finding-title, a measure subtitle and a source line.
   It prints properly, because a board pack still gets printed.
   ========================================================================== */

:root {
  --paper:   #fcfbf7;
  --paper-2: #f5f2ea;
  --ink:     #14130f;
  --ink-2:   #3a382f;
  --muted:   #6b6759;
  --faint:   #9a9585;
  --rule:    #ddd8c9;
  --rule-2:  #eae5d8;

  --cobalt:  #1b3fae;
  --cobalt-2:#12308a;
  --cobalt-soft: #e7ebf8;
  --pos:     #1d5c3a;
  --neg:     #93251d;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, Inter, Roboto, Helvetica, Arial, sans-serif;
  --measure: 68ch;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.62 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cobalt); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; }

.skip { position: absolute; left: -9999px; background: var(--ink); color: #fff; padding: 10px 16px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }

/* --- Demo strip ----------------------------------------------------------- */

.demostrip {
  background: var(--paper-2); border-bottom: 1px solid var(--rule);
  font: 400 12px/1.5 var(--sans); color: var(--muted);
  padding: 7px 0;
}
.demostrip .wrap { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.demostrip strong { color: var(--ink-2); font-weight: 600; }
.demostrip .gap { flex: 1; }
.demostrip a, .demostrip button {
  color: var(--cobalt); background: none; border: 0; cursor: pointer; font: inherit; text-decoration: underline;
}

/* --- Layout --------------------------------------------------------------- */

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 40px; }

.report {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 56px;
  max-width: 1180px; margin: 0 auto; padding: 0 40px 120px;
}

/* --- Masthead ------------------------------------------------------------- */

.masthead { border-bottom: 3px double var(--ink); padding: 40px 0 20px; margin-bottom: 34px; }
.masthead__top { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.masthead h1 {
  font-family: var(--serif); font-weight: 400; font-size: clamp(38px, 5.6vw, 62px);
  line-height: 1.03; letter-spacing: -0.022em; margin: 0;
}
.masthead .org {
  font: 600 12px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 14px;
}
.masthead .period { font-family: var(--serif); font-size: 21px; color: var(--ink-2); margin-top: 10px; font-style: italic; }

.controls { display: flex; gap: 22px; align-items: flex-end; flex-wrap: wrap; margin-top: 26px; }
.control label {
  display: block; font: 600 10.5px/1 var(--sans); letter-spacing: .13em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 7px;
}
.control select {
  font: inherit; font-size: 15px; padding: 6px 10px; background: var(--paper);
  border: 1px solid var(--rule); border-radius: 0; color: var(--ink); min-width: 172px;
}
.control select:focus { border-color: var(--cobalt); outline: none; }
.control .print {
  border: 1px solid var(--rule); background: none; padding: 7px 15px; cursor: pointer;
  font-size: 14px; color: var(--ink-2);
}
.control .print:hover { border-color: var(--ink-2); }

/* --- Floating section index ----------------------------------------------- */

.index { position: sticky; top: 30px; align-self: start; }
.index h2 {
  font: 600 10.5px/1 var(--sans); letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 12px; padding-bottom: 9px; border-bottom: 1px solid var(--rule);
}
.index ol { list-style: none; margin: 0; padding: 0; counter-reset: sec; }
.index li { counter-increment: sec; }
.index a {
  display: grid; grid-template-columns: 20px 1fr; gap: 6px;
  padding: 5px 0; font-size: 14px; color: var(--ink-2); text-decoration: none; line-height: 1.35;
}
.index a::before { content: counter(sec); color: var(--faint); font-variant-numeric: tabular-nums; }
.index a:hover { color: var(--cobalt); }
.index a[aria-current="true"] { color: var(--cobalt); font-weight: 600; }
.index a[aria-current="true"]::before { color: var(--cobalt); }
.index .appendix a::before { content: "–"; }

/* --- Body ----------------------------------------------------------------- */

.body { min-width: 0; counter-reset: figure; }

section.sec { margin-bottom: 66px; scroll-margin-top: 24px; }
section.sec > h2 {
  font-family: var(--serif); font-weight: 400; font-size: 32px; letter-spacing: -0.018em;
  margin: 0 0 4px; line-height: 1.16;
}
section.sec > h2 .no {
  font: 600 11px/1 var(--sans); letter-spacing: .14em; color: var(--cobalt);
  display: block; margin-bottom: 10px; text-transform: uppercase;
}
section.sec > .standfirst {
  font-size: 18px; line-height: 1.55; color: var(--ink-2); max-width: var(--measure);
  margin: 0 0 26px; padding-bottom: 22px; border-bottom: 1px solid var(--rule);
}

p.prose { max-width: var(--measure); font-size: 16px; line-height: 1.65; margin: 0 0 18px; }
p.prose b { font-weight: 640; }
p.lead { font-size: 18px; }

/* Findings: the three sentences that matter, set as a numbered list, not tiles. */
ol.findings { list-style: none; margin: 0 0 30px; padding: 0; counter-reset: finding; }
ol.findings li {
  counter-increment: finding; display: grid; grid-template-columns: 34px minmax(0, 1fr);
  gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--rule-2); max-width: var(--measure);
}
ol.findings li::before {
  content: counter(finding); font-family: var(--serif); font-size: 27px; color: var(--cobalt);
  line-height: 1; padding-top: 3px;
}
ol.findings p { margin: 0; font-size: 17px; line-height: 1.5; }
ol.findings .detail { margin-top: 6px; font-size: 14.5px; color: var(--muted); }

/* --- Figures -------------------------------------------------------------- */

figure.fig { margin: 0 0 40px; counter-increment: figure; }
figure.fig figcaption { margin-bottom: 16px; }
figcaption .no {
  font: 600 10.5px/1 var(--sans); letter-spacing: .13em; text-transform: uppercase; color: var(--cobalt);
}
figcaption .no::before { content: "Figure " counter(figure) " · "; }
figcaption h3 {
  font-family: var(--serif); font-weight: 400; font-size: 22px; line-height: 1.26;
  margin: 7px 0 4px; letter-spacing: -0.012em; max-width: 46ch;
}
figcaption .measure { font-size: 13.5px; color: var(--muted); }

figure.fig svg { display: block; width: 100%; height: auto; overflow: visible; }
figure.fig .source {
  font-size: 12.5px; color: var(--faint); margin: 12px 0 0;
  padding-top: 9px; border-top: 1px solid var(--rule-2); max-width: var(--measure);
}

/* Chart ink. Muted by default, cobalt only for the series under discussion. */
.ax { font-family: var(--sans); font-size: 11.5px; fill: var(--faint); }
.axlabel { font-family: var(--sans); font-size: 11.5px; fill: var(--muted); }
.gl { stroke: var(--rule-2); stroke-width: 1; }
.gl--zero { stroke: var(--ink-2); stroke-width: 1; }
.ink { fill: #b9b2a0; }
.ink--hi { fill: var(--cobalt); }
.ink--neg { fill: #c08c86; }
.line { fill: none; stroke: var(--cobalt); stroke-width: 2; }
.line--muted { fill: none; stroke: #b9b2a0; stroke-width: 1.5; stroke-dasharray: 4 3; }
.band { fill: var(--cobalt); opacity: .1; }
.dlabel { font-family: var(--sans); font-size: 12px; font-weight: 600; fill: var(--ink); }
.dlabel--muted { fill: var(--muted); font-weight: 400; }

/* --- Editorial tables: rules, never boxes -------------------------------- */

.tablewrap { overflow-x: auto; margin: 0 0 12px; }
table.ed { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 520px; }
table.ed caption { text-align: left; font-size: 13.5px; color: var(--muted); padding-bottom: 9px; }
table.ed th {
  text-align: left; font: 600 11px/1.4 var(--sans); letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); padding: 0 14px 8px 0; border-bottom: 1px solid var(--ink-2);
}
table.ed th.r, table.ed td.r { text-align: right; }
table.ed td { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--rule-2); font-variant-numeric: tabular-nums; }
table.ed td:first-child { font-variant-numeric: normal; }
table.ed tr.total td { border-top: 1px solid var(--ink-2); border-bottom: 0; font-weight: 650; padding-top: 12px; }
table.ed .delta--pos { color: var(--pos); }
table.ed .delta--neg { color: var(--neg); }
table.ed .note { display: block; font-size: 12.5px; color: var(--muted); }

/* --- Key numbers, set as a rule-separated row, not cards ----------------- */

.keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(138px, 1fr)); gap: 0 26px; margin: 0 0 34px; }
.keys > div { padding: 16px 0; border-top: 2px solid var(--ink); }
.keys dt { font: 600 10.5px/1.3 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.keys dd { margin: 0; font-family: var(--serif); font-size: 30px; line-height: 1.05; letter-spacing: -0.02em; }
.keys .delta { display: block; font-family: var(--sans); font-size: 13px; margin-top: 7px; letter-spacing: 0; }
.delta--pos { color: var(--pos); }
.delta--neg { color: var(--neg); }
.delta--flat { color: var(--muted); }

/* --- Cohort grid ---------------------------------------------------------- */

.cohort { border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.cohort th { font: 600 10.5px/1.3 var(--sans); color: var(--muted); padding: 0 5px 7px; text-align: center; font-weight: 600; }
.cohort th.rowhead { text-align: left; padding-right: 12px; }
.cohort td { padding: 0; }
.cohort td.rowhead { font-size: 12.5px; color: var(--ink-2); padding-right: 12px; white-space: nowrap; }
.cohort .cell { width: 40px; height: 25px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; }
.cohort .cell--empty { background: var(--paper-2); color: transparent; }

/* --- Appendix ------------------------------------------------------------- */

.defs { max-width: var(--measure); }
.defs dt { font-weight: 640; font-size: 15px; margin-top: 16px; }
.defs dd { margin: 3px 0 0; font-size: 15px; color: var(--ink-2); }

.colophon {
  border-top: 3px double var(--ink); margin-top: 20px; padding-top: 20px;
  font-size: 13.5px; color: var(--muted); max-width: var(--measure);
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 940px) {
  .report { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 22px 80px; }
  .wrap { padding: 0 22px; }
  .index {
    position: static; margin-bottom: 40px; padding-bottom: 22px; border-bottom: 1px solid var(--rule);
  }
  .index ol { display: flex; flex-wrap: wrap; gap: 0 22px; }
  .masthead { padding-top: 28px; }
  section.sec > h2 { font-size: 26px; }
  section.sec > .standfirst { font-size: 16.5px; }
  .keys dd { font-size: 26px; }
}

/* --- Print: a board pack still gets printed ------------------------------ */

@media print {
  @page { margin: 18mm 16mm; }
  body { background: #fff; font-size: 11pt; }
  .demostrip, .index, .controls, .skip { display: none !important; }
  .report { display: block; padding: 0; max-width: none; }
  .wrap { padding: 0; max-width: none; }
  .masthead { padding-top: 0; }
  .masthead h1 { font-size: 34pt; }
  section.sec { margin-bottom: 26pt; page-break-inside: avoid; }
  figure.fig { page-break-inside: avoid; margin-bottom: 20pt; }
  section.sec > h2 { font-size: 17pt; page-break-after: avoid; }
  figcaption h3 { font-size: 13pt; page-break-after: avoid; }
  .keys dd { font-size: 20pt; }
  a { color: inherit; text-decoration: none; }
  .colophon { page-break-before: avoid; }
}
