/* AudioWave — listing + player styling */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --c1: #0a0c14;
  --c2: #1b2030;
  --accent: #8fd36b;
  --ink: #eef2f6;
  --muted: rgba(238, 242, 246, 0.62);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: #06080f;
  -webkit-font-smoothing: antialiased;
}

/* ---------- listing ---------- */

.listing {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(28px, 7vw, 72px) clamp(16px, 4vw, 28px) 48px;
}

.masthead { text-align: center; margin-bottom: clamp(24px, 5vw, 44px); }

.masthead h1 {
  font-size: clamp(28px, 7vw, 46px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.masthead p {
  margin-top: 10px;
  color: var(--muted);
  font-size: clamp(13px, 3vw, 16px);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(12px, 2.5vw, 20px);
}

.card {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 11px;
  padding: clamp(11px, 2.5vw, 15px) clamp(13px, 3vw, 18px);
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  background: linear-gradient(150deg, var(--c2), var(--c1));
  border: 1px solid rgba(255, 255, 255, 0.09);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card::after {
  content: "";
  position: absolute;
  inset: auto -20% -70% -20%;
  height: 62px;
  background: radial-gradient(closest-side, var(--accent), transparent);
  opacity: 0.16;
  pointer-events: none;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  outline: none;
}

.card-icon { font-size: 24px; line-height: 1; flex-shrink: 0; }

/* Drawn icons sit on the same size scale as the emoji ones. */
.card-icon svg,
.player-icon svg {
  width: 1em;
  height: 1em;
  display: block;
}

/* A block-level SVG ignores the parent's text-align, unlike the emoji icons,
   so it needs auto margins to sit centred on the player page. */
.player-icon svg { margin-inline: auto; }
.card-title { font-size: 17px; font-weight: 650; line-height: 1.2; }
.card-blurb { font-size: 12.5px; color: var(--muted); line-height: 1.45; }

.foot {
  margin-top: 34px;
  text-align: center;
  font-size: 12.5px;
  color: rgba(238, 242, 246, 0.4);
}

/* ---------- player ---------- */

body.is-player {
  background: radial-gradient(120% 100% at 50% 0%, var(--c2), var(--c1) 65%, #05070c);
  min-height: 100dvh;
}

.player {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

#viz {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 42vh;
  pointer-events: none;
}

.player-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 460px;
  width: 100%;
}

.player-icon { font-size: clamp(44px, 12vw, 72px); line-height: 1; display: block; }

.player h1 {
  margin-top: 10px;
  font-size: clamp(24px, 6vw, 36px);
  letter-spacing: -0.02em;
}

.player-blurb {
  margin-top: 8px;
  color: var(--muted);
  font-size: clamp(13px, 3vw, 15px);
  line-height: 1.55;
}

.btn-play {
  margin-top: clamp(26px, 6vw, 40px);
  width: clamp(112px, 30vw, 148px);
  height: clamp(112px, 30vw, 148px);
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.25s ease, transform 0.12s ease;
}

.btn-play:hover { background: rgba(255, 255, 255, 0.1); }
.btn-play:active { transform: scale(0.97); }
.btn-play:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.btn-play.playing {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent);
  animation: pulse 2.8s ease-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.22); }
  70%  { box-shadow: 0 0 0 28px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.vol {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.vol input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 160px;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.22);
  cursor: pointer;
}

.vol input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

.vol input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- sleep timer ---------- */

.timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 20px;
}

.clock {
  min-width: 108px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.clock.ending { color: var(--accent); }

.btn-step {
  padding: 8px 13px;
  min-width: 62px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.btn-step:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.09);
}

.btn-step:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn-step:disabled {
  opacity: 0.3;
  cursor: default;
}

.status {
  margin-top: 16px;
  min-height: 1.2em;
  font-size: 12.5px;
  color: rgba(238, 242, 246, 0.45);
}

.status.error { color: #ff9d9d; }

.btn-back {
  display: inline-block;
  margin-top: 30px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--ink);
  text-decoration: none;
  font-size: 13.5px;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.btn-back:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
}

@media (prefers-reduced-motion: reduce) {
  .card, .btn-play, .btn-back { transition: none; }
  .btn-play.playing { animation: none; }
}
