/* ==========================================================================
   Moonstone Hotel & Residences
   Layout: sections that follow one another in normal scroll
   (dark hero, limestone, walnut, espresso night). Each section has its own composition;
   big mixed-type titles (wide serif + light grotesk) cut through the images
   with a difference blend. Tiny uppercase labels frame every panel.
   ========================================================================== */
:root {
  /* colour: sampled from the hotel's own materials */
  --stone: #ECE5DA;       /* limestone ground: facade and room walls */
  --sand: #E0D4C3;        /* light oak floor */
  --ink: #231B15;         /* walnut-black text */
  --ink-2: #6E6053;       /* taupe: marble and fluted stone */
  --walnut: #3A2C21;      /* lift-door frames and entrance canopy */
  --walnut-2: #47372A;
  --espresso: #1C1611;    /* night: rooftop and footer */
  --oak: #A57E53;         /* honey oak panelling, the one accent */
  --bronze: #8E6E50;      /* lift doors */
  --cream: #F3ECE1;
  --cream-2: rgba(243, 236, 225, .7);
  --line-ink: rgba(35, 27, 21, .2);
  --line-cream: rgba(243, 236, 225, .28);
  --plan: #E6DCCE;        /* floor-plan ground */
  --err: #E9A58F;
  /* difference-blended titles: this value turns into --ink over --stone */
  --blend-fg: #C9CAC5;

  /* type */
  /* Thai falls through to Taviraj (classical, high-contrast looped serif) and
     IBM Plex Sans Thai Looped (looped sans for text and labels) */
  --f-serif: "Gilda Display", "Taviraj", "Noto Serif Thai", "Didot", Georgia, serif;
  --f-sans: "Inter Tight", "IBM Plex Sans Thai Looped", "Noto Sans Thai", "Helvetica Neue", Arial, sans-serif;
  --t-label: .6875rem;
  --t-small: .8125rem;
  --t-hero: clamp(2.5rem, 7vw, 8rem);
  --t-g: clamp(2.2rem, 5.6vw, 6.6rem);
  --t-s: clamp(2.6rem, 7.6vw, 9rem);

  /* rhythm */
  --g: clamp(16px, 2.4vw, 40px);
  --hdr-h: 72px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: light;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
body {
  margin: 0;
  background: var(--espresso);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: var(--t-small);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: var(--oak); color: var(--cream); }
:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }
.sr-only { position: absolute !important; left: 0; top: 0; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.skip {
  position: fixed; left: 16px; top: 16px; z-index: 100;
  padding: 10px 16px; background: var(--ink); color: var(--cream);
  transform: translateY(-200%); transition: transform .3s var(--ease);
}
.skip:focus { transform: none; }

.wrap {
  width: 100%;
  padding-left: max(var(--g), env(safe-area-inset-left, 0px));
  padding-right: max(var(--g), env(safe-area-inset-right, 0px));
}

/* ---------- type roles ---------- */
.label, .meta p {
  font-size: var(--t-label); font-weight: 500; line-height: 1.4;
  letter-spacing: .02em; text-transform: uppercase;
}
.g {
  display: block;
  font-family: var(--f-sans); font-weight: 300;
  font-size: var(--t-g); line-height: .92; letter-spacing: -.025em;
  text-transform: uppercase;
}
.s {
  display: block;
  font-family: var(--f-serif); font-weight: 400;
  font-size: var(--t-s); line-height: .92; letter-spacing: -.005em;
  text-transform: uppercase;
}
.blend { mix-blend-mode: difference; color: var(--blend-fg); }
html[lang="th"] body { font-weight: 300; }
html[lang="th"] .label, html[lang="th"] .meta p { text-transform: none; letter-spacing: .01em; font-size: .75rem; font-weight: 500; }
html[lang="th"] .g { text-transform: none; letter-spacing: 0; font-size: calc(var(--t-g) * .54); line-height: 1.45; font-weight: 300; }
html[lang="th"] .s { text-transform: none; letter-spacing: .005em; font-size: calc(var(--t-s) * .72); line-height: 1.32; font-weight: 300; }

/* split text built by JS */
.wd { display: inline-block; white-space: nowrap; }
.ch { display: inline-block; }
.ln { display: block; overflow: hidden; padding-bottom: .06em; margin-bottom: -.06em; }
.lni { display: block; }
html[lang="th"] .ln { padding-top: .26em; margin-top: -.26em; }

/* ---------- pills & icon buttons ---------- */
.pill {
  --fill: var(--ink); --fill-fg: var(--stone);
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  min-height: 44px; padding: 0 24px;
  border: 1px solid currentColor; border-radius: 999px;
  font-size: .65rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap;
  transition: color .35s var(--ease);
}
.pill::before {
  content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: inherit;
  background: var(--fill); transform: translateY(102%); transition: transform .35s var(--ease);
}
.pill:hover::before, .pill:focus-visible::before { transform: none; }
.pill:hover, .pill:focus-visible { color: var(--fill-fg); }
.pill--light, .walnut .pill, .night .pill, .hero .pill, .reg .pill { --fill: var(--cream); --fill-fg: var(--ink); }
.pill--static { pointer-events: none; }
.pill--static::before { display: none; }
.arrow { width: 26px; height: 10px; flex: none; transition: transform .35s var(--ease); }
.arrow--up { width: 11px; height: 11px; }
.pill:hover .arrow { transform: translateX(4px); }
.pill:hover .arrow--up { transform: translate(2px, -2px); }
html[lang="th"] .pill { text-transform: none; letter-spacing: .02em; font-size: .8rem; }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid transparent; transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.icon-btn svg { width: 24px; height: 10px; }
.icon-btn:hover { border-color: currentColor; }

/* ---------- header (difference-blended so it reads on any panel) ---------- */
.hdr {
  position: fixed; inset: 0 0 auto; z-index: 60;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch;
  height: calc(var(--hdr-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(var(--g), env(safe-area-inset-left, 0px));
  padding-right: max(var(--g), env(safe-area-inset-right, 0px));
  color: var(--cream);
  transition: transform .5s var(--ease), color .3s var(--ease), background-color .3s var(--ease);
}
.hdr::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: currentColor; opacity: .35; transform-origin: 50% 50%; transform: scaleX(var(--hl, 1));
  transition: opacity .6s var(--ease);
}
.hdr.is-scrolled::after { opacity: 0; }
.hdr.is-light { color: var(--ink); }
.hdr.is-scrolled { background: rgba(28, 22, 17, .78); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.hdr.is-scrolled.is-light { background: rgba(236, 229, 218, .86); }
.hdr.is-hidden { transform: translateY(-101%); }
.menu-open .hdr, .menu-open .hdr.is-light { transform: none; color: var(--cream); background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.hdr__menu {
  justify-self: start; display: inline-flex; align-items: center; gap: 14px;
  font-size: var(--t-label); font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
}
.burger { position: relative; width: 22px; height: 8px; }
.burger i { position: absolute; left: 0; height: 1px; background: currentColor; transition: transform .4s var(--ease), width .4s var(--ease); }
.burger i:first-child { top: 0; width: 100%; }
.burger i:last-child { bottom: 0; width: 60%; }
.hdr__menu:hover .burger i:last-child { width: 100%; }
.menu-open .burger i:first-child { transform: translateY(3.5px) rotate(18deg); }
.menu-open .burger i:last-child { width: 100%; transform: translateY(-3.5px) rotate(-18deg); }
.hdr__menu-label { display: grid; overflow: hidden; height: 1.45em; }
.hdr__menu-label span { grid-area: 1 / 1; transition: transform .4s var(--ease); }
.hdr__menu-label span:last-child { transform: translateY(110%); }
.menu-open .hdr__menu-label span:first-child { transform: translateY(-110%); }
.menu-open .hdr__menu-label span:last-child { transform: none; }
.hdr__logo {
  align-self: center; justify-self: center;
  font-size: .8rem; font-weight: 500; letter-spacing: .34em; text-transform: uppercase; padding-left: .34em;
}
.hdr__right { justify-self: end; display: flex; align-items: stretch; }
.hdr__right > * { display: flex; align-items: center; }
.lang { gap: 6px; padding-right: 22px; font-size: var(--t-label); font-weight: 500; letter-spacing: .1em; }
.lang button { min-width: 28px; min-height: 36px; opacity: .5; transition: opacity .4s; }
.lang button[aria-pressed="true"], .lang button:hover { opacity: 1; }
.hdr__link {
  padding: 0 22px; border-left: 1px solid color-mix(in srgb, currentColor 35%, transparent);
  font-size: var(--t-label); font-weight: 500; letter-spacing: .16em; text-transform: uppercase;
  transition: opacity .4s;
}
.hdr__link--cta { padding-right: 0; }
.hdr__link:hover { opacity: .6; }
html[lang="th"] .hdr__menu, html[lang="th"] .hdr__link { letter-spacing: .02em; text-transform: none; font-size: .78rem; }
@media (max-width: 760px) {
  :root { --hdr-h: 60px; }
  .hdr__link { display: none !important; }
  .hdr__menu-label { display: none; }
  .lang { padding-right: 0; }
}

/* ---------- menu ---------- */
.menu { position: fixed; inset: 0; z-index: 55; color: var(--cream); }
.menu__bg { position: absolute; inset: 0; background: var(--walnut) var(--grain); }
.menu__inner {
  position: relative; height: 100%;
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); grid-template-rows: 1fr auto;
  gap: 24px 4vw;
  padding: calc(var(--hdr-h) + env(safe-area-inset-top, 0px) + 4vh) max(var(--g), env(safe-area-inset-right, 0px)) calc(var(--g) + env(safe-area-inset-bottom, 0px)) max(var(--g), env(safe-area-inset-left, 0px));
}
.menu__links { align-self: center; display: grid; gap: 4px; }
.menu__links li { overflow: hidden; }
.menu__links a { display: inline-flex; align-items: baseline; gap: 22px; transition: color .3s var(--ease), transform .45s var(--ease); }
.menu__no { font-size: var(--t-label); font-weight: 500; color: var(--cream-2); }
.menu__txt { font-family: var(--f-serif); font-size: clamp(2.1rem, 5vw, 4.6rem); line-height: 1.08; text-transform: uppercase; }
html[lang="th"] .menu__txt { text-transform: none; font-size: clamp(1.8rem, 3.8vw, 3.4rem); line-height: 1.5; font-weight: 300; }
.menu__links:hover a { color: rgba(243, 236, 225, .35); }
.menu__links a:hover, .menu__links a:focus-visible { color: var(--cream); transform: translateX(14px); }
.menu__links a:focus-visible { outline: none; text-decoration: underline 1px; text-underline-offset: .2em; }
.menu__preview { position: relative; align-self: center; justify-self: end; width: min(100%, 460px); aspect-ratio: 1; overflow: hidden; }
.menu__preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.08); transition: opacity .5s var(--ease), transform .9s var(--ease); }
.menu__preview img.is-on { opacity: 1; transform: none; }
.menu__foot {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px;
  padding-top: 18px; border-top: 1px solid var(--line-cream);
  font-size: var(--t-label); font-weight: 500; text-transform: uppercase; color: var(--cream-2);
}
html[lang="th"] .menu__foot { text-transform: none; }
@media (max-width: 760px) {
  .menu__inner { grid-template-columns: 1fr; }
  .menu__preview { display: none; }
}

/* ---------- panels ---------- */
main { position: relative; }
/* sections follow one another; isolation keeps their z-index:-1 layers (lines, photos) above their own background */
.panel { position: relative; isolation: isolate; overflow: hidden; }
.paper { background: var(--stone) var(--grain); color: var(--ink); }
.sand { background-color: var(--sand); }
.walnut { background: var(--walnut) var(--grain); color: var(--cream); }
.night { background: var(--espresso) var(--grain); color: var(--cream); }
.walnut, .night, .hero, .reg { --blend-fg: #FFF0DC; }

.lines { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.lines path, .lines circle, .roof__ring circle { fill: none; stroke: currentColor; stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .4; }
.paper .lines path { stroke: var(--bronze); opacity: .55; }

/* meta row: the small labels that open every panel */
.meta {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 20px;
  padding-top: calc(var(--hdr-h) + 18px);
}
.meta__a { grid-column: 1 / 4; }
.meta__b { grid-column: 7 / 10; }
.meta__b--center { grid-column: 5 / 9; text-align: center; }
.meta__c { grid-column: 10 / 13; display: grid; gap: 12px; align-content: start; }
.meta__pair { display: flex; gap: 4.5em; }
.meta__text { margin-top: 10px; max-width: 32ch; text-transform: none !important; font-weight: 400 !important; font-size: .75rem !important; line-height: 1.45 !important; }
.walnut .meta__text, .night .meta__text { color: var(--cream-2); }
.meta__pair span:first-child { color: var(--oak); }
@media (max-width: 760px) {
  .meta { grid-template-columns: 1fr 1fr; row-gap: 16px; }
  .meta__a { grid-column: 1; }
  .meta__c { grid-column: 2; }
  .meta__b, .meta__b--center { grid-column: 1 / -1; grid-row: 2; text-align: left; }
}

/* ---------- 1. hero ---------- */
.hero {
  height: 100vh; height: 100svh; min-height: 600px;
  display: grid; place-items: center;
  background: var(--espresso); color: var(--cream);
}
.hero__bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.hero__bg img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 76%; }
.hero__bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(28, 22, 17, .62) 0%, rgba(28, 22, 17, .38) 38%, rgba(28, 22, 17, .42) 62%, rgba(28, 22, 17, .8) 100%);
}
.hero__inner { display: grid; justify-items: center; gap: clamp(28px, 4vw, 52px); padding: var(--hdr-h) max(var(--g), env(safe-area-inset-right, 0px)) 0 max(var(--g), env(safe-area-inset-left, 0px)); text-align: center; }
.hero__title {
  font-family: var(--f-serif); font-weight: 400; font-size: var(--t-hero);
  line-height: .98; letter-spacing: .01em; word-spacing: .2em; text-transform: uppercase;
  text-wrap: balance;
}
.hero__tag {
  margin-top: calc(-1 * clamp(14px, 2vw, 30px));
  font-family: var(--f-serif); font-size: clamp(.8rem, 1.05vw, 1rem); font-weight: 400;
  letter-spacing: .32em; text-transform: uppercase; padding-left: .32em; color: rgba(243, 236, 225, .9);
  text-shadow: 0 1px 24px rgba(28, 22, 17, .7), 0 0 2px rgba(28, 22, 17, .35);
}
html[lang="th"] .hero__tag { font-size: clamp(1.35rem, 2.3vw, 2.1rem); font-weight: 400; letter-spacing: .02em; text-transform: none; padding-left: 0; color: var(--cream); }
.hero__text {
  position: absolute; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  width: min(760px, calc(100% - 2 * var(--g))); text-align: center;
  font-size: .75rem; line-height: 1.5; color: var(--cream-2);
}

