/* ==========================================================================
   Spyglass Circle — presentation styles
   ========================================================================== */

:root {
  --bg: #0d0d0c;
  --ink: #f3efe7;
  --ink-soft: rgba(243, 239, 231, 0.72);
  --ink-faint: rgba(243, 239, 231, 0.42);
  --line: rgba(243, 239, 231, 0.18);
  --accent: #c9b38a;           /* warm brass */
  --glass: rgba(18, 18, 16, 0.55);
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Manrope", "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(20px, 5vw, 72px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--bg); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.is-loading { overflow: hidden; }
body.is-locked { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }

/* --------------------------------------------------------------------------
   Loader
   -------------------------------------------------------------------------- */
.loader {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity 1.1s var(--ease), visibility 0s linear 1.1s;
}
.loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader picture, .loader__img {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.loader__img { object-fit: cover; transform: scale(1.04); animation: loaderZoom 14s var(--ease) forwards; }
.loader__shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(13,13,12,.25) 0%, rgba(13,13,12,.35) 45%, rgba(13,13,12,.85) 100%);
}
.loader__content {
  position: relative; text-align: center; padding: 0 var(--gutter);
  margin-top: 28vh;
}
.loader__overline, .overline {
  font-family: var(--sans); font-weight: 400;
  font-size: 11px; letter-spacing: .32em; text-transform: uppercase;
  color: var(--ink-soft); margin: 0 0 14px;
}
.loader__title {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(40px, 7vw, 84px); line-height: 1; letter-spacing: .02em;
  margin: 0 0 34px;
}
.loader__bar {
  width: min(240px, 60vw); height: 1px; margin: 0 auto;
  background: var(--line); overflow: hidden;
}
.loader__bar span {
  display: block; height: 100%; width: 100%;
  background: var(--ink); transform-origin: 0 50%; transform: scaleX(0);
  transition: transform .4s var(--ease);
}
.loader__pct {
  margin: 14px 0 0; font-size: 11px; letter-spacing: .2em; color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
@keyframes loaderZoom { to { transform: scale(1); } }

/* --------------------------------------------------------------------------
   Stage
   -------------------------------------------------------------------------- */
.stage {
  position: fixed; inset: 0; z-index: 1;
  height: 100vh; height: 100lvh;
  overflow: hidden; background: var(--bg);
}
.stage__canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
#canvas-front { opacity: 0; }
.stage__veil {
  position: absolute; inset: 0; background: var(--bg); opacity: 0;
}
.stage__closing { position: absolute; inset: 0; opacity: 0; }
.stage__closing picture, .stage__closing img {
  width: 100%; height: 100%;
}
.stage__closing img { object-fit: cover; }
.stage__gradient {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(13,13,12,.38) 0%, rgba(13,13,12,0) 22%),
    linear-gradient(0deg, rgba(13,13,12,.72) 0%, rgba(13,13,12,0) 42%);
}

.track { position: relative; z-index: 0; width: 1px; pointer-events: none; }

/* --------------------------------------------------------------------------
   Text overlays (positioned on the stage, opacity driven by script)
   -------------------------------------------------------------------------- */
.overlays { position: absolute; inset: 0; pointer-events: none; }

.ov {
  position: absolute; opacity: 0; visibility: hidden;
  will-change: opacity, transform;
}
.ov.is-live { visibility: visible; }
.ov.is-interactive { pointer-events: auto; }

.ov h2, .ov h1 {
  font-family: var(--serif); font-weight: 300; margin: 0;
  letter-spacing: .01em; line-height: 1.02;
}
.ov p { margin: 0; }
.ov .text {
  margin-top: 16px; max-width: 34ch;
  color: var(--ink-soft); font-size: clamp(14px, 1.15vw, 16px);
}

/* Hero */
.ov--hero {
  inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 0 var(--gutter);
  background: radial-gradient(ellipse 60% 45% at 50% 50%, rgba(13,13,12,.5) 0%, rgba(13,13,12,0) 100%);
  text-shadow: 0 2px 30px rgba(0,0,0,.35);
}
.ov--hero h1 { font-size: clamp(52px, 10vw, 148px); }
.ov--feature, .ov--room, .ov--chapter, .ov--closing { text-shadow: 0 1px 24px rgba(0,0,0,.35); }
.ov--hero .text { margin-inline: auto; text-align: center; font-style: italic; font-family: var(--serif); font-size: clamp(18px, 1.8vw, 24px); color: var(--ink-soft); }

