:root {
  --ink: #0c0a08;
  --ink-soft: #17130f;
  --paper: #f5efe4;
  --paper-dim: #d8cdb8;
  --gold: #c9a463;
  --gold-bright: #e7c98a;
  --line: rgba(245, 239, 228, 0.16);

  --font-display: 'Cinzel', serif;
  --font-body: 'Josefin Sans', sans-serif;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-stopped) { overscroll-behavior: contain; }

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-weight: 300;
  overflow-x: hidden;
  cursor: none;
}

@media (pointer: coarse) {
  body { cursor: auto; }
}

::selection { background: var(--gold); color: var(--ink); }

/* ---------- Loader ---------- */
#loader {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  transition: opacity 700ms var(--ease-in-out), filter 700ms var(--ease-in-out);
}
#loader.is-done {
  opacity: 0;
  filter: blur(6px);
  pointer-events: none;
}
.loader-mark {
  font-family: var(--font-display);
  letter-spacing: 0.35em;
  font-size: 14px;
  color: var(--gold-bright);
}
.loader-bar-track {
  width: min(240px, 60vw);
  height: 1px;
  background: var(--line);
}
.loader-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--gold);
  transition: width 220ms var(--ease-out);
}
.loader-pct {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--paper-dim);
}

/* ---------- Custom cursor ---------- */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--gold-bright);
  pointer-events: none;
  z-index: 998;
  mix-blend-mode: difference;
  transform: translate(-50%, -50%) scale(1);
  transition: width 220ms var(--ease-out), height 220ms var(--ease-out), background 220ms var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (pointer: coarse) { .cursor { display: none; } }
.cursor.is-hover {
  width: 64px;
  height: 64px;
  background: var(--paper);
}
.cursor-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink);
  opacity: 0;
  transition: opacity 180ms var(--ease-out);
}
.cursor.is-hover .cursor-label { opacity: 1; }

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px clamp(20px, 5vw, 56px);
  mix-blend-mode: difference;
}
.nav-mark {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.3em;
  color: var(--paper);
}
.nav-links a {
  color: var(--paper);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.08em;
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -4px;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 320ms var(--ease-out);
}
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- Progress rail ---------- */
.rail {
  position: fixed;
  right: clamp(16px, 3vw, 32px);
  top: 50%;
  transform: translateY(-50%);
  height: 140px;
  z-index: 55;
  mix-blend-mode: difference;
}
.rail-track {
  width: 1px;
  height: 100%;
  background: var(--line);
  position: relative;
}
.rail-fill {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 0%;
  background: var(--paper);
  transition: height 60ms linear;
}

/* ---------- Scroll-scrub section ---------- */
.scrub-wrap {
  position: relative;
  height: 500vh;
}
.scrub-pin {
  position: relative;
  height: 100svh;
  width: 100%;
  overflow: hidden;
  background: var(--ink);
}
#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scene-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(12,10,8,0.55) 0%, rgba(12,10,8,0.05) 22%, rgba(12,10,8,0.05) 66%, rgba(12,10,8,0.75) 100%),
    radial-gradient(120% 90% at 50% 50%, transparent 45%, rgba(12,10,8,0.35) 100%);
  pointer-events: none;
}

.beat {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
  opacity: 0;
  pointer-events: none;
}
.beat[data-beat="1"] { align-items: center; justify-content: flex-end; padding-bottom: 14vh; }
.beat[data-beat="2"] { align-items: flex-start; justify-content: center; text-align: left; padding-left: clamp(24px, 8vw, 100px); }
.beat[data-beat="3"] { align-items: flex-end; justify-content: center; text-align: right; padding-right: clamp(24px, 8vw, 100px); }

.beat-eyebrow {
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-bright);
  margin-bottom: 18px;
}
.beat-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(34px, 6.4vw, 84px);
  line-height: 1.12;
  color: var(--paper);
}
.beat-title span { display: block; overflow: hidden; }
.beat-title--sm { font-size: clamp(28px, 4.6vw, 58px); }
.beat-copy {
  margin-top: 18px;
  max-width: 360px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--paper-dim);
  font-weight: 300;
}
.beat[data-beat="3"] .beat-copy { margin-left: auto; }

/* ---------- CTA button (Emil-style press feedback + fill wipe) ---------- */
.cta {
  --tx: 50%;
  margin-top: 30px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 34px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  color: var(--paper);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.1em;
  overflow: hidden;
  isolation: isolate;
  transition: transform 160ms var(--ease-out), border-color 220ms var(--ease-out), color 220ms var(--ease-out);
}
.cta:active { transform: scale(0.97); }
.cta-fill {
  position: absolute;
  inset: 0;
  background: var(--gold);
  border-radius: inherit;
  transform: scaleX(0);
  transform-origin: left;
  z-index: -1;
  transition: transform 420ms var(--ease-in-out);
}
.cta:hover .cta-fill { transform: scaleX(1); }
.cta:hover { color: var(--ink); border-color: var(--gold); }
.cta--outline { border-color: var(--line); }

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--paper-dim);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0.85;
  transition: opacity 400ms var(--ease-out);
}
.scroll-cue i {
  width: 1px;
  height: 34px;
  background: linear-gradient(180deg, var(--gold-bright), transparent);
  position: relative;
  overflow: hidden;
}
.scroll-cue i::after {
  content: '';
  position: absolute;
  top: -100%; left: 0;
  width: 100%; height: 100%;
  background: var(--paper);
  animation: cue-drip 1.8s var(--ease-in-out) infinite;
}
@keyframes cue-drip {
  0% { transform: translateY(0); }
  100% { transform: translateY(200%); }
}
.scroll-cue.is-hidden { opacity: 0; }

