/* Emerald View Villa — romantic Caribbean getaway
   Palette sampled from the property photographs. */

:root {
  --gold: #e2a63d;
  --gold-deep: #c4882a;
  --terracotta: #a85a3a;
  --cream: #faf5ea;
  --sand: #f3ead6;
  --green: #40602f;
  --leaf: #7ca24e;
  --bougainvillea: #e23a68;
  --turquoise: #3ec4d6;
  --pool: #6fd6e6;
  --amber: #ffb765;
  --night: #0c1210;
  --ink: #241e12;
  --ink-soft: #5c5240;

  --serif: "Fraunces", Georgia, serif;
  --sans: "Work Sans", "Segoe UI", sans-serif;
  --script: "Great Vibes", cursive;
}

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

html { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  font-family: var(--sans);
  font-weight: 300;
  background: var(--night);
  color: var(--cream);
  line-height: 1.6;
  overflow-x: hidden;
}

::selection { background: var(--bougainvillea); color: var(--cream); }

img, video { display: block; max-width: 100%; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.08; }

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 1.1rem;
}

.script { font-family: var(--script); }

/* ============ Preloader ============ */
.preloader {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: radial-gradient(120% 120% at 50% 18%, #114d56 0%, #0a2e33 42%, #05090a 100%);
  transition: opacity 1.1s ease, visibility 1.1s;
}
.preloader.done { opacity: 0; visibility: hidden; }
.preloader-logo { width: min(74vw, 560px); overflow: visible; }
.logo-line {
  font-family: var(--script);
  font-size: 96px;
  fill: transparent;
  stroke: var(--pool);
  stroke-width: 1.1;
  stroke-dasharray: 1400;
  stroke-dashoffset: 1400;
  opacity: 0;
}
.logo-line-2 { font-size: 88px; }
.preloader.tracing .logo-line {
  opacity: 1;
  animation: trace 2.1s ease forwards, inkfill 0.9s ease 1.7s forwards;
}
.preloader.tracing .logo-line-2 { animation-delay: 0.45s, 2.05s; }
@keyframes trace { to { stroke-dashoffset: 0; } }
@keyframes inkfill { to { fill: var(--pool); } }

/* ============ Chrome ============ */
.chrome {
  position: fixed; inset: 0 0 auto 0; z-index: 90;
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.4rem clamp(1.2rem, 4vw, 3rem);
  opacity: 0; transform: translateY(-8px);
  transition: opacity 1.2s ease 0.2s, transform 1.2s ease 0.2s;
  pointer-events: none;
  mix-blend-mode: difference;
}
.chrome.on { opacity: 1; transform: none; pointer-events: auto; }
.wordmark, .chrome-link {
  color: var(--cream); text-decoration: none;
  font-size: 0.78rem; letter-spacing: 0.3em; text-transform: uppercase;
}
.wordmark { font-family: var(--serif); font-size: 0.92rem; }
.chrome-link { position: relative; }
.chrome-link::after {
  content: ""; position: absolute; left: 0; bottom: -5px;
  width: 100%; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: left; transition: transform 0.5s ease;
}
.chrome-link:hover::after { transform: scaleX(1); }

/* ============ Fireflies overlay ============ */
#fireflies {
  position: fixed; inset: 0; z-index: 60;
  pointer-events: none; mix-blend-mode: screen;
  opacity: 0; transition: opacity 2s ease;
}
#fireflies.on { opacity: 1; }

