/* Hylla · the room scene.
   A single plate of a real room, with a dot on each object. Clicking a dot opens
   that object's pictures in place — the page never navigates, because the point
   of the room is that you stay in it.

   Tokens come from site.css. This file only owns .room-* and .spot-*. */

.room-scene {
  position: relative;
  padding: clamp(3rem, 8vh, 6rem) 0;
  background: var(--sc-canvas);
}

.room-scene__head {
  max-width: 48ch;
  margin: 0 auto clamp(1.5rem, 4vh, 2.5rem);
  padding: 0 clamp(1rem, 4vw, 2rem);
  text-align: center;
}
.room-scene__head p { color: var(--sc-ink-soft); margin: 0.6rem 0 0; }

/* ---------- the plate ---------- */
.room-scene__stage {
  position: relative;
  width: min(100%, 1600px);
  margin: 0 auto;
  /* The dots are positioned in percentages of this box, so the box has to keep
     the plate's aspect ratio EXACTLY. The plate is 1344 x 752, which is a hair
     wider than 16/9 — at 16/9 the sides get cropped and every dot on the left
     and right edges walks off its object. */
  aspect-ratio: 1344 / 752;
  overflow: hidden;
  background: var(--sc-surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset,
              0 24px 60px -40px rgba(26, 31, 29, 0.55);
}
.room-scene__plate {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* ---------- the dot ----------
   Big enough to read as an invitation, and a 44px hit area on touch even though
   the visible dot is smaller. */
.spot {
  position: absolute;
  left: var(--x); top: var(--y);
  transform: translate(-50%, -50%);
  width: 44px; height: 44px;
  display: grid; place-items: center;
  padding: 0; border: 0; background: none;
  cursor: pointer;
  color: #fff;
  z-index: 2;
}
.spot__dot {
  position: relative;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 10px rgba(16, 26, 21, 0.45),
              0 0 0 1px rgba(16, 26, 21, 0.06);
  transition: transform 220ms var(--sc-ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
/* The halo is a separate ring so the dot itself never changes size on the pulse —
   a dot that breathes is harder to hit than one that sits still. */
.spot__dot::after {
  content: "";
  position: absolute; inset: -7px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.8);
  opacity: 0;
  animation: spot-pulse 2.8s var(--sc-ease-out, cubic-bezier(0.23, 1, 0.32, 1)) infinite;
}
@keyframes spot-pulse {
  0%   { transform: scale(0.72); opacity: 0.85; }
  70%  { transform: scale(1.5);  opacity: 0; }
  100% { transform: scale(1.5);  opacity: 0; }
}
.spot:hover .spot__dot,
.spot:focus-visible .spot__dot { transform: scale(1.22); }
.spot:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 50%; }
.spot[aria-expanded="true"] .spot__dot { transform: scale(1.3); background: var(--signal, #c9795c); }
.spot[aria-expanded="true"] .spot__dot::after { animation: none; opacity: 0; }

/* The object's name, revealed on hover so the room can be read without clicking. */
.spot__name {
  position: absolute;
  left: 50%; bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  white-space: nowrap;
  font-size: 0.74rem; letter-spacing: 0.04em; text-transform: uppercase;
  color: #fff;
  background: rgba(16, 26, 21, 0.72);
  padding: 0.3rem 0.55rem;
  border-radius: 2px;
  opacity: 0; pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.spot:hover .spot__name,
.spot:focus-visible .spot__name { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- the panel that opens in place ---------- */
.room-panel {
  position: absolute;
  z-index: 5;
  width: min(30rem, calc(100% - 2rem));
  background: color-mix(in oklab, var(--sc-canvas) 96%, #fff);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset,
              0 24px 60px -30px rgba(26, 31, 29, 0.6);
  padding: 1rem;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 200ms ease, transform 200ms var(--sc-ease-out, cubic-bezier(0.23, 1, 0.32, 1));
  pointer-events: none;
}
.room-panel[data-open] { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* The close button sits at the top right of the panel, so the row that holds the
   price has to end before it does or the two collide. */
.room-panel__top {
  display: flex; align-items: baseline; gap: 0.6rem;
  margin-bottom: 0.15rem;
  padding-right: 2rem;
}
.room-panel__title {
  font-family: var(--sc-font-display);
  font-variation-settings: "wght" 620, "wdth" 100;
  font-size: 1.05rem; letter-spacing: -0.01em; margin: 0;
}
.room-panel__price { margin-left: auto; color: var(--sc-ink); font-variant-numeric: tabular-nums; }
.room-panel__note { color: var(--sc-ink-soft); font-size: 0.86rem; margin: 0 0 0.7rem; }

.room-panel__close {
  position: absolute; top: 0.4rem; right: 0.4rem;
  width: 32px; height: 32px; border: 0; background: none; cursor: pointer;
  color: var(--sc-ink-soft); font-size: 1.1rem; line-height: 1;
  border-radius: 50%;
}
.room-panel__close:hover { color: var(--sc-ink); }
.room-panel__close:focus-visible { outline: 2px solid var(--sc-accent); outline-offset: 2px; }

/* ---------- the draggable strip ----------
   Horizontal scroll is the native behaviour on touch and trackpad; the pointer
   drag below is only there so a mouse user can grab it too. */
.strip {
  display: flex; gap: 0.5rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  padding-bottom: 0.35rem;
  cursor: grab;
  overscroll-behavior-x: contain;
}
.strip[data-dragging] { cursor: grabbing; scroll-snap-type: none; }
.strip[data-dragging] img { pointer-events: none; }
.strip::-webkit-scrollbar { height: 6px; }
.strip::-webkit-scrollbar-thumb { background: color-mix(in oklab, var(--sc-ink) 22%, transparent); border-radius: 3px; }

.strip button {
  flex: 0 0 auto;
  padding: 0; border: 0; background: none; cursor: zoom-in;
  scroll-snap-align: start;
  border-radius: 2px;
}
.strip img {
  display: block;
  width: 108px; height: 132px;
  object-fit: cover;
  border-radius: 2px;
  transition: transform 200ms var(--sc-ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
.strip button:hover img { transform: scale(1.04); }
.strip button:focus-visible { outline: 2px solid var(--sc-accent); outline-offset: 2px; }

.room-panel__hint { margin: 0.5rem 0 0; font-size: 0.74rem; color: var(--sc-ink-soft); }

/* ---------- the big view ----------
   Fixed to the viewport, because "they come big in your screen" means big, not
   big-inside-a-card. */
.lightbox {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: color-mix(in oklab, var(--plate-night, #101a15) 88%, transparent);
  opacity: 0; pointer-events: none;
  transition: opacity 220ms ease;
  padding: clamp(1rem, 4vw, 3rem);
}
.lightbox[data-open] { opacity: 1; pointer-events: auto; }
.lightbox__img {
  max-width: min(100%, 1100px);
  max-height: 86vh;
  object-fit: contain;
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.8);
  transform: scale(0.97);
  transition: transform 260ms var(--sc-ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
.lightbox[data-open] .lightbox__img { transform: scale(1); }
.lightbox__cap {
  position: absolute; left: 0; right: 0; bottom: clamp(0.8rem, 3vh, 1.6rem);
  text-align: center; color: var(--plate-night-soft, #93a399);
  font-size: 0.82rem;
}
.lightbox__btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff; font-size: 1.4rem; cursor: pointer;
  display: grid; place-items: center;
}
.lightbox__btn:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lightbox__btn--prev { left: clamp(0.5rem, 2vw, 1.5rem); }
.lightbox__btn--next { right: clamp(0.5rem, 2vw, 1.5rem); }
.lightbox__close { top: clamp(0.8rem, 3vh, 1.5rem); right: clamp(0.8rem, 3vw, 1.5rem); transform: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- phone ----------
   The panel stops trying to sit next to a dot and becomes a sheet, because at
   375px there is no "next to". */
@media (max-width: 720px) {
  /* Same plate, same ratio on a phone. A 4:5 crop would cut the waffle at the
     left edge and the herringbone stack at the right — the two objects that sit
     closest to the frame. A short wide stage is the honest trade. */
  .room-scene__stage { aspect-ratio: 1344 / 752; }
  .room-panel {
    position: fixed;
    left: 0; right: 0; bottom: 0; top: auto;
    width: 100%;
    border-radius: 12px 12px 0 0;
    transform: translateY(100%);
    transition: transform 260ms var(--sc-ease-out, cubic-bezier(0.23, 1, 0.32, 1)), opacity 200ms ease;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
  .room-panel[data-open] { transform: translateY(0); }
  .strip img { width: 96px; height: 118px; }
}

@media (prefers-reduced-motion: reduce) {
  .spot__dot::after { animation: none; opacity: 0.5; }
  .room-panel, .lightbox, .lightbox__img, .strip img, .spot__dot { transition: none; }
}

/* An object the visitor's country cannot receive: the pictures still open, the
   price stops pretending to be an offer. */
.room-panel[data-unavailable] .room-panel__price { color: var(--sc-ink-soft); text-decoration: line-through; }
.room-panel[data-unavailable] .room-panel__note { color: var(--sc-ink); }
