/* ==========================================================================
   there are no shadows when the sun is at its highest
   Stylesheet organised as: variables -> reset -> background/atmosphere ->
   intro -> header -> stage/display -> rail -> player -> responsive ->
   reduced motion.
   ========================================================================== */

:root {
  /* Current atmosphere colors. These are updated by app.js whenever the
     selected song changes, and every color-based transition below reads
     from them so the whole page tints together. */
  --wash: #3d3652;
  --wash-deep: #221f30;
  --glow: #6b5b8f;
  --ink: #f1ecf7;
  --accent: #8677ad;

  --ink-dim: color-mix(in srgb, var(--ink) 65%, transparent);
  --ink-faint: color-mix(in srgb, var(--ink) 35%, transparent);

  --surface: rgba(10, 9, 15, 0.42);
  --surface-strong: rgba(8, 7, 12, 0.62);
  --border: rgba(255, 255, 255, 0.14);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Work Sans", -apple-system, BlinkMacSystemFont, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-slow: 1.4s;
  --dur-med: 0.7s;
  --dur-fast: 0.3s;

  color-scheme: dark;
}

/* ---------------------------------------------------------------------- */
/* Reset                                                                   */
/* ---------------------------------------------------------------------- */

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

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--wash-deep);
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  transition: color var(--dur-med) var(--ease);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

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

svg { width: 1.1em; height: 1.1em; fill: currentColor; }

/* ---------------------------------------------------------------------- */
/* Atmosphere background                                                  */
/* ---------------------------------------------------------------------- */

.atmosphere-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.atmosphere-bg__wash {
  position: absolute;
  inset: -10%;
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease);
}

.atmosphere-bg__wash--a { background: radial-gradient(120% 90% at 50% 12%, var(--glow) 0%, var(--wash) 45%, var(--wash-deep) 100%); }
.atmosphere-bg__wash--b { background: radial-gradient(120% 90% at 50% 12%, var(--glow) 0%, var(--wash) 45%, var(--wash-deep) 100%); }
.atmosphere-bg__wash.is-active { opacity: 1; }

.atmosphere-bg__art {
  position: absolute;
  inset: -6%;
  background-size: cover;
  background-position: center;
  filter: blur(60px) saturate(1.15);
  opacity: 0;
  transform: scale(1.08);
  transition: opacity var(--dur-slow) var(--ease), transform 6s linear;
}

.atmosphere-bg__art--b { }
.atmosphere-bg__art.is-active { opacity: 0.55; transform: scale(1.14); }

.atmosphere-bg__grain {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------------- */
/* Header                                                                  */
/* ---------------------------------------------------------------------- */

.site-header {
  position: relative;
  z-index: 2;
  padding: 1.75rem clamp(1.25rem, 4vw, 3rem) 0;
}

.site-header__album {
  margin: 0;
  max-width: 22ch;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--ink-dim);
  transition: color var(--dur-med) var(--ease);
}

/* ---------------------------------------------------------------------- */
/* Stage / display                                                        */
/* ---------------------------------------------------------------------- */

.stage {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem clamp(1.25rem, 4vw, 3rem) 12rem;
}

.display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  text-align: center;
}

.display__art-wrap {
  width: min(46vh, 380px);
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 40px 90px -20px rgba(0, 0, 0, 0.65), 0 0 0 1px var(--border);
}

.display__art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity var(--dur-med) var(--ease), transform var(--dur-slow) var(--ease);
}

.display__art.is-visible {
  opacity: 1;
  transform: scale(1);
}

.display__meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}



.display__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: -0.01em;
  transition: opacity var(--dur-fast) ease;
}

.display__title.is-fading {
  opacity: 0;
}

/* ---------------------------------------------------------------------- */
/* Rail (track selection)                                                 */
/* ---------------------------------------------------------------------- */

.rail {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 6.75rem;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 0.85rem;
  padding: 0 clamp(1rem, 4vw, 3rem);
  overflow-x: auto;
  scrollbar-width: none;
}

.rail::-webkit-scrollbar { display: none; }

.rail__item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 3.1rem;
  opacity: 0.55;
  transform: translateY(0) scale(0.94);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.rail__item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.55);
}

.rail__item:hover { opacity: 0.85; }

