:root {
  --cream: #fbe7bf;
  --cream-dim: rgba(251, 231, 191, 0.72);
  --ink: #4a3215;               /* cut-out colour inside the cream platform marks */
  --bar: rgba(74, 46, 16, 0.5);
  --bar-edge: rgba(251, 231, 191, 0.38);
  --rule: rgba(251, 231, 191, 0.3);
  --bar-h: 126px;              /* kept in sync with the real bar by app.js */
  --gap: 34px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--serif);
  color: var(--cream);
  background: #2a1b0d;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }

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

/* ---------- The two scenes ---------- */

.page { position: relative; overflow: clip; }

.bg { position: absolute; left: 0; right: 0; z-index: -1; }

/* Day: the road. Ends behind the middle of the player bar. */
.bg-day {
  top: 0;
  height: calc(100svh - var(--gap) - var(--bar-h) / 2 + 70px);
  background:
    linear-gradient(to bottom, rgba(10, 38, 78, 0.22), transparent 30%),
    linear-gradient(to top, rgba(40, 24, 6, 0.34), transparent 30%),
    #1c4f86 url("assets/scene-bg.jpg") center / cover no-repeat;
}

/* Dusk: the creek and the fire. Feathers in from behind the player bar. */
.bg-dusk {
  top: calc(100svh - var(--gap) - var(--bar-h) / 2 - 70px);
  bottom: 0;
  overflow: hidden;
  container-type: size;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 140px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 140px);
}

/* The painting keeps its own proportions and crops from the sides or bottom. */
.dusk-art {
  --fx: 0.500;
  --w: max(100cqw, calc(100cqh * 1.251800));
  position: absolute;
  width: var(--w);
  aspect-ratio: 1024 / 818;
  left: calc((100cqw - var(--w)) * var(--fx));
  top: 0;
}
.dusk-art > img { display: block; width: 100%; height: 100%; }
.dusk-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(24, 12, 2, 0.5), transparent 16%);
  pointer-events: none;
}

/* ---------- Layout ---------- */

.day {
  height: calc(100svh - var(--gap) - var(--bar-h));
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding:
    max(clamp(20px, 6.500vh, 72px), env(safe-area-inset-top))
    16px 0;
}

/* The player rides up with the page, then stays at the top over the evening sky. */
.dock {
  position: sticky;
  top: 12px;
  z-index: 5;
  width: min(calc(100% - 32px), 1400px);
  margin: 0 auto;
}

.dusk {
  height: 100svh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

.wordmark { margin: 0; line-height: 0; }

.wordmark img {
  display: block;
  width: min(56vw, 860px);
  height: auto;
  max-height: 36svh;
  object-fit: contain;
  filter: drop-shadow(0 3px 5px rgba(12, 30, 60, 0.45)) drop-shadow(0 10px 26px rgba(12, 30, 60, 0.28));
  user-select: none;
  -webkit-user-drag: none;
}

/* Scroll cue */

.hint {
  height: var(--gap);
  display: grid;
  place-items: center;
  color: var(--cream);
  filter: drop-shadow(0 1px 3px rgba(30, 16, 2, 0.8));
}
.hint svg { width: 22px; height: 22px; animation: nudge 2.400s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(-2px); opacity: 0.6; } 50% { transform: translateY(3px); opacity: 1; } }

/* ---------- Player bar ---------- */

.bar {
  display: grid;
  grid-template-columns: auto minmax(200px, 1.150fr) minmax(250px, 1fr) auto;
  align-items: center;
  column-gap: clamp(18px, 2.200vw, 34px);
  padding: 14px clamp(16px, 2.400vw, 34px);
  background: var(--bar);
  border: 1px solid var(--bar-edge);
  border-radius: 20px;
  -webkit-backdrop-filter: blur(9px) saturate(1.150);
  backdrop-filter: blur(9px) saturate(1.150);
  box-shadow: 0 10px 34px rgba(30, 16, 2, 0.28), inset 0 1px 0 rgba(255, 240, 210, 0.12);
  text-shadow: 0 1px 3px rgba(30, 16, 2, 0.55);
}

.cover {
  display: block;
  width: 96px;
  height: 96px;
  border-radius: 3px;
  border: 1px solid rgba(251, 231, 191, 0.55);
  box-shadow: 0 3px 12px rgba(20, 10, 0, 0.4);
}

/* Tracks */

.tracks {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 112px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}

.track {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  padding: 4px 10px 4px 8px;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1.250;
  letter-spacing: 0.01em;
  text-align: left;
  text-shadow: inherit;
  color: var(--cream);
  transition: background-color 0.150s;
}

.track:hover { background: rgba(251, 231, 191, 0.1); }
.track.current { background: rgba(251, 231, 191, 0.2); }

.track.stream-only .title,
.track.stream-only .num { color: var(--cream-dim); }
.track .marker { width: 10px; flex: none; align-self: center; line-height: 0; opacity: 0; }
.track .marker svg { width: 10px; height: 10px; }
.track.current .marker { opacity: 1; }
.track .num { flex: none; font-variant-numeric: tabular-nums; }
.track .title { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.track .dur { flex: none; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--cream-dim); }

/* Transport */

.transport {
  display: flex;
  align-items: center;
  gap: clamp(14px, 1.800vw, 26px);
  padding: 6px clamp(18px, 2.200vw, 34px);
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  min-width: 0;
}

