/* The World, Yesterday — one-picture summary poster */

:root {
  color-scheme: light;
  --surface-1:      #fcfcfb;
  --page-plane:     #f9f9f7;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:       #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11,11,11,0.10);

  --cat-blue:    #2a78d6;  /* politics */
  --cat-aqua:    #1baf7a;  /* climate / environment */
  --cat-red:     #e34948;  /* disaster */

  --status-good:     #0ca30c;
  --status-critical: #d03b3b;
  --success-text:    #006300;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1:      #1a1a19;
    --page-plane:     #0d0d0d;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --gridline:       #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255,255,255,0.10);

    --cat-blue:    #3987e5;
    --cat-aqua:    #199e70;
    --cat-red:     #e66767;

    --status-good:     #0ca30c;
    --status-critical: #d03b3b;
    --success-text:    #0ca30c;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-plane);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

body {
  display: flex;
  justify-content: center;
  padding: 28px 16px 48px;
}

.poster {
  width: 100%;
  max-width: 1180px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(11,11,11,0.06);
}

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

.masthead {
  padding: 28px 36px 20px;
  border-bottom: 1px solid var(--gridline);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.masthead h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.masthead .date {
  color: var(--text-secondary);
  font-size: 15px;
}

.masthead .strapline {
  width: 100%;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

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

.grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 0;
}

@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
}

.col-divider {
  border-left: 1px solid var(--gridline);
}

/* ---- Section headers ---- */

.section {
  padding: 22px 36px;
}
.section + .section {
  border-top: 1px solid var(--gridline);
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 14px;
}

/* ---- Category tag ---- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px 3px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.tag::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot);
  flex: none;
}
.tag-disaster   { --dot: var(--cat-red);      color: var(--cat-red); }
.tag-politics   { --dot: var(--cat-blue);     color: var(--cat-blue); }
.tag-climate    { --dot: var(--cat-aqua);     color: var(--cat-aqua); }
.tag-economy    { --dot: var(--text-muted);   color: var(--text-secondary); }

/* ---- Lead story ---- */

.lead {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.lead h2 {
  margin: 6px 0 0;
  font-size: 25px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.lead p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.55;
  max-width: 62ch;
}

.lead-figure {
  margin-top: 4px;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}

.mini-stat {
  min-width: 120px;
}
.mini-stat .value {
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: normal;
}
.mini-stat .value.critical { color: var(--status-critical); }
.mini-stat .label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Story cards ---- */

.stories {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 560px) {
  .stories { grid-template-columns: 1fr; }
}

.story {
  border: 1px solid var(--gridline);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.story h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.story p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* ---- Markets ---- */

.market-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--gridline);
}
.market-row:last-child { border-bottom: none; }

.market-name {
  font-size: 13.5px;
  font-weight: 600;
}
.market-close {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.market-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.market-delta.down { color: var(--status-critical); }
.market-delta.up   { color: var(--success-text); }
.market-delta .arrow { font-size: 11px; }

.market-note {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---- Climate strip ---- */

.climate-strip {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.climate-stat {
  flex: 1 1 140px;
}
.climate-stat .value {
  font-size: 26px;
  font-weight: 800;
}
.climate-stat .label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

/* heat bar */
.heat-scale {
  margin-top: 16px;
}
.heat-scale .track {
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, #cde2fb 0%, #86b6ef 25%, #eda100 60%, #e34948 85%, #d03b3b 100%);
  position: relative;
}
.heat-scale .marker {
  position: absolute;
  top: -5px;
  width: 2px;
  height: 20px;
  background: var(--text-primary);
}
.heat-scale .marker::after {
  content: attr(data-label);
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
}
.heat-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- Footer ---- */

.footer {
  padding: 18px 36px 26px;
  border-top: 1px solid var(--gridline);
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.6;
}
.footer a { color: var(--text-muted); }
