/* ════════════════════════════════════════════════════════════════════════
   A YEAR OF SKY — one page, from morning paper to night ops and back.
   Every color reads the lerped custom properties below; story.js drives
   --them from scroll position (the "nightness" engine).
   ════════════════════════════════════════════════════════════════════════ */

:root {
  /* lerped by story.js between paper (day) and console (night) values */
  --bg: #fbf9f4;
  --ink: #211e19;
  --ink-soft: #4f4a40;
  --ink-faint: #8a8273;
  --rule: #e3dcc9;
  --rule-dark: #c9c0a8;
  --accent: #a63a24;
  --accent-wash: #f3efe3;
  --panel: #f6f2e7;

  /* constants of the night register (data colors, never lerped) */
  --amber: #ffb454;
  --ice: #8fc7e8;
  --green: #7ee787;
  --alert: #ff5c5c;
  --night-bg: #060b14;
  --night-panel: #0c1524;
  --night-line: #16283e;

  --serif: "Newsreader", serif;
  --mono: "IBM Plex Mono", monospace;
  --disp: "Chakra Petch", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: var(--serif); font-optical-sizing: auto;
  color: var(--ink); background: var(--bg);
  font-size: 19px; line-height: 1.65;
  font-feature-settings: "onum" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: #ead9c4; color: #211e19; }

.sheet { max-width: 1020px; margin: 0 auto; padding: 0 24px; }
.measure { max-width: 640px; margin-left: auto; margin-right: auto; }

/* ───────────────────────── masthead (morning) ───────────────────────── */
header.masthead { text-align: center; padding: 74px 0 0; }
.rubric { font-size: 13px; letter-spacing: .28em; text-transform: uppercase;
  color: var(--accent); font-weight: 500; }
.rubric::before, .rubric::after { content: "—"; color: var(--rule-dark); margin: 0 14px; }
h1 { font-size: clamp(46px, 7.4vw, 80px); font-weight: 400; line-height: 1.02;
  letter-spacing: -.012em; margin: 24px auto 16px; max-width: 18ch; }
h1 em { font-style: italic; color: var(--accent); }
.dek { font-style: italic; font-size: 22px; color: var(--ink-soft);
  max-width: 47ch; margin: 0 auto; line-height: 1.5; }
.byline { font-size: 12px; letter-spacing: .24em; text-transform: uppercase;
  color: var(--ink-faint); margin-top: 28px; }
.diamond { text-align: center; color: var(--rule-dark); font-size: 14px; margin: 42px 0; }

/* ───────────────────────── prose ───────────────────────── */
.prose p { text-align: justify; hyphens: auto; -webkit-hyphens: auto; margin-bottom: 1.35em; }
.prose p + p { text-indent: 1.6em; }
.opening::first-letter { font-size: 4.9em; float: left; line-height: .78;
  padding: .07em .08em 0 0; font-weight: 500; }
.prose .num { font-weight: 500; white-space: nowrap; }
.prose .num.hot { color: var(--accent); }
sup.fn { font-size: .62em; color: var(--accent); font-style: normal; }
sup.fn a { color: inherit; text-decoration: none; }

.filter-line {
  margin: 2.2em 0 1.4em; padding: 1.1em 1.4em;
  background: var(--accent-wash);
  border-top: 1px solid var(--rule-dark); border-bottom: 1px solid var(--rule-dark);
  font-style: italic; color: var(--ink-soft);
  text-align: center !important; text-indent: 0 !important;
}
.filter-line select {
  font-family: inherit; font-size: inherit; font-style: normal; font-weight: 500;
  color: var(--accent); border: 0; border-bottom: 1px solid var(--accent);
  background: transparent; cursor: pointer; padding: 0 2px 1px; margin: 0 2px;
  appearance: none; -webkit-appearance: none; text-align: center;
}
.filter-line select:focus { outline: none; border-bottom-width: 2px; }
.filter-line option { color: #211e19; background: #fbf9f4; font-style: normal; }

/* ───────────────────────── sections & figures ───────────────────────── */
.section-head { text-align: center; margin: 72px 0 34px;
  font-size: 15px; letter-spacing: .26em; text-transform: uppercase; font-weight: 500; }
.section-head .numeral { color: var(--accent); margin-right: 14px; }

figure { margin: 38px auto 56px; max-width: 860px; }
figure.narrow { max-width: 640px; }
.fig-frame { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule-dark);
  padding: 26px 8px 18px; }
figcaption { font-style: italic; font-size: 15px; color: var(--ink-faint);
  text-align: center; margin-top: 14px; line-height: 1.55;
  max-width: 58ch; margin-left: auto; margin-right: auto; }
figcaption b { font-style: normal; font-weight: 500; color: var(--ink-soft); }
.chart-wrap { position: relative; height: 240px; }
.chart-tall { height: 300px; }

/* calendar */
.cal-scroll { overflow-x: auto; display: flex; justify-content: center; padding: 4px 0; }
.cal-inner { width: max-content; }
#cal-months { position: relative; height: 17px; font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }
#cal-months span { position: absolute; top: 0; }
#calendar { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px);
  gap: 2px; width: max-content; }
