/* ================================================================
   Marina Bahía Concepción: coming soon
   ================================================================ */

:root {
  --ink: #070d14;
  --ink-soft: #0b1420;
  --sand: #ece3d0;
  --sand-dim: #b9ac93;
  --gold: #c9a662;
  --gold-soft: rgba(201, 166, 98, 0.35);
  --mist: #7e8fa0;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Jost", "Segoe UI", sans-serif;
}

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

html {
  scroll-behavior: smooth;
  background: var(--ink);
  overflow-x: clip;
}

body {
  position: relative;
  background: transparent;
  color: var(--sand);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: min(1060px, 88vw);
  margin: 0 auto;
}

/* ---------------- Hero ---------------- */

.hero {
  position: relative;
  /* 1 viewport on screen + 2 viewports of scroll driving the sunset */
  height: 300vh;
  height: 300svh;
}

/* Title/header stay on screen for the whole hero scroll via fixed
   positioning. CRITICAL: this element must stay fully transparent.
   iOS promotes a position:fixed box to its own compositor layer on
   first paint; a background swapped in later by JS does not reliably
   invalidate that layer, so it kept compositing over the canvas until
   `is-away` forced a repaint (~scrollY 1300 on iPhone). The WebGL
   fallback now lives in #scene-fallback, behind the canvas. */
.hero-chrome {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100svh;
  min-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
  background: none;
}

.hero-chrome .hero-header,
.hero-chrome .hero-content,
.hero-chrome .scroll-cue { pointer-events: auto; }

.hero-chrome.is-away {
  visibility: hidden;
  pointer-events: none;
}

/* Fixed, and left entirely to the compositor — no JS touches its
   position. Sized to the LARGE viewport (lvh) so no strip is exposed
   at the bottom when Safari's URL bar retracts; dvh is deliberately
   avoided because it re-fires resize mid-scroll on iOS. */
#scene-root {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  /* own compositing layer, promoted before first paint */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Sunset stand-in if WebGL is unavailable or still warming up.
   Sits BEHIND the canvas; main.js removes it after the first
   successful render, which needs no repaint of any overlay. */
#scene-fallback {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    #1b2a4a 0%,
    #43395f 34%,
    #93536b 52%,
    #d98d5f 62%,
    #23344a 63%,
    #101c2b 100%
  );
}

#scene {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(7, 13, 20, 0.34) 0%, rgba(7, 13, 20, 0.08) 24%, transparent 40%),
    linear-gradient(to top, rgba(7, 13, 20, 0.72) 0%, transparent 36%),
    radial-gradient(ellipse 62% 48% at 50% 38%, rgba(7, 13, 20, 0.24) 0%, transparent 72%),
    radial-gradient(ellipse 140% 110% at 50% 50%, transparent 60%, rgba(7, 13, 20, 0.32) 100%);
}

.hero-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(1.2rem, 3vw, 2.2rem) clamp(1.4rem, 4vw, 3rem);
  z-index: 3;
  animation: fadeDown 1.6s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

.wordmark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: 0.45em;
  color: var(--sand);
}

.header-right {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 1.8rem);
}

.header-loc {
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--sand-dim);
}

.lang-toggle {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-indent: 0.16em; /* optically center the tracked text */
  text-transform: uppercase;
  color: var(--sand);
  background: rgba(7, 13, 20, 0.18);
  border: 1px solid var(--gold-soft);
  border-radius: 2em;
  padding: 0.55em 1.15em;
  cursor: pointer;
  transition: color 0.4s ease, border-color 0.4s ease;
}

.lang-toggle:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.hero-content {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 0 1.25rem;
  transform: translateY(-2vh);
}

.eyebrow {
  font-size: clamp(0.62rem, 1.4vw, 0.75rem);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.4rem;
  animation: fadeUp 1.6s cubic-bezier(0.22, 1, 0.36, 1) 0.55s both;
}

/* White + difference = a photographic negative of whatever is
   behind the glyphs (sky, water, sun) as the sunset scrolls. */
.hero .eyebrow {
  color: #fff;
  mix-blend-mode: difference;
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.7rem, 9.5vw, 6.4rem);
  line-height: 1.04;
  letter-spacing: 0.045em;
  text-shadow: 0 2px 18px rgba(7, 13, 20, 0.65), 0 2px 60px rgba(7, 13, 20, 0.8);
  animation: fadeUp 1.8s cubic-bezier(0.22, 1, 0.36, 1) 0.75s both;
}