.buttons { display: flex; align-items: center; gap: 12px; flex: none; }

.skip { width: 30px; height: 30px; display: grid; place-items: center; opacity: 0.92; }
.skip svg { width: 22px; height: 22px; }
.skip:hover { opacity: 1; }

.buttons.single .skip { display: none; }

.play {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1.500px solid var(--cream);
  border-radius: 50%;
  transition: background-color 0.150s;
}
.play:hover { background: rgba(251, 231, 191, 0.14); }
.play svg { width: 24px; height: 24px; }
.play .i-pause { display: none; }
.play.playing .i-play { display: none; }
.play.playing .i-pause { display: block; }

.progress { flex: 1; min-width: 0; padding-top: 12px; }

.seek {
  --pct: 0%;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 14px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.seek::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--cream) var(--pct), rgba(251, 231, 191, 0.34) var(--pct));
}
.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4.500px;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 1px 3px rgba(30, 16, 2, 0.5);
}
.seek::-moz-range-track { height: 3px; border-radius: 3px; background: rgba(251, 231, 191, 0.34); }
.seek::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--cream); }
.seek::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--cream); }

.times {
  display: flex;
  justify-content: space-between;
  margin-top: 3px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--cream-dim);
}

/* Platforms */

.platforms { display: flex; align-items: center; gap: clamp(14px, 1.600vw, 24px); }

.platform {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: opacity 0.150s;
}
.platform svg { width: 26px; height: 26px; flex: none; filter: drop-shadow(0 1px 2px rgba(30, 16, 2, 0.45)); }
.platform:hover { opacity: 0.78; }
.platform[hidden] { display: none; }
.platforms.nudge .platform { animation: beckon 0.900s ease-in-out 2; }
.platforms.nudge .platform:nth-child(2) { animation-delay: 0.120s; }
.platforms.nudge .platform:nth-child(3) { animation-delay: 0.240s; }
.platforms.nudge .platform:nth-child(4) { animation-delay: 0.360s; }
@keyframes beckon { 0%, 100% { transform: none; } 40% { transform: translateY(-4px) scale(1.060); } }

/* Footer line */

.legal {
  margin: 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(251, 231, 191, 0.78);
  text-shadow: 0 1px 3px rgba(30, 16, 2, 0.7);
}

/* Notice */

.notice {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 90%;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(74, 46, 16, 0.82);
  border: 1px solid var(--bar-edge);
  font-size: 13px;
  text-align: center;
  z-index: 10;
}
.notice[hidden] { display: none; }

/* ---------- Mid widths: platforms drop to their own row ---------- */

@media (max-width: 1240px) {
  .bar {
    grid-template-columns: auto minmax(0, 1.100fr) minmax(0, 1fr);
    row-gap: 12px;
  }
  .transport { border-right: 0; padding-right: 0; }
  .platforms {
    grid-column: 1 / -1;
    justify-content: center;
    gap: clamp(20px, 4vw, 44px);
    padding-top: 12px;
    border-top: 1px solid var(--rule);
  }
}

/* ---------- Phones ---------- */

@media (max-width: 760px) {
  :root { --bar-h: 322px; }

  /* The road sits above the player like the album cover; the player rests on warm ground. */
  .bg-day {
    height: calc(100svh - var(--gap) - var(--bar-h) + 44px);
    background:
      linear-gradient(to bottom, rgba(10, 38, 78, 0.2), transparent 26%),
      #1c4f86 url("assets/scene-bg.jpg") 74% center / cover no-repeat;
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 64px), transparent 100%);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 64px), transparent 100%);
  }
  .bg-dusk {
    top: auto;
    height: calc(min(100svh, 150vw) + 80px);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 110px);
    mask-image: linear-gradient(to bottom, transparent 0, #000 110px);
  }
  .dusk-art { --fx: 0.400; top: auto; bottom: 0; }

  .day { padding-top: max(clamp(22px, 5vh, 48px), env(safe-area-inset-top)); }
  .dock { position: relative; top: auto; }
  .dusk { height: min(100svh, 150vw); }

  .wordmark img { width: min(90vw, 520px); max-height: none; }

  .bar {
    grid-template-columns: 64px minmax(0, 1fr);
    column-gap: 14px;
    row-gap: 12px;
    padding: 14px;
    border-radius: 18px;
  }
  .cover { width: 64px; height: 64px; align-self: start; margin-top: 3px; }
  .tracks { max-height: 124px; }
  .track { padding: 5px 6px 5px 4px; font-size: 16px; }

  .transport {
    grid-column: 1 / -1;
    border: 0;
    border-top: 1px solid var(--rule);
    padding: 12px 2px 0;
    gap: 16px;
  }
  .buttons { gap: 8px; }
  .skip { width: 36px; height: 36px; }

  .platforms {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
    padding-top: 12px;
  }
  .platform { flex-direction: column; gap: 5px; font-size: 11px; font-weight: 500; letter-spacing: 0; padding: 2px 0; }
  .platform svg { width: 28px; height: 28px; }
}

/* ---------- Short landscape screens ---------- */

@media (max-height: 520px) and (min-width: 761px) {
  .day { padding-top: 14px; }
  .wordmark img { max-height: 30svh; }
  .cover { width: 72px; height: 72px; }
  .tracks { max-height: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
