/* ============================================================
   MERIDIAN TOWER — demo site
   Palette: Dusk Navy / Harbor Slate / Glass Blue / Morning Glass / Brass
   Type: Italiana (display) · Hanken Grotesk (body) · Spline Sans Mono (data)
   ============================================================ */

:root {
  /* color tokens */
  --ink: #0d1520;          /* Dusk Navy — deep page base */
  --ink-2: #16202e;        /* Harbor Slate — elevated surfaces */
  --glass: #9fb4c7;        /* Glass Blue — secondary text on dark */
  --paper: #e8edf1;        /* Morning Glass — light sections */
  --paper-2: #dde4ea;      /* Morning Glass, shaded */
  --accent: #be9455;       /* Brass — the only warm note (URL-overridable) */
  --accent-ink: #0d1520;   /* text on brass */
  --line: rgba(159, 180, 199, 0.16);   /* hairline on dark */
  --line-paper: rgba(13, 21, 32, 0.14); /* hairline on light */

  /* type */
  --f-display: "Italiana", serif;
  --f-body: "Hanken Grotesk", sans-serif;
  --f-mono: "Spline Sans Mono", monospace;

  /* motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --gutter: clamp(1.25rem, 4vw, 4rem);
  --max: 1560px;
}

/* evening variant — 18:00–06:00, set by JS. Deeper base, warmer accent.
   If the URL supplies ?accent=, JS re-applies it after this. */
:root[data-theme="evening"] {
  --ink: #0a101a;
  --ink-2: #121a26;
  --paper: #e3e7ec;
  --paper-2: #d6dce3;
  --accent: #c99c5a;
}

/* ---------- reset / base ---------- */

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

/* native smooth scroll only as a fallback when Lenis isn't running —
   Lenis 1.1.x no longer adds .lenis-smooth, and scroll-behavior: smooth
   fights Lenis's per-frame scrollTop writes */
html:not(.lenis) { scroll-behavior: smooth; }
html.lenis { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-body);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a { color: inherit; text-decoration: none; }

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

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

.wrap {
  width: min(100% - 2 * var(--gutter), var(--max));
  margin-inline: auto;
}

/* mono utility labels */
.tag {
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

/* section heading pattern */
.sec-head { display: flex; align-items: baseline; gap: 1.5rem; margin-bottom: clamp(2.5rem, 6vw, 5rem); }
.sec-head::after { content: ""; flex: 1; height: 1px; background: var(--line); transform-origin: left; }
.on-paper .sec-head::after { background: var(--line-paper); }

h2 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(2rem, 5.4vw, 4.25rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
}

/* link underline draw */
.u-link { position: relative; }
.u-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -3px;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.45s var(--ease-out);
}
.u-link:hover::after,
.u-link:focus-visible::after { transform: scaleX(1); transform-origin: left; }

/* ---------- header ---------- */

.site-head {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem var(--gutter);
  transition: background-color 0.5s ease, box-shadow 0.5s ease;
}
.site-head.is-solid {
  background: rgba(13, 21, 32, 0.86);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--line);
}

.brand {
  font-family: var(--f-display);
  font-size: 1.35rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.brand em { font-style: normal; color: var(--accent); }

.site-nav { display: flex; align-items: center; gap: clamp(1.25rem, 3vw, 2.5rem); }
.site-nav a { font-size: 0.9rem; letter-spacing: 0.04em; color: var(--glass); }
.site-nav a:hover { color: var(--paper); }

.head-cta {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent) !important;
  border: 1px solid var(--accent);
  padding: 0.65em 1.3em;
  transition: background-color 0.25s ease, color 0.25s ease;
}
.head-cta:hover { background: var(--accent); color: var(--accent-ink) !important; }

@media (max-width: 767px) {
  .site-nav a:not(.head-cta) { display: none; }
}
.head-cta .cta-short { display: none; }
@media (max-width: 480px) {
  .brand { font-size: 1rem; letter-spacing: 0.1em; }
  .head-cta { font-size: 0.62rem; padding: 0.6em 1em; white-space: nowrap; }
  .head-cta .cta-full { display: none; }
  .head-cta .cta-short { display: inline; }
}

/* ---------- hero (scrub zone) ---------- */

.hero { position: relative; height: 340vh; }

