/* ==========================================================================
   VIEWING ROOM — the property gallery, on property_details.html.
   A full-screen stage: each photograph opens through a louvre of vertical
   slats, then settles with a slow zoom. Over it, the title and the
   Exterior / Interior / Film tabs at the top; the counter and caption, the
   filmstrip (the active frame widens and fills with the slideshow's gold
   progress) and the controls at the foot; and a contact sheet of every
   photograph. js/viewing-room.js drives it; without it the first
   photograph shows with its caption.
   ========================================================================== */

.vr {
  --vr-slide: 6.5s;                    /* the slideshow's time per photograph */
  position: relative;
  isolation: isolate;
  height: 100vh;
  height: 100svh;
  min-height: 640px;
  max-height: 1100px;
  overflow: hidden;
  background: #071324;
  color: var(--c-ivory);
}
.vr::before {
  content: "";
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-gold) 30%, #f3dfae 50%, var(--c-gold) 70%, transparent);
  opacity: .7;
  pointer-events: none;
}
.vr:fullscreen { height: 100vh; max-height: none; }


/* --- the stage -------------------------------------------------------------------- */
.vr__stage { position: absolute; inset: 0; touch-action: pan-y; }

.vr__img,
.vr__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.vr__img.is-kb { animation: vr-kb 9s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes vr-kb {
  from { transform: scale(1.07); }
  to   { transform: scale(1); }
}

/* the louvre: vertical slats, each a window onto the same full-stage image */
.vr__louvre { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.vr__slat {
  position: absolute;
  top: 0;
  bottom: 0;
  overflow: hidden;
  clip-path: inset(0 0 100% 0);
  animation: vr-slat .95s cubic-bezier(.77, 0, .18, 1) both;
}
.vr__slat:nth-child(even) { clip-path: inset(100% 0 0 0); animation-name: vr-slat-up; }
.vr__slat img {
  position: absolute;
  top: 0;
  height: 100%;
  max-width: none;
  object-fit: cover;
  transform: scale(1.07);
}
/* a gold hairline down each slat's edge while it opens */
.vr__slat::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent, rgb(208 173 103 / .8), transparent);
  animation: vr-edge 1.4s ease-out both;
}
@keyframes vr-slat    { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes vr-slat-up { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes vr-edge    { 0%, 55% { opacity: 1; } 100% { opacity: 0; } }

/* the film, only in film mode */
.vr__video { z-index: 2; opacity: 0; pointer-events: none; transition: opacity .6s var(--ease-css); }
.vr.is-film.has-film .vr__video { opacity: 1; pointer-events: auto; }

.vr__play {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  display: none;
  place-items: center;
  width: 108px;
  height: 108px;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--c-gold);
  color: var(--c-navy);
  box-shadow: 0 0 0 14px rgb(208 173 103 / .2), 0 30px 60px rgb(0 0 0 / .4);
  transition: scale .4s var(--ease-css), box-shadow .4s var(--ease-css);
}
.vr__play::after {
  content: "";
  position: absolute;
  inset: -14px;
  border: 1px solid rgb(208 173 103 / .6);
  border-radius: 50%;
  animation: vr-ring 2.4s ease-out infinite;
}
@keyframes vr-ring { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.5); } }
.vr__play svg { width: 34px; height: 34px; margin-inline-start: 4px; }
.vr__play .i-pause { display: none; }
.vr__play:hover { scale: 1.06; box-shadow: 0 0 0 18px rgb(208 173 103 / .25), 0 30px 60px rgb(0 0 0 / .4); }
.vr.is-film:not(.is-playing) .vr__play { display: grid; }

.vr__shade {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgb(var(--scrim) / .78) 0%, rgb(var(--scrim) / .25) 24%, transparent 40%),
    linear-gradient(to top, rgb(7 19 36 / .92) 0%, rgb(var(--scrim) / .45) 26%, transparent 50%);
}

/* the stage's left and right thirds step back and forward */
.vr__half {
  position: absolute;
  z-index: 3;
  top: 22%;
  bottom: 30%;
  width: 32%;
}
.vr__half--prev { left: 0; cursor: w-resize; }
.vr__half--next { right: 0; cursor: e-resize; }
.vr.is-film .vr__half,
.vr:not(.is-enhanced) .vr__half { display: none; }


/* --- the overlay -------------------------------------------------------------------- */
.vr__ui {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  pointer-events: none;
}
.vr__ui button,
.vr__ui a { pointer-events: auto; }

.vr__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-md);
  padding-block-start: clamp(100px, 13vh, 140px);
}

.vr__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--c-gold);
  text-shadow: 0 2px 14px rgb(var(--scrim) / .7);
}
.vr__eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; }
.vr__h {
  margin-block-start: 8px;
  font-family: var(--font-display);
  font-size: clamp(40px, 4vw, 72px);
  font-weight: var(--fw-medium);
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--c-ivory);
  text-shadow: 0 4px 30px rgb(var(--scrim) / .5);
}
.vr__h em { font-style: italic; color: var(--c-gold); }

