/* ============================================================
   Energy Prosperity 2030 — Document styles
   A4 portrait whitepaper, single-column, generous margins
   ============================================================ */

@page {
  size: A4 portrait;
  margin: 0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #1a0b2e;
  font-family: var(--font-sans);
  color: var(--fg1);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Viewer shell (screen) ---------- */
.viewer {
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 24px 120px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------- Page frame ---------- */
.page {
  position: relative;
  width: 210mm;
  height: 297mm;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0,0,0,0.35), 0 8px 24px rgba(0,0,0,0.2);
  overflow: hidden;
  page-break-after: always;
  break-after: page;
  color: var(--fg1);
}
.page:last-child { page-break-after: auto; }

.page-body {
  position: absolute;
  inset: 0;
  padding: 22mm 20mm 20mm;
  display: flex;
  flex-direction: column;
}

/* ---------- Running header / footer ---------- */
.page-header,
.page-footer {
  position: absolute;
  left: 20mm; right: 20mm;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--tea-slate-500);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.page-header { top: 10mm; }
.page-footer { bottom: 10mm; }
.page-header .rule {
  flex: 1; height: 1px;
  background: var(--tea-slate-200);
  margin: 0 14px;
}
.page-footer .dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--tea-magenta);
  display: inline-block;
  margin-right: 8px;
}
.pg-num { font-weight: 500; color: var(--tea-purple-brand); }

/* ---------- Section heads ---------- */
.eyebrow {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--tea-purple-brand);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow .num {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--tea-magenta);
}

h1.section-title {
  font-size: 32px;
  line-height: 1.05;
  letter-spacing: -0.028em;
  font-weight: 800;
  color: var(--tea-purple-night);
  margin: 0 0 14px;
  text-wrap: balance;
}

h2.section-title {
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: var(--tea-purple-night);
  margin: 18px 0 10px;
  text-wrap: balance;
}

h3.sub {
  font-size: 14px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 700;
  color: var(--tea-purple-brand);
  margin: 14px 0 6px;
  text-transform: none;
}

p.lede {
  font-size: 15px;
  line-height: 1.55;
  color: var(--tea-slate-700);
  margin: 0 0 14px;
  font-weight: 400;
  text-wrap: pretty;
}

/* ---------- Body copy ---------- */
.body-copy {
  font-size: 10.5px;
  line-height: 1.65;
  color: var(--tea-ink);
  text-wrap: pretty;
}
.body-copy p { margin: 0 0 9px; }
.body-copy strong { font-weight: 700; color: var(--tea-purple-night); }
.body-copy em { font-style: italic; color: var(--tea-purple-brand); }

/* ---------- Source line ---------- */
.source {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--tea-slate-500);
  letter-spacing: 0.02em;
  margin-top: 6px;
}
.source::before { content: "Source: "; opacity: 0.55; }
.source.no-prefix::before { content: ""; }

/* ---------- Figure ---------- */
figure {
  margin: 10px 0 14px;
}
figcaption {
  font-size: 9.5px;
  line-height: 1.45;
  color: var(--tea-slate-600);
  margin-top: 8px;
  font-style: italic;
}
.fig-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tea-magenta);
  font-weight: 500;
  margin-bottom: 4px;
  font-style: normal;
}

