/* ExplainSong — song analysis page.
   Editorial dossier layout, sharing the type and colour system of the songs
   directory (/songs.html) so the archive and the entries read as one site.

   Colour note: --red (#ec3013) is the accent and is GRAPHIC ONLY — white on it
   is 4.2:1, so it can never carry small text. --red-ui (#c0240c) is the same
   hue darkened to clear 4.5:1 on every surface used here. */

:root {
  --canvas: #e6e4e4;
  --panel: #f3f2f2;
  --band: #eae9e9;
  --ink: #201e1d;
  --body: #444141;
  --muted: #605d5d;
  --faint: #9b9797;
  --rule: #d7d3d3;
  --tint: #fff2ef;
  --red: #ec3013;
  --red-ui: #c0240c;
  --red-deep: #ae1800;
  --measure: 68ch;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Archivo, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.6;
}
a { color: var(--red-deep); text-decoration: none; }
a:hover { color: var(--red-ui); text-decoration: underline; text-underline-offset: 3px; }
::selection { background: rgba(236, 48, 19, .28); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

.sheet {
  max-width: 1280px;
  margin: 0 auto;
  background: var(--panel);
  border-left: 2px solid var(--ink);
  border-right: 2px solid var(--ink);
}
@media (max-width: 1320px) { .sheet { border-left: 0; border-right: 0; } }

/* ── reading progress ─────────────────────────────────────── */
.progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--red); z-index: 60;
}

/* ── masthead ─────────────────────────────────────────────── */
.masthead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 68px; padding: 12px 40px; flex-wrap: wrap;
  border-bottom: 2px solid var(--ink);
  position: sticky; top: 0; z-index: 50; background: var(--panel);
}
.brand { display: flex; align-items: baseline; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { font-weight: 800; font-size: 20px; color: var(--red); }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: -.01em; }
.nav { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.nav a { font-weight: 600; font-size: 14px; color: var(--muted); }
.nav a[aria-current="page"] {
  font-weight: 800; color: var(--ink);
  border-bottom: 2px solid var(--red); padding-bottom: 3px;
}

/* ── breadcrumb ───────────────────────────────────────────── */
.crumbs {
  padding: 14px 40px; border-bottom: 1px solid var(--rule);
  font-size: 13px; color: var(--muted);
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--red-ui); }
.crumbs span { margin: 0 8px; color: var(--muted); }

/* ── hero ─────────────────────────────────────────────────── */
.hero { padding: 48px 40px 40px; border-bottom: 2px solid var(--ink); }
.kicker {
  font-weight: 800; font-size: 12px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--red-ui); margin: 0 0 18px;
}
.hero h1 {
  margin: 0 0 16px; font-weight: 800;
  font-size: clamp(44px, 7.5vw, 88px); line-height: .98;
  letter-spacing: -.035em; max-width: 16ch;
}
.byline {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px;
  font-weight: 600; font-size: 17px; color: var(--muted); margin: 0 0 28px;
}
.byline b { font-weight: 800; color: var(--ink); }
.byline i { font-style: normal; color: var(--muted); }

.answer {
  border-left: 4px solid var(--red);
  padding: 4px 0 4px 22px; max-width: 62ch;
}
.answer-label {
  display: block; font-weight: 800; font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--red-ui); margin-bottom: 10px;
}
.answer p {
  margin: 0; font-size: clamp(19px, 2.1vw, 23px);
  line-height: 1.45; letter-spacing: -.011em; color: var(--ink);
}