.vr__controls { display: flex; align-items: center; gap: 10px; }

.vr__modes {
  display: flex;
  gap: 2px;
  padding: 5px;
  border: 1px solid rgb(208 173 103 / .3);
  border-radius: var(--r-pill);
  background: rgb(11 25 40 / .55);
  backdrop-filter: blur(12px);
}
.vr__mode {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding-inline: 18px 14px;
  border-radius: var(--r-pill);
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--c-ivory);
  transition: background-color var(--dur-fast) var(--ease-css), color var(--dur-fast) var(--ease-css);
}
.vr__mode b { font-size: 10px; font-weight: var(--fw-bold); letter-spacing: .08em; color: var(--c-gold); transition: color var(--dur-fast) var(--ease-css); }
.vr__mode:hover { background: rgb(248 245 239 / .1); }
.vr__mode.is-active { background: var(--c-gold); color: var(--c-navy); }
.vr__mode.is-active b { color: var(--c-navy); }

.vr__icon,
.vr__btn {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgb(248 245 239 / .25);
  border-radius: 50%;
  background: rgb(11 25 40 / .45);
  backdrop-filter: blur(10px);
  color: var(--c-ivory);
  transition: background-color var(--dur-fast) var(--ease-css), color var(--dur-fast) var(--ease-css), border-color var(--dur-fast) var(--ease-css);
}
.vr__icon svg,
.vr__btn svg { width: 20px; height: 20px; }
.vr__icon:hover,
.vr__btn:hover,
.vr__icon[aria-expanded="true"] { border-color: var(--c-gold); background: var(--c-gold); color: var(--c-navy); }
.vr__icon--full .i-close { display: none; }
.vr:fullscreen .vr__icon--full .i-open { display: none; }
.vr:fullscreen .vr__icon--full .i-close { display: inline; }
.vr.no-fullscreen .vr__icon--full { display: none; }

/* the foot: caption, filmstrip, controls */
.vr__bottom {
  grid-row: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: var(--sp-md) clamp(24px, 3vw, 48px);
  padding-block-end: clamp(28px, 5vh, 52px);
}

.vr__caption { display: grid; gap: 6px; min-width: 0; }
.vr__count {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-display);
  font-variant-numeric: lining-nums tabular-nums;
  line-height: 1;
}
.vr__count b { font-size: clamp(56px, 5.4vw, 96px); font-weight: var(--fw-medium); color: var(--c-gold); }
.vr__count span { font-size: clamp(20px, 1.6vw, 26px); color: var(--c-mist); }
.vr__name {
  max-width: 24ch;
  font-family: var(--font-display);
  font-size: clamp(28px, 2.6vw, 44px);
  font-weight: var(--fw-medium);
  line-height: 1.08;
  letter-spacing: -.01em;
  color: var(--c-ivory);
  text-shadow: 0 4px 30px rgb(var(--scrim) / .5);
}
.vr__kind { font-size: var(--fs-label); font-weight: var(--fw-semi); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--c-mist); text-shadow: 0 2px 14px rgb(var(--scrim) / .7); }
.vr.is-changing .vr__caption > * { animation: vr-cap .7s var(--ease-css) both; }
.vr.is-changing .vr__name { animation-delay: .06s; }
.vr.is-changing .vr__kind { animation-delay: .12s; }
@keyframes vr-cap { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.vr__strip { min-width: 0; }
.vr__thumbs { display: flex; align-items: flex-end; gap: 10px; }
.vr__thumbs[hidden] { display: none; }
.vr__thumb {
  position: relative;
  flex: none;
  width: 92px;
  height: 64px;
  overflow: hidden;
  border: 1px solid rgb(248 245 239 / .2);
  border-radius: 8px;
  opacity: .62;
  transition: width .55s var(--ease-css), height .55s var(--ease-css), opacity .3s var(--ease-css), border-color .3s var(--ease-css);
}
.vr__thumb img { width: 100%; height: 100%; object-fit: cover; }
.vr__thumb:hover { opacity: 1; }
.vr__thumb.is-active { width: 156px; height: 92px; border-color: var(--c-gold); opacity: 1; }
.vr__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--c-gold);
  box-shadow: 0 0 10px rgb(208 173 103 / .7);
  transform: scaleX(0);
  transform-origin: left center;
}
.vr__thumb.is-active .vr__bar { transform: scaleX(1); }
.vr.is-auto .vr__thumb.is-active .vr__bar { transform: scaleX(0); animation: vr-progress var(--vr-slide) linear forwards; }
.vr.is-auto.is-held .vr__thumb.is-active .vr__bar { animation-play-state: paused; }
@keyframes vr-progress { to { transform: scaleX(1); } }

.vr__film-note { max-width: 34ch; font-size: var(--fs-small); line-height: 1.55; color: var(--c-mist); }

