:root {
  color-scheme: dark;
  --bg: #050505;
  --text: #f5f3ee;
  --muted: rgba(245, 243, 238, 0.74);
  --faint: rgba(245, 243, 238, 0.18);
  --spotify: #1ed760;
  --offline: #f1f1ef;
  --offline-text: #151515;
  --accent-rgb: 78, 92, 88;
  --ease-cinematic: cubic-bezier(0.22, 0.72, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-height: 100%;
}

body {
  position: relative;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.ambient-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--bg);
  pointer-events: none;
}

.ambient-layer,
.ambient-shade {
  position: absolute;
  inset: 0;
}

.ambient-layer {
  --ambient-artwork: none;
  inset: -5%;
  background:
    radial-gradient(circle at 52% 31%, rgba(30, 215, 96, 0.5), transparent 43%),
    linear-gradient(180deg, rgba(3, 3, 3, 0.18), rgba(3, 3, 3, 0.78));
  background-position: center;
  background-size: cover;
  filter: blur(12px) saturate(1.22) brightness(0.88);
  opacity: 0;
  transform: scale(1.12);
  transition: opacity 850ms var(--ease-cinematic);
}

.ambient-layer::before {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(180deg, rgba(3, 3, 3, 0.03), rgba(3, 3, 3, 0.14)),
    var(--ambient-artwork);
  background-position: center;
  background-size: cover;
  content: "";
  opacity: 0.94;
  transform: scale(1.04);
}

.ambient-layer.is-active {
  opacity: 0.92;
  animation: ambient-drift 28s ease-in-out infinite alternate;
}

.ambient-layer.is-active.is-blooming {
  animation: ambient-bloom 720ms var(--ease-cinematic) both;
}

.ambient-shade {
  background:
    radial-gradient(circle at 50% 38%, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.33) 58%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.21)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), #050505 100%);
}

body[data-playback-state="paused"] .ambient-layer,
body[data-playback-state="offline"] .ambient-layer {
  animation-play-state: paused;
}

body[data-playback-state="paused"] .ambient-layer.is-active,
body[data-playback-state="offline"] .ambient-layer.is-active {
  opacity: 0.84;
}

body.is-scene-departing .ambient-layer.is-active {
  opacity: 0.62;
  animation-play-state: paused;
  transition-duration: 180ms;
}

body.is-page-hidden .ambient-layer,
body.is-page-hidden .art-stage,
body.is-page-hidden .equalizer span {
  animation-play-state: paused !important;
}

.site-topbar,
.site-footer {
  position: fixed;
  z-index: 10;
  left: clamp(1rem, 4vw, 3.2rem);
  right: clamp(1rem, 4vw, 3.2rem);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 1rem;
  font-size: clamp(0.72rem, 1vw, 0.84rem);
  font-weight: 400;
  line-height: 1.08;
  text-transform: uppercase;
}

.site-topbar {
  top: clamp(1rem, 4vw, 2.2rem);
}

.site-footer {
  bottom: clamp(1rem, 4vw, 2rem);
  align-items: end;
}

.brand-name {
  justify-self: start;
  color: var(--text);
  font-weight: 400;
  text-decoration: none;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.16em;
}

.presence-badge {
  justify-self: center;
  min-width: 4.35rem;
  padding: 0.28rem 0.5rem 0.24rem;
  border-radius: 5px;
  color: var(--offline-text);
  background: var(--offline);
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.presence-badge.is-online {
  color: #021008;
  background: var(--spotify);
}

.presence-badge.is-offline {
  color: var(--offline-text);
  background: var(--offline);
}

.location-time {
  justify-self: end;
  display: grid;
  gap: 0.2rem;
  text-align: right;
}

.location-time time {
  color: var(--text);
}

.page-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(6rem, 14vh, 9rem) clamp(1rem, 4vw, 3rem);
}

/* The small viewport remains stable while Safari's browser chrome expands and collapses. */
@supports (min-height: 100svh) {
  body,
  .page-shell {
    min-height: 100svh;
  }
}

.player {
  width: min(520px, 100%);
  display: grid;
  justify-items: center;
  gap: 0.85rem;
  text-align: center;
}

.art-stage,
.art-wrap {
  position: relative;
  aspect-ratio: 1;
  width: min(300px, 70vw);
  height: auto;
}

.art-wrap {
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  background: #0b0b0b;
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  --shadow-x: 0px;
  --shadow-y: 24px;
  --shadow-blur: 60px;
  box-shadow: var(--shadow-x) var(--shadow-y) var(--shadow-blur) rgba(0, 0, 0, 0.44);
  transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) translateZ(0);
  transform-style: preserve-3d;
  transition:
    filter 600ms var(--ease-cinematic),
    box-shadow 600ms var(--ease-cinematic);
}

.player.is-playing .art-stage {
  animation: art-drift 12s var(--ease-cinematic) infinite alternate;
}

.player.is-arriving .art-stage {
  animation: art-arrival 820ms var(--ease-cinematic) both;
}