/* booking-style bar (hero and register) */
.bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 18px clamp(18px, 2.4vw, 34px); }
.bar__field { position: relative; display: block; }
.bar select, .bar input {
  appearance: none; -webkit-appearance: none;
  width: clamp(150px, 13vw, 210px); min-height: 40px; padding: 8px 26px 8px 0;
  border: 0; border-bottom: 1px solid var(--line-cream); border-radius: 0;
  background: transparent no-repeat right 2px center / 9px 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 6'%3E%3Cpath d='M0 0h9L4.5 6z' fill='%23F2EEE7'/%3E%3C/svg%3E");
  color: var(--cream); font: inherit; font-size: .8125rem; text-align: left;
  outline: none; transition: border-color .4s var(--ease);
}
.bar input { background-image: none; padding-right: 0; }
.bar input::placeholder { color: var(--cream-2); }
.bar select:focus, .bar input:focus { border-bottom-color: var(--cream); }
.bar select option { color: var(--ink); background: var(--cream); }
.bar select:invalid, .bar select:has(option[value=""]:checked) { color: var(--cream-2); }
.bar .pill { margin-left: 6px; }
.bar__err { position: absolute; left: 0; top: 100%; padding-top: 4px; font-size: .7rem; color: var(--err); white-space: nowrap; }
.bar__field.is-invalid input { border-bottom-color: var(--err); }
@media (max-width: 760px) {
  .bar { flex-direction: column; align-items: stretch; width: min(100%, 360px); }
  .bar select, .bar input { width: 100%; }
  .bar .pill { margin: 10px 0 0; }
  .hero__inner { width: 100%; }
}