/* ── fact strip ───────────────────────────────────────────── */
.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 2px; background: var(--rule);
  border-bottom: 2px solid var(--ink);
}
.fact { background: var(--band); padding: 20px 24px; }
.fact dt {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.fact dd {
  margin: 0; font-weight: 800; font-size: 19px; line-height: 1.2;
  letter-spacing: -.015em;
}
.fact dd small { display: block; font-weight: 600; font-size: 13px; color: var(--muted); letter-spacing: 0; margin-top: 3px; }

/* ── body layout ──────────────────────────────────────────── */
.layout {
  display: grid; grid-template-columns: 260px 1fr;
  align-items: start;
}
.rail {
  position: sticky; top: 92px;
  padding: 36px 24px 36px 40px;
}
.rail-label {
  font-weight: 800; font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 14px;
}
.toc { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: flex; gap: 10px; align-items: baseline;
  padding: 7px 0; font-weight: 600; font-size: 14px;
  color: var(--muted); border-bottom: 1px solid var(--rule);
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-size: 11px; font-weight: 800; color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.toc a:hover { color: var(--red-ui); text-decoration: none; }
.toc a[aria-current="true"] { color: var(--ink); font-weight: 800; }
.toc a[aria-current="true"]::before { color: var(--red-ui); }

/* The divider lives here, not on .rail: the rail is sticky and therefore only
   as tall as its own content, which left the rule as a short stub. */
.article {
  padding: 36px 40px 8px; min-width: 0;
  border-left: 2px solid var(--ink);
  max-width: 820px; margin: 0 auto; width: 100%;
}

/* ── sections ─────────────────────────────────────────────── */
.article section { counter-increment: sec; padding-bottom: 8px; }
.article { counter-reset: sec; }
.article section + section { margin-top: 44px; padding-top: 40px; border-top: 2px solid var(--ink); }
.article h2 {
  display: flex; align-items: baseline; gap: 14px;
  margin: 0 0 20px; font-weight: 800;
  font-size: clamp(25px, 3vw, 33px); line-height: 1.1; letter-spacing: -.025em;
}
.article h2::before {
  content: counter(sec, decimal-leading-zero);
  flex: none; font-size: 13px; letter-spacing: .06em; color: var(--panel);
  background: var(--ink); padding: 5px 8px; transform: translateY(-4px);
  font-variant-numeric: tabular-nums;
}
.article p {
  margin: 0 0 18px; max-width: var(--measure);
  color: var(--body); text-wrap: pretty;
}
.article p strong { color: var(--ink); }
.article em { font-style: italic; }

/* Lyric quotes: the loudest thing on the page after the title. */
.article blockquote {
  margin: 30px 0; padding: 20px 0 20px 26px;
  border-left: 4px solid var(--red);
  font-weight: 800; font-size: clamp(19px, 2.2vw, 25px);
  line-height: 1.35; letter-spacing: -.02em; color: var(--ink);
  max-width: 46ch; text-wrap: pretty;
}

/* Gloss under a pull quote: the English of a French/Italian aria line. Additive
   — only pages that carry the markup are affected. It sits directly under the
   blockquote and shares its rule, so read the two as one unit. */
.article .quote-gloss {
  margin: -22px 0 30px; padding-left: 30px;
  max-width: 46ch; font-size: 15px; line-height: 1.5;
  color: var(--muted); font-style: italic;
}

/* ── video ────────────────────────────────────────────────── */
.video-frame { border: 2px solid var(--ink); background: var(--ink); margin: 26px 0 10px; }
.video-frame .youtube-embed { position: relative; padding-bottom: 56.25%; height: 0; }
.video-frame iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block;
}
.video-cap { font-size: 13px; color: var(--muted); margin: 0 0 8px; }

/* ── lyrics call-out ──────────────────────────────────────── */
.lyrics-cta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  background: var(--ink); color: var(--panel);
  padding: 26px 28px; margin: 26px 0 6px;
}
.lyrics-cta p { margin: 0; max-width: 46ch; color: #d7d3d3; font-size: 15px; }
.lyrics-cta b { display: block; color: #fff; font-size: 19px; font-weight: 800; margin-bottom: 4px; letter-spacing: -.015em; }
.lyrics-cta a.lyrics-link {
  flex: none; font-weight: 800; font-size: 14px; letter-spacing: .04em;
  text-transform: uppercase; color: #fff; background: var(--red-ui);
  padding: 15px 24px; border: 2px solid var(--red-ui);
}
.lyrics-cta a.lyrics-link:hover { background: #a81a04; border-color: #a81a04; color: #fff; text-decoration: none; }

/* ── Editorial articles ───────────────────────────────────────────────────
   The long-form pieces (/blog/*, the root essays and list articles) share this
   sheet rather than carrying a second design system, so a reader moving from a
   song page to a story sees one site. Every rule below is additive: song pages
   carry none of this markup and are unaffected.

   The numbered .article h2 badge does real work on a list article — it is the
   item number, so a "10 songs that…" piece needs no separate counter. */

/* Deck under the headline. Sits where a song page puts its byline. */
.standfirst {
  margin: -4px 0 22px; max-width: 54ch;
  font-size: clamp(18px, 2vw, 21px); line-height: 1.45;
  letter-spacing: -.01em; color: var(--body);
}

/* Pull-out box: a "fun fact", a caveat, a definition. */
.callout {
  margin: 28px 0; padding: 20px 24px;
  background: var(--tint); border-left: 4px solid var(--red);
  max-width: var(--measure);
}
.callout-label {
  display: block; font-weight: 800; font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--red-ui); margin-bottom: 8px;
}
.callout p { margin: 0; color: var(--body); }
.callout p + p { margin-top: 12px; }

.article h3 {
  margin: 30px 0 12px; font-weight: 800;
  font-size: clamp(18px, 1.8vw, 21px); letter-spacing: -.018em; color: var(--ink);
}

.article ul, .article ol { margin: 0 0 18px; padding-left: 22px; max-width: var(--measure); }
.article li { margin-bottom: 9px; color: var(--body); }
.article li::marker { color: var(--red-ui); font-weight: 800; }

/* Hand-off at the end of a list item to that song's own page. */
.section-link {
  display: inline-block; margin-top: 4px;
  font-weight: 800; font-size: 14px; letter-spacing: .01em;
}

/* ── related ──────────────────────────────────────────────── */
.related { border-top: 2px solid var(--ink); padding: 36px 40px 40px; }
.related h2 {
  margin: 0 0 20px; font-weight: 800; font-size: 24px; letter-spacing: -.02em;
}
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: var(--ink); }
.rel {
  display: block; background: var(--panel); padding: 20px 22px; color: var(--ink);
}
.rel:hover { background: var(--tint); text-decoration: none; }
.rel-artist { display: block; font-weight: 600; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.rel-title { display: block; font-weight: 800; font-size: 19px; line-height: 1.15; letter-spacing: -.018em; margin-bottom: 7px; }
.rel-teaser { display: block; font-size: 13px; line-height: 1.45; color: var(--body); }

.backlink { border-top: 2px solid var(--ink); padding: 24px 40px; background: var(--band); }
.backlink a { font-weight: 800; font-size: 14px; }

/* ── footer ───────────────────────────────────────────────── */
.foot {
  border-top: 2px solid var(--ink); padding: 32px 40px;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.foot-brand { font-weight: 800; font-size: 17px; margin-bottom: 6px; }
.foot-brand span { color: var(--red-ui); }
.foot-tag { font-size: 13px; color: var(--muted); }
.foot-links { display: flex; gap: 26px; flex-wrap: wrap; align-items: baseline; }
.foot-links a { font-size: 13px; color: var(--muted); }
.foot-copy { font-size: 13px; color: var(--muted); }

/* ── responsive ───────────────────────────────────────────── */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .rail {
    position: static; border-bottom: 2px solid var(--ink);
    padding: 24px 40px;
  }
  .article { border-left: 0; max-width: none; }
  .toc { display: flex; flex-wrap: wrap; gap: 0 22px; }
  .toc a { border-bottom: 0; }
  .related-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .masthead, .crumbs, .hero, .rail, .article, .related, .backlink, .foot {
    padding-left: 20px; padding-right: 20px;
  }
  .fact { padding: 16px 20px; }
  .masthead { position: static; }
  .hero { padding-top: 32px; padding-bottom: 30px; }
  .article h2::before { transform: translateY(-2px); }
  .lyrics-cta { padding: 22px 20px; }
  .lyrics-cta a.lyrics-link { width: 100%; text-align: center; }
}

/* ── Album cover ──────────────────────────────────────────────────────────
   Additive: only pages that carry the markup are affected, so the earlier
   pilot pages are untouched.

   The sleeve is hotlinked from Apple's CDN and carries a visible link to its
   Apple Music page — see fetch-album-art.js for why both of those are
   load-bearing rather than decorative. It is shown square and uncropped
   (`object-fit: contain`); never crop a cover to fit a slot. The generated
   tile from generate-song-art.js sits behind it as a background, so a rotated
   Apple URL degrades to abstract art rather than an empty box. */
.cover {
  display: flex;
  align-items: center;
  gap: 20px;
  /* Matches the .hero / .article inset so the sleeve lines up with the
     headline above it rather than sitting flush against the sheet edge. */
  margin: 28px 0 34px;
  padding: 0 40px;
}

.cover-art {
  position: relative;
  flex: none;
  width: 132px;
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  overflow: hidden;
  background-color: #efece7;
  background-size: cover;
  background-position: center;
  box-shadow: 0 1px 2px rgba(20, 19, 18, 0.16), 0 10px 24px rgba(20, 19, 18, 0.1);
}
.cover-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cover-meta {
  min-width: 0;
  font: 400 13px/1.55 Archivo, system-ui, sans-serif;
  color: #55504b;
}
.cover-meta b {
  display: block;
  font-weight: 600;
  color: #201e1d;
}
.cover-meta a {
  color: var(--red-ui, #c0240c);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 720px) {
  .cover { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 640px) {
  .cover-art { width: 104px; }
  .cover { gap: 16px; margin-top: 22px; margin-bottom: 28px; }
}