.hero h1 span {
  display: inline-block;
  font-style: italic;
  font-weight: 400;
}

.rule {
  width: 68px;
  height: 1px;
  margin: 1.9rem auto;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
  animation: ruleGrow 1.8s cubic-bezier(0.22, 1, 0.36, 1) 1.15s both;
}

.hero-sub {
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  letter-spacing: 0.12em;
  color: var(--sand);
  opacity: 0.85;
  max-width: 34em;
  margin: 0 auto;
  animation: fadeUp 1.8s cubic-bezier(0.22, 1, 0.36, 1) 1.3s both;
}

.coming-soon {
  margin-top: 2.6rem;
  font-size: clamp(0.68rem, 1.6vw, 0.8rem);
  letter-spacing: 0.55em;
  text-indent: 0.55em; /* optically center the tracked text */
  text-transform: uppercase;
  color: var(--sand);
  border: 1px solid var(--gold-soft);
  border-radius: 2em;
  padding: 0.85em 2.1em;
  display: inline-block;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  background: rgba(7, 13, 20, 0.18);
  animation: fadeUp 1.8s cubic-bezier(0.22, 1, 0.36, 1) 1.55s both;
}

.scroll-cue {
  position: absolute;
  bottom: clamp(1.4rem, 4vh, 2.6rem);
  left: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-left: -24px;
  color: var(--sand);
  border: 1px solid var(--gold-soft);
  border-radius: 50%;
  background: rgba(7, 13, 20, 0.42);
  cursor: pointer;
  animation: fadeUp 1.8s ease 2.2s both;
}

.scroll-cue-mouse {
  display: none;
}

.scroll-cue-down {
  width: 22px;
  height: 22px;
}

/* Fine pointer: mouse wheel cue, morphs into the down button on hover. */
@media (hover: hover) and (pointer: fine) {
  .scroll-cue {
    width: 26px;
    height: 44px;
    margin-left: -13px;
    border-color: rgba(236, 227, 208, 0.35);
    border-radius: 14px;
    background: transparent;
    transition:
      width 0.35s ease,
      height 0.35s ease,
      margin-left 0.35s ease,
      border-color 0.35s ease,
      border-radius 0.35s ease,
      background 0.35s ease,
      color 0.35s ease;
  }

  .scroll-cue-mouse {
    display: block;
    position: absolute;
    inset: 0;
    transition: opacity 0.25s ease;
  }

  .scroll-cue-mouse span {
    position: absolute;
    top: 8px;
    left: 50%;
    width: 2px;
    height: 8px;
    margin-left: -1px;
    border-radius: 2px;
    background: var(--sand);
    animation: scrollDot 2.4s ease-in-out infinite;
  }

  .scroll-cue-down {
    opacity: 0;
    transition: opacity 0.25s ease;
  }

  .scroll-cue:hover,
  .scroll-cue:focus-visible {
    width: 48px;
    height: 48px;
    margin-left: -24px;
    color: var(--gold);
    border-color: var(--gold);
    border-radius: 50%;
    background: rgba(7, 13, 20, 0.28);
  }

  .scroll-cue:hover .scroll-cue-mouse,
  .scroll-cue:focus-visible .scroll-cue-mouse { opacity: 0; }

  .scroll-cue:hover .scroll-cue-down,
  .scroll-cue:focus-visible .scroll-cue-down { opacity: 1; }
}

/* ---------------- Sections ---------------- */

.section {
  position: relative;
  z-index: 2;
  padding: clamp(5rem, 12vw, 9rem) 0;
  background: var(--ink);
}

.section .eyebrow { animation: none; }

.section h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.1rem, 5.5vw, 3.6rem);
  letter-spacing: 0.03em;
  line-height: 1.1;
  margin-bottom: 1.6rem;
}

.lead {
  font-size: clamp(0.98rem, 2vw, 1.13rem);
  color: var(--sand-dim);
  max-width: 44em;
  letter-spacing: 0.02em;
}

.vision {
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, rgba(27, 42, 74, 0.35) 0%, transparent 60%),
    var(--ink);
  text-align: center;
}

.vision .lead { margin: 0 auto; }

