/* Walter Mitty Street — styles
   Kept deliberately quiet: the picture and the cloud are the experience. */

:root {
  --night: #0f131a;          /* page background around the picture */
  --ink: #e9edf3;            /* text on dark */
  --ink-soft: rgba(233, 237, 243, 0.72);
  --glass: rgba(14, 18, 26, 0.55);
  --glass-line: rgba(255, 255, 255, 0.12);
  --warm: #f3c77a;           /* the one warm accent: Walter Mitty light */
  --serif: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  /* the "gallery wall": a deep night blue, with a warm wash of light over
     the frame as if from a picture lamp */
  background:
    radial-gradient(ellipse 70% 55% at 50% 4%, rgba(243, 199, 122, 0.10), transparent 70%),
    var(--night);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: 96px;          /* room for the fixed player */
}

/* ---------- Masthead ---------------------------------------------------- */
.masthead { padding: 14px 18px 0; }
.brand {
  font: italic 500 1.15rem var(--serif);
  color: var(--ink-soft); text-decoration: none; letter-spacing: 0.02em;
}
.brand:hover, .brand:focus-visible { color: var(--ink); }

/* ---------- The gilded frame -------------------------------------------- *
   Built in CSS only (no images): an outer gilt moulding with light catching
   its bevels, a thin beaded lip, then a dark velvet liner around the
   picture. Change --moulding / --liner to make it chunkier or slimmer.    */
.gallery {
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 16px 0;
}
.frame {
  --moulding: clamp(14px, 2.4vw, 34px);
  --liner: clamp(5px, 0.9vw, 12px);
  --gold-1: #f1dca0; --gold-2: #c39a4e; --gold-3: #8c672b; --gold-4: #4d3413;   /* antique gilt */
  position: relative;
  margin: 0;
  /* as wide as the screen allows, but never taller than the window */
  width: min(100%, calc((100vh - 250px) * 1672 / 941 + 2 * (var(--moulding) + var(--liner))));
  width: min(100%, calc((100svh - 250px) * 1672 / 941 + 2 * (var(--moulding) + var(--liner))));
  min-width: min(100%, 520px);
  padding: var(--moulding);
  border-radius: 3px;
  background:
    /* fine grain of the gilding */
    repeating-linear-gradient(90deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 3px),
    /* light falls from the top left */
    linear-gradient(135deg, var(--gold-4) 0%, var(--gold-2) 14%, var(--gold-1) 24%, var(--gold-3) 38%,
      var(--gold-4) 50%, var(--gold-2) 64%, var(--gold-1) 76%, var(--gold-3) 90%, var(--gold-4) 100%);
  box-shadow:
    0 0 0 1px #2b1d0b,                                   /* outer edge */
    0 34px 70px -24px rgba(0, 0, 0, 0.85),                /* hangs off the wall */
    0 0 120px -30px rgba(243, 199, 122, 0.25),            /* warm lamp glow */
    inset 0 2px 1px rgba(255, 246, 214, 0.65),            /* top bevel catches the light */
    inset 0 -3px 4px rgba(40, 24, 6, 0.6),                /* bottom bevel in shade */
    inset 0 0 0 3px rgba(255, 236, 180, 0.18),
    inset 0 0 0 calc(var(--moulding) * 0.42) rgba(70, 45, 12, 0.18);   /* the cove */
}
/* the beaded lip just inside the moulding */
.frame::before {
  content: ""; position: absolute; pointer-events: none;
  inset: calc(var(--moulding) - 5px);
  border-radius: 2px;
  background:
    radial-gradient(circle, rgba(255, 240, 196, 0.9) 0 1.1px, rgba(110, 75, 27, 0.9) 1.6px 2.2px, transparent 2.6px)
      0 0 / 6px 6px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  padding: 5px;
  opacity: 0.85;
}
.liner {
  position: relative;
  padding: var(--liner);
  background: #17110c;                                   /* dark velvet */
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.85), inset 0 0 0 1px rgba(0, 0, 0, 0.6);
}

/* ---------- Stage (inside the frame) ----------------------------------- */
#stage {
  position: relative;
  aspect-ratio: 1672 / 941;
  overflow: hidden;
  container-type: inline-size;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7);
}
#scene {
  position: absolute; inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;          /* dragging moves the cloud, not the page */
  cursor: none;                /* the cloud is the cursor */
  outline: none;
}
#scene:focus-visible { box-shadow: inset 0 0 0 2px var(--warm); }

.loading {
  position: absolute; inset: 0; margin: 0;
  display: grid; place-items: center;
  font: italic 500 1.4rem var(--serif); color: var(--ink-soft);
}
.ready .loading { display: none; }

.to-lyrics {
  margin: 16px 0 0;
  font: italic 500 1.05rem var(--serif); letter-spacing: 0.03em;
  color: var(--ink-soft); text-decoration: none;
}
.to-lyrics:hover, .to-lyrics:focus-visible { color: var(--warm); }

