/*
  HOMEPAGE HERO — the listening room (markup: index.html, behaviour: js/modules/listeningRoom.js)

  .room            the scroll track: its height is the length of the camera move + a dwell
  .room__stage     pinned to the viewport while the track scrolls past
  .room__frames    the camera move through the room (a frame sequence on a canvas)
  .room__shot      the first frame (paints before the canvas) and the top-down photograph,
                   positioned by transform (anchored on the record)
  .room__canvas    the Three.js layer, transparent, exactly over the top-down photograph
  .room__intro     the headline over the wide room
  .room__ui        minimal controls once the collection is up
*/

.room {
  position: relative;
  height: 480svh;
  background: #1c0609;
  color: var(--color-off-white);
}

.room__stage {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  outline: none;
}

.room__photos {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.room__shot {
  position: absolute;
  left: 0;
  top: 0;
  width: auto; /* the intrinsic size (width/height attributes): transforms scale from it */
  height: auto;
  max-width: none;
  transform-origin: 0 0;
  opacity: 0;
  will-change: transform, opacity;
  user-select: none;
  -webkit-user-drag: none;
}

.room__shot[data-shot='wide'] {
  opacity: 1;
}

/* the camera move (frame sequence), drawn by js/modules/frameSequence.js */
.room__frames {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* the top-down photograph may not reach the edges: let it melt into the dark
   (the same fade the frame canvas applies to the last frame, so the hand-over is invisible) */
.room__shot--top {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 9%, #000 91%, transparent 100%),
    linear-gradient(to right, transparent 0, #000 5%, #000 95%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to bottom, transparent 0, #000 9%, #000 91%, transparent 100%),
    linear-gradient(to right, transparent 0, #000 5%, #000 95%, transparent 100%);
  mask-composite: intersect;
}

.room__canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  opacity: 0;
  touch-action: pan-y; /* vertical swipes still scroll the page; horizontal ones browse */
}

.room__vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 70% at 50% 46%, transparent 55%, rgba(18, 3, 7, 0.55) 100%),
    linear-gradient(to bottom, rgba(18, 3, 7, 0.35), transparent 18%);
}

/* ---- the headline over the wide room ---- */
.room__intro {
  --out: 0;
  position: absolute;
  z-index: 3;
  left: calc(var(--edge) + 2vw);
  top: 44%;
  width: min(36vw, 600px);
  display: flex;
  flex-direction: column;
  opacity: calc(1 - var(--out));
  transform: translate3d(0, calc(-50% - var(--out) * 40px), 0);
  text-shadow: 0 1px 24px rgba(20, 4, 8, 0.35);
  pointer-events: none;
}

.room:not(.is-ready) .room__intro {
  opacity: 0;
}

.room.is-revealing .room__intro,
.room.is-revealing .room__invite {
  transition: opacity 1.3s var(--ease-out) 0.15s;
}

.room__title {
  display: flex;
  flex-direction: column;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
}

.room__title-a {
  align-self: flex-start;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: clamp(2rem, 4.4vw, 4.8rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.room__title-b {
  align-self: flex-start;
  margin-left: 18%;
  padding: 0 0.06em 0.04em;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 300;
  font-optical-sizing: auto;
  font-size: clamp(2.8rem, 6.8vw, 7.4rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.room__title-c {
  align-self: flex-end;
  margin-top: 0.3em;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: clamp(0.95rem, 1.7vw, 1.85rem);
  line-height: 1;
  letter-spacing: -0.025em;
  text-transform: uppercase;
}

.room__support {
  align-self: flex-end;
  max-width: 30ch;
  margin-top: var(--space-sm);
  font-size: var(--fs-body);
  line-height: 1.5;
  text-align: right;
  color: rgba(243, 239, 232, 0.72);
}

/* ---- the invitation ---- */
.room__invite {
  --out: 0;
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: var(--space-md);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9em;
  font-size: var(--fs-micro);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  white-space: nowrap;
  color: rgba(243, 239, 232, 0.8);
  opacity: calc(1 - var(--out));
  pointer-events: none;
}

.room:not(.is-ready) .room__invite {
  opacity: 0;
}

.room__invite-line {
  position: relative;
  width: 1px;
  height: 42px;
  overflow: hidden;
  background: rgba(243, 239, 232, 0.2);
}

.room__invite-line::after {
  content: '';
  position: absolute;
  left: 0;
  top: -40%;
  width: 1px;
  height: 40%;
  background: var(--color-off-white);
  animation: room-drip 2.2s var(--ease-in-out) infinite;
}

@keyframes room-drip {
  to { top: 100%; }
}

/* ---- controls (only once the collection is up) ---- */
.room__ui {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}

.room__ui.is-on {
  opacity: 1;
}

.room__ui.is-on > * {
  pointer-events: auto;
}

.room__browse {
  position: absolute;
  left: 50%;
  bottom: max(1.4vh, 10px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

/* under the covers: a small italic heading over the record's name */
.room__now {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

/* the heading over the collection (in .room__pick): the display serif, upright, a quiet ivory */
.room__heading {
  font-family: var(--font-display, var(--font-serif));
  font-weight: 400;
  font-style: italic;
  font-size: calc(25px * var(--k, 0.8));
  line-height: 1;
  letter-spacing: 0.005em;
  white-space: nowrap;
  color: #fff; /* the same white as "Drag" (2026-12-06) */
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.35);
}

/* "Drag", on the record beside the needle. Placed by listeningRoom.js at the stylus (left/top,
   --k: the picture's scale); the arrow's tip is that point, the word sits down-left of it. */
.room__drag {
  --k: 0.8;
  position: absolute;
  width: 0;
  height: 0;
  color: #fff;
  opacity: 0;
  transition: opacity 0.7s var(--ease-out);
  pointer-events: none;
}

.room__ui.is-on .room__drag.is-on {
  opacity: 1;
  transition-delay: 0.5s;
}

/* sized with "Pick a record, any record.": the word takes the heading's size (--pk, set by
   listeningRoom.js from the heading's scale) and the arrow shrinks with it (--d) */
.room__drag-arrow {
  --d: calc(var(--pk, var(--k)) * 0.72);
  position: absolute;
  left: calc(-85px * var(--d));
  top: calc(-5px * var(--d));
  width: calc(90px * var(--d));
  height: calc(30px * var(--d));
  max-width: none; /* the cue box itself has no width */
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  opacity: 0.85;
}

.room__drag-word {
  --d: calc(var(--pk, var(--k)) * 0.72);
  position: absolute;
  right: calc(87px * var(--d) + 0.35em);
  top: calc(25px * var(--d) - 0.62em);
  font-family: var(--font-display, var(--font-serif));
  font-style: italic;
  font-size: calc(25px * var(--pk, var(--k)));
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

@media (prefers-reduced-motion: no-preference) {
  .room__ui.is-on .room__drag.is-on .room__drag-arrow {
    animation: room-drag-nudge 2.8s var(--ease-in-out) 1.2s infinite;
  }
}

@keyframes room-drag-nudge {
  0%, 70%, 100% { translate: 0 0; }
  35% { translate: 3px -2px; }
}

/* Above the collection, on the left: the heading, and under it the browsing cue in the same hand
   as "Drag" (a low two-headed arrow, then "Drag to browse" / "Swipe to browse"). Placed by
   listeningRoom.js (left: the block's left edge; top: its foot; --k: its scale). The cue goes once
   the visitor has moved through the records; the heading stays. Never in the way of a drag. */
.room__ui.is-on > .room__pick,
.room__pick {
  pointer-events: none;
}

.room__pick {
  --k: 0.8;
  position: absolute;
  left: 6vw;
  top: 58%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: calc(10px * var(--k));
  transform: translateY(-100%);
}

.room__swipe {
  display: flex;
  align-items: center;
  gap: calc(12px * var(--k));
  color: #fff;
  opacity: 0;
  transition: opacity 0.7s var(--ease-out);
}

/* The two lines are one composition (2026-12-06, round 2): "Scroll or drag to browse" is centred
   under "Pick a record, any record." (the arrows are mirror images at equal gaps, so the words'
   centre is the heading's centre). listeningRoom.js centres the pair over the left fan of covers,
   clear of the turntable. */
@media (min-width: 701px) {
  .room__pick {
    align-items: center;
    gap: calc(12px * var(--k));
  }
}

.room__ui.is-on .room__swipe.is-on {
  opacity: 1;
  transition-delay: 0.9s;
}

.room__ui.is-on .room__swipe.is-on.is-used {
  opacity: 0.6;
  transition-delay: 0s;
}

.room__swipe .room__swipe-word {
  position: static;
  font-size: calc(23px * var(--k));
}

.room__swipe .room__swipe-arrow {
  position: static;
  width: calc(46px * var(--k));
  height: calc(19px * var(--k));
}

/* each arrow nudges out its own way, one after the other */
@media (prefers-reduced-motion: no-preference) {
  .room__ui.is-on .room__swipe.is-on .room__swipe-arrow--prev {
    animation: room-swipe-prev 3.2s var(--ease-in-out) 1.6s infinite;
  }
  .room__ui.is-on .room__swipe.is-on .room__swipe-arrow--next {
    animation: room-swipe-next 3.2s var(--ease-in-out) 1.6s infinite;
  }
}

@keyframes room-swipe-prev {
  0%, 20%, 60%, 100% { translate: 0 0; }
  40% { translate: -4px 0; }
}

@keyframes room-swipe-next {
  0%, 50%, 90%, 100% { translate: 0 0; }
  70% { translate: 4px 0; }
}

/* Nothing looks chosen until the visitor has chosen: the record's name and Play wait until the
   albums have been browsed, hovered or clicked (listeningRoom.js sets .is-chosen). They keep their
   room, so nothing moves when they appear. */
.room__ui .room__caption,
.room__ui .room__play {
  transition: opacity 0.6s var(--ease-out), visibility 0s linear 0.6s, border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.room__ui:not(.is-chosen) .room__caption,
.room__ui:not(.is-chosen) .room__play {
  opacity: 0;
  visibility: hidden;
}

.room__ui.is-chosen .room__caption,
.room__ui.is-chosen .room__play {
  transition-delay: 0s;
}

.room__caption {
  min-width: 18ch;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.5em;
  font-size: var(--fs-small);
  line-height: 1.2;
  white-space: nowrap;
}

.room__artist {
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.room__dash {
  opacity: 0.5;
}

.room__album {
  font-family: var(--font-serif);
  font-size: 1.15em;
  font-weight: 300;
  color: rgba(243, 239, 232, 0.8);
}

.room__arrow {
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid rgba(243, 239, 232, 0.28);
  border-radius: 50%;
  color: var(--color-off-white);
  font-size: 0.9rem;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.room__arrow:hover,
.room__arrow:focus-visible {
  border-color: var(--color-off-white);
  background: rgba(243, 239, 232, 0.08);
}

.hint-touch {
  display: none;
}

@media (hover: none) {
  .hint-pointer {
    display: none;
  }
  .hint-touch {
    display: inline;
  }
}

.room__play {
  margin-left: 0.4rem;
  padding: 0.55em 1.2em;
  border: 1px solid rgba(243, 239, 232, 0.35);
  border-radius: 999px;
  font-size: var(--fs-micro);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--color-off-white);
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.room__play:hover,
.room__play:focus-visible {
  border-color: var(--color-off-white);
  background: rgba(243, 239, 232, 0.08);
}

/* leaving the room: clear, quiet, always in the same corner */
.room__exit {
  position: absolute;
  right: var(--edge);
  bottom: max(1.4vh, 10px);
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.55em 0;
  font-size: var(--fs-micro);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--color-off-white);
  border-bottom: 1px solid rgba(243, 239, 232, 0.35);
  transition: border-color var(--dur-fast) var(--ease-out), gap var(--dur-fast) var(--ease-out);
}

.room__exit span {
  display: inline-block;
  transition: transform var(--dur-fast) var(--ease-out);
}

.room__exit:hover,
.room__exit:focus-visible {
  border-color: var(--color-off-white);
}

.room__exit:hover span,
.room__exit:focus-visible span {
  transform: translateY(3px);
}

/* ---- fallback (no WebGL): one disc spins on the photographed platter ---- */
.room__fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.room__fb-wrap {
  position: absolute;
}

.room__fb-disc {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.8s var(--ease-out);
}

.room__fb-disc.is-on {
  opacity: 1;
  animation: room-spin 1.8s linear infinite;
}

.room__fb-disc.is-paused {
  animation-play-state: paused;
}

@keyframes room-spin {
  to { rotate: 360deg; }
}

@media (max-width: 700px) {
  .room {
    height: 400svh;
  }
  .room__intro {
    left: var(--edge);
    right: var(--edge);
    top: 34%;
    width: auto;
    padding: 1.4rem 1.2rem 1.6rem;
    background: radial-gradient(ellipse at 50% 50%, rgba(28, 6, 9, 0.6), rgba(28, 6, 9, 0) 72%);
  }
  .room__title-a {
    font-size: 11.5vw;
  }
  .room__title-b {
    margin-left: 10%;
    font-size: 18vw;
  }
  .room__title-c {
    font-size: 4.9vw;
  }
  .room__support {
    font-size: var(--fs-small);
  }
  .room__browse {
    gap: 0.7rem;
    bottom: calc(3.4rem + 1.4vh);
  }
  .room__caption {
    min-width: 0;
    flex-direction: column;
    align-items: center;
    gap: 0.1em;
  }
  .room__dash {
    display: none;
  }
  .room__browse {
    flex-wrap: wrap;
    justify-content: center;
    width: calc(100% - 2 * var(--edge));
  }
  .room__play {
    order: 3;
  }
  .room__exit {
    right: 50%;
    transform: translateX(50%);
    bottom: max(1vh, 8px);
  }
  /* Phones: the covers fill the width down to the buttons, so the heading and the record's name
     move into the gap between the turntable and the covers, and the arrows and Play make a
     compact row at the bottom (the long hint gives way: the "Drag" cue and the heading say it) */
  .room__browse {
    display: contents;
  }
  .room__now {
    position: absolute;
    left: 50%;
    top: 52%;
    width: max-content;
    max-width: calc(100% - 2 * var(--edge));
    transform: translate(-50%, -50%);
    gap: 0.2rem;
  }
  .room__now .room__caption {
    flex-direction: row;
    gap: 0.5em;
  }
  .room__arrow,
  .room__play {
    position: absolute;
    bottom: calc(3.4rem + 1.4vh);
  }
  .room__arrow[data-room-prev] {
    left: calc(50% - 7.4rem);
  }
  .room__arrow[data-room-next] {
    left: calc(50% + 5.2rem);
  }
  .room__play {
    left: 50%;
    margin: 0;
    transform: translateX(-50%);
    background: rgba(28, 6, 9, 0.55);
  }
  /* the heading and the cue: centred in the gap between the turntable and the covers, the
     record's name just under them once one has been chosen */
  .room__pick {
    left: 50%;
    top: 50.5%;
    align-items: center;
    gap: calc(6px * var(--k));
    transform: translate(-50%, -100%);
  }
  .room__heading {
    font-size: calc(24px * var(--k, 0.8));
  }
  .room__now {
    top: 54.5%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .room__invite-line::after {
    animation: none;
    top: 30%;
  }
  .room__fb-disc.is-on {
    animation-duration: 6s;
  }
}

/* ---------- No Play button in the room (2026-12-06) ----------
   The complete Deezer logo takes its place (css/sound.css). Records are played by dropping the
   tonearm on them by hand, as before. The button itself stays in the page for keyboard and screen
   reader visitors only (it appears while it has keyboard focus), and in the no-WebGL fallback,
   where there is no tonearm, it stays visible: no way of playing a record is lost. */
.room__ui:not(.is-fallback) .room__play:not(:focus-visible) {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
