/* v0.0.6 */
/* Palette sampled from the hero image.
   Dark theme: you are out in the void with the image.
   Light theme: you're indoors, looking out through a porthole. The hero stays dark
   in both — inverting a starfield never works. */
:root {
  --void: #000000;
  --ember: #FF8A4C;
  --signal: #62C9F5;
  --haze: #D9E6EC;

  --bg: var(--void);
  --fg: var(--haze);
  --muted: #8FA3AD;
  --line: #1B2E38;
  --accent: var(--ember);
  --accent-2: var(--signal);
  --wash: rgba(98, 201, 245, 0.05);
  --on-accent: #000;

  --display: "Unbounded", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --player-h: 4.75rem;
  --gutter: clamp(1.25rem, 5vw, 3.5rem);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #E7EDF0;
  --fg: #0C1820;
  --muted: #4A5E68;
  --line: #C3D0D6;
  --accent: #B4461A;
  --accent-2: #0F6D9A;
  --wash: rgba(15, 109, 154, 0.06);
  --on-accent: #fff;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1.0625rem/1.6 var(--body);
  padding-bottom: calc(var(--player-h) + env(safe-area-inset-bottom));
  transition: background-color .3s ease, color .3s ease;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 50;
  background: var(--ember); color: #000; padding: .6rem 1rem; border-radius: .4rem;
}
.skip:focus { top: 1rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
  color: var(--haze);
  background: var(--void) url("/img/hero.jpg") center / contain no-repeat;
  overflow: hidden;
}
/* The image's own margins are pure black, so "contain" on a black field
   reads as one continuous void on wide screens and keeps its HUD frame intact. */
@media (orientation: portrait) {
  .hero { background-size: cover; background-position: 48% center; }
}
.hero::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to top, rgba(0,0,0,.9) 0%, rgba(0,0,0,.55) 30%, transparent 62%);
}
:root[data-theme="light"] .hero {
  margin: .75rem;
  min-height: calc(100svh - 1.5rem);
  border-radius: 1.75rem;
  box-shadow: 0 0 0 1px rgba(12,24,32,.25), 0 30px 60px -30px rgba(12,24,32,.6);
}

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: clamp(1rem, 3vw, 1.75rem) var(--gutter);
}
.wordmark {
  display: inline-flex; align-items: center; gap: .6rem;
  text-decoration: none; font: 700 .95rem/1 var(--display); letter-spacing: -.01em;
  white-space: nowrap;
}
.bar-actions { display: flex; align-items: center; gap: .6rem; }

.round {
  display: inline-grid; place-items: center;
  width: 2.75rem; height: 2.75rem; flex: none;
  border-radius: 50%;
  border: 1px solid rgba(217,230,236,.28);
  background: rgba(0,0,0,.35);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: inherit;
  transition: border-color .2s, background-color .2s;
}
.round:hover { border-color: rgba(217,230,236,.6); }

.chip {
  display: inline-flex; align-items: center; gap: .6rem;
  height: 2.75rem; padding: 0 1rem 0 .9rem;
  border-radius: 999px;
  border: 1px solid rgba(217,230,236,.28);
  background: rgba(0,0,0,.35);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-size: .95rem; white-space: nowrap;
}
.chip[aria-pressed="true"] { border-color: var(--ember); }