.vr__nav { display: flex; gap: 10px; }
.vr__btn--play .i-play { display: none; }
.vr:not(.is-auto) .vr__btn--play .i-pause { display: none; }
.vr:not(.is-auto) .vr__btn--play .i-play { display: inline; }
.vr.is-film .vr__btn--play .i-play { display: inline; }
.vr.is-film .vr__btn--play .i-pause { display: none; }
.vr.is-film.is-playing .vr__btn--play .i-play { display: none; }
.vr.is-film.is-playing .vr__btn--play .i-pause { display: inline; }
.vr.is-film .vr__nav [data-vr-prev],
.vr.is-film .vr__nav [data-vr-next] { display: none; }
.vr:not(.is-enhanced) .vr__nav,
.vr:not(.is-enhanced) .vr__modes,
.vr:not(.is-enhanced) .vr__icon,
.vr:not(.is-enhanced) .vr__strip { display: none; }


/* --- the contact sheet -------------------------------------------------------------- */
.vr__sheet {
  position: absolute;
  inset: 0;
  z-index: 7;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgb(7 19 36 / .94);
  backdrop-filter: blur(14px);
  animation: vr-sheet .45s var(--ease-css) both;
}
.vr__sheet[hidden] { display: none; }
@keyframes vr-sheet { from { opacity: 0; } to { opacity: 1; } }
.vr__sheet-in { padding-block: clamp(96px, 12vh, 130px) var(--sp-xl); }
.vr__sheet-head { display: flex; align-items: center; justify-content: space-between; margin-block-end: var(--sp-md); }
.vr__sheet-group + .vr__sheet-group { margin-block-start: var(--sp-lg); }
.vr__sheet-k {
  margin-block-end: var(--sp-sm);
  font-family: var(--font-display);
  font-size: clamp(28px, 2.4vw, 40px);
  font-weight: var(--fw-medium);
  color: var(--c-ivory);
}
.vr__sheet-k span { font-family: var(--font-body); font-size: 12px; font-weight: var(--fw-bold); letter-spacing: .1em; color: var(--c-gold); vertical-align: super; }
.vr__sheet-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(10px, 1.2vw, 20px); }
.vr__sheet-item {
  display: grid;
  gap: 10px;
  width: 100%;
  text-align: start;
  animation: vr-cap .6s var(--ease-css) both;
}
.vr__sheet-grid li:nth-child(2) .vr__sheet-item { animation-delay: .05s; }
.vr__sheet-grid li:nth-child(3) .vr__sheet-item { animation-delay: .1s; }
.vr__sheet-grid li:nth-child(4) .vr__sheet-item { animation-delay: .15s; }
.vr__sheet-grid li:nth-child(5) .vr__sheet-item { animation-delay: .2s; }
.vr__sheet-item img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid rgb(248 245 239 / .15);
  border-radius: 10px;
  transition: border-color .3s var(--ease-css), transform .5s var(--ease-css);
}
.vr__sheet-item span { display: flex; gap: 10px; font-size: var(--fs-small); font-weight: var(--fw-semi); color: var(--c-ivory); }
.vr__sheet-item b { font-size: 11px; letter-spacing: .12em; color: var(--c-gold); }
.vr__sheet-item:hover img,
.vr__sheet-item:focus-visible img { border-color: var(--c-gold); transform: translateY(-4px); }
.vr__sheet-item.is-current img { border-color: var(--c-gold); box-shadow: 0 0 0 3px rgb(208 173 103 / .3); }


/* --- narrow ----------------------------------------------------------------------------- */
@media (max-width: 1099px) {
  .vr__bottom { grid-template-columns: minmax(0, 1fr) auto; }
  .vr__strip { grid-column: 1 / -1; grid-row: 2; }
  .vr__thumbs { overflow-x: auto; scrollbar-width: none; padding-block-start: 4px; }
  .vr__thumbs::-webkit-scrollbar { display: none; }
  .vr__sheet-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 759px) {
  .vr { height: 92svh; min-height: 600px; }
  .vr__top { flex-direction: column; gap: var(--sp-sm); padding-block-start: 92px; }
  .vr__controls { width: 100%; }
  .vr__modes { flex: 1; }
  .vr__mode { flex: 1; justify-content: center; padding-inline: 8px; min-height: 40px; font-size: 11px; letter-spacing: .1em; }
  .vr__mode b { display: none; }
  .vr__icon { width: 44px; height: 44px; flex: none; }
  .vr__icon--full { display: none; }
  .vr__bottom { gap: 14px 12px; padding-block-end: 22px; }
  .vr__count b { font-size: 52px; }
  .vr__name { font-size: 26px; }
  .vr__nav [data-vr-prev],
  .vr__nav [data-vr-next] { display: none; }
  .vr__btn { width: 44px; height: 44px; }
  .vr__thumb { width: 72px; height: 50px; }
  .vr__thumb.is-active { width: 112px; height: 66px; }
  .vr__half { top: 30%; bottom: 36%; }
  .vr__play { width: 88px; height: 88px; }
  .vr__sheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .vr__img.is-kb,
  .vr__slat,
  .vr__slat::after,
  .vr__play::after,
  .vr.is-changing .vr__caption > *,
  .vr__sheet,
  .vr__sheet-item { animation: none; }
  .vr__slat { clip-path: none; }
  .vr__thumb { transition: none; }
}