.hero-pin {
  position: sticky;
  top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% center; /* art-direct: keep the tower crown in frame on narrow crops */
}
@media (max-width: 767px) {
  .hero-video { object-position: 58% center; }
}

/* handoff veil — fades up to Dusk Navy as the scrub ends, so film and
   first section share one continuous background */
.hero-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--ink) 0%, rgba(13, 21, 32, 0.55) 34%, rgba(13, 21, 32, 0) 68%);
  opacity: 0;
}

.hero-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 var(--gutter) clamp(4.5rem, 12vh, 8rem);
  pointer-events: none;
}

.hero-kicker {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--glass);
  margin-bottom: 1.1rem;
}

.hero-title {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(2.9rem, 10.5vw, 9rem);
  line-height: 0.98;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-shadow: 0 2px 40px rgba(10, 16, 26, 0.5);
}

.hero-sub {
  margin-top: 1.2rem;
  max-width: 30ch;
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  color: var(--paper);
  opacity: 0.92;
}

/* line-mask wrapper for the load reveal */
.mask-line { display: block; overflow: hidden; }
.mask-line > span { display: block; }

/* copy that appears as the camera crests the roof */
.hero-crest {
  position: absolute;
  top: 18vh;
  right: var(--gutter);
  text-align: right;
  opacity: 0;
}
.hero-crest p {
  font-family: var(--f-display);
  font-size: clamp(1.4rem, 3vw, 2.4rem);
  letter-spacing: 0.06em;
}
.hero-crest .tag { display: block; margin-top: 0.6rem; }

.scroll-hint {
  position: absolute;
  bottom: 1.6rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--glass);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.scroll-hint::after {
  content: "";
  width: 1px;
  height: 2.4rem;
  background: linear-gradient(var(--accent), transparent);
}

/* ---------- floor-line texture (structural hairlines) ---------- */

.floor-lines {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 119px,
    var(--line) 119px,
    var(--line) 120px
  );
}

/* ---------- manifesto ---------- */

.manifesto {
  position: relative;
  background: var(--ink);
  padding: clamp(6rem, 16vh, 11rem) 0;
}

.manifesto-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(2.5rem, 6vw, 7rem);
  align-items: end;
}

.manifesto h2 { max-width: 14ch; }
.manifesto h2 em { font-style: normal; color: var(--accent); }

.manifesto-aside p { color: var(--glass); font-size: 1rem; }
.manifesto-aside p + p { margin-top: 1.25rem; }
.manifesto-aside strong { color: var(--paper); font-weight: 500; }

@media (max-width: 767px) {
  .manifesto-grid { grid-template-columns: 1fr; align-items: start; }
}

/* ---------- THE ELEVATOR (signature, pinned) ---------- */

.elevator { position: relative; background: var(--ink); }

.elev-pin {
  height: 100vh; height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  overflow: hidden;
}

.elev-left {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 clamp(1.25rem, 5vw, 5rem);
  border-right: 1px solid var(--line);
}

/* the brass cable: a vertical rail with a car that rises with scroll */
.elev-rail {
  position: absolute;
  top: 10vh; bottom: 10vh;
  left: clamp(0.6rem, 2vw, 2rem);
  width: 1px;
  background: var(--line);
}
.elev-car {
  position: absolute;
  left: -4px;
  bottom: 0;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(190, 148, 85, 0.8);
}
.elev-rail::before {
  /* filled portion of the cable, scaled by JS via --rise */
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 100%;
  background: var(--accent);
  transform: scaleY(var(--rise, 0));
  transform-origin: bottom;
}

.elev-readout { margin-bottom: 2.2rem; }

.elev-floor {
  font-family: var(--f-mono);
  font-size: clamp(4.4rem, 11vw, 9.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
  display: block;
}
.elev-floor::before { content: "L"; color: var(--accent); font-size: 0.32em; vertical-align: 2.1em; margin-right: 0.18em; letter-spacing: 0; }

.elev-stopname {
  font-family: var(--f-display);
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  margin-top: 0.4rem;
}

.elev-stopdesc { color: var(--glass); max-width: 36ch; min-height: 3.2em; font-size: 0.98rem; }

.elev-stops { list-style: none; margin-top: 2.6rem; display: grid; gap: 0.55rem; }
.elev-stops li {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--glass);
  opacity: 0.45;
  transition: opacity 0.35s ease, color 0.35s ease;
}
.elev-stops li.is-active { opacity: 1; color: var(--paper); }
.elev-stops li.is-active .stop-no { color: var(--accent); }
.stop-no { font-variant-numeric: tabular-nums; }