.player.is-paused .art-wrap,
.player.is-offline .art-wrap {
  filter: saturate(0.78) brightness(0.92);
  --shadow-y: 20px;
  --shadow-blur: 52px;
}

.album-art,
.art-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.album-art {
  z-index: 1;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transform: scale(1.018);
  transition:
    opacity 560ms var(--ease-cinematic),
    transform 620ms var(--ease-cinematic);
  will-change: opacity, transform;
}

.album-art.is-loaded {
  opacity: 1;
  transform: scale(1);
}

.art-fallback {
  display: grid;
  place-items: center;
  color: rgba(0, 0, 0, 0.62);
  font-size: clamp(3.2rem, 20vw, 7rem);
  font-weight: 950;
  letter-spacing: 0;
}

.art-fallback[hidden] {
  display: none;
}

.track-copy {
  width: min(22rem, 100%);
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 0.34rem;
}

.track-copy.is-transitioning .status-row,
.track-copy.is-transitioning .artist,
.track-copy.is-transitioning .song-title,
.track-copy.is-transitioning .album {
  animation: copy-in 520ms var(--ease-cinematic) both;
}

.track-copy.is-transitioning .status-row {
  animation-delay: 20ms;
}

.track-copy.is-transitioning .artist {
  animation-delay: 90ms;
}

.track-copy.is-transitioning .song-title {
  animation-delay: 150ms;
}

.track-copy.is-transitioning .album {
  animation-delay: 220ms;
}

.status-row {
  order: -2;
  display: flex;
  gap: 0.42rem;
  align-items: center;
  justify-content: center;
  min-height: 1rem;
}

.equalizer {
  position: relative;
  display: inline-grid;
  grid-template-columns: repeat(3, 3px);
  gap: 3px;
  align-items: end;
  width: 15px;
  height: 12px;
  transform: translateY(-0.02em);
}

.equalizer span {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: var(--text);
  opacity: 0.48;
  transform: scaleY(0.25);
  transform-origin: bottom;
}

.player.is-playing .equalizer span {
  background: var(--spotify);
  opacity: 1;
  animation: bounce 820ms ease-in-out infinite;
}

.player.is-playing .equalizer span:nth-child(2) {
  animation-duration: 680ms;
  animation-delay: 120ms;
}

.player.is-playing .equalizer span:nth-child(3) {
  animation-duration: 940ms;
  animation-delay: 240ms;
}

.player:not(.is-playing) .equalizer {
  display: inline-grid;
  place-items: center;
}

.player:not(.is-playing) .equalizer span {
  display: none;
}

.player:not(.is-playing) .equalizer::after {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(245, 243, 238, 0.48);
  content: "";
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.5rem, 2vw, 0.6rem);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: uppercase;
}

.song-title {
  margin: 0;
  display: -webkit-box;
  max-width: min(22ch, 100%);
  overflow: hidden;
  color: var(--text);
  font-size: clamp(1.45rem, 4vw, 1.85rem);
  font-weight: 760;
  line-height: 0.96;
  letter-spacing: 0;
  text-transform: uppercase;
  overflow-wrap: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.artist,
.album {
  max-width: 100%;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.1rem);
  font-weight: 400;
  line-height: 1.25;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.artist {
  display: -webkit-box;
  order: -1;
  margin-top: 0.15rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.album {
  margin-top: 0;
  font-size: clamp(0.7rem, 2vw, 0.8rem);
  color: rgba(245, 243, 238, 0.62);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  align-items: center;
  margin-top: 0.65rem;
}

.spotify-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  gap: 0.36rem;
  padding: 0.4rem 0.82rem;
  border: 1px solid rgba(245, 243, 238, 0.72);
  border-radius: 999px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.08);
  font-size: clamp(0.82rem, 2.4vw, 0.94rem);
  font-weight: 400;
  text-decoration: none;
  text-transform: none;
  transition:
    padding 220ms var(--ease-cinematic),
    transform 220ms var(--ease-cinematic),
    color 220ms ease,
    background 220ms ease;
}

.spotify-link:hover {
  color: #000;
  background: #fff;
  padding-inline: 0.88rem 0.78rem;
  transform: translateY(-1px);
}

.spotify-link[hidden] {
  display: none;
}

.explicit {
  padding: 0.28rem 0.45rem;
  border-radius: 2px;
  color: #000;
  background: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.about-wrap {
  position: relative;
  justify-self: start;
  grid-column: 1;
}

.info-button {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(245, 243, 238, 0.72);
  border-radius: 50%;
  color: var(--text);
  background: rgba(0, 0, 0, 0.18);
  font: inherit;
  line-height: 1;
  cursor: pointer;
  transition:
    transform 160ms ease,
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.info-button span {
  font-size: 0.9rem;
  font-weight: 650;
  transform: translateY(-0.02em);
}

.info-button:hover,
.info-button:focus-visible {
  border-color: var(--text);
  color: var(--text);
  background: rgba(245, 243, 238, 0.1);
}

.info-button:hover {
  transform: translateY(-1px) scale(1.02);
}

.info-button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.about-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.85rem);
  z-index: 20;
  width: min(360px, calc(100vw - 2rem));
  max-height: min(70vh, 360px);
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--faint);
  border-radius: 8px;
  color: var(--text);
  background: rgba(10, 10, 10, 0.94);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.48);
  text-transform: none;
}

