/* The music room: one gramophone under one light, and a row of records.
   It stays dark in either theme, since the scene is a photo of a dark stage. */

.room-page {
  background: var(--room);
  color: var(--room-ink);
  :focus-visible {
    outline-color: var(--room-gold);
  }
}

.room {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 2.4dvh, 22px);
  min-height: 100dvh;
  padding: 0 16px 28px;
}

.room-back {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 1;
  padding: 6px 4px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--room-dim);
  text-decoration: none;
  &:hover,
  &:focus-visible {
    color: var(--room-ink);
  }
}

/* The scene's bottom quarter is plain black, so it's cropped off and the
   records sit just below the light on the floor. */
.room-scene {
  display: block;
  width: min(100%, calc(66dvh * 768 / 1040));
  height: auto;
  aspect-ratio: 768 / 1040;
  object-fit: cover;
  object-position: top;
  margin-bottom: calc(-1 * clamp(20px, 4dvh, 44px));
  /* The beam enters at the picture's left edge. Fading that edge keeps it
     from ending in a hard line where the page is wider than the picture. */
  mask-image: linear-gradient(to right, transparent, black 14%);
}

.records {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 3.5vw, 30px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.record {
  --disc: clamp(64px, 19vw, 112px);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 6px 2px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--room-dim);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  &:hover,
  &:focus-visible,
  &[aria-pressed="true"] {
    color: var(--room-ink);
  }
  &[aria-pressed="true"] .record-disc {
    box-shadow:
      0 0 0 2px var(--room-gold),
      0 12px 26px var(--room-shadow);
  }
  @media (prefers-reduced-motion: no-preference) {
    &:hover .record-disc {
      translate: 0 -4px;
    }
    &.is-playing img {
      animation: record-spin 9s linear infinite;
    }
  }
}

/* Only the label turns: grooves look the same at any angle, and the sheen is
   the light's reflection, which stays put on a real record too. */
.record-disc {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--disc);
  aspect-ratio: 1;
  border-radius: 50%;
  background: repeating-radial-gradient(
    circle,
    var(--room-vinyl) 0 2px,
    var(--room-groove) 2px 3px
  );
  box-shadow:
    inset 0 0 0 1px var(--room-line),
    0 12px 26px var(--room-shadow);
  transition: translate 0.25s ease;
  img {
    width: 56%;
    height: 56%;
    border-radius: 50%;
    object-fit: cover;
  }
  &::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(
      from 30deg,
      transparent 0 6%,
      var(--room-sheen) 11%,
      transparent 17% 50%,
      var(--room-sheen) 61%,
      transparent 67%
    );
  }
}

@keyframes record-spin {
  to {
    rotate: 1turn;
  }
}

.room-choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.room-choice {
  padding: 10px 18px;
  border: 1px solid var(--room-line);
  border-radius: 999px;
  background: none;
  color: var(--room-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  &:hover,
  &:focus-visible {
    color: var(--room-ink);
    border-color: var(--room-ink);
  }
  &[aria-pressed="true"] {
    color: var(--room-ink);
    border-color: var(--room-gold);
  }
}

.room-controls {
  display: flex;
  justify-content: center;
  gap: 14px;
}

/* Play and pause share a button; music.js sets data-playing. */
.room-control {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--room-line);
  border-radius: 50%;
  background: none;
  color: var(--room-dim);
  cursor: pointer;
  svg {
    grid-area: 1 / 1;
    width: 18px;
    height: 18px;
  }
  &:hover,
  &:focus-visible {
    color: var(--room-ink);
    border-color: var(--room-ink);
  }
  &[data-playing="true"] .when-paused,
  &[data-playing="false"] .when-playing {
    display: none;
  }
}

/* Keeps its space while hidden, so nothing jumps when music starts. */
.room-now {
  max-width: 36ch;
  min-height: 2.9em;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  text-align: center;
  &[hidden] {
    display: block;
    visibility: hidden;
  }
}

.room-by {
  display: block;
  font-size: 0.78rem;
  color: var(--room-dim);
}

.room-credits {
  max-width: 62ch;
  margin-top: auto;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--room-dim);
  summary {
    width: fit-content;
    margin-inline: auto;
    padding: 4px 6px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    &:hover {
      color: var(--room-ink);
    }
  }
  ul {
    margin: 10px 0 0;
    padding-left: 1.2em;
  }
  a:hover {
    color: var(--room-ink);
  }
}
