/* Print edition. Linked from the root layout with media="print"
   (src/app/layout.tsx), after the site's own stylesheets, so a browser
   fetches it without blocking the first render and applies it only when
   printing. It is plain CSS (no Tailwind processing): it may read the
   theme's custom properties but not @apply them. Every rule that must win
   over the screen styles either is !important or comes later in the
   cascade than the rule it overrides at the same specificity. */
@page {
  margin: 12mm;
}

/* All surfaces and their legacy scope markers print on white paper. */
:root[data-theme],
:root[data-theme] :where(.terminal-scope) {
  color-scheme: light;
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-surface-2: #f4f4f1;
  --color-surface-3: #e6e6e1;
  --color-terminal: #ffffff;
  --color-terminal-ink: #11130f;
  --color-terminal-muted: #4e504b;
  --color-terminal-muted-2: #61635d;
  --color-ink: #111318;
  --color-ink-2: #343b44;
  --color-ink-3: #505963;
  --color-axis: #47515d;
  --color-hairline: rgba(17, 19, 24, 0.28);
  --color-hairline-soft: rgba(17, 19, 24, 0.14);
  --color-hairline-strong: rgba(17, 19, 24, 0.58);
  --color-grid: #ddddda;
  --color-refline: rgba(17, 19, 24, 0.3);
  --color-brand-lime: #315f08;
  --color-brand-orange: #983823;
  --color-brand-copper: #704617;
  --color-good: #175d32;
  --color-bad: #8f302d;
}

:root[data-theme] {
  --color-terminal-border: #7c7c76;
  --color-terminal-divider: #b9b9b2;
  --color-footer: #ffffff;
}

/* Keep every chart and legacy surface readable in print. */
:root[data-theme] :where(.terminal-scope) {
  --color-spark-stroke: #8c98a5;
  --color-de-emphasis: #8994a0;
  --color-cursor-fill: rgba(35, 45, 57, 0.055);
  --color-accent: #246fc7;
  --color-accent-bright: #0f5da8;
  --color-accent-dim: rgba(36, 111, 199, 0.11);
  --color-brand-lime-hover: #4c850d;
  --color-on-brand: #fffdf8;
  --color-status-on: #14743c;
  --color-status-mid: #8b6100;
  --color-status-off: #68727d;
  --color-status-legacy: #66717e;
  --color-s1: #226bc0;
  --color-s2: #0a7757;
  --color-s3: #916000;
  --color-s4: #23752b;
  --color-s5: #6657c5;
  --color-s6: #b64242;
  --color-s7: #a83a67;
  --color-s8: #ae4622;
}

html,
body {
  background: #ffffff !important;
}

body {
  color: #111318;
  font-size: 10pt;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.site-header,
.site-footer,
.skip-link,
.section-index,
.chip-flipper,
button {
  display: none !important;
}

main,
.container-site {
  max-width: none !important;
  padding-inline: 0 !important;
}

.card,
.market-terminal,
.terminal-card,
.page-stat,
.evidence-disclosure,
.dataset-status-scroll {
  background: #ffffff !important;
  box-shadow: none !important;
}

.editorial-brief {
  background: #f4f1e9 !important;
}

.chart-surface,
.stat-tile,
.method-card,
table,
tr {
  break-inside: avoid;
}

.scroll-thin,
[class*="overflow-x-auto"],
[class*="overflow-auto"] {
  max-height: none !important;
  overflow: visible !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
}

table {
  min-width: 0 !important;
  font-size: 8pt !important;
}

thead th {
  position: static !important;
  background: #f4f4f1 !important;
}

details:not([open]) > *:not(summary) {
  display: block !important;
}

a {
  color: currentColor;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

svg {
  max-width: 100%;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
