/* Sparrow Monument — v1 */
:root {
  --scale: 1;
  --night: #0b1530;
  --night-2: #13224d;
  --cream: #f6ecd6;
  --cream-dim: #d9cdb2;
  --amber: #f2b13b;
  --ink: #1b140d;
  --ink-soft: #3d3226;
  --red: #a3201a;
  --focus: #ffd34d;
  --paper: #efe3c4;
  --rule: #1b140d;
  --head: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --body: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, sans-serif;
  --bar-h: 4.25rem;
}

*, *::before, *::after { box-sizing: border-box; }
/* 20px base; A− floors at 0.9 = 18px. */
html { font-size: calc(20px * var(--scale)); scroll-behavior: smooth; scroll-padding-top: calc(var(--bar-h) + 4.5rem); }
html[data-motion="off"] { scroll-behavior: auto; }
body { margin: 0; background: var(--night); color: var(--cream); font-family: var(--body); line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 0.08em; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd { font-family: var(--body); font-weight: 700; border: 2px solid currentColor; border-radius: 6px; padding: 0 0.35em; }

.skip { position: absolute; left: 1rem; top: -10rem; z-index: 100; background: var(--focus); color: var(--ink); padding: 0.75rem 1.25rem; font-weight: 700; border-radius: 8px; }
.skip:focus { top: 1rem; }

/* ---------- Top bar ---------- */
.topbar { position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--bar-h); display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 1rem; background: rgba(11, 21, 48, 0.94); border-bottom: 1px solid rgba(246, 236, 214, 0.18); backdrop-filter: blur(6px); }
.brand { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 48px; min-width: 48px; font-family: var(--head); font-weight: 700; font-size: 1rem; text-decoration: none; white-space: nowrap; overflow: hidden; }
.brand-mark { width: 2rem; height: 2rem; color: var(--amber); flex-shrink: 0; }
.brand-text { overflow: hidden; text-overflow: ellipsis; }
.brand-years { color: var(--amber); }
.controls { display: flex; gap: 0.5rem; flex-shrink: 0; }
.controls button, .btn, .play-btn, .yearbar a {
  min-height: 48px; min-width: 48px; font: 700 1rem/1.2 var(--body); cursor: pointer; border-radius: 10px; }
.controls button { background: transparent; color: var(--cream); border: 2px solid var(--cream-dim); padding: 0 0.8rem; }
.controls button:hover { background: var(--cream); color: var(--night); }
#motion-toggle[aria-pressed="false"] { border-color: var(--amber); color: var(--amber); }
@media (max-width: 560px) {
  .brand-text { display: none; }
  #motion-toggle { font-size: 0.9rem; padding: 0 0.5rem; }
}

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.6rem 1.3rem; border: 2px solid var(--cream); background: transparent; color: var(--cream); text-decoration: none; }
.btn:hover { background: var(--cream); color: var(--night); }
.btn-primary { background: var(--amber); border-color: var(--amber); color: var(--night); }
.btn-primary:hover { background: var(--cream); border-color: var(--cream); }
.btn-ghost { border-color: transparent; text-decoration: underline; }

