/* ExplainSong homepage — the "1b editorial" direction from the
   `ExplainSong Mobile.dc.html` Claude Design comp, with the comp's own 1440
   layout ("2a — Desktop for 1b") as the wide breakpoint.

   Mobile-first. The comp draws mobile inside a 402x874 iOS frame and desktop
   inside a 1440x900 browser frame; everything between those two widths is
   interpolated here, since a real site has to answer at every width.

   Deliberate departure from the comp's pixel values: the mockup pads the top
   of the phone screen by 62px to clear the iOS status bar and dynamic island.
   There is no status bar in a browser, so that inset is not reproduced — it
   would read as a large unexplained gap.

   Colour: the comp's accent is oklch(0.72 0.19 25). At the 9–11px sizes the
   comp uses it for kickers, that hue does not clear 4.5:1 on this background,
   so it is split the same way the songs directory splits its red — --accent
   is the graphic hue (rules, the hero emphasis at 46px+), --accent-ink is a
   lightened variant reserved for small text. Verified in-browser; see
   CLAUDE.md. Do not use --accent for anything below ~24px. */

:root {
  color-scheme: dark;

  --bg: #100e0d;
  --bg-raised: #191512;

  /* Text ramp. Every value here is used for text a reader must read, so each
     one clears 4.5:1 on --bg. The comp's own rgba(243,237,230,.35) sits at
     about 3.2:1 and is not reproduced for text. */
  --ink: #f3ede6;
  --ink-muted: rgba(243, 237, 230, 0.78);
  --ink-dim: rgba(243, 237, 230, 0.66);

  /* Non-text only: hairlines, tile fills, the scrim. */
  --line: rgba(243, 237, 230, 0.14);
  --line-strong: rgba(243, 237, 230, 0.28);

  --accent: #fb6a4b;
  --accent-ink: #ff9074;

  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: 24px;
  --maxw: 1440px;
}

@supports (color: oklch(0.72 0.19 25)) {
  :root {
    --accent: oklch(0.72 0.19 25);
    --accent-ink: oklch(0.8 0.15 28);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 12px 18px;
  background: var(--bg-raised);
  color: var(--ink);
  font: 400 14px/1 var(--sans);
}
.skip-link:focus {
  left: 12px;
  top: 12px;
}

.shell {
  max-width: var(--maxw);
  margin: 0 auto;
}

/* ── Masthead ─────────────────────────────────────────────────── */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px var(--gutter) 0;
}

.wordmark {
  font: 400 20px/1 var(--serif);
  letter-spacing: 0.01em;
  color: var(--ink);
}

/* The comp draws a two-line hamburger. It opens nothing in the mockup; here it
   is a real disclosure button toggling .nav. */
/* Carries the `hidden` attribute in the markup and is revealed by home.js, so
   a no-JS reader never meets a button that cannot do anything. `hidden` loses
   to `display:flex` on specificity, hence the explicit rule. */