/* ---------- 2. spaces carousel ---------- */
.spaces { --sp-w: min(31vw, 540px); padding-bottom: clamp(48px, 6vw, 88px); }
.sp { position: relative; }
.sp__stage { position: relative; height: var(--sp-w); margin-top: clamp(48px, 7vw, 120px); }
.sp__fig {
  position: absolute; left: 50%; top: 0; width: var(--sp-w); height: var(--sp-w); margin-left: calc(var(--sp-w) / -2);
  overflow: hidden; background: var(--sand);
}
.sp__fig img { width: 100%; height: 100%; object-fit: cover; }
html:not(.js) .sp__fig:not(.is-on) { display: none; }
.sp__title {
  position: absolute; left: 0; right: 0; top: 50%; z-index: 10; transform: translateY(-50%);
  display: grid; justify-items: center; text-align: center; pointer-events: none; white-space: nowrap;
}
.sp__foot {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 24px;
  width: var(--sp-w); margin: 22px auto 0;
}
.sp__text { max-width: 32ch; font-size: .75rem; line-height: 1.5; min-height: 3em; }
.sp__ctrls { display: flex; align-items: center; gap: 4px; flex: none; }
@media (max-width: 760px) {
  .spaces { --sp-w: 66vw; }
  .sp__foot { width: calc(100% - 2 * var(--g)); flex-direction: column; }
}