#calendar .cell { width: 12px; height: 12px; border-radius: 1px; background: var(--accent-wash); }
#calendar .cell:hover { outline: 1.5px solid var(--accent); }
.cal-meta { display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; font-size: 13px; font-style: italic; color: var(--ink-faint);
  flex-wrap: wrap; gap: 8px; }
.legend { display: flex; gap: 3px; align-items: center; font-style: normal; }
.legend i { width: 11px; height: 11px; border-radius: 1px; display: inline-block; }
#cal-tip { position: fixed; pointer-events: none; z-index: 100; white-space: nowrap;
  background: #211e19; color: #fbf9f4; font-size: 13px; font-style: italic;
  padding: 6px 12px; border-radius: 2px; opacity: 0; }

/* ───────────────────────── dusk interstitial ───────────────────────── */
.dusk {
  min-height: 90vh; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 10vh 24px;
}
.dusk p { font-style: italic; font-size: clamp(22px, 3vw, 29px);
  color: var(--ink-soft); max-width: 30ch; line-height: 1.7; text-wrap: balance; }
/* let the three deliberate <br> lines sit on one row each on desktop */
@media (min-width: 620px) { .dusk p { max-width: none; } }

/* ───────────────────────── the stage (night) ───────────────────────── */
.stage-wrap { position: relative; }
.stage-sticky { position: sticky; top: 0; height: 100vh; overflow: hidden; }
#stage-canvas { display: block; width: 100%; height: 100%; }
.stage-hud {
  position: absolute; top: 18px; right: 20px; text-align: right;
  font-family: var(--mono); pointer-events: none;
  background: rgba(6,11,20,.55); border: 1px solid var(--night-line);
  padding: 10px 16px;
}
.stage-hud .date { font-family: var(--disp); font-weight: 600; font-size: 20px;
  color: #fff; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.stage-hud .count { font-size: 10px; letter-spacing: .18em; color: var(--amber); margin-top: 3px; }
.stage-note {
  position: absolute; z-index: 6; left: 0; right: 0;
  width: min(360px, 80vw); margin: 0 auto; pointer-events: none;
  font-size: 14px; line-height: 1.7; color: #b9c6cc; font-style: italic;
  background: rgba(8,13,24,.78); border: 1px solid var(--night-line);
  border-left: 2px solid var(--amber); border-radius: 6px;
  padding: 16px 20px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.stage-note b { color: #eef4f6; font-weight: 500; font-style: normal; }
.stage-note .num { color: var(--amber); font-style: normal; font-weight: 500; }
.stage-note.left { margin-left: max(6vw, 24px); margin-right: auto; }
.stage-note.right { margin-right: max(6vw, 24px); margin-left: auto; }

/* ───────────────────────── night panels ───────────────────────── */
.night-zone .section-head { color: var(--ink); }
.panel {
  position: relative; background: var(--panel);
  border: 1px solid var(--rule); padding: 18px 18px 14px;
}
.night-zone .panel::before, .night-zone .panel::after {
  content: ""; position: absolute; width: 10px; height: 10px; pointer-events: none;
  border-color: #3b6a86; border-style: solid; border-width: 0;
}
.night-zone .panel::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.night-zone .panel::after { top: -1px; right: -1px; border-top-width: 2px; border-right-width: 2px; }
.panel h3 { font-family: var(--disp); font-weight: 600; font-size: 11px;
  letter-spacing: .22em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.panel .plain { font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  color: var(--ink-faint); margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 860px; margin: 38px auto; }
.grid2 .wide { grid-column: 1 / -1; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
.panel canvas.instrument { display: block; width: 100%; height: 230px; }

/* loudness scale */
.dba-scale { max-width: 760px; margin: 0 auto; padding: 10px 8px 0; }
.dba-track { position: relative; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--rule), var(--rule-dark) 45%, #c98a64 70%, var(--accent) 100%); }
.dba-mark { position: absolute; top: -5px; width: 1.5px; height: 16px; background: var(--ink-soft); }
.dba-mark.you { top: -8px; width: 2.5px; height: 22px; background: var(--accent); }
.dba-labels { position: relative; font-size: 13px; color: var(--ink-faint); }
.dba-labels span { position: absolute; transform: translateX(-50%); text-align: center;
  line-height: 1.45; white-space: nowrap; font-style: italic; }
.dba-labels b { display: block; font-style: normal; font-weight: 500; color: var(--ink-soft); font-size: 15px; }
.dba-top { height: 46px; margin-bottom: 10px; }
.dba-top span { bottom: 0; }
.dba-bottom { height: 52px; margin-top: 12px; }
.dba-bottom .you b { color: var(--accent); font-size: 19px; }

/* tables */
table { width: 100%; max-width: 640px; margin: 0 auto; border-collapse: collapse; font-size: 16px; }
caption { caption-side: top; text-align: center; font-size: 14px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--ink-soft); padding-bottom: 14px; font-weight: 500;
  font-family: var(--mono); }
th { font-weight: 500; font-style: italic; text-align: left; font-size: 15px;
  color: var(--ink-faint); border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule-dark); padding: 8px 10px; }
th.r, td.r { text-align: right; font-variant-numeric: tabular-nums; }
td { padding: 7px 10px; border-bottom: 1px solid var(--rule); }
tr:last-child td { border-bottom: 1px solid var(--ink); }
td .bar { display: inline-block; height: 9px; background: var(--accent); opacity: .75;
  vertical-align: baseline; margin-right: 10px; }
td.type { font-weight: 500; font-family: var(--mono); font-size: 14px; }
td .meaning { font-style: italic; color: var(--ink-faint); font-size: 14px; font-family: var(--serif); }

/* rare birds + curiosities (night cards) */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px; max-width: 980px; margin: 38px auto; }
.card { background: var(--panel); border: 1px solid var(--rule);
  border-left: 2px solid var(--accent); padding: 16px 18px;
  font-size: 14px; line-height: 1.65; }
.card .lede { font-family: var(--mono); font-size: 10px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 8px; }
.card b { color: var(--accent); font-weight: 500; }
.rare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 2px 28px; max-width: 980px; margin: 0 auto; }
.rare-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px;
  align-items: baseline; padding: 7px 4px; border-bottom: 1px dashed var(--rule);
  font-size: 14px; }