/* ============ Scroll-scrubbed sections ============ */
.scrub { position: relative; height: calc(var(--len, 3) * 100vh); }
.scrub .pin {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  background: var(--night);
}
.scrub .pin .seg-canvas,
.scrub .pin .poster {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
/* Poster is the real anchor photo, shown as a placeholder beneath the canvas
   until the frame sequence has decoded, then faded out. */
.scrub .pin .poster { z-index: 0; transition: opacity 0.6s ease; }
.scrub .pin .seg-canvas { z-index: 1; display: block; }

.veil { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.veil-hero {
  background:
    linear-gradient(180deg, rgba(5,9,10,0.42) 0%, rgba(5,9,10,0) 30%),
    linear-gradient(180deg, rgba(5,9,10,0) 62%, rgba(5,9,10,0.55) 100%);
}
.veil-edges {
  background:
    linear-gradient(90deg, rgba(5,9,10,0.38) 0%, rgba(5,9,10,0) 26%),
    linear-gradient(270deg, rgba(5,9,10,0.38) 0%, rgba(5,9,10,0) 26%),
    linear-gradient(180deg, rgba(5,9,10,0) 70%, rgba(5,9,10,0.4) 100%);
}
.veil-floor {
  background: linear-gradient(180deg, rgba(5,9,10,0.18) 0%, rgba(5,9,10,0) 22%, rgba(5,9,10,0) 58%, rgba(5,9,10,0.52) 100%);
}

/* Hero copy */
.hero-copy {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 0 1.4rem;
  will-change: transform, opacity;
}
.hero-copy h1 {
  font-size: clamp(2.9rem, 9vw, 6.4rem);
  font-weight: 300;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 44px rgba(5, 9, 10, 0.5);
}
.hero-copy .tagline {
  margin-top: 1.4rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  color: var(--amber);
}
.scroll-cue {
  position: absolute; bottom: 2.2rem; left: 50%; transform: translateX(-50%); z-index: 3;
  font-size: 0.68rem; letter-spacing: 0.3em; text-transform: uppercase;
  color: rgba(250, 245, 234, 0.85);
  display: flex; flex-direction: column; align-items: center; gap: 0.7rem;
  transition: opacity 0.8s ease;
}
.scroll-cue span {
  width: 1px; height: 44px;
  background: linear-gradient(180deg, transparent, var(--amber));
  animation: cue 2.6s ease-in-out infinite;
}
@keyframes cue { 0%, 100% { transform: scaleY(0.55); opacity: 0.4; } 50% { transform: scaleY(1); opacity: 1; } }

/* Captions inside scrub sections */
.cap {
  position: absolute; max-width: min(34rem, 84vw); z-index: 3;
  opacity: 0; transform: translateY(18px);
  transition: opacity 0.9s ease, transform 0.9s ease;
  pointer-events: none;
}
.cap.live { opacity: 1; transform: none; }
.cap h2 { font-size: clamp(1.9rem, 4.4vw, 3.1rem); margin-bottom: 0.7rem; text-shadow: 0 2px 30px rgba(5,9,10,0.65); }
.cap h3 { font-size: clamp(1.35rem, 3vw, 2rem); margin-bottom: 0.35rem; text-shadow: 0 2px 26px rgba(5,9,10,0.7); }
.cap p { color: rgba(250,245,234,0.86); text-shadow: 0 1px 18px rgba(5,9,10,0.8); }
.cap-left { left: clamp(1.4rem, 6vw, 5rem); bottom: 16vh; }
.cap-right { right: clamp(1.4rem, 6vw, 5rem); bottom: 16vh; text-align: right; }
.cap-title { top: 12vh; left: 50%; transform: translate(-50%, 18px); text-align: center; }
.cap-title.live { transform: translate(-50%, 0); }
.room-cap { left: clamp(1.4rem, 6vw, 5rem); bottom: 12vh; }

/* ============ Horizontal details gallery ============ */
.hgallery { position: relative; height: calc(var(--len, 4) * 100vh); background: var(--night); }
.hgallery .pin {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
}
.hgallery-head { padding: 0 clamp(1.4rem, 6vw, 5rem) 3vh; }
.hgallery-head h2 { font-size: clamp(2rem, 4.6vw, 3.4rem); }
.hgallery-head p { color: rgba(250,245,234,0.62); margin-top: 0.6rem; }
.track {
  display: flex; align-items: center; gap: clamp(1.2rem, 3vw, 2.6rem);
  padding: 0 clamp(1.4rem, 6vw, 5rem);
  will-change: transform; width: max-content;
}
.card { flex: 0 0 auto; }
.card-media {
  border-radius: 4px; overflow: hidden;
  background: #101815;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}
.card-media.landscape { width: clamp(300px, 36vw, 500px); aspect-ratio: 3 / 2; }
.card-media.portrait { width: clamp(210px, 24vw, 330px); aspect-ratio: 2 / 3; }
.card-media video { width: 100%; height: 100%; object-fit: cover; }
.card figcaption {
  margin-top: 0.9rem;
  font-family: var(--serif); font-style: italic;
  font-size: 1.02rem; color: rgba(250,245,234,0.78);
}

/* ============ The build ============ */
.build { background: var(--cream); color: var(--ink); padding: clamp(5rem, 12vh, 9rem) clamp(1.4rem, 6vw, 5rem); }
.build .eyebrow { color: var(--terracotta); }
.build-inner { max-width: 68rem; margin: 0 auto; }
.build h2 { font-size: clamp(1.9rem, 4.2vw, 3.2rem); margin-bottom: 3rem; }
.build-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 2.6rem; }
.build h3 {
  font-size: 1.18rem; font-weight: 600;
  margin: 1.6rem 0 0.5rem; color: var(--terracotta);
}
.build h3:first-child { margin-top: 0; }
.build p { color: var(--ink-soft); }
.about-panel {
  margin-top: 3.6rem; padding-top: 3.2rem; border-top: 1px solid rgba(36, 30, 18, 0.12);
  max-width: 42rem;
}
.about-panel p:last-child {
  font-family: var(--serif); font-style: italic; font-size: 1.18rem;
  color: var(--ink); line-height: 1.6;
}
.sources { margin-top: 4.4rem; }
.sources-label {
  font-size: 0.72rem; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--terracotta); margin-bottom: 1.3rem;
}
.sources-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.9rem; }
.sources-grid figure { margin: 0; }
.sources-grid img {
  width: 100%; aspect-ratio: 21 / 9; object-fit: cover;
  border-radius: 3px; filter: saturate(1.06) sepia(0.06);
}
.sources-grid figcaption { font-size: 0.72rem; color: var(--ink-soft); margin-top: 0.35rem; letter-spacing: 0.06em; }