.elev-right { position: relative; }

.elev-panel { position: absolute; inset: 0; }
.elev-panel figure {
  position: absolute;
  inset: 0;
  margin: 0;
  clip-path: inset(100% 0 0 0); /* revealed from below, like rising past a floor */
}
.elev-panel figure:first-child { clip-path: inset(0 0 0 0); }
.elev-panel img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.elev-panel figcaption {
  position: absolute;
  right: 1.4rem; bottom: 1.2rem;
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper);
  background: rgba(13, 21, 32, 0.55);
  padding: 0.5em 0.9em;
  backdrop-filter: blur(6px);
}

@media (max-width: 767px) {
  .elev-pin { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .elev-left { padding-top: 5.5rem; padding-bottom: 1.5rem; border-right: 0; border-bottom: 1px solid var(--line); justify-content: flex-end; }
  .elev-rail { display: none; }
  .elev-floor { font-size: 3.4rem; display: inline-block; margin-right: 1rem; }
  .elev-stopname { display: inline-block; font-size: 1.3rem; }
  .elev-stopdesc { display: none; }
  .elev-stops { margin-top: 1.2rem; grid-template-columns: 1fr 1fr; gap: 0.35rem; }
}

/* ---------- residences (light) ---------- */

.residences {
  background: var(--paper);
  color: var(--ink);
  padding: clamp(5.5rem, 14vh, 10rem) 0;
}

.res-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.25rem, 2.5vw, 2.5rem);
}

.res-card {
  background: var(--paper-2);
  border: 1px solid var(--line-paper);
  display: flex;
  flex-direction: column;
  transform-style: preserve-3d;
  transition: transform 0.22s var(--ease-out);
  will-change: auto;
}

.res-card figure { margin: 0; overflow: hidden; aspect-ratio: 4 / 3; }
.res-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out);
}
.res-card:hover img { transform: scale(1.04); }

.res-body { padding: 1.5rem 1.5rem 1.75rem; display: grid; gap: 0.4rem; }

.res-name {
  font-family: var(--f-display);
  font-size: 1.6rem;
  letter-spacing: 0.04em;
}

.res-spec {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(13, 21, 32, 0.62);
}

.res-price { margin-top: 0.7rem; font-weight: 500; }
.res-price small { display: block; font-weight: 400; font-size: 0.78rem; color: rgba(13, 21, 32, 0.55); }

@media (max-width: 1023px) {
  .res-grid { grid-template-columns: 1fr; max-width: 560px; margin-inline: auto; }
}

/* ---------- location strip (horizontal scroll) ---------- */

.location {
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
  border-top: 1px solid var(--line-paper);
}

.loc-pin {
  height: 100vh; height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.loc-head { padding: 0 var(--gutter); margin-bottom: 3rem; }

.loc-track {
  display: flex;
  gap: clamp(1.25rem, 2.5vw, 2.5rem);
  padding: 0 var(--gutter);
  width: max-content;
}

.loc-card {
  width: clamp(240px, 30vw, 380px);
  border: 1px solid var(--line-paper);
  background: var(--paper-2);
  padding: 2rem 1.75rem 1.75rem;
  display: grid;
  gap: 2.6rem;
}

.loc-min {
  font-family: var(--f-display);
  font-size: clamp(3.4rem, 6vw, 5.2rem);
  line-height: 1;
}
.loc-min sup { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); top: -2.4em; position: relative; margin-left: 0.5em; }

.loc-place { font-weight: 500; }
.loc-place small { display: block; font-weight: 400; color: rgba(13, 21, 32, 0.55); font-size: 0.85rem; margin-top: 0.15rem; }

/* ---------- numbers band ---------- */

.numbers {
  background: var(--ink);
  padding: clamp(5.5rem, 14vh, 9rem) 0;
  border-top: 1px solid var(--line);
}

.num-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem;
}

.num-cell { border-left: 1px solid var(--line); padding-left: 1.4rem; }