.rail__item.is-active {
  opacity: 1;
  transform: translateY(-6px) scale(1.12);
}

.rail__item.is-active img {
  box-shadow: 0 10px 24px -6px rgba(0, 0, 0, 0.6), 0 0 0 2px var(--accent);
}

.rail__title {
  display: none;
}

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

.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  align-items: center;
  gap: 1.5rem;
  padding: 0.9rem clamp(1rem, 4vw, 2rem);
  background: var(--surface-strong);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-top: 1px solid var(--border);
}

.player__track {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.player__thumb {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.player__info { min-width: 0; }

.player__song {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player__time {
  margin: 0.1rem 0 0;
  font-size: 0.72rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.player__time-sep { margin: 0 0.3em; }

.player__center {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  min-width: 0;
}

.player__controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.player__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) ease;
}

.player__btn:hover { opacity: 0.75; }
.player__btn:active { transform: scale(0.92); }

.player__btn--ghost {
  width: 2rem;
  height: 2rem;
  color: var(--ink-dim);
}

.player__btn--main {
  width: 2.75rem;
  height: 2.75rem;
  background: var(--ink);
  color: var(--wash-deep);
  transition: background var(--dur-med) var(--ease), color var(--dur-med) var(--ease), transform var(--dur-fast) ease;
}

.player__btn--main svg { width: 1.25em; height: 1.25em; }

.player__progress { flex: 1; min-width: 0; }

.player__bar {
  position: relative;
  height: 1.2rem;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.player__bar-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 2px;
}

.player__bar-fill {
  position: absolute;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--ink);
  border-radius: 2px;
  transition: background var(--dur-med) var(--ease);
}

.player__bar-handle {
  position: absolute;
  left: 0%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  transform: translateX(-50%);
  transition: background var(--dur-med) var(--ease), transform var(--dur-fast) ease;
}

.player__bar:hover .player__bar-handle { transform: translateX(-50%) scale(1.25); }

.player__volume {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.player__volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 5.5rem;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  outline-offset: 4px;
}

.player__volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
}

.player__volume-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
}

/* ---------------------------------------------------------------------- */
/* Intro (album cover moment)                                             */
/* ---------------------------------------------------------------------- */

.intro {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.25rem;
  padding: 2rem;
  background: var(--wash-deep);
  text-align: center;
  transition: opacity var(--dur-slow) var(--ease), visibility var(--dur-slow) var(--ease);
}

.intro__cover-wrap {
  width: min(50vh, 340px);
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 50px 100px -25px rgba(0, 0, 0, 0.7);
}

.intro__cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.intro__title {
  margin: 0;
  max-width: 22ch;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  line-height: 1.25;
}

.intro__artist {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.intro__enter {
  margin-top: 0.75rem;
  padding: 0.7rem 2.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.95rem;
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease;
}

.intro__enter:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
}

.intro.is-dismissed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ---------------------------------------------------------------------- */
/* Responsive                                                              */
/* ---------------------------------------------------------------------- */

@media (max-width: 720px) {
  .stage { padding-bottom: 11.5rem; }

  .display__art-wrap { width: min(58vw, 280px); }

  .rail {
    bottom: 6.25rem;
    justify-content: flex-start;
    gap: 0.65rem;
  }

  .rail__item { width: 2.6rem; }

  .player {
    grid-template-columns: 1fr;
    grid-template-areas: "track" "progress" "controls";
    gap: 0.6rem;
    padding: 0.75rem 1rem 1rem;
  }

  .player__track { grid-area: track; }

  .player__center {
    grid-area: controls;
    justify-content: space-between;
  }

  .player__progress {
    grid-area: progress;
    order: -1;
  }

  .player__volume { display: none; }

  .site-header { padding-top: 1.25rem; }
  .site-header__album { max-width: 16ch; font-size: 0.78rem; }
}

@media (max-width: 420px) {
  .player__center { gap: 0.75rem; }
  .player__controls { gap: 0.4rem; }
}

/* ---------------------------------------------------------------------- */
/* Reduced motion                                                          */
/* ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.15s !important;
    scroll-behavior: auto !important;
  }

  .atmosphere-bg__art { transform: none !important; }
  .display__art { transform: none !important; }
  .rail__item.is-active { transform: none; }
}