/* Signal meter: flat when silent, moving when playing */
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.bars i {
  width: 3px; height: 100%; background: currentColor; border-radius: 1px;
  transform-origin: bottom; transform: scaleY(.25); opacity: .7;
}
:root[data-playing] .bars i { background: var(--ember); opacity: 1; animation: meter 1s ease-in-out infinite; }
:root[data-playing] .bars i:nth-child(2) { animation-delay: -.35s; animation-duration: .8s; }
:root[data-playing] .bars i:nth-child(3) { animation-delay: -.6s;  animation-duration: 1.15s; }
@keyframes meter { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

/* Theme icon shows the theme you'll switch TO */
.i-moon { display: none; }
:root[data-theme="light"] .i-sun { display: none; }
:root[data-theme="light"] .i-moon { display: block; }

.hero-copy {
  align-self: end;
  padding: 0 var(--gutter) calc(var(--player-h) + clamp(1.5rem, 6vh, 4rem));
  max-width: 60rem;
}
h1 {
  margin: 0;
  font: 800 clamp(3.1rem, 14vw, 9rem)/.88 var(--display);
  letter-spacing: -.035em;
  color: #F2F7F9;
  text-shadow: 0 0 48px rgba(98,201,245,.28);
}
h1 span { display: block; }
/* The second line doesn't quite line up. That's the point. */
h1 .misfit { padding-left: .62em; transform: translateY(.04em) rotate(-.6deg); transform-origin: left; }

.kicker {
  margin: 1.1rem 0 0;
  font: italic 400 clamp(1.1rem, 2.2vw, 1.4rem)/1.3 var(--body);
  color: var(--ember);
}
.logline { margin: .75rem 0 0; max-width: 44ch; font-size: clamp(1.05rem, 1.8vw, 1.2rem); color: #B8C8CF; }

.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  min-height: 3rem; padding: 0 1.4rem;
  border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 1rem; text-decoration: none;
  transition: transform .15s ease, background-color .2s, border-color .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--ember); color: #000; }
.btn-primary:hover { background: #FFA06D; }
.btn-ghost { border-color: rgba(217,230,236,.4); color: var(--haze); }
.btn-ghost:hover { border-color: var(--haze); }

/* Play/pause icon swaps (hero, player) */
.i-pause { display: none; }
:root[data-playing] #hero-play .i-play,
:root[data-playing] #play .i-play { display: none; }
:root[data-playing] #hero-play .i-pause,
:root[data-playing] #play .i-pause { display: block; }

/* The one orchestrated moment: the title resolves into focus on load */
@media (prefers-reduced-motion: no-preference) {
  h1 span { animation: resolve 1.4s cubic-bezier(.2,.7,.2,1) both; }
  h1 .misfit { animation-name: resolve-misfit; animation-delay: .18s; }
  .kicker, .logline, .actions { animation: fade .8s ease 1s both; }
}
@keyframes resolve {
  from { opacity: 0; letter-spacing: .25em; filter: blur(10px); }
  to   { opacity: 1; letter-spacing: -.035em; filter: blur(0); }
}
@keyframes resolve-misfit {
  from { opacity: 0; letter-spacing: .25em; filter: blur(10px); transform: none; }
  to   { opacity: 1; letter-spacing: -.035em; filter: blur(0); transform: translateY(.04em) rotate(-.6deg); }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Content ---------- */
.content {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 6rem);
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(3.5rem, 9vw, 7rem) var(--gutter) clamp(3rem, 6vw, 5rem);
}
.narrative {
  display: grid;
  min-width: 0;
}
.script { padding-top: clamp(2rem, 4vw, 3rem); }
.songs { grid-column: 2; grid-row: 1; align-self: start; }
@media (max-width: 52rem) {
  .content {
    grid-template-columns: 1fr;
  }
  .songs { grid-column: 1; grid-row: 2; }
}

h2 {
  margin: 0;
  font: 700 clamp(1.7rem, 3.4vw, 2.4rem)/1.1 var(--display);
  letter-spacing: -.025em;
}
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.meta { margin: 0; color: var(--muted); font-size: .95rem; }

.tracks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.track {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr) auto auto;
  align-items: center; gap: .75rem;
  padding: .7rem .5rem;
  border-bottom: 1px solid var(--line);
  transition: background-color .15s;
}
.track:hover { background: var(--wash); }
.track-n { font: 400 .95rem/1 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.track-title { font-weight: 600; overflow-wrap: anywhere; }
.track[aria-current="true"] .track-n,
.track[aria-current="true"] .track-title { color: var(--accent); }

.track .round {
  width: 2.5rem; height: 2.5rem;
  background: transparent; border-color: var(--line);
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.track .round:hover { border-color: var(--accent); color: var(--accent); }
.track .i-pause { display: none; }
:root[data-playing] .track[aria-current="true"] .i-play { display: none; }
:root[data-playing] .track[aria-current="true"] .i-pause { display: block; }

.dl {
  display: inline-flex; align-items: center; gap: .4rem;
  min-height: 2.5rem; padding: 0 .9rem;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: .9rem; font-weight: 600; text-decoration: none; color: var(--accent-2);
}
.dl:hover { border-color: var(--accent-2); }
@media (max-width: 30rem) { .dl-label { display: none; } .dl { padding: 0 .7rem; } }

.empty { padding: 1.5rem .5rem; color: var(--muted); }

.story p { max-width: 62ch; margin: 1.25rem 0 0; }

/* Placeholder copy is visibly marked so it can't ship by accident */
.todo { border-left: 2px dashed var(--accent-2); padding-left: .8rem; font-style: italic; opacity: .85; }

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem;
  max-width: 76rem; margin: 0 auto;
  padding: 2rem var(--gutter);
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: .9rem;
}
.foot p { margin: 0; }

/* ---------- Player ---------- */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: clamp(.75rem, 2vw, 1.5rem);
  min-height: var(--player-h);
  padding: .6rem var(--gutter) calc(.6rem + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  border-top: 1px solid var(--line);
}
.player .round { background: transparent; border-color: var(--line); -webkit-backdrop-filter: none; backdrop-filter: none; }
.player .round:hover { border-color: var(--accent); }
.controls { display: flex; align-items: center; gap: .4rem; }
.round-main { width: 3rem; height: 3rem; background: var(--accent) !important; border-color: var(--accent) !important; color: var(--on-accent); }

.now { min-width: 0; }
.now-title { margin: 0 0 .15rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scrub { display: flex; align-items: center; gap: .6rem; }
.time { font: 400 .8rem/1 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; min-width: 2.6em; }
.time:last-child { text-align: right; }

#seek { flex: 1; min-width: 0; height: 1.5rem; margin: 0; accent-color: var(--accent); background: transparent; cursor: pointer; }

@media (max-width: 30rem) {
  #prev { display: none; }
  .time { display: none; }
}

.status {
  position: fixed; left: 50%; bottom: calc(var(--player-h) + 1rem + env(safe-area-inset-bottom)); z-index: 45;
  transform: translateX(-50%);
  max-width: min(90vw, 32rem); margin: 0; padding: .7rem 1rem;
  background: var(--fg); color: var(--bg); border-radius: .6rem; font-size: .95rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