/* ---------- 1 · Flight ---------- */
.flight, .crown { position: relative; min-height: 100vh; min-height: 100svh; overflow: hidden; isolation: isolate;
  background: radial-gradient(ellipse at 50% 120%, #1d3170 0%, var(--night) 60%); }
.sky { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.sky canvas { position: absolute; inset: 0; }
.sky-static { display: none; position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; color: var(--amber); opacity: 0.9; }
.map-labels .pin { position: absolute; font-size: 0.9rem; font-weight: 700; color: var(--cream-dim); letter-spacing: 0.02em; }
.pin-grenada { left: 12%; top: 22%; }
.pin-trinidad { right: 10%; bottom: 30%; }
.flight-copy { position: relative; display: grid; align-content: end; min-height: 100vh; min-height: 100svh; padding: calc(var(--bar-h) + 2rem) 1rem 5.5rem; max-width: 60rem; margin: 0 auto; }
.captions { list-style: none; margin: 0 0 2rem; padding: 0; display: grid; gap: 0.75rem; }
.cap { font-size: 1.2rem; max-width: 36em; text-shadow: 0 2px 12px var(--night); }
.title-card .kicker { color: var(--amber); font-weight: 700; margin: 0; letter-spacing: 0.04em; }
.title-card h1 { font-family: var(--head); font-weight: 900; font-size: clamp(2.6rem, 9vw, 6rem); line-height: 1; margin: 0.3rem 0; text-shadow: 0 4px 30px var(--night); }
.title-card .years { font-family: var(--head); font-size: clamp(1.5rem, 4vw, 2.4rem); margin: 0; color: var(--amber); }
.title-card .tagline { font-family: var(--head); font-style: italic; font-size: clamp(1.4rem, 3.5vw, 2rem); margin: 0.4rem 0 1.4rem; }
.title-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.flight > .sources { position: absolute; left: 1rem; right: 1rem; bottom: 1rem; max-width: 60rem; margin: 0 auto; }

/* Animated mode: captions play one at a time; title card waits for the landing. */
html.js[data-motion="on"] .flight .cap { opacity: 0; transform: translateY(0.6rem); transition: opacity 0.8s, transform 0.8s; position: absolute; }
html.js[data-motion="on"] .flight-copy > * { grid-area: 1 / 1; align-self: end; }
html.js[data-motion="on"] .flight .captions { position: relative; min-height: 8em; margin: 0; }
html.js[data-motion="on"] .flight .cap { bottom: 0; }
html.js[data-motion="on"] .flight .map-labels { transition: opacity 1.2s; }
html.js[data-motion="on"] .flight[data-step="4"] .map-labels { opacity: 0; }
html.js[data-motion="on"] .flight[data-step="1"] .cap[data-step="1"],
html.js[data-motion="on"] .flight[data-step="2"] .cap[data-step="2"],
html.js[data-motion="on"] .flight[data-step="3"] .cap[data-step="3"] { opacity: 1; transform: none; }
html.js[data-motion="on"] .flight .title-card { opacity: 0; transform: translateY(1rem); transition: opacity 1.2s, transform 1.2s; }
html.js[data-motion="on"] .flight[data-step="4"] .title-card { opacity: 1; transform: none; }
html.js[data-motion="on"] .flight[data-step="4"] .captions { display: none; }
html.js[data-motion="on"] .flight:not([data-step="4"]) .title-actions a { visibility: hidden; }
/* Reduced motion / no canvas: static silhouette, everything visible. */
html[data-motion="off"] .sky { display: none; }
html[data-motion="off"] .sky-static, html:not(.p5-ok) .sky-static { display: block; }
html[data-motion="off"] .sky-static { opacity: 0.35; }
html[data-motion="off"] #replay, html[data-motion="off"] .map-labels, html:not(.p5-ok) .map-labels { display: none; }

/* ---------- 2 · Sang the News ---------- */
.newsroom { background: #1a1712; color: var(--cream); padding-bottom: 4rem; }
.news-intro { max-width: 46rem; margin: 0 auto; padding: 4rem 1rem 1.5rem; }
.news-intro h2 { font-family: var(--head); font-weight: 900; font-size: clamp(2.2rem, 7vw, 4rem); line-height: 1.05; margin: 0 0 1rem; }
.news-intro p { font-size: 1.1rem; margin: 0 0 0.8rem; }
.hint { color: var(--cream-dim); }

.yearbar { position: sticky; top: var(--bar-h); z-index: 40; background: rgba(26, 23, 18, 0.97); border-block: 1px solid rgba(246, 236, 214, 0.2); }
.yearbar ol { list-style: none; margin: 0 auto; padding: 0.5rem 1rem; display: flex; gap: 0.4rem; overflow-x: auto; max-width: 75rem; scrollbar-width: thin; }
.yearbar a { display: inline-flex; align-items: center; padding: 0 0.85rem; white-space: nowrap; text-decoration: none; border: 2px solid transparent; color: var(--cream); }
.yearbar a:hover { border-color: var(--cream-dim); }
.yearbar a[aria-current="true"] { background: var(--amber); color: var(--ink); }

.fronts { display: grid; gap: 3.5rem; padding: 2.5rem 1rem 0; max-width: 72rem; margin: 0 auto; }

.front { --paper: #efe3c4; --mast-bg: transparent; --mast-ink: var(--ink); --accent: var(--red);
  background: var(--paper); color: var(--ink); border-radius: 3px; padding: 0 clamp(1rem, 3vw, 2.5rem) 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); position: relative; }
.front:focus { outline: none; }
.front:focus-visible { outline: 4px solid var(--focus); }
/* Paper ages by era */
.front.era-fifties { --paper: #e9d8ad; background-image: radial-gradient(ellipse at 20% 10%, rgba(120, 80, 20, 0.12), transparent 60%), radial-gradient(ellipse at 90% 90%, rgba(120, 80, 20, 0.16), transparent 55%); }
.front.era-sixties { --paper: #efe3c4; }
.front.era-seventies { --paper: #f6efdf; --mast-bg: var(--red); --mast-ink: #fff8ec; }
.front.era-eighties { --paper: #fbf8f1; --mast-bg: #0b3d91; --mast-ink: #ffffff; --accent: #0b3d91; }
.front.era-modern { --paper: #ffffff; --mast-bg: var(--ink); --mast-ink: #ffffff; --accent: var(--ink); }
.front.era-screen { --paper: #0f1d42; --ink: var(--cream); --mast-bg: transparent; --mast-ink: var(--amber); --accent: var(--amber); --rule: var(--cream-dim); --ink-soft: var(--cream-dim);
  color: var(--cream); border: 2px solid rgba(242, 177, 59, 0.5); box-shadow: 0 0 80px rgba(242, 177, 59, 0.18); }

.masthead { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0.5rem;
  border-bottom: 4px double var(--rule); padding: 1rem 0 0.6rem; margin: 0 calc(-1 * clamp(1rem, 3vw, 2.5rem)) 1.2rem; padding-inline: clamp(1rem, 3vw, 2.5rem);
  background: var(--mast-bg); color: var(--mast-ink); }
.mast-name { font-family: var(--head); font-weight: 900; font-style: italic; font-size: clamp(1.4rem, 4vw, 2.2rem); line-height: 1; }
.mast-meta { font-weight: 700; font-size: 0.95rem; letter-spacing: 0.06em; text-transform: uppercase; }

.front-body { display: grid; gap: 1.5rem 2.5rem; }
@media (min-width: 860px) { .front-body { grid-template-columns: 1.35fr 1fr; } .reply { border-left: 2px solid var(--rule); padding-left: 2rem; } }
.dateline { margin: 0; font-weight: 700; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; }
.headline { font-family: var(--head); font-weight: 900; font-size: clamp(2.1rem, 6.2vw, 4.4rem); line-height: 1.02; margin: 0.25rem 0 0.9rem; letter-spacing: -0.01em; text-wrap: balance; overflow-wrap: anywhere; }
.deck { font-family: var(--head); font-weight: 700; font-style: italic; font-size: 1.3rem; line-height: 1.35; margin: 0 0 0.9rem; border-top: 1px solid var(--rule); padding-top: 0.7rem; }
.front .news { font-size: 1.1rem; margin: 0; }
.content-note { margin-top: 1rem; padding: 0.6rem 0.8rem; border: 2px solid var(--accent); border-radius: 6px; }

.reply-kicker { margin: 0 0 0.4rem; font-size: 0.95rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.song { font-family: var(--head); font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin: 0 0 0.6rem; }
.song cite { font-style: normal; }
.aka { font-family: var(--body); font-size: 1rem; font-weight: 400; color: var(--ink-soft); }
.readings-intro { margin: 0.4rem 0 0; font-weight: 700; }
.pull { margin: 0.8rem 0; padding: 0 0 0 1rem; border-left: 5px solid var(--accent); }
.pull p { font-family: var(--head); font-style: italic; font-size: 1.25rem; line-height: 1.4; margin: 0 0 0.3rem; }
.pull footer { font-size: 0.95rem; color: var(--ink-soft); }
.pull footer::before { content: '— '; }
.note { font-size: 1rem; color: var(--ink-soft); }
.tributes .pull p { font-size: 1.15rem; }

.player { margin-top: 1.2rem; display: grid; gap: 0.6rem; }
.play-btn { display: inline-flex; align-items: center; gap: 0.6rem; justify-content: center; padding: 0.7rem 1.2rem; background: var(--ink); color: var(--paper); border: 2px solid var(--ink); }
.era-screen .play-btn { background: var(--amber); color: var(--night); border-color: var(--amber); }
.play-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.play-icon { font-size: 0.85em; }
.player iframe { width: 100%; height: 120px; border: 0; border-radius: 6px; background: #fff; }
.buy { font-size: 0.95rem; }

.sources { margin-top: 1.4rem; border-top: 1px solid var(--rule); padding-top: 0.6rem; font-size: 0.95rem; }
.sources summary { cursor: pointer; font-weight: 700; min-height: 48px; display: flex; align-items: center; }
.sources ul { margin: 0.4rem 0 0; padding-left: 1.2rem; display: grid; gap: 0.35rem; }
.sources-dark { border-color: rgba(246, 236, 214, 0.25); color: var(--cream); }

/* Reveal (animated mode only) */
html.js[data-motion="on"] .front { opacity: 0; transform: translateY(40px) rotate(-0.6deg); transition: opacity 0.7s ease, transform 0.9s cubic-bezier(.2, .7, .2, 1); }
html.js[data-motion="on"] .front:nth-child(even) { transform: translateY(40px) rotate(0.6deg); }
html.js[data-motion="on"] .front.is-in { opacity: 1; transform: none; }

/* ---------- 3 · Crown ---------- */
.crown { background: radial-gradient(ellipse at 50% 20%, #1d3170 0%, var(--night) 65%); }
.crown-static { color: var(--amber); }
.crown-copy { max-width: 60rem; margin: 0 auto; padding: 46vh 1rem 4rem; text-align: center; }
.crown-copy h2 { font-family: var(--head); font-weight: 900; font-size: clamp(2.6rem, 9vw, 5.5rem); margin: 0; color: var(--amber); }
.epitaph { font-family: var(--head); font-style: italic; font-size: clamp(1.4rem, 3.6vw, 2.1rem); line-height: 1.3; margin: 0.6rem auto 2.2rem; max-width: 30em; }
.epitaph-by { display: block; font-family: var(--body); font-style: normal; font-size: 1rem; color: var(--cream-dim); margin-top: 0.4rem; }
.epitaph-by::before { content: '— '; }
.stats { list-style: none; padding: 0; margin: 0 0 2.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1rem; }
.stats li { border: 2px solid rgba(242, 177, 59, 0.45); border-radius: 10px; padding: 1rem 0.5rem; display: grid; gap: 0.2rem; }
.stat-n { font-family: var(--head); font-weight: 900; font-size: 2.6rem; line-height: 1; color: var(--amber); }
.stat-l { font-size: 1rem; }
.crown-copy h3 { font-family: var(--head); font-size: 1.6rem; margin: 0 0 0.8rem; }
.honours { list-style: none; padding: 0; margin: 0 auto 1.5rem; max-width: 40rem; text-align: left; display: grid; gap: 0.6rem; }
.honours li { display: grid; grid-template-columns: 4rem 1fr; gap: 0.8rem; align-items: baseline; border-bottom: 1px solid rgba(246, 236, 214, 0.15); padding-bottom: 0.6rem; }
.h-year { font-weight: 700; color: var(--amber); }
.crown-copy .sources { text-align: left; max-width: 40rem; margin-inline: auto; }

/* ---------- Footer ---------- */
.site-foot { background: #070d20; padding: 3rem 1rem 4rem; }
.foot-inner { max-width: 46rem; margin: 0 auto; }
.site-foot h2 { font-family: var(--head); font-size: 1.8rem; margin: 0 0 1rem; }
.site-foot .sources { border-color: rgba(246, 236, 214, 0.25); }
.credit { margin-top: 2rem; color: var(--cream-dim); }

@media (forced-colors: active) {
  .front, .stats li { border: 2px solid CanvasText; }
  .yearbar a[aria-current="true"] { outline: 3px solid Highlight; }
}
@media print {
  .topbar, .yearbar, .sky, .sky-static, .player, .flight .title-actions { display: none !important; }
  .front { break-inside: avoid; box-shadow: none; opacity: 1 !important; transform: none !important; }
}