/* ---------- Vision: concept shell vs. built, same landscape behind both ---------- */
.vision {
  position: relative;
  height: 100svh;
  overflow: hidden;
  background: var(--ink);
}
.vision-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.vision-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.vision-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(12, 10, 8, 0.72) 0%, rgba(12, 10, 8, 0.25) 32%, rgba(12, 10, 8, 0.45) 100%);
}
.vision-content {
  position: absolute;
  top: 9%;
  left: 0;
  right: 0;
  z-index: 3;
  text-align: center;
  padding: 0 24px;
}
.vision-content .beat-eyebrow,
.vision-content .beat-title { color: var(--paper); }
.vision-viewer {
  position: absolute;
  inset: 0;
  z-index: 2;
}
model-viewer#estateViewer {
  width: 100%;
  height: 100%;
  --poster-color: transparent;
  background-color: transparent;
}

.vision-toggle {
  margin-top: 26px;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(12, 10, 8, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.vision-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--paper-dim);
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 10px 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 220ms var(--ease-out), color 220ms var(--ease-out), transform 160ms var(--ease-out);
}
.vision-btn:active { transform: scale(0.97); }
.vision-btn.is-active {
  background: var(--gold);
  color: var(--ink);
}

.vision-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  width: 34px;
  height: 34px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms var(--ease-out);
}
.vision-loading.is-visible { opacity: 1; }
.vision-loading span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--gold-bright);
  animation: vision-spin 0.9s linear infinite;
}
@keyframes vision-spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .vision-content { top: 7%; }
  .vision-toggle { margin-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .vision-loading span { animation: none; }
}

/* ---------- Infinite marquee gallery ---------- */
.gallery {
  padding: 14vh clamp(20px, 5vw, 56px) 10vh;
  background: var(--ink);
}
.gallery-intro {
  max-width: 640px;
  margin: 0 auto 7vh;
  text-align: center;
}
.gallery-eyebrow {
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-bright);
  margin-bottom: 16px;
}
.gallery-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(30px, 4.6vw, 52px);
  line-height: 1.15;
  margin-bottom: 18px;
}
.gallery-copy {
  color: var(--paper-dim);
  font-size: 15px;
  line-height: 1.6;
}
.gallery-copy code {
  font-family: ui-monospace, monospace;
  color: var(--gold-bright);
  background: rgba(201, 164, 99, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.gallery-marquee {
  position: relative;
  height: 82vh;
  display: flex;
  gap: 14px;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
}
.gallery-col {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  position: relative;
}
.gallery-col--wide { flex: 1.35; }

.gallery-track {
  display: flex;
  flex-direction: column;
  gap: 14px;
  will-change: transform;
  animation-duration: var(--dur, 36s);
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
.gallery-col[data-dir="up"] .gallery-track { animation-name: gallery-scroll-up; }
.gallery-col[data-dir="down"] .gallery-track {
  animation-name: gallery-scroll-down;
  transform: translateY(-50%);
}
@keyframes gallery-scroll-up {
  from { transform: translateY(0); }
  to { transform: translateY(-50%); }
}
@keyframes gallery-scroll-down {
  from { transform: translateY(-50%); }
  to { transform: translateY(0); }
}
.gallery-marquee:hover .gallery-track {
  animation-play-state: paused;
}

.gallery-track img {
  width: 100%;
  display: block;
  object-fit: cover;
  border-radius: 6px;
  filter: saturate(0.9) contrast(1.04);
  flex-shrink: 0;
}
.gallery-track img.t-tall  { height: 300px; }
.gallery-track img.t-med   { height: 220px; }
.gallery-track img.t-short { height: 160px; }

.gallery-cue {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  width: 44px; height: 68px;
  border-radius: 999px;
  border: 1px solid rgba(245, 239, 228, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.gallery-cue i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--paper);
  opacity: 0.9;
}
.gallery-cue i:first-child { animation: cue-blink 1.6s var(--ease-in-out) infinite; }
.gallery-cue i:last-child { animation: cue-blink 1.6s var(--ease-in-out) infinite 0.5s; }
@keyframes cue-blink {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(3px); }
}

@media (max-width: 720px) {
  .gallery-marquee { height: 68vh; gap: 8px; }
  .gallery-col--wide { flex: 1; }
  .gallery-col:nth-child(4), .gallery-col:nth-child(5) { display: none; }
  .gallery-track img.t-tall  { height: 220px; }
  .gallery-track img.t-med   { height: 170px; }
  .gallery-track img.t-short { height: 130px; }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-track { animation: none !important; }
  .gallery-col[data-dir="down"] .gallery-track { transform: translateY(0); }
}

/* ---------- Entrance Sweep (CSS 3D ring, GSAP-driven, pinned to scroll) ---------- */
.tube-section {
  background: #060606;
}
.tube-wrap {
  position: relative;
  height: 350vh;
}
.esk-frame {
  position: relative;
  height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
}
.esk-copy {
  position: absolute;
  top: 10%;
  left: 0;
  right: 0;
  z-index: 4;
  text-align: center;
  padding: 0 24px;
  pointer-events: none;
}
.esk-copy__sub {
  margin: 14px auto 0;
  max-width: 380px;
}
.esk-cue {
  position: absolute;
  left: 50%;
  bottom: 6%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--paper-dim);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0.85;
  pointer-events: none;
}
.esk-cue i {
  width: 1px;
  height: 34px;
  background: linear-gradient(180deg, var(--gold-bright), transparent);
  position: relative;
  overflow: hidden;
}
.esk-cue i::after {
  content: '';
  position: absolute;
  top: -100%; left: 0;
  width: 100%; height: 100%;
  background: var(--paper);
  animation: cue-drip 1.8s var(--ease-in-out) infinite;
}
@media (max-width: 720px) {
  .esk-copy { top: 6%; }
  .esk-cue { display: none; }
}
.esk-viewport {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: var(--esk-height);
  overflow: hidden;
  border-radius: var(--esk-radius);
  background: transparent;
  isolation: isolate;
  container-type: size;
}
.esk-scene {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  perspective: 1000px;
}
.esk-orbit, .esk-group { position: absolute; inset: 0; }
.esk-card {
  --esk-card-width: calc(min(100cqw, 100cqh) * var(--esk-card-scale));
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--esk-card-width);
  margin-left: calc(var(--esk-card-width) / -2);
  margin-top: calc(var(--esk-card-width) * -0.75);
  transform-style: preserve-3d;
  will-change: transform;
}
.esk-card__img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--esk-card-radius);
  object-fit: cover;
  object-position: center;
  background: transparent;
}
@media (prefers-reduced-motion: reduce) {
  .esk-card, .esk-group, .esk-orbit { animation: none !important; }
}
.esk-card__img { cursor: pointer; }