/* ---------- 3. rooms slider ---------- */
.rooms { padding-bottom: clamp(36px, 4vw, 64px); }
.rm {
  --rm-pt: clamp(56px, 6.4vw, 110px);
  position: relative; display: grid; grid-template-columns: minmax(0, 46fr) minmax(0, 54fr);
  padding-top: var(--rm-pt);
}
.rm__media { grid-column: 1; grid-row: 1; }
.rm__frame { position: relative; display: block; width: 100%; aspect-ratio: 1.1 / 1; overflow: hidden; background: var(--walnut-2); }
.rm__frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rm__frame img:not(.is-on) { visibility: hidden; }
.rm__frame img.is-plan { object-fit: contain; padding: 6%; background: var(--plan); }
.rm__pager { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; font-size: var(--t-label); font-weight: 500; font-variant-numeric: tabular-nums; }
.rm__count { min-width: 5ch; text-align: center; }
.rm__title { position: absolute; left: 22%; top: calc(var(--rm-pt) + 3.6vw); z-index: 10; pointer-events: none; white-space: nowrap; }
.rm__title .s { padding-left: 30vw; font-size: clamp(2.4rem, 5.4vw, 6.6rem); }
.rm__title .g { font-size: clamp(2rem, 4.8vw, 5.8rem); }
.rm__next {
  position: absolute; right: max(var(--g), env(safe-area-inset-right, 0px)); top: calc(var(--rm-pt) - 44px); z-index: 11;
  width: 80px; height: 80px; border-radius: 50%; border: 1px solid var(--line-cream);
  display: grid; place-items: center; background: rgba(243, 236, 225, .05);
  font-size: .6rem; font-weight: 500; letter-spacing: .22em; text-transform: uppercase;
  transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s;
}
.rm__next span { transform: rotate(16deg); padding-left: .22em; }
.rm__next:hover { background: var(--cream); color: var(--ink); border-color: var(--cream); }
html[lang="th"] .rm__next { letter-spacing: 0; text-transform: none; font-size: .78rem; }
.rm__side {
  grid-column: 2; grid-row: 1; align-self: end;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
  padding: 0 0 52px clamp(24px, 3.6vw, 64px);
}
.rm__pills { display: flex; flex-wrap: wrap; gap: 8px; }
.rm__list { font-size: .65rem; font-weight: 500; line-height: 1.5; text-transform: uppercase; letter-spacing: .02em; }
.rm__list li { display: flex; gap: 8px; }
.rm__list li::before { content: "•"; color: var(--oak); }
html[lang="th"] .rm__list { text-transform: none; font-size: .78rem; }
@media (max-width: 900px) {
  .rm { grid-template-columns: 1fr; --rm-pt: 28px; }
  .rm__title { position: relative; left: auto; top: auto; grid-row: 2; margin-top: 22px; white-space: normal; }
  .rm__title .s { padding-left: 0; font-size: clamp(2.2rem, 11vw, 4.4rem); }
  .rm__title .g { font-size: clamp(1.8rem, 9vw, 3.6rem); }
  .rm__next { top: calc(var(--rm-pt) + 12px); right: calc(var(--g) + 12px); width: 64px; height: 64px; }
  .rm__side { grid-column: 1; grid-row: 3; padding: 24px 0 0; flex-direction: column; align-items: flex-start; }
  .rm__media { grid-row: 1; }
}