/* ---------------- Amenities ---------------- */

.amenities {
  background: var(--ink-soft);
}

.amenities h2 { margin-bottom: 0; }

.amenity-grid {
  list-style: none;
  margin-top: clamp(2.6rem, 6vw, 4.2rem);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 1px;
  background: rgba(236, 227, 208, 0.08);
  border: 1px solid rgba(236, 227, 208, 0.08);
}

.amenity-grid li {
  background: var(--ink-soft);
  padding: clamp(1.8rem, 3.5vw, 2.6rem);
  transition: background 0.5s ease;
}

.amenity-grid li:hover {
  background: #0e1929;
}

.amenity-grid svg {
  width: 34px;
  height: 34px;
  color: var(--gold);
  margin-bottom: 1.2rem;
}

.amenity-grid h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.amenity-grid p {
  font-size: 0.88rem;
  color: var(--sand-dim);
  letter-spacing: 0.02em;
}

/* ---------------- Location ---------------- */

.location {
  text-align: center;
  background:
    radial-gradient(ellipse 110% 90% at 50% 100%, rgba(67, 57, 95, 0.22) 0%, transparent 60%),
    var(--ink);
}

.location .lead { margin: 0 auto; }

.coords {
  margin-top: 2.6rem;
  font-family: var(--serif);
  font-size: clamp(1.3rem, 3.4vw, 2rem);
  font-weight: 300;
  letter-spacing: 0.14em;
  color: var(--sand);
}

.map-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  margin-top: 1.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--gold);
  border-bottom: 1px solid transparent;
  padding-bottom: 0.3em;
  transition: border-color 0.4s ease, color 0.4s ease;
}

.map-link:hover {
  color: var(--sand);
  border-color: var(--gold-soft);
}

.map-link svg { width: 14px; height: 14px; }

/* ---------------- Footer ---------------- */

.footer {
  position: relative;
  z-index: 2;
  border-top: 1px solid rgba(236, 227, 208, 0.08);
  padding: 3.4rem 0 3rem;
  text-align: center;
  background: var(--ink);
}

.footer .wordmark {
  display: block;
  margin-bottom: 1.1rem;
  color: var(--gold);
}

.footer p {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--sand-dim);
}

.footer .fine {
  margin-top: 0.9rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: rgba(185, 172, 147, 0.55);
}

.footer .lang-toggle {
  margin-top: 1.6rem;
  background: transparent;
  color: var(--sand-dim);
}

.footer .lang-toggle:hover {
  color: var(--gold);
}

/* ---------------- Reveal on scroll ---------------- */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 1.1s cubic-bezier(0.22, 1, 0.36, 1),
              transform 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

.amenity-grid .reveal:nth-child(2) { transition-delay: 0.08s; }
.amenity-grid .reveal:nth-child(3) { transition-delay: 0.16s; }
.amenity-grid .reveal:nth-child(4) { transition-delay: 0.24s; }
.amenity-grid .reveal:nth-child(5) { transition-delay: 0.32s; }
.amenity-grid .reveal:nth-child(6) { transition-delay: 0.4s; }
.amenity-grid .reveal:nth-child(7) { transition-delay: 0.48s; }
.amenity-grid .reveal:nth-child(8) { transition-delay: 0.56s; }

/* ---------------- Animations ---------------- */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: none; }
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: none; }
}

@keyframes ruleGrow {
  from { opacity: 0; transform: scaleX(0); }
  to   { opacity: 1; transform: scaleX(1); }
}

@keyframes scrollDot {
  0%   { transform: translateY(0); opacity: 1; }
  60%  { transform: translateY(16px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* no scroll-driven sunset; hero is a single static viewport */
  .hero { height: 100vh; height: 100svh; }
  .hero-header, .eyebrow, .hero h1, .rule, .hero-sub, .coming-soon, .scroll-cue {
    animation: none;
  }
  .scroll-cue-mouse span { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------------- Small screens ---------------- */

@media (max-width: 560px) {
  .header-loc { display: none; }
  .amenity-grid { grid-template-columns: 1fr; }

  /* backdrop-filter over a live WebGL layer forces a per-frame readback
     on iOS and is a real contributor to scroll jank. Flat fill instead. */
  .coming-soon {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(7, 13, 20, 0.42);
  }
}