.about-popover h2 {
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
  font-weight: 680;
  line-height: 1.15;
}

.about-popover p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 520;
  line-height: 1.45;
}

.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 19;
  background: transparent;
}

@keyframes bounce {
  0%,
  100% {
    transform: scaleY(0.25);
  }

  50% {
    transform: scaleY(1);
  }
}

@keyframes ambient-drift {
  0% {
    transform: translate3d(-0.35%, 0.15%, 0) scale(1.12);
  }

  100% {
    transform: translate3d(0.4%, -0.25%, 0) scale(1.135);
  }
}

@keyframes ambient-bloom {
  0% {
    opacity: 0.08;
    transform: scale(1.15);
  }

  48% {
    opacity: 0.96;
  }

  100% {
    opacity: 0.92;
    transform: scale(1.12);
  }
}

@keyframes art-drift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  100% {
    transform: translate3d(0, -2px, 0) scale(1.014);
  }
}

@keyframes art-arrival {
  0% {
    opacity: 0.72;
    transform: translate3d(0, 5px, 0) scale(0.985);
  }

  55% {
    opacity: 1;
    transform: translate3d(0, -1px, 0) scale(1.018);
  }

  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes copy-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (hover: hover) and (pointer: fine) {
  .art-wrap {
    will-change: transform;
  }

  .brand-name {
    transition: opacity 180ms ease;
  }

  .brand-name:hover {
    opacity: 0.7;
  }

  .spotify-link:focus-visible {
    color: #000;
    background: #fff;
    outline: 1px solid rgba(245, 243, 238, 0.5);
    outline-offset: 3px;
  }
}

@media (max-width: 720px) {
  .site-topbar,
  .site-footer {
    left: 1rem;
    right: 1rem;
    grid-template-columns: 1fr auto 1fr;
    row-gap: 0.9rem;
  }

  .presence-badge {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
  }

  .location-time {
    grid-column: 3;
  }

  .page-shell {
    align-items: center;
    padding: 6.9rem 1rem 5.8rem;
  }

  .player {
    gap: 0.72rem;
  }

  .art-stage,
  .art-wrap {
    width: min(78vw, 42vh, 350px);
  }

  .track-copy {
    gap: 0.25rem;
  }

  .status {
    font-size: 0.56rem;
    letter-spacing: 0.04em;
  }

  .artist,
  .album {
    line-height: 1.18;
  }

  .actions {
    margin-top: 0.5rem;
  }

  .site-footer {
    bottom: calc(clamp(1rem, 4vw, 2rem) + env(safe-area-inset-bottom, 0px));
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    justify-items: stretch;
  }

  .about-wrap {
    grid-column: 1;
    justify-self: start;
  }

  .about-popover {
    position: fixed;
    right: 1rem;
    bottom: calc(clamp(1rem, 4vw, 2rem) + env(safe-area-inset-bottom, 0px) + 2.75rem);
    left: 1rem;
    width: auto;
  }

  .song-title {
    max-width: 100%;
    font-size: clamp(1.26rem, 6.4vw, 1.85rem);
  }
}

@media (max-width: 420px) {
  .site-topbar,
  .site-footer {
    left: 0.8rem;
    right: 0.8rem;
    font-size: 0.66rem;
  }

  .presence-badge {
    min-width: 0;
  }

  .about-popover {
    right: 0.8rem;
    left: 0.8rem;
  }

  .page-shell {
    padding: 6.35rem 0.8rem 5.15rem;
  }

  .art-stage,
  .art-wrap {
    width: min(82vw, 43vh, 330px);
  }

  .player {
    gap: 0.62rem;
  }

  .track-copy {
    gap: 0.2rem;
  }
}

@media (max-width: 420px) and (min-height: 720px) {
  .player {
    transform: translateY(-0.7rem);
  }
}

@media (max-width: 720px) and (max-height: 700px) {
  .page-shell {
    padding: 4.75rem 1rem 4.25rem;
  }

  .art-stage,
  .art-wrap {
    width: min(72vw, 36vh, 280px);
    width: min(72vw, 36svh, 280px);
  }

  .player {
    gap: 0.5rem;
  }

  .track-copy {
    gap: 0.16rem;
  }

  .actions {
    margin-top: 0.35rem;
  }
}

@media (max-width: 720px) and (max-height: 520px) {
  .page-shell {
    padding: 3.9rem 1rem 3.6rem;
  }

  .art-stage,
  .art-wrap {
    width: min(60vw, 28vh, 180px);
    width: min(60vw, 28svh, 180px);
  }
}

@media (max-width: 720px) and (max-height: 420px) {
  .player {
    transform: scale(0.88);
  }
}

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

  .art-wrap {
    --tilt-x: 0deg !important;
    --tilt-y: 0deg !important;
  }

  .player.is-playing .equalizer span {
    height: 5px;
    transform: none;
    animation: none !important;
  }
}