/* ---------- 4. residences ---------- */
.res { padding-bottom: clamp(56px, 7vw, 110px); }
.res__title { position: relative; z-index: 10; display: grid; justify-items: center; text-align: center; margin-top: clamp(40px, 5vw, 80px); }
.res__g { font-size: clamp(1.2rem, 2.4vw, 2.6rem); }
.res__s { font-size: clamp(3.4rem, 13.6vw, 16rem); line-height: .86; white-space: nowrap; }
html[lang="th"] .res__s { font-size: calc(clamp(3.4rem, 13.6vw, 16rem) * .7); }
.res__media { position: relative; margin-top: calc(clamp(3.4rem, 13.6vw, 16rem) * -.6); }
.res__big { width: 72%; margin-inline: auto; aspect-ratio: 16 / 8.6; overflow: hidden; }
.res__big img, .res__small img { width: 100%; height: 100%; object-fit: cover; }
.res__small { position: absolute; right: max(var(--g), env(safe-area-inset-right, 0px)); bottom: -12%; width: 19%; aspect-ratio: 3 / 4; overflow: hidden; z-index: 2; }
.res__row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px clamp(32px, 6vw, 120px);
  margin-top: clamp(64px, 9vw, 140px); align-items: end;
}
.facts { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: clamp(24px, 4vw, 64px); }
.facts div { display: grid; gap: 6px; }
.facts dt { font-size: var(--t-label); font-weight: 500; text-transform: uppercase; color: var(--ink-2); }
.facts dd { font-family: var(--f-serif); font-size: clamp(2.2rem, 4vw, 4.4rem); line-height: 1; white-space: nowrap; }
html[lang="th"] .facts dt { text-transform: none; font-size: .78rem; }
.res__copy { display: grid; gap: 22px; justify-items: start; max-width: 40ch; }
.res__copy p { font-size: .875rem; line-height: 1.55; }
@media (max-width: 760px) {
  .res__big { width: 100%; aspect-ratio: 4 / 3; }
  .res__small { width: 34%; bottom: -16%; }
  .res__row { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- 5. rooftop ---------- */
.roof { padding-bottom: clamp(48px, 6vw, 96px); }
.roof__stage { position: relative; display: grid; place-items: center; height: min(78vh, 58vw); min-height: 320px; margin-top: clamp(12px, 2vw, 40px); }
/* moon: WebGL canvas over a pre-rendered still; the canvas fades in once its textures load */
.roof__moon { position: absolute; height: 100%; aspect-ratio: 1; }
.roof__still, .roof__gl, .roof__ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.roof__still { object-fit: contain; transition: opacity .8s var(--ease); }
.roof__gl { opacity: 0; transition: opacity .8s var(--ease); }
.roof__moon.is-live .roof__gl { opacity: 1; }
.roof__moon.is-live .roof__still { opacity: 0; }
.roof__ring { overflow: visible; pointer-events: none; }
.roof__ring circle { opacity: .35; }
/* title sits across the moon's lower limb: mostly on the night sky, inverting only where it crosses the moon */
.roof__title { position: relative; z-index: 10; align-self: end; margin-bottom: -.12em; display: grid; justify-items: center; text-align: center; white-space: nowrap; }
.roof__title .g { font-size: clamp(1.2rem, 2.4vw, 2.6rem); margin-bottom: .3em; }
.roof__title .s { font-size: clamp(2.8rem, 8vw, 9.4rem); }
.roof__cols {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px clamp(24px, 4vw, 64px);
  margin-top: clamp(40px, 5vw, 80px);
}
.roof__cols li { display: grid; gap: 10px; align-content: start; padding-top: 18px; border-top: 1px solid var(--line-cream); }
.roof__no { font-size: var(--t-label); font-weight: 500; color: var(--cream-2); }
.roof__cols h3 { font-family: var(--f-serif); font-weight: 400; font-size: clamp(1.5rem, 2.2vw, 2.2rem); text-transform: uppercase; line-height: 1; }
html[lang="th"] .roof__cols h3 { text-transform: none; font-weight: 300; line-height: 1.3; }
.roof__cols p { font-size: .8125rem; color: var(--cream-2); max-width: 30ch; }
@media (max-width: 760px) {
  .roof__stage { height: 86vw; }
  .roof__title { white-space: normal; padding-inline: var(--g); }
  .roof__title .s { font-size: 9.4vw; }
  .roof__cols { grid-template-columns: 1fr; }
}

/* ---------- 6. location ---------- */
.loc { padding-bottom: clamp(56px, 7vw, 110px); }
.loc__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 40px clamp(24px, 4vw, 72px); align-items: end; margin-top: clamp(48px, 7vw, 120px); }
.loc__text { display: grid; gap: 26px; justify-items: start; }
.loc__title { position: relative; z-index: 10; white-space: nowrap; }
.loc__title .s { font-size: clamp(2.6rem, 6.2vw, 7.4rem); }
.loc__title .g { font-size: clamp(1.6rem, 3.6vw, 4.2rem); margin-top: .12em; }
.loc__addr { font-size: .875rem; line-height: 1.6; color: var(--ink-2); }
.loc__fig { height: min(76vh, 50vw); overflow: hidden; cursor: zoom-in; }
.loc__fig img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 900px) {
  .loc__grid { grid-template-columns: 1fr; }
  .loc__title { white-space: normal; }
  .loc__fig { order: -1; height: auto; aspect-ratio: 4 / 3.4; }
}