.scroll-hint {
  position: absolute; left: 50%; bottom: calc(36px + var(--safe-b));
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  font-size: 10px; letter-spacing: .34em; text-transform: uppercase; color: var(--ink-soft);
  transition: opacity .6s var(--ease);
}
.scroll-hint__line {
  width: 1px; height: 46px; background: var(--line); position: relative; overflow: hidden;
}
.scroll-hint__line::after {
  content: ""; position: absolute; left: 0; top: -40%; width: 100%; height: 40%;
  background: var(--ink); animation: hintDrop 2.2s var(--ease) infinite;
}
@keyframes hintDrop { to { top: 100%; } }

/* Feature (Arrival / Backyard / Day to Night) */
.ov--feature {
  left: var(--gutter); bottom: calc(clamp(56px, 11vh, 120px) + var(--safe-b));
  max-width: min(560px, calc(100vw - 2 * var(--gutter)));
}
.ov--feature h2 { font-size: clamp(40px, 5.6vw, 84px); }

/* Room label */
.ov--room {
  left: var(--gutter); bottom: calc(clamp(56px, 10vh, 110px) + var(--safe-b));
  max-width: min(480px, calc(100vw - 2 * var(--gutter)));
}
.ov--room h2 { font-size: clamp(36px, 4.6vw, 68px); }
.ov--room .overline .num { color: var(--accent); margin-right: .9em; }

/* Chapter */
.ov--chapter {
  inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 0 var(--gutter);
}
.ov--chapter .numeral {
  font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--accent);
  margin-bottom: 18px;
}
.ov--chapter h2 { font-size: clamp(56px, 9vw, 132px); }
.ov--chapter .rule { width: 56px; height: 1px; background: var(--line); margin: 30px auto 24px; }
.ov--chapter .text { margin: 0 auto; text-align: center; }

/* Closing */
.ov--closing {
  inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; text-align: center;
  padding: 0 var(--gutter) calc(clamp(72px, 14vh, 140px) + var(--safe-b));
}
.ov--closing h2 { font-size: clamp(48px, 8vw, 120px); }
.ov--closing .text {
  margin: 18px auto 34px; text-align: center; max-width: 30ch;
  font-family: var(--serif); font-style: italic; font-size: clamp(19px, 1.9vw, 26px); color: var(--ink);
}
.ov--closing .credit { margin-top: 28px; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-faint); }

.btn-contact {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 16px 30px; border: 1px solid rgba(243,239,231,.55); border-radius: 999px;
  color: var(--ink); text-decoration: none;
  font-size: 12px; letter-spacing: .22em; text-transform: uppercase; font-weight: 400;
  background: rgba(13,13,12,.25);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background .4s var(--ease), color .4s var(--ease), border-color .4s var(--ease);
}
.btn-contact:hover, .btn-contact:focus-visible { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-contact svg { flex: none; }

/* --------------------------------------------------------------------------
   Floating UI
   -------------------------------------------------------------------------- */
.floor-indicator {
  position: fixed; z-index: 20;
  left: var(--gutter); top: calc(22px + env(safe-area-inset-top, 0px));
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft);
  opacity: 0; transform: translateY(-6px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
  pointer-events: none;
}
.floor-indicator strong { font-weight: 500; color: var(--ink); }
.floor-indicator.is-visible { opacity: 1; transform: none; }
.floor-indicator__dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

.dock {
  position: fixed; z-index: 30;
  right: var(--gutter); bottom: calc(22px + var(--safe-b));
  display: flex; align-items: center; gap: 10px;
  opacity: 0; transition: opacity .8s var(--ease);
}
body.is-ready .dock { opacity: 1; }
.dock__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 42px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--glass);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  color: var(--ink); text-decoration: none; cursor: pointer;
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase; font-weight: 400;
  transition: background .35s var(--ease), border-color .35s var(--ease), opacity .5s var(--ease);
}
.dock__btn:hover, .dock__btn:focus-visible { background: rgba(243,239,231,.14); border-color: rgba(243,239,231,.4); }
.dock__btn--icon { width: 42px; padding: 0; }
.dock__btn--icon.is-hidden { opacity: 0; pointer-events: none; }

:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