.nav-toggle[hidden] {
  display: none;
}
.nav-toggle {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 2px;
  background: none;
  border: 0;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 1px;
  background: var(--ink-muted);
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.nav-toggle[aria-expanded="true"] span:first-child {
  transform: translateY(2.5px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:last-child {
  transform: translateY(-2.5px) rotate(-45deg);
}

/* Same progressive-disclosure shape as the songs directory: the collapsed
   state is applied only under `.js`, so with scripting off the whole nav is
   simply present. (The directory's gotcha applies here too — a new page that
   renames these classes will render the expanded list while the toggle claims
   otherwise.) */
.nav {
  display: block;
  padding: 18px var(--gutter) 0;
}
.js .nav {
  display: none;
}
.js .nav[data-open="true"] {
  display: block;
}
.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav a {
  display: block;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font: 300 16px/1.2 var(--sans);
  color: var(--ink-muted);
}
.nav a:hover {
  color: var(--ink);
}

/* The desktop search affordance in the masthead; hidden on mobile, where the
   hero field is the only entry point. */
.masthead-search {
  display: none;
}

/* The "recently explained" rail belongs to the 1440 artboard only. It is in
   the markup once and hidden here, rather than duplicated per breakpoint —
   two copies would mean two sets of the same links in the document. */
.recent {
  display: none;
}

/* ── Hero ─────────────────────────────────────────────────────── */

.hero {
  padding: 38px var(--gutter) 0;
}

.hero h1 {
  margin: 0 0 22px;
  font: 400 clamp(38px, 11.5vw, 46px) / 0.98 var(--serif);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

/* The search field. It is a real <button> that opens the overlay: on a phone
   the comp shows a tap target, not a focused input, and a button announces
   that correctly to a screen reader. */
.search-open {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0 0 14px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.search-open:hover {
  border-bottom-color: var(--accent);
}
.search-open .placeholder {
  font: 300 17px/1 var(--sans);
  color: var(--ink-dim);
}
.search-open .label {
  font: 400 11px/1 var(--mono);
  letter-spacing: 0.04em;
  color: var(--accent-ink);
  flex: none;
}

/* ── Section rule ─────────────────────────────────────────────── */

.rule {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 30px var(--gutter) 22px;
}
.rule::before,
.rule::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}
.rule span {
  font: 400 10px/1 var(--mono);
  letter-spacing: 0.16em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

/* A left-aligned variant: rule runs only to the right of the label. */
.rule--lead {
  padding-bottom: 18px;
}
.rule--lead::before {
  display: none;
}

/* ── Artwork tiles ────────────────────────────────────────────── */

/* Real artwork, drawn by generate-song-art.js as SVG. We hold no licensed
   cover art and never will, so these are honestly abstract — a per-song
   spectrum derived from a hash of the slug — rather than anything imitating a
   sleeve. Deliberately not the og share cards: those carry the wordmark and
   the song title, so in-page they duplicate the headline beside them.

   object-fit:cover because the slot's aspect ratio changes across breakpoints
   (≈1.7:1 mobile, ≈1.4:1 desktop, square for the mobile thumb) while the
   source is one 4:3 file; the composition is centre-weighted so it survives
   the crop. The flat background shows while the SVG is in flight. */
/* Every art slot is SQUARE, at every breakpoint. Real album covers are square,
   and Apple offers them on condition they are shown unaltered — dropping one
   into the comp's 1.7:1 slot would crop the sleeve top and bottom, which is
   both a bad look and a modification of someone else's artwork.

   The wrapper carries the generated tile as a background and the <img> carries
   the licensed cover on top. If Apple ever rotates a URL the img simply fails
   and the tile underneath shows through — a no-JS fallback that cannot leave
   an empty hole. */
.art {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: #191512;
  background-size: cover;
  background-position: center;
  border-radius: 3px;
  overflow: hidden;
}
.art img {
  display: block;
  width: 100%;
  height: 100%;
  /* contain, not cover: the source is already square, so this is a no-op for a
     real cover and merely letterboxes anything that is not. Never crop. */
  object-fit: contain;
}
.art--feature {
  max-width: 340px;
}
.art--thumb {
  width: 78px;
  flex: none;
  border-radius: 2px;
}

/* ── Feature ──────────────────────────────────────────────────── */

.feature {
  padding: 0 var(--gutter);
  display: block;
  position: relative;
}
.feature:hover h2 a {
  color: var(--accent-ink);
}

/* Stretched link: the whole card is clickable to the song page, but the card
   is NOT one big <a>. It cannot be — each cover needs its own visible link to
   the Apple Music album page, and <a> may not nest. (Same pattern, and the
   same reason to never nest, as preciradar's basket cards.) */
.stretch::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
}
.feature h2 a,
.more-title a {
  color: inherit;
  transition: color 0.15s ease;
}

/* Attribution back to the store. Required by the terms the artwork is offered
   under, so it is a real visible link, not a title attribute — and it must sit
   above the stretched link or it becomes unclickable. */
.credit {
  position: relative;
  z-index: 1;
  color: var(--ink-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.credit:hover {
  color: var(--accent-ink);
}

.kicker {
  font: 400 10px/1 var(--mono);
  letter-spacing: 0.12em;
  color: var(--accent-ink);
  margin: 20px 0 8px;
  text-transform: uppercase;
}

.feature h2 {
  margin: 0 0 10px;
  font: 400 30px/1.08 var(--serif);
  transition: color 0.15s ease;
}

.feature p {
  margin: 0 0 8px;
  font: 300 14px/1.6 var(--sans);
  color: var(--ink-muted);
  text-wrap: pretty;
}

.byline {
  font: 300 12px/1 var(--sans);
  color: var(--ink-dim);
}

/* ── Secondary list ───────────────────────────────────────────── */

.more {
  padding: 34px var(--gutter) 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  list-style: none;
  margin: 0;
}

.more li {
  margin: 0;
}

.card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  /* Anchor for the stretched link; the card is not itself an <a>. */
  position: relative;
}
.card:hover .more-title a {
  color: var(--accent-ink);
}

.more-body {
  flex: 1;
  min-width: 0;
}

/* The card interior is spans inside an <a> (an <a> may not contain block-level
   headings here without splitting the link), so each part needs to be told to
   stack. */
.more-body > * {
  display: block;
}

.more .kicker {
  margin: 0 0 7px;
  font-size: 9px;
  color: var(--ink-dim);
}

.more-title {
  font: 400 21px/1.12 var(--serif);
  margin-bottom: 5px;
  transition: color 0.15s ease;
}

.more-meta {
  font: 300 12px/1.5 var(--sans);
  color: var(--ink-dim);
}

/* ── Footer ───────────────────────────────────────────────────── */

.foot {
  margin-top: 52px;
  padding: 26px var(--gutter) 40px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.foot nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}
.foot a {
  font: 300 13px/1.4 var(--sans);
  color: var(--ink-muted);
}
.foot a:hover {
  color: var(--ink);
}
.foot p {
  margin: 0;
  font: 300 12px/1.5 var(--sans);
  color: var(--ink-dim);
}

/* ── Search overlay ───────────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--bg);
  padding: 22px var(--gutter) 0;
  display: flex;
  flex-direction: column;
}
.overlay[hidden] {
  display: none;
}
@media (prefers-reduced-motion: no-preference) {
  .overlay {
    animation: sheet 0.22s ease-out;
  }
}
@keyframes sheet {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.overlay-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--accent);
  flex: none;
}

.overlay-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  color: var(--ink);
  font: 300 17px/1.3 var(--sans);
  padding: 0;
}
.overlay-input::placeholder {
  color: var(--ink-dim);
}
.overlay-input:focus {
  outline: none;
}

.overlay-close {
  background: none;
  border: 0;
  cursor: pointer;
  font: 400 11px/1 var(--mono);
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  flex: none;
  padding: 4px;
}
.overlay-close:hover {
  color: var(--ink);
}

.results {
  list-style: none;
  margin: 0;
  padding: 0 0 40px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.results li a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}
.results li a:hover,
.results li a:focus-visible {
  border-bottom-color: var(--accent);
}
.results .r-title {
  font: 400 21px/1.1 var(--serif);
}
.results .r-artist {
  font: 300 11px/1.3 var(--sans);
  color: var(--ink-dim);
  flex: none;
  text-align: right;
}

.results-note {
  padding: 22px 0;
  font: 300 14px/1.6 var(--sans);
  color: var(--ink-dim);
}
.results-note a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Tablet ───────────────────────────────────────────────────── */

@media (min-width: 700px) {
  :root {
    --gutter: 40px;
  }

  .hero h1 {
    font-size: clamp(46px, 7vw, 60px);
  }
  .art--feature {
    max-width: 420px;
  }
  .feature h2 {
    font-size: 40px;
  }
  .feature p {
    font-size: 16px;
    max-width: 62ch;
  }

  .more {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 32px;
  }
  .more li,
  .more .card {
    flex: 1 1 260px;
  }
  .card {
    flex-direction: column;
    gap: 14px;
  }
  .more .art--thumb {
    width: 100%;
    border-radius: 2px;
  }
  .more-title {
    font-size: 24px;
  }
}

/* ── Desktop: comp artboard 2a, 1440 ──────────────────────────── */

@media (min-width: 1024px) {
  :root {
    --gutter: 56px;
  }

  .masthead {
    padding: 26px var(--gutter);
    border-bottom: 1px solid var(--line);
  }
  .wordmark {
    font-size: 24px;
  }
  .nav-toggle {
    display: none;
  }

  /* Must out-specify `.js .nav{display:none}` from the mobile block, or the
     desktop nav vanishes as soon as scripting is on. */
  .nav,
  .js .nav,
  .js .nav[data-open="false"] {
    display: block;
    padding: 0;
  }
  .nav ul {
    flex-direction: row;
    align-items: center;
    gap: 34px;
  }
  .nav a {
    padding: 0;
    border: 0;
    font-size: 13px;
    color: var(--ink-muted);
  }

  .masthead-inner {
    display: flex;
    align-items: center;
    gap: 34px;
  }

  .masthead-search {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: none;
    color: var(--ink-dim);
    font: 300 13px/1 var(--sans);
    cursor: pointer;
  }
  .masthead-search:hover {
    border-color: var(--accent);
    color: var(--ink);
  }
  .masthead-search kbd {
    font: 400 10px/1 var(--mono);
    color: var(--ink-dim);
  }

  /* Hero: headline + field on the left, "recently explained" on the right. */
  .hero {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 64px;
    align-items: end;
    padding: 74px var(--gutter) 66px;
    border-bottom: 1px solid var(--line);
  }
  .hero h1 {
    margin-bottom: 30px;
    font-size: clamp(58px, 5.3vw, 76px);
    line-height: 0.96;
    letter-spacing: -0.015em;
  }
  .search-open {
    max-width: 560px;
    padding-bottom: 16px;
  }
  .search-open .placeholder {
    font-size: 20px;
  }

  .recent {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 6px;
  }
  .recent h2 {
    margin: 0;
    font: 400 10px/1 var(--mono);
    letter-spacing: 0.16em;
    color: var(--ink-dim);
    text-transform: uppercase;
  }
  .recent ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .recent a {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
  }
  .recent a:hover .r-t {
    color: var(--accent-ink);
  }
  .recent .r-t {
    font: 400 20px/1.1 var(--serif);
    transition: color 0.15s ease;
  }
  .recent .r-m {
    font: 300 12px/1 var(--sans);
    color: var(--ink-dim);
    flex: none;
  }

  /* Feature runs as a two-column spread. */
  .feature {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 56px;
    align-items: center;
    padding: 56px var(--gutter) 60px;
  }
  .art--feature {
    max-width: 100%;
  }
  .feature-body .kicker {
    margin: 0 0 18px;
    font-size: 10px;
    letter-spacing: 0.14em;
  }
  .feature h2 {
    margin-bottom: 18px;
    font-size: clamp(40px, 3.8vw, 54px);
    line-height: 1.02;
    letter-spacing: -0.01em;
  }
  .feature p {
    margin-bottom: 20px;
    font-size: 17px;
    line-height: 1.62;
    max-width: 520px;
  }
  .byline {
    font-size: 13px;
  }

  .rule {
    padding: 0 var(--gutter) 26px;
    gap: 14px;
  }
  .rule::before {
    display: none;
  }

  .more {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    padding: 0 var(--gutter) 72px;
  }
  .more li {
    flex: none;
  }
  .more .art--thumb {
    width: 100%;
  }
  .more .kicker {
    margin: 18px 0 8px;
    letter-spacing: 0.14em;
  }
  .more-title {
    font-size: 28px;
    line-height: 1.08;
  }
  .more-meta {
    font-size: 13px;
  }

  /* Desktop overlay is a centred column over a near-opaque scrim, not a
     full-bleed sheet. */
  .overlay {
    background: rgba(16, 14, 13, 0.97);
    align-items: center;
    padding-top: 120px;
  }
  .overlay-inner {
    width: 720px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .overlay-bar {
    padding-bottom: 18px;
  }
  .overlay-input {
    font-size: 28px;
    font-weight: 300;
  }
  .results li a {
    padding: 20px 0;
  }
  .results .r-title {
    font-size: 26px;
  }
  .results .r-artist {
    font-size: 13px;
  }

  .foot {
    margin-top: 0;
    padding: 30px var(--gutter) 56px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

@media (min-width: 1024px) {
  .overlay-inner {
    width: 720px;
  }
}

/* ── Lede and link modules ────────────────────────────────────── */

.lede {
  margin: 0 0 22px;
  max-width: 34em;
  font: 300 15px/1.55 var(--sans);
  color: var(--ink-muted);
}
.lede a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Static link rows under the cards: real <a href>s, one per line on a phone. */
.links {
  margin: 0;
  padding: 0 var(--gutter);
  list-style: none;
}
.links li {
  margin: 0;
}
.links--cols a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.links--cols a:hover .l-t {
  color: var(--accent-ink);
}
.links .l-t {
  font: 400 17px/1.2 var(--serif);
}
.links .l-m {
  flex: none;
  font: 300 12px/1 var(--sans);
  color: var(--ink-dim);
  text-align: right;
}
.links--row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.links--row a {
  display: inline-block;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font: 300 13px/1 var(--sans);
  color: var(--ink-muted);
  text-decoration: none;
}
.links--row a:hover {
  color: var(--ink);
  border-color: var(--ink-muted);
}

@media (min-width: 700px) {
  .links--cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 40px;
  }
}
@media (min-width: 1024px) {
  .links--cols {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