/* ---------- 7. register ---------- */
.reg {
  min-height: 100vh; min-height: 100svh; display: grid; place-items: center;
  background: var(--espresso); color: var(--cream); text-align: center;
}
.reg__bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.reg__bg img { width: 100%; height: 100%; object-fit: cover; }
.reg__bg::after { content: ""; position: absolute; inset: 0; background: rgba(28, 22, 17, .64); }
.reg__inner { display: grid; justify-items: center; gap: clamp(18px, 2.2vw, 28px); padding-block: calc(var(--hdr-h) + 40px) 80px; }
.reg__title { font-family: var(--f-serif); font-weight: 400; font-size: clamp(2.6rem, 6.6vw, 7.6rem); line-height: .96; text-transform: uppercase; text-wrap: balance; }
html[lang="th"] .reg__title { text-transform: none; font-size: clamp(2.2rem, 4.6vw, 5rem); line-height: 1.3; font-weight: 300; }
.reg__text { max-width: 44ch; font-size: .875rem; color: var(--cream-2); }
.reg .bar { margin-top: 18px; }
.reg__note { font-size: .7rem; color: var(--cream-2); margin-top: 8px; }
.reg__ok { font-family: var(--f-serif); font-size: clamp(1.6rem, 2.6vw, 2.4rem); max-width: 24ch; line-height: 1.25; }
html[lang="th"] .reg__ok { font-weight: 300; }