/* ---------- Stat cards ---------- */
.stat-grid {
  display: grid;
  gap: 10px;
  margin: 12px 0 14px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--tea-slate-200);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(15,2,32,.04);
}
.stat-card.dark {
  background: var(--grad-purple-depth);
  border-color: transparent;
  color: #fff;
}
.stat-card.accent {
  background: var(--grad-magenta-cyan);
  border-color: transparent;
  color: #fff;
}
.stat-card .eyebrow {
  font-size: 8.5px;
  margin-bottom: 6px;
  letter-spacing: 0.2em;
}
.stat-card.dark .eyebrow,
.stat-card.accent .eyebrow { color: var(--tea-cyan-300); }
.stat-card.accent .eyebrow { color: rgba(255,255,255,.85); }
.stat-card .stat-num {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--tea-purple-night);
}
.stat-card.gradient-num .stat-num {
  background: var(--grad-spectrum-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.stat-card.dark .stat-num,
.stat-card.accent .stat-num { color: #fff; }
.stat-card .stat-desc {
  font-size: 10px;
  line-height: 1.5;
  color: var(--tea-slate-600);
  margin-top: 6px;
}
.stat-card.dark .stat-desc,
.stat-card.accent .stat-desc { color: rgba(255,255,255,.75); }
.stat-card .stat-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--tea-slate-500);
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.stat-card.dark .stat-sub,
.stat-card.accent .stat-sub { color: rgba(255,255,255,.5); }

/* ---------- Callouts (lavender editorial) ---------- */
.callout {
  background: var(--tea-lavender);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 12px 0;
  border-left: 2px solid var(--tea-purple-brand);
}
.callout .callout-label {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--tea-purple-brand);
  margin-bottom: 6px;
}
.callout p { margin: 0 0 6px; font-size: 10.5px; line-height: 1.6; color: var(--tea-ink); }
.callout p:last-child { margin-bottom: 0; }

.pullquote {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.018em;
  color: var(--tea-purple-night);
  margin: 14px 0;
  padding: 12px 0 12px 16px;
  border-left: 3px solid var(--tea-magenta);
  text-wrap: balance;
}

/* ---------- Tables ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  margin: 10px 0 6px;
}
.data-table thead th {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tea-slate-500);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1.5px solid var(--tea-purple-night);
}
.data-table thead th.num { text-align: right; }
.data-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--tea-slate-200);
  color: var(--tea-ink);
  vertical-align: top;
}
.data-table tbody td.num {
  font-family: var(--font-mono);
  text-align: right;
  font-size: 10px;
  color: var(--tea-purple-night);
}
.data-table tbody tr:last-child td { border-bottom: 1.5px solid var(--tea-purple-night); font-weight: 700; }
.data-table tbody tr:last-child td { background: var(--tea-off-white); }
.data-table tbody tr.total td {
  border-top: 1.5px solid var(--tea-purple-night);
  border-bottom: 1.5px solid var(--tea-purple-night);
  background: var(--tea-off-white);
  font-weight: 700;
}
.data-table tbody tr.total td.num { color: var(--tea-magenta-600); }
.data-table caption {
  caption-side: bottom;
  font-size: 9px;
  color: var(--tea-slate-500);
  text-align: left;
  padding-top: 8px;
  font-family: var(--font-mono);
}

/* Two-column body grid when needed */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.two-col-23 { display: grid; grid-template-columns: 2fr 3fr; gap: 14px; }
.two-col-32 { display: grid; grid-template-columns: 3fr 2fr; gap: 14px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ---------- COVER ---------- */
.cover {
  background: var(--grad-spectrum);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.cover .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  pointer-events: none;
}
.cover .blob-1 { width: 520px; height: 520px; background: var(--tea-magenta); top: -140px; right: -120px; }
.cover .blob-2 { width: 420px; height: 420px; background: var(--tea-cyan); bottom: -100px; left: -90px; opacity: 0.45; }
.cover .blob-3 { width: 300px; height: 300px; background: var(--tea-pink-500); top: 40%; left: 20%; opacity: 0.3; }

.cover-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 22mm 20mm;
}
.cover-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,.75);
}
.cover-top .logo img { height: var(--cover-logo-h, 20px); filter: brightness(0) invert(1); transition: height .18s ease; }
.cover-title-wrap { margin-top: auto; }
.cover-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,.8);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.cover-eyebrow::before {
  content: "";
  width: 40px; height: 1px;
  background: var(--tea-cyan-300);
}
.cover-title {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 68px;
  line-height: 1.14;
  letter-spacing: -0.035em;
  margin: 0;
  color: #fff;
  text-wrap: balance;
}
.cover-title .grad {
  background: linear-gradient(120deg, #ffffff 0%, #E879F9 35%, #67E8F9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  display: block;
  line-height: 1.18;
  padding-bottom: 0.12em;
}
.cover-sub {
  font-size: 18px;
  line-height: 1.5;
  color: rgba(255,255,255,.85);
  margin-top: 22px;
  max-width: 520px;
  text-wrap: pretty;
  font-weight: 400;
}
.cover-hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid rgba(255,255,255,.25);
}
.cover-hero-stats .stat {
  padding-right: 22px;
  padding-left: 22px;
  border-right: 1px solid rgba(255,255,255,.18);
}
.cover-hero-stats .stat:first-child { padding-left: 0; }
.cover-hero-stats .stat:last-child { border-right: 0; padding-right: 0; }
.cover-hero-stats .stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,.6);
  margin-bottom: 6px;
}
.cover-hero-stats .stat-val {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.025em;
  line-height: 1;
}
.cover-hero-stats .stat-val.cyan { color: var(--tea-cyan-300); }
.cover-hero-stats .stat-val.magenta { color: var(--tea-magenta-400); }
.cover-hero-stats .stat-cap {
  font-size: 10px;
  color: rgba(255,255,255,.7);
  margin-top: 4px;
}