/* ---------- Lightbox (click a ring card to expand it) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6vh 6vw;
  background: rgba(6, 6, 6, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 320ms var(--ease-out), visibility 0s linear 320ms;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 320ms var(--ease-out), visibility 0s;
}
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
  transform: scale(0.95);
  opacity: 0;
  transition: transform 380ms var(--ease-out), opacity 380ms var(--ease-out);
}
.lightbox.is-open .lightbox-img {
  transform: scale(1);
  opacity: 1;
}
.lightbox-close {
  position: absolute;
  top: 28px;
  right: clamp(20px, 5vw, 56px);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--paper);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), border-color 220ms var(--ease-out), background 220ms var(--ease-out);
}
.lightbox-close:hover { border-color: var(--gold); background: rgba(201, 164, 99, 0.12); }
.lightbox-close:active { transform: scale(0.92); }

@media (prefers-reduced-motion: reduce) {
  .lightbox, .lightbox-img { transition: opacity 0.01ms !important; transform: none !important; }
}

/* ---------- Closing section ---------- */
.closing {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10vh 24px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(201,164,99,0.10), transparent 60%),
    var(--ink);
  position: relative;
}
.closing-eyebrow {
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-bright);
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(14px);
}
.closing-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(36px, 7vw, 92px);
  line-height: 1.12;
  opacity: 0;
  transform: translateY(24px);
}
.closing .cta { margin-top: 40px; opacity: 0; transform: translateY(14px); }

.closing-contact {
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 22px;
  opacity: 0;
  transform: translateY(14px);
}
.closing-contact a {
  color: var(--paper-dim);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.04em;
  position: relative;
  transition: color 220ms var(--ease-out);
}
.closing-contact a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -3px;
  width: 100%; height: 1px;
  background: var(--gold-bright);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 260ms var(--ease-out);
}
.closing-contact a:hover { color: var(--paper); }
.closing-contact a:hover::after { transform: scaleX(1); transform-origin: left; }
.closing-location {
  color: var(--paper-dim);
  opacity: 0.6;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.footer {
  position: absolute;
  bottom: 28px;
  left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 56px);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--paper-dim);
}

@media (max-width: 720px) {
  .beat[data-beat="2"], .beat[data-beat="3"] { align-items: center; text-align: center; padding-left: 24px; padding-right: 24px; }
  .beat[data-beat="3"] .beat-copy { margin-left: 0; margin-right: 0; }
  .footer { flex-direction: column; gap: 6px; align-items: center; text-align: center; }
  .rail { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