/* ---------- footer ---------- */
.footer { position: relative; overflow: hidden; padding-top: clamp(64px, 8vw, 120px); color: var(--cream); }
.footer__top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px var(--g); font-size: .8125rem; color: var(--cream-2); }
.footer__col { display: grid; gap: 14px; align-content: start; }
.footer__col .label { color: var(--cream); }
.footer__col ul { display: grid; gap: 4px; }
.footer__col a { color: var(--cream); transition: opacity .4s; }
.footer__col a:hover { opacity: .6; }
.footer__word {
  font-family: var(--f-serif); font-size: clamp(3.2rem, 14.6vw, 22rem); line-height: .8; letter-spacing: -.01em;
  text-transform: uppercase; text-align: center; white-space: nowrap; overflow: hidden;
  padding: clamp(40px, 6vw, 96px) 0 .04em;
}
.footer__base {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding-top: 18px; padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line-cream);
  font-size: var(--t-label); font-weight: 500; text-transform: uppercase; color: var(--cream-2);
}
html[lang="th"] .footer__base { text-transform: none; }
@media (max-width: 760px) { .footer__top { grid-template-columns: 1fr 1fr; } .footer__col:first-child { grid-column: 1 / -1; } }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  background: rgba(28, 22, 17, .97); color: var(--cream);
  padding: calc(72px + env(safe-area-inset-top, 0px)) max(84px, env(safe-area-inset-right, 0px)) calc(72px + env(safe-area-inset-bottom, 0px)) max(84px, env(safe-area-inset-left, 0px));
}
.lightbox__fig { width: 100%; height: 100%; display: grid; place-items: center; }
.lightbox__fig img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.lightbox__fig img.is-plan { background: var(--plan); padding: 3%; }
/* shown only while the next image is still downloading */
.lightbox.is-loading::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%; background: var(--cream); animation: lb-pulse 1s ease-in-out infinite;
}
@keyframes lb-pulse { 0%, 100% { opacity: .2; transform: scale(.7); } 50% { opacity: .9; transform: scale(1.2); } }
.lightbox__close {
  position: absolute; top: calc(18px + env(safe-area-inset-top, 0px)); right: max(var(--g), env(safe-area-inset-right, 0px));
  display: inline-flex; align-items: center; gap: 12px; min-height: 44px;
  font-size: var(--t-label); font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
}
.lightbox__close i { position: relative; width: 20px; height: 20px; }
.lightbox__close i::before, .lightbox__close i::after { content: ""; position: absolute; left: 0; top: 50%; width: 100%; height: 1px; background: currentColor; transform: rotate(45deg); }
.lightbox__close i::after { transform: rotate(-45deg); }
.lightbox__prev, .lightbox__next { position: absolute; top: 50%; translate: 0 -50%; border-color: var(--line-cream); }
.lightbox__prev { left: max(var(--g), env(safe-area-inset-left, 0px)); }
.lightbox__next { right: max(var(--g), env(safe-area-inset-right, 0px)); }
.lightbox__count { position: absolute; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); left: 50%; translate: -50% 0; font-size: var(--t-label); font-weight: 500; font-variant-numeric: tabular-nums; color: var(--cream-2); }
@media (max-width: 760px) {
  .lightbox { padding-inline: max(var(--g), env(safe-area-inset-left, 0px)); }
  .lightbox__prev, .lightbox__next { top: auto; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); translate: none; }
}

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