.rare-row .code { font-family: var(--mono); font-weight: 600; color: var(--accent); font-size: 13px; }
.rare-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rare-row .meta { font-family: var(--mono); color: var(--ink-faint); font-size: 11px; text-align: right; }

/* ───────────────────────── poster finale ───────────────────────── */
.poster {
  max-width: 880px; margin: 70px auto;
  border: 2px solid var(--ink); padding: 56px 48px 40px;
  text-align: center; background: var(--bg);
  box-shadow: 10px 10px 0 var(--accent-wash);
}
.poster .p-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .34em;
  text-transform: uppercase; color: var(--accent); }
.poster .p-num { font-size: clamp(64px, 11vw, 130px); font-weight: 500;
  line-height: 1; margin: 18px 0 6px; font-variant-numeric: tabular-nums; }
.poster .p-sub { font-style: italic; font-size: 20px; color: var(--ink-soft); }
.poster .p-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px; margin: 36px 0 26px; border-top: 1px solid var(--ink); padding-top: 22px; }
.poster .p-stat .v { font-size: 26px; font-weight: 500; }
.poster .p-stat .k { font-family: var(--mono); font-size: 9px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--ink-faint); margin-top: 4px; }
.poster .p-foot { font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  color: var(--ink-faint); text-transform: uppercase; }
.poster .p-foot b { color: var(--accent); font-weight: 500; }

/* footnotes */
.notes { margin: 80px auto 0; max-width: 640px; }
.notes hr { border: 0; border-top: 1px solid var(--ink); width: 88px; margin: 0 0 26px; }
.notes ol { list-style: none; counter-reset: fn; }
.notes li { counter-increment: fn; font-size: 15px; color: var(--ink-soft);
  margin-bottom: 14px; padding-left: 26px; position: relative; line-height: 1.6; }
.notes li::before { content: counter(fn) "."; position: absolute; left: 0;
  color: var(--accent); font-weight: 500; }
.notes a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--rule-dark); }
#refresh-link { cursor: pointer; }
#refresh-status { font-style: italic; color: var(--ink-faint); }
.console-cta { text-align: center; margin: 56px 0 0; }
.console-cta a {
  font-family: var(--mono); font-size: 12px; letter-spacing: .26em; text-transform: uppercase;
  color: var(--accent); text-decoration: none;
  border: 1px solid var(--rule-dark); padding: 13px 26px; display: inline-block;
  transition: all .2s;
}
.console-cta a:hover { border-color: var(--accent); box-shadow: 4px 4px 0 var(--accent-wash); }

footer { text-align: center; padding: 64px 0 56px; font-family: var(--mono);
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint);
  line-height: 2; }
footer a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--rule-dark); }
footer a:hover { color: var(--ink); }

/* veil + reveals */
.veil { position: fixed; inset: 0; background: #fbf9f4; z-index: 200;
  display: flex; align-items: center; justify-content: center; transition: opacity .6s; }
.veil.hide { opacity: 0; pointer-events: none; }
.veil p { font-style: italic; color: #8a8273; font-size: 17px; }
.reveal { opacity: 0; transform: translateY(22px);
  transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 700px) {
  body { font-size: 17px; }
  .prose p { text-align: left; }
  .poster { padding: 36px 20px 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { transition: none; opacity: 1; transform: none; }
}
