/* Marcus — Dusk to Dawn
   The sky colours (--sky-*, --horizon, --accent) are driven from app.js as the
   night progresses; the values here are the dusk starting point. */

:root {
  --sky-top: #1a0f1c;
  --sky-mid: #3a1a26;
  --sky-low: #6b2a22;
  --horizon: #e0773a;
  --accent: #ff9f5a;
  --accent-soft: rgba(255, 159, 90, 0.18);

  --ink: #f6ede2;
  --ink-dim: rgba(246, 237, 226, 0.66);
  --ink-faint: rgba(246, 237, 226, 0.38);
  --line: rgba(246, 237, 226, 0.14);
  --glass: rgba(12, 9, 16, 0.55);

  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans: 'Manrope', system-ui, -apple-system, sans-serif;

  --gutter: clamp(16px, 5vw, 72px);
  --max: 1240px;
  --night: 0; /* 0 = dusk, 1 = dawn */

  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: #0b0810;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }

::selection { background: var(--accent); color: #140c10; }

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

.visually-hidden,
.skip:not(:focus) {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip:focus { position: fixed; top: 12px; left: 12px; z-index: 50; padding: 8px 14px; background: var(--ink); color: #111; border-radius: 6px; }

/* ── Atmosphere ─────────────────────────────────────────────── */

.sky {
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(130% 60% at 50% 112%, var(--horizon) 0%, transparent 62%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 62%, var(--sky-low) 100%);
  transition: background 0.4s linear;
}

.silk {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ── Header ─────────────────────────────────────────────────── */

.top {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--gutter);
  transition: background 0.4s ease, backdrop-filter 0.4s ease;
}
.top.scrolled {
  background: linear-gradient(180deg, rgba(8, 6, 12, 0.6), rgba(8, 6, 12, 0));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.mark {
  font-family: var(--serif);
  font-size: 1.6rem;
  text-decoration: none;
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.top.scrolled .mark { opacity: 1; transform: none; }
.top nav { display: flex; gap: clamp(16px, 3vw, 36px); }
.top nav a {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-dim);
  transition: color 0.2s;
}
.top nav a:hover { color: var(--ink); }

/* ── Type helpers ───────────────────────────────────────────── */

.micro {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0;
}
.dim { color: var(--ink-dim); }

h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.2rem, 5.2vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 0.35em 0 0.4em;
}
h2 em { font-style: italic; color: var(--accent); transition: color 0.6s; }

section { position: relative; padding: clamp(80px, 14vh, 160px) var(--gutter); }
section > * { max-width: var(--max); margin-inline: auto; }

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

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding-top: 120px;
  padding-bottom: 120px;
}
.hero > * { margin-inline: 0; }
.hero { padding-left: max(var(--gutter), calc((100vw - var(--max)) / 2)); }

.wordmark {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(5.5rem, 21vw, 19rem);
  line-height: 0.82;
  letter-spacing: -0.035em;
  margin: 0.12em 0 0.14em -0.04em;
  background: linear-gradient(180deg, var(--ink) 30%, color-mix(in srgb, var(--accent) 55%, var(--ink)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  line-height: 1.25;
  color: var(--ink-dim);
  margin: 0 0 2.2em;
}

.hero-actions { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }

.begin {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 26px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 7, 14, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  transition: border-color 0.3s, background 0.3s, transform 0.3s;
}
.begin:hover { border-color: var(--accent); background: rgba(10, 7, 14, 0.55); transform: translateY(-1px); }
.begin-icon {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-soft), 0 0 40px var(--accent-soft);
  animation: ember 2.8s ease-in-out infinite;
  transition: background 0.6s;
}
.begin-icon::after {
  content: '';
  position: absolute;
  left: 17px; top: 14px;
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent #1a0e0c;
}
body.playing .begin-icon::after {
  left: 15px; top: 15px;
  width: 14px; height: 14px;
  border: 0;
  background: linear-gradient(90deg, #1a0e0c 0 35%, transparent 35% 65%, #1a0e0c 65%);
}
@keyframes ember {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft), 0 0 30px var(--accent-soft); }
  50% { box-shadow: 0 0 0 10px transparent, 0 0 60px var(--accent-soft); }
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 36px;
  width: 22px; height: 36px;
  margin-left: -11px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.scroll-cue span {
  position: absolute;
  left: 50%; top: 8px;
  width: 2px; height: 7px;
  margin-left: -1px;
  border-radius: 2px;
  background: var(--ink-dim);
  animation: cue 2.2s ease-in-out infinite;
}
@keyframes cue { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }

/* ── The Night / tracklist ──────────────────────────────────── */

.section-head { max-width: 720px; margin-left: 0; }
.night > .section-head { margin-inline: auto; max-width: var(--max); }
.section-head .dim { max-width: 52ch; }

.tracklist {
  --progress: 0;
  position: relative;
  list-style: none;
  margin-top: 56px;
  padding: 0 0 0 28px;
}
/* The night line: a thin vertical horizon that fills as the EP plays */
.tracklist::before,
.tracklist::after {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 1px;
  height: 100%;
  background: var(--line);
}
.tracklist::after {
  height: calc(var(--progress) * 100%);
  background: linear-gradient(180deg, #ffb070, var(--accent));
  box-shadow: 0 0 12px var(--accent);
}

.track {
  position: relative;
  border-bottom: 1px solid var(--line);
}
.track:first-child { border-top: 1px solid var(--line); }

.track-btn {
  display: grid;
  grid-template-columns: 4.2rem 2.2rem minmax(0, 1fr) minmax(0, 15rem) 3.4rem;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 18px 12px 18px 0;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  transition: padding 0.35s ease;
}
.track-btn:hover { padding-left: 10px; }
.track-btn:hover .track-title { color: var(--ink); }

.track-clock,
.track-num,
.track-dur {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.track-dur { text-align: right; }

.track-name { min-width: 0; }
.track-title {
  display: block;
  font-family: var(--serif);
  font-size: clamp(1.45rem, 2.6vw, 2.1rem);
  line-height: 1.1;
  color: var(--ink-dim);
  transition: color 0.3s;
  overflow-wrap: anywhere;
}
.track-translation {
  display: block;
  margin-top: 2px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-faint);
}
.track-meta {
  font-size: 0.78rem;
  color: var(--ink-faint);
  line-height: 1.4;
}
.track-meta b { display: block; font-weight: 500; color: var(--ink-dim); }

/* the dot that sits on the night line */
.track::before {
  content: '';
  position: absolute;
  left: -32px;
  top: 50%;
  width: 9px; height: 9px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: #0b0810;
  border: 1px solid var(--ink-faint);
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.track.passed::before { background: var(--accent); border-color: var(--accent); }
.track.current::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft), 0 0 20px var(--accent);
}
.track.current .track-title { color: var(--ink); }
.track.current .track-num { color: transparent; }

/* equaliser bars for the current track */
.eq {
  position: absolute;
  left: calc(4.2rem + 16px);
  top: 50%;
  display: none;
  gap: 2px;
  align-items: flex-end;
  height: 14px;
  margin-top: -7px;
}
.track.current .eq { display: flex; }
.eq i {
  width: 3px;
  height: 100%;
  background: var(--accent);
  transform-origin: bottom;
  transform: scaleY(0.25);
}
body.playing .track.current .eq i { animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -0.3s !important; }
.eq i:nth-child(3) { animation-delay: -0.6s !important; }
@keyframes eq { 0%, 100% { transform: scaleY(0.25); } 50% { transform: scaleY(1); } }

/* hover art preview (pointer devices only) */
.track-peek {
  position: absolute;
  right: 18rem;
  top: 50%;
  width: 150px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) rotate(-3deg) scale(0.92);
  transition: opacity 0.35s ease, transform 0.35s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 2;
}
@media (hover: hover) {
  .track-btn:hover + .track-peek { opacity: 1; transform: translateY(-50%) rotate(-2deg) scale(1); }
}

/* ── Focus (selected song) ──────────────────────────────────── */

.focus {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
}
.focus > * { margin: 0; max-width: none; }

.focus-art {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 40px 120px -20px color-mix(in srgb, var(--accent) 45%, transparent), 0 20px 60px rgba(0, 0, 0, 0.5);
}
.focus-art img {
  width: 100%; height: 100%;
  object-fit: cover;
  animation: drift 24s ease-in-out infinite alternate;
  transition: opacity 0.5s;
}
.focus-art img.swap { opacity: 0; }
@keyframes drift { from { transform: scale(1.04) translate(0, 0); } to { transform: scale(1.12) translate(-2%, -2%); } }

.focus-title { margin: 0.3em 0 0.05em; }
.focus-translation {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.4rem;
  color: var(--accent);
  transition: color 0.6s;
}
.focus-scene {
  margin: 1.4em 0 0.3em;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.focus-note { max-width: 46ch; margin: 0 0 1.8em; font-size: 1.05rem; }

.focus-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.pill {
  padding: 12px 24px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #1a0e0c;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.2s, transform 0.2s, background 0.6s, border-color 0.6s;
}
.pill:hover { filter: brightness(1.08); transform: translateY(-1px); }
.pill.ghost { background: transparent; color: var(--ink); border-color: var(--line); font-weight: 500; }
.pill.ghost:hover { border-color: var(--ink-dim); }

.lyrics { margin-top: 32px; border-top: 1px solid var(--line); padding-top: 18px; }
.lyrics summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.lyrics summary::-webkit-details-marker { display: none; }
.lyrics summary::after { content: ' +'; }
.lyrics[open] summary::after { content: ' –'; }
.lyrics-body {
  margin-top: 18px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 8px;
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--ink-dim);
  mask-image: linear-gradient(180deg, transparent 0, #000 24px, #000 calc(100% - 32px), transparent 100%);
  padding-block: 18px 32px;
}
.lyrics-body .tag {
  display: block;
  margin: 1.2em 0 0.3em;
  font-family: var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.lyrics-body .tag:first-child { margin-top: 0; }
.lyrics-body .direction { font-style: italic; color: var(--ink-faint); font-size: 1rem; }
.lyrics-body p { margin: 0; }

/* ── Studio ─────────────────────────────────────────────────── */

.studio { padding-top: clamp(120px, 20vh, 220px); }
.studio > .micro { margin-inline: auto; }
.exchange {
  display: grid;
  gap: 18px;
  margin-block: 40px 72px;
}
.exchange p {
  margin: 0;
  max-width: 30ch;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1.2s ease, transform 1.2s ease;
}
.exchange.in p { opacity: 1; transform: none; }
.exchange.in p:nth-child(2) { transition-delay: 1.1s; }
.exchange.in p:nth-child(3) { transition-delay: 2.2s; }
.exchange.in p:nth-child(4) { transition-delay: 3.3s; }
.call {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  line-height: 1.25;
  color: var(--ink);
}
.exchange .answer {
  max-width: 44ch;
  justify-self: end;
  text-align: right;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.studio-copy { max-width: 760px; margin-left: 0; }
.studio > .studio-copy { margin-inline: auto; max-width: var(--max); }
.studio-copy p.dim { max-width: 56ch; font-size: 1.1rem; }
.studio-copy .micro { margin-top: 2.4em; }

/* ── Join ───────────────────────────────────────────────────── */

.join { text-align: center; padding-bottom: clamp(140px, 22vh, 240px); }
.join .dim { max-width: 46ch; margin-inline: auto; }
.signup {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 520px;
  margin: 36px auto 0;
}
.signup input {
  flex: 1 1 240px;
  min-width: 0;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(10, 7, 14, 0.45);
  color: var(--ink);
  font: inherit;
}
.signup input::placeholder { color: var(--ink-faint); }
.signup input:focus { outline: none; border-color: var(--accent); }
.signup-status { flex-basis: 100%; min-height: 1.5em; margin-top: 8px; }
.elsewhere {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin-top: 56px;
  padding: 0;
  list-style: none;
}
.elsewhere a {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-dim);
}
.elsewhere a:hover { color: var(--ink); }

.foot {
  display: flex;
  justify-content: space-between;
  padding: 24px var(--gutter) 120px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
}

/* ── Player ─────────────────────────────────────────────────── */

.player {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 30;
  width: min(720px, calc(100% - 24px));
  transform: translate(-50%, 140%);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.player.visible { transform: translate(-50%, 0); }

.player-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px 10px 10px;
}
.player-art { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex: none; }
.player-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.player-title { font-family: var(--serif); font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-sub { font-size: 0.72rem; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-controls { display: flex; align-items: center; gap: 4px; }
.player-time { font-size: 0.74rem; font-variant-numeric: tabular-nums; color: var(--ink-faint); min-width: 3.2em; text-align: right; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  transition: background 0.2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); }
.icon-btn svg { width: 18px; height: 18px; fill: var(--ink); }
.icon-btn.play { width: 44px; height: 44px; background: var(--ink); }
.icon-btn.play svg { fill: #120c10; width: 18px; height: 18px; }
.icon-btn.play:hover { background: #fff; }
.i-pause { display: none; }
body.playing .i-pause { display: block; }
body.playing .i-play { display: none; }

.seek {
  --pct: 0%;
  display: block;
  width: 100%;
  height: 3px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: linear-gradient(90deg, var(--accent) var(--pct), rgba(255, 255, 255, 0.1) var(--pct));
  cursor: pointer;
}
.seek::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--ink); opacity: 0; transition: opacity 0.2s; }
.seek::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--ink); opacity: 0; }
.seek:hover::-webkit-slider-thumb,
.seek:focus-visible::-webkit-slider-thumb { opacity: 1; }
.seek:hover::-moz-range-thumb { opacity: 1; }
.seek:focus-visible { outline: none; }

/* ── Reveal on scroll ───────────────────────────────────────── */

.reveal { opacity: 0; transform: translateY(18px); transition: opacity 1s ease, transform 1s ease; }
.reveal.in { opacity: 1; transform: none; }
.hero .reveal:nth-child(2) { transition-delay: 0.12s; }
.hero .reveal:nth-child(3) { transition-delay: 0.3s; }
.hero .reveal:nth-child(4) { transition-delay: 0.45s; }

/* ── Small screens ──────────────────────────────────────────── */

@media (max-width: 860px) {
  .track-btn { grid-template-columns: 3.2rem minmax(0, 1fr) 3rem; gap: 12px; }
  .track-num, .track-meta { display: none; }
  .eq { left: calc(3.2rem + 12px - 26px); display: none !important; }
  .track-peek { display: none; }
  .focus { grid-template-columns: 1fr; }
  .focus-art { max-width: 520px; }
}

@media (max-width: 560px) {
  .top nav { gap: 14px; }
  .top nav a { font-size: 0.68rem; letter-spacing: 0.12em; }
  .tracklist { padding-left: 20px; }
  .track::before { left: -24px; }
  .player-inner { gap: 8px; padding-right: 10px; }
  .player-time, .player-controls [data-prev] { display: none; }
  .answer { font-size: 0.72rem; }
  .foot { flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
  .reveal, .exchange p { opacity: 1; transform: none; }
}