.cover-bottom {
  margin-top: 30px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,.65);
}

/* ---------- TOC ---------- */
.toc-page {
  background: var(--tea-off-white);
}
.toc-battles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.toc-battle {
  background: #fff;
  border: 1px solid var(--tea-slate-200);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: 0 1px 2px rgba(15,2,32,.03);
}
.toc-battle .badge {
  width: 32px; height: 32px; border-radius: 999px;
  background: var(--grad-purple-cyan);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.toc-battle .t {
  font-size: 11px;
  font-weight: 700;
  color: var(--tea-purple-night);
  letter-spacing: -0.005em;
  margin-bottom: 3px;
}
.toc-battle .q {
  font-size: 10px;
  color: var(--tea-slate-600);
  line-height: 1.4;
}
.toc-battle .pg {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--tea-magenta);
  flex-shrink: 0;
  padding-left: 8px;
}

.toc-list {
  margin-top: 20px;
  border-top: 1px solid var(--tea-slate-200);
}
.toc-list .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--tea-slate-200);
  gap: 12px;
}
.toc-list .row .lbl-n {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--tea-magenta);
  width: 26px;
}
.toc-list .row .lbl-t {
  font-size: 12px;
  color: var(--tea-purple-night);
  font-weight: 600;
  flex: 1;
}
.toc-list .row .lbl-p {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--tea-slate-500);
}