/* --------------------------------------------------------------------------
   Floor plans modal
   -------------------------------------------------------------------------- */
.plans {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  opacity: 0; transition: opacity .45s var(--ease);
}
.plans[hidden] { display: none; }
.plans.is-open { opacity: 1; }
.plans__backdrop {
  position: absolute; inset: 0; background: rgba(6,6,5,.86);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.plans__panel {
  position: relative; width: min(1280px, 94vw); height: min(860px, 88vh); height: min(860px, 88dvh);
  display: flex; flex-direction: column;
  transform: translateY(14px) scale(.985); transition: transform .5s var(--ease);
}
.plans.is-open .plans__panel { transform: none; }
.plans__head {
  display: flex; align-items: center; gap: 24px; padding: 0 2px 16px;
  border-bottom: 1px solid var(--line);
}
.plans__title {
  font-family: var(--serif); font-weight: 300; font-size: 28px; margin: 0; white-space: nowrap;
}
.plans__tabs { display: flex; gap: 4px; margin: 0 auto; }
.plans__tab {
  background: none; border: 0; cursor: pointer; padding: 10px 14px;
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint);
  position: relative; transition: color .3s var(--ease);
}
.plans__tab::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -17px; height: 1px;
  background: var(--accent); transform: scaleX(0); transition: transform .4s var(--ease);
}
.plans__tab:hover { color: var(--ink-soft); }
.plans__tab[aria-selected="true"] { color: var(--ink); }
.plans__tab[aria-selected="true"]::after { transform: scaleX(1); }
.plans__close {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  border: 1px solid var(--line); background: none; cursor: pointer;
  display: grid; place-items: center; transition: background .3s var(--ease);
}
.plans__close:hover { background: rgba(243,239,231,.1); }

.plans__viewport {
  position: relative; flex: 1; min-height: 0; overflow: hidden;
  touch-action: none; cursor: zoom-in;
  user-select: none; -webkit-user-select: none;
}
.plans__viewport.is-zoomed { cursor: grab; }
.plans__viewport.is-dragging { cursor: grabbing; }
.plans__layer {
  position: absolute; inset: 0; opacity: 0; visibility: hidden;
  transition: opacity .55s var(--ease), visibility 0s linear .55s;
}
.plans__layer.is-active { opacity: 1; visibility: visible; transition: opacity .55s var(--ease); }
.plans__zoom {
  position: absolute; inset: 0; transform-origin: 0 0;
  will-change: transform;
}
.plans__zoom.is-animating { transition: transform .45s var(--ease); }
.plans__zoom img {
  width: 100%; height: 100%; object-fit: contain; padding: 2% 0;
  pointer-events: none; -webkit-user-drag: none;
}
.plans__hint {
  margin: 10px 0 0; text-align: center; font-size: 10px; letter-spacing: .24em;
  text-transform: uppercase; color: var(--ink-faint);
}

.noscript { position: fixed; inset: 0; display: grid; place-items: center; z-index: 200; background: var(--bg); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 720px) {
  .plans__panel { width: 100vw; height: 100%; padding: calc(14px + env(safe-area-inset-top, 0px)) 14px calc(14px + var(--safe-b)); }
  .plans__head { flex-wrap: wrap; gap: 8px; }
  .plans__title { font-size: 22px; flex: 1; }
  .plans__tabs { order: 3; width: 100%; justify-content: space-between; margin: 0; }
  .plans__tab { padding: 10px 6px; font-size: 10px; letter-spacing: .14em; }
  .plans__tab::after { left: 6px; right: 6px; bottom: -1px; }
  .dock__btn span { letter-spacing: .16em; }
  .floor-indicator { font-size: 10px; }
  .ov .text { max-width: 30ch; }
}

@media (orientation: portrait) and (max-width: 899px) {
  .stage__gradient {
    background:
      linear-gradient(180deg, rgba(13,13,12,.5) 0%, rgba(13,13,12,0) 18%),
      linear-gradient(0deg, rgba(13,13,12,.9) 0%, rgba(13,13,12,0) 48%);
  }
  .ov--feature, .ov--room { bottom: calc(96px + var(--safe-b)); }
  .ov--closing { padding-bottom: calc(100px + var(--safe-b)); }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .2s !important;
  }
  .loader__img { transform: none; }
  .scroll-hint__line::after { display: none; }
}