/* ============ Inquire ============ */
.inquire {
  position: relative; padding: clamp(5rem, 14vh, 10rem) clamp(1.4rem, 6vw, 5rem);
  display: grid; place-items: center; overflow: hidden;
}
.inquire-bg {
  position: absolute; inset: 0;
  background: url("../assets/img/img-k-aerial-sunset.jpg") center / cover no-repeat;
  filter: saturate(1.1);
}
.inquire-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(12,18,16,0.86) 0%, rgba(12,18,16,0.55) 50%, rgba(12,18,16,0.88) 100%);
}
.inquire-card {
  position: relative; width: min(34rem, 100%);
  background: rgba(12, 18, 16, 0.55);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(250, 245, 234, 0.14);
  border-radius: 6px;
  padding: clamp(1.8rem, 4vw, 3rem);
}
.inquire h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); margin-bottom: 0.7rem; }
.inquire-note { font-size: 0.86rem; color: rgba(250,245,234,0.6); margin-bottom: 1.8rem; }
.inquire label {
  display: block; margin-bottom: 1.25rem;
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(250,245,234,0.66);
}
.inquire input, .inquire textarea {
  display: block; width: 100%; margin-top: 0.45rem;
  background: transparent; border: none; border-bottom: 1px solid rgba(250,245,234,0.3);
  padding: 0.55rem 0.1rem; color: var(--cream);
  font-family: var(--sans); font-size: 1rem;
  transition: border-color 0.4s ease;
}
.inquire input:focus, .inquire textarea:focus {
  outline: none; border-bottom-color: var(--bougainvillea);
}
.inquire button {
  margin-top: 0.6rem;
  background: var(--bougainvillea); color: var(--cream);
  border: none; border-radius: 3px;
  padding: 0.95rem 2.2rem;
  font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.24em; text-transform: uppercase;
  cursor: pointer; transition: background 0.4s ease, transform 0.4s ease;
}
.inquire button:hover { background: #c92e57; transform: translateY(-2px); }
.form-toast { margin-top: 1.1rem; font-size: 0.9rem; color: var(--amber); min-height: 1.4em; }

/* ============ Footer ============ */
.footer {
  background: #05090a; text-align: center;
  padding: 3.6rem 1.4rem 4.2rem;
  color: rgba(250,245,234,0.55); font-size: 0.88rem;
}
.footer .script { font-size: 2.1rem; color: var(--turquoise); display: block; margin-bottom: 0.7rem; }

/* ============ Focus & motion ============ */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--amber); outline-offset: 3px;
}

body.rm .scrub { height: auto; }
body.rm .scrub .pin { position: relative; height: 100vh; }
body.rm .scrub .pin .seg-canvas { display: none; }
body.rm .scrub .pin .poster { display: block; opacity: 1; }
body.rm .cap { opacity: 1; transform: none; }
body.rm .hgallery { height: auto; }
body.rm .hgallery .pin { position: relative; height: auto; padding: 4rem 0; }
body.rm .track { width: auto; flex-wrap: wrap; }
body.rm #fireflies { display: none; }

@media (max-width: 720px) {
  .cap-left, .cap-right, .room-cap { bottom: 9vh; }
  .cap-right { text-align: left; right: auto; left: 1.4rem; }
  .card-media.landscape { width: 78vw; }
  .card-media.portrait { width: 52vw; }
}