/* ---------- Section opener (photo hero) ---------- */
.section-opener {
  position: relative;
  overflow: hidden;
  color: #fff;
}
.section-opener .bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.section-opener .bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(170deg, rgba(15,2,32,.55) 0%, rgba(107,33,168,.55) 55%, rgba(6,182,212,.25) 100%);
  mix-blend-mode: multiply;
}
.section-opener .bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15,2,32,0) 30%, rgba(15,2,32,.75) 100%);
  z-index: 2;
}
.section-opener .bg img {
  width: 100%; height: 100%; object-fit: cover;
  filter: saturate(.95) contrast(1.02);
}
.section-opener-inner {
  position: relative; z-index: 3;
  padding: 22mm 20mm;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.section-opener .op-number {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.32em;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  margin: 0;
}
.section-opener .op-numeral {
  font-family: var(--font-mono);
  font-size: 320px;
  line-height: .82;
  font-weight: 700;
  letter-spacing: -0.06em;
  color: rgba(255,255,255,.06);
  margin: 0;
  user-select: none;
  position: absolute;
  right: 18mm;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: none;
}
.section-opener .op-bottom {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.section-opener .op-rule-mini {
  width: 60px;
  height: 2px;
  background: var(--tea-cyan-300);
  margin: 0 0 4px;
}
.section-opener .op-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--tea-cyan-300);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-opener .op-eyebrow::before {
  content: "";
  width: 30px; height: 1px;
  background: var(--tea-cyan-300);
}
.section-opener h1.op-title {
  font-size: 48px;
  line-height: 1;
  letter-spacing: -0.035em;
  font-weight: 800;
  color: #fff;
  margin: 0 0 14px;
  text-wrap: balance;
}
.section-opener .op-lede {
  font-size: 16px;
  line-height: 1.5;
  color: rgba(255,255,255,.85);
  max-width: 500px;
  text-wrap: pretty;
  margin: 0;
}

/* ---------- Chart frame ---------- */
.chart-card {
  background: #fff;
  border: 1px solid var(--tea-slate-200);
  border-radius: 12px;
  padding: 14px 16px;
}
.chart-card.dark {
  background: var(--tea-purple-night);
  color: #fff;
  border-color: transparent;
}
.chart-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--tea-purple-night);
  margin-bottom: 4px;
}
.chart-card.dark .chart-title { color: #fff; }
.chart-sub {
  font-size: 10px;
  color: var(--tea-slate-600);
  margin-bottom: 10px;
}
.chart-card.dark .chart-sub { color: rgba(255,255,255,.7); }

/* Horizontal bar mini-chart */
.hbar-row {
  display: grid;
  grid-template-columns: 120px 1fr 60px;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
  font-size: 10px;
}
.hbar-row .lbl { color: var(--tea-purple-night); font-weight: 600; }
.hbar-track { background: var(--tea-purple-50); height: 16px; border-radius: 3px; overflow: hidden; position: relative; }
.hbar-fill { height: 100%; border-radius: 3px; background: var(--grad-magenta-cyan); }
.hbar-val { font-family: var(--font-mono); font-size: 10px; color: var(--tea-purple-brand); font-weight: 500; text-align: right; }

/* Placeholder block for diagrams "to follow" */
.diagram-placeholder {
  position: relative;
  background: var(--tea-lavender);
  border: 1.5px dashed var(--tea-purple-300);
  border-radius: 12px;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  min-height: 180px;
  overflow: hidden;
}
.diagram-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 30%, rgba(217,70,239,.18), transparent 50%),
    radial-gradient(circle at 82% 70%, rgba(6,182,212,.18), transparent 50%);
  pointer-events: none;
}
.diagram-placeholder .dp-inner { position: relative; z-index: 1; max-width: 420px; }
.diagram-placeholder .dp-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--tea-purple-brand);
  margin-bottom: 6px;
}
.diagram-placeholder .dp-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--tea-purple-night);
  margin-bottom: 6px;
}
.diagram-placeholder .dp-desc {
  font-size: 10px;
  color: var(--tea-slate-600);
  line-height: 1.5;
}

/* Icon helpers */
.icon-sq {
  width: 26px; height: 26px;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--tea-purple-50);
  color: var(--tea-purple-brand);
}
.icon-sq svg { width: 15px; height: 15px; stroke-width: 1.5; }

/* Key-number marks inline */
.kn {
  font-family: var(--font-mono);
  color: var(--tea-purple-brand);
  font-weight: 500;
}
.kn-lg {
  font-weight: 800;
  color: var(--tea-purple-night);
}

/* Battle badge */
.battle-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--tea-purple-night);
  color: #fff;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.battle-badge .n {
  background: var(--grad-magenta-cyan);
  color: #fff;
  width: 20px; height: 20px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}

/* Small divider */
.hr-brand {
  height: 2px;
  background: var(--grad-magenta-cyan);
  border: none;
  margin: 10px 0;
  width: 40px;
}

/* Spacer helper */
.spacer { flex: 1; }

/* Print tuning: remove viewer shell */
@media print {
  body { background: #fff !important; }
  .viewer { max-width: none; padding: 0; gap: 0; }
  .page { box-shadow: none; margin: 0; }
}