.num-val {
  font-family: var(--f-display);
  font-size: clamp(3rem, 6.5vw, 5.6rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.num-val .num-suffix { color: var(--accent); }

.num-cap {
  margin-top: 0.7rem;
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--glass);
}

@media (max-width: 767px) {
  .num-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem 1.25rem; }
}

/* ---------- booking ---------- */

.book {
  position: relative;
  background: var(--ink-2);
  padding: clamp(6rem, 16vh, 11rem) 0;
  border-top: 1px solid var(--line);
}

.book-grid {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: clamp(2.5rem, 6vw, 7rem);
}

.book h2 { max-width: 12ch; }
.book-note { margin-top: 1.5rem; color: var(--glass); max-width: 42ch; }

.book-form { display: grid; gap: 1.6rem; align-content: start; }

.field { display: grid; gap: 0.45rem; }
.field label {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--glass);
}
.field input {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--paper);
  font-family: var(--f-body);
  font-size: 1.05rem;
  padding: 0.55em 0.1em;
  border-radius: 0;
  transition: border-color 0.3s ease;
}
.field input:focus { outline: none; border-bottom-color: var(--accent); }
.field input::placeholder { color: rgba(159, 180, 199, 0.4); }

/* color-scheme so the native date picker matches */
.field input[type="date"] { color-scheme: dark; }

.btn-brass {
  justify-self: start;
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  padding: 1.05em 2.2em;
  cursor: pointer;
  transition: opacity 0.25s ease;
}
.btn-brass:hover { opacity: 0.92; }

.form-success {
  display: none;
  border-left: 2px solid var(--accent);
  padding: 0.4rem 0 0.4rem 1.2rem;
  color: var(--paper);
}
.book-form.is-done .form-success { display: block; }
.book-form.is-done .field, .book-form.is-done .btn-brass { display: none; }

@media (max-width: 767px) {
  .book-grid { grid-template-columns: 1fr; }
}

/* ---------- footer ---------- */

.site-foot {
  background: var(--ink);
  border-top: 1px solid var(--line);
  padding: 2.2rem 0 5.5rem;
}
.foot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2.5rem;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.82rem;
  color: var(--glass);
}
.foot-row .brand { font-size: 1rem; }
.foot-legal { max-width: 72ch; font-size: 0.72rem; opacity: 0.65; line-height: 1.7; margin-top: 1.4rem; }

/* ---------- live proof chip ---------- */

.proof-chip {
  position: fixed;
  left: 1rem; bottom: 1rem;
  z-index: 60;
  font-family: var(--f-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--glass);
  background: rgba(13, 21, 32, 0.78);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  padding: 0.55em 0.95em;
  display: flex;
  gap: 0.85em;
  pointer-events: none;
}
.proof-chip b { color: var(--accent); font-weight: 400; }

/* ---------- reduced motion: full static fallback ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  /* collapse scrub/pin zones to normal sections */
  .hero { height: 100vh; height: 100svh; }
  .hero-video { display: none; }
  .hero-pin { background: url("") center / cover no-repeat var(--ink); } /* poster set inline by HTML */
  .hero-veil { opacity: 1; }
  .hero-crest { opacity: 1; }
  /* elevator becomes a stacked static list */
  .elev-pin { height: auto; grid-template-columns: 1fr; }
  .elev-right { display: none; }
  .elev-static { display: grid !important; }
  .elev-stops li { opacity: 1; }
  .loc-pin { height: auto; padding: clamp(4rem, 10vh, 7rem) 0; }
  .loc-track { width: auto; flex-wrap: wrap; }
}

/* static elevator gallery (shown only under reduced motion) */
.elev-static {
  display: none;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
}
.elev-static figure { margin: 0; position: relative; }
.elev-static img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 3 / 2; }
.elev-static figcaption {
  position: absolute; left: 1rem; bottom: 0.9rem;
  font-family: var(--f-mono); font-size: 0.66rem;
  letter-spacing: 0.2em; text-transform: uppercase;
  background: rgba(13, 21, 32, 0.6); padding: 0.4em 0.8em;
}
@media (max-width: 640px) { .elev-static { grid-template-columns: 1fr; } }

/* ---------- ultrawide guard ---------- */

@media (min-width: 2000px) {
  body { font-size: 1.15rem; }
  .hero-title { font-size: 10.5rem; }
}