/* ---------- Intro card (inside the frame) ------------------------------- */
.intro {
  position: absolute; inset: 0; z-index: 4;
  display: grid; place-items: center;
  pointer-events: none;        /* the cloud can be moved behind the card */
  background: radial-gradient(ellipse at center, rgba(10, 13, 19, 0.15), rgba(10, 13, 19, 0.55));
  transition: opacity 0.9s ease;
}
.intro.leaving { opacity: 0; }
.intro-card {
  pointer-events: auto;
  text-align: center;
  padding: clamp(14px, 3cqw, 28px) clamp(16px, 3.6cqw, 34px);
  max-width: min(520px, 86cqw);
  border-radius: 18px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid var(--glass-line);
}
.kicker {
  margin: 0 0 6px; font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-soft);
}
.intro h1 {
  margin: 0; font: italic 500 clamp(1.6rem, 6cqw, 3.4rem)/1.05 var(--serif); letter-spacing: 0.01em;
}
.lede { margin: clamp(8px, 1.4cqw, 14px) 0 clamp(12px, 2.2cqw, 22px); font: 400 clamp(0.95rem, 2cqw, 1.15rem)/1.45 var(--serif); color: var(--ink-soft); }
.start {
  font: 500 0.95rem var(--sans); letter-spacing: 0.04em;
  padding: 11px 26px; border-radius: 999px; cursor: pointer;
  color: #1d1a14; background: var(--warm); border: 0;
}
.start:hover { filter: brightness(1.06); }
.start:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
@container (max-width: 460px) {
  .intro .kicker, .intro .lede br { display: none; }
}

/* ---------- Lyrics ------------------------------------------------------ */
.lyrics {
  max-width: 980px;
  margin: clamp(56px, 9vw, 110px) auto 0;
  padding: 0 24px;
  text-align: center;
  scroll-margin-top: 24px;
}
.lyrics h2 {
  margin: 0 0 clamp(28px, 5vw, 48px);
  font: italic 500 clamp(2rem, 5vw, 3rem)/1.1 var(--serif);
  letter-spacing: 0.01em;
}
.lyrics h2::after {
  content: ""; display: block; width: 64px; height: 1px; margin: 22px auto 0;
  background: linear-gradient(90deg, transparent, var(--warm), transparent);
}
.stanzas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: clamp(26px, 4vw, 40px) clamp(28px, 5vw, 64px);
  text-align: left;
}
.stanza {
  margin: 0;
  align-self: start;
  font: 400 clamp(1.15rem, 2.1vw, 1.3rem)/1.6 var(--serif);
  color: rgba(233, 237, 243, 0.86);
  text-wrap: pretty;
}
/* each sung line; a long line wraps with a small hanging indent */
.stanza .line { display: block; padding-left: 1.1em; text-indent: -1.1em; }
/* the chorus: in the warm Walter Mitty light */
.stanza.chorus {
  font-style: italic;
  color: var(--warm);
  padding-left: 18px;
  border-left: 1px solid rgba(243, 199, 122, 0.45);
}
.footer {
  margin: clamp(56px, 9vw, 96px) 0 0;
  text-align: center;
  font: italic 500 1rem var(--serif);
}
.footer a { color: var(--ink-soft); text-decoration: none; }
.footer a:hover, .footer a:focus-visible { color: var(--warm); }

/* ---------- Player ------------------------------------------------------ */
.player {
  position: fixed; left: 16px; bottom: 16px; z-index: 3;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px 7px 7px;
  width: min(380px, calc(100vw - 32px));
  border-radius: 999px;
  background: rgba(14, 18, 26, 0.86);     /* solid enough to read over the lyrics */
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid var(--glass-line);
  opacity: 0.75; transition: opacity 0.4s ease;
}
.player:hover, .player:focus-within, body:not(.playing) .player { opacity: 1; }

.icon-btn {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: transparent; color: var(--ink); border: 0; padding: 0;
}
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); }
.icon-btn:focus-visible { outline: 2px solid var(--warm); outline-offset: 1px; }
.icon-btn.play { background: rgba(255, 255, 255, 0.1); }
.i-pause { display: none; }
.playing .i-play { display: none; }
.playing .i-pause { display: block; }
#motionBtn[aria-pressed="true"] { color: var(--warm); }

.track { flex: 1; min-width: 0; }
.track-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.track-title { font: italic 500 1rem var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time { font-size: 0.72rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.seek {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 14px; margin: 0; background: transparent; cursor: pointer;
}
.seek::-webkit-slider-runnable-track { height: 2px; background: rgba(255, 255, 255, 0.25); border-radius: 2px; }
.seek::-moz-range-track { height: 2px; background: rgba(255, 255, 255, 0.25); border-radius: 2px; }
.seek::-webkit-slider-thumb {
  -webkit-appearance: none; width: 10px; height: 10px; margin-top: -4px;
  border-radius: 50%; background: var(--warm); border: 0;
}
.seek::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--warm); border: 0; }
.seek:focus-visible { outline: 1px solid var(--warm); outline-offset: 2px; }

.preview-note {
  position: fixed; right: 16px; bottom: 16px; z-index: 3; margin: 0;
  max-width: 330px; padding: 8px 12px; border-radius: 10px;
  font-size: 0.75rem; line-height: 1.4; color: var(--ink-soft);
  background: var(--glass); border: 1px solid var(--glass-line);
}
.preview-note code { color: var(--warm); font-size: 0.72rem; }

/* ---------- Phones held upright ---------------------------------------- */
@media (max-aspect-ratio: 1/1) {
  .gallery { padding: 6px 10px 0; }
  .frame { width: 100%; }
  /* a taller window onto the street; the view pans to follow the cloud */
  #stage { aspect-ratio: 4 / 5; max-height: calc(100svh - 190px); }
  .player { left: 50%; transform: translateX(-50%); bottom: 14px; opacity: 1; }
  .preview-note { left: 16px; right: 16px; bottom: 84px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .intro, .player { transition: none; }
}
