:root {
  --navy: #0b1424;
  --navy-2: #12203a;
  --gold: #d8b26a;
  --gold-soft: #ecd3a0;
  --ivory: #f4efe4;
  --muted: #a9b3c4;
  --serif: "Noto Serif Thai", serif;
  --sans: "IBM Plex Sans Thai", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--navy); color: var(--ivory); font-family: var(--sans); line-height: 1.6; overflow-x: clip; }
a { color: inherit; }
.nw { white-space: nowrap; }
h1, h2 { font-family: var(--serif); font-weight: 800; line-height: 1.25; }
h1 { font-size: clamp(2.4rem, 7vw, 5.5rem); }
h2 { font-size: clamp(1.8rem, 4.4vw, 3.2rem); }
.kicker { font-size: .85rem; letter-spacing: .14em; color: var(--gold); }
.lead { margin-top: .9rem; color: var(--muted); }

.nav { position: fixed; inset: 0 0 auto; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem clamp(1rem, 4vw, 3rem); background: linear-gradient(rgba(11,20,36,.8), transparent); }
.brand { font-family: var(--serif); font-weight: 800; font-size: 1.35rem; text-decoration: none; display: flex; align-items: baseline; gap: .5rem; }
.brand span { font-family: var(--sans); font-size: .6rem; letter-spacing: .3em; color: var(--gold); }
.nav-cta { font-size: .9rem; text-decoration: none; border: 1px solid rgba(216,178,106,.5); color: var(--gold-soft); padding: .35rem 1rem; border-radius: 99px; }

.btn { display: inline-block; padding: .8rem 1.8rem; border-radius: 99px; background: var(--gold); color: var(--navy); font-weight: 600; text-decoration: none; box-shadow: 0 8px 30px rgba(216,178,106,.3); transition: transform .2s; }
.btn:hover { transform: translateY(-2px); }
.btn.ghost { background: transparent; color: var(--ivory); border: 1px solid rgba(244,239,228,.35); box-shadow: none; }

/* ---------- 1. build ---------- */
.build { height: 520vh; position: relative; }
.build-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.sky { position: absolute; inset: 0; background:
  radial-gradient(60% 40% at 50% 100%, rgba(216,178,106,.25), transparent 70%),
  linear-gradient(#060c18 0%, #0e1d38 55%, #1b2c4d 80%, #0b1424 100%); }
.sky::after { /* river */ content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 18%; background: linear-gradient(rgba(216,178,106,.12), rgba(11,20,36,.9)); }
.tower { position: absolute; left: 50%; bottom: 6%; height: 82%; aspect-ratio: 600 / 720; transform: translateX(-50%); overflow: visible; will-change: opacity; }
.tower-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; will-change: opacity, transform; }
.build-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(rgba(11,20,36,.55), transparent 30%, transparent 60%, rgba(11,20,36,.75)); }

.counter { position: absolute; z-index: 3; right: clamp(1rem, 5vw, 4rem); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: flex-end; font-family: var(--serif); color: var(--muted); line-height: 1.1; }
.counter b { font-size: clamp(3rem, 9vw, 7rem); color: var(--gold-soft); font-variant-numeric: tabular-nums; }

.beat { position: absolute; z-index: 3; left: clamp(1.25rem, 6vw, 6rem); top: 50%; transform: translateY(-50%); width: min(30rem, 42vw); opacity: 0; will-change: opacity; text-shadow: 0 2px 24px rgba(0,0,0,.6); }
.beat .num { font-family: var(--serif); color: var(--gold); letter-spacing: .1em; margin-bottom: .4rem; }
.beat.final { left: 50%; top: auto; bottom: 10vh; transform: translateX(-50%); width: min(40rem, calc(100% - 2.5rem)); text-align: center; }
.progress { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(244,239,228,.1); }
.progress span { display: block; height: 100%; width: 0; background: var(--gold); }

@media (max-width: 899px) {
  .tower { height: 62%; bottom: 8%; }
  .beat { left: 50%; top: 5.5rem; transform: translateX(-50%); width: calc(100% - 2.5rem); text-align: center; }
  .beat.final { top: auto; }
  .counter { top: auto; bottom: 1.2rem; right: 1.25rem; transform: none; flex-direction: row; align-items: baseline; gap: .35rem; }
  .counter b { font-size: 2.4rem; }
}

/* ---------- 2. facts ---------- */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: rgba(216,178,106,.2); border-block: 1px solid rgba(216,178,106,.2); }
@media (min-width: 900px) { .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.fact { background: var(--navy); padding: 2.5rem 1rem; text-align: center; }
.fact b { display: block; font-family: var(--serif); font-size: clamp(2.6rem, 6vw, 4.2rem); color: var(--gold-soft); line-height: 1.1; font-variant-numeric: tabular-nums; }
.fact span { color: var(--muted); font-size: .95rem; }

/* ---------- 3. plans ---------- */
.plans { height: 330vh; position: relative; }
.plans-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 1rem; padding: 5.5rem 1.25rem 1.5rem; background: radial-gradient(70% 60% at 70% 50%, #15284a, var(--navy)); }
.plan-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0 1rem; }
.plan-tabs button { font: inherit; font-size: .85rem; cursor: pointer; padding: .35rem .9rem; border-radius: 99px; border: 1px solid rgba(244,239,228,.25); background: transparent; color: var(--muted); transition: all .3s; }
.plan-tabs button[aria-selected="true"] { background: var(--gold); color: var(--navy); border-color: var(--gold); font-weight: 600; }
.plan-size { font-family: var(--serif); color: var(--muted); margin-top: .2rem; }
.plan-size b { font-size: 2.4rem; color: var(--gold-soft); }
.plan-desc { color: var(--muted); max-width: 26rem; margin-top: .4rem; font-size: .95rem; }
.plan-price { margin-top: .8rem; }
.plan-price b { font-family: var(--serif); font-size: 1.6rem; color: var(--gold-soft); }
.plan-copy > * { transition: opacity .35s; }
.plan-copy.swap > h2, .plan-copy.swap > .plan-size, .plan-copy.swap > .plan-desc, .plan-copy.swap > .plan-price { opacity: 0; }
.plan-board { position: relative; min-height: 0; display: grid; place-items: center; }
#planSvg { width: 100%; height: 100%; max-height: 100%; }
.plan-note { position: absolute; bottom: 0; right: 0; font-size: .72rem; color: var(--muted); }
.room { fill: rgba(216,178,106,.06); stroke: var(--gold-soft); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.1s cubic-bezier(.65,0,.35,1), fill .6s; }
.room.wet { fill: rgba(120,170,220,.10); }
.room.out { fill: rgba(120,200,160,.08); stroke-dasharray: .02 .015; }
.drawn .room { stroke-dashoffset: 0; }
.room-label { font-family: var(--sans); font-size: 11px; fill: var(--ivory); text-anchor: middle; opacity: 0; transition: opacity .5s .7s; }
.room-label.sz { font-size: 9px; fill: var(--muted); }
.drawn .room-label { opacity: 1; }
.plan-shell { fill: none; stroke: var(--gold); stroke-width: 4; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.2s cubic-bezier(.65,0,.35,1); }
.drawn .plan-shell { stroke-dashoffset: 0; }
@media (min-width: 900px) {
  .plans-stage { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: none; align-items: center; gap: 4vw; padding: 6rem clamp(2rem, 7vw, 7rem) 3rem; }
  .plan-board { height: 70vh; }
}

/* ---------- 4. visit ---------- */
.visit { position: relative; min-height: 100svh; display: grid; align-items: end; padding: 0 1.25rem 3rem; overflow: hidden; }
.visit-shot { position: absolute; inset: 0; }
.visit-shot img { width: 100%; height: 120%; object-fit: cover; display: block; will-change: transform; }
.visit-shot::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 30%, rgba(11,20,36,.92)); }
.visit-card { position: relative; max-width: 34rem; padding: 2rem; border-radius: 1.5rem; background: rgba(11,20,36,.6); border: 1px solid rgba(216,178,106,.25); backdrop-filter: blur(10px); }
.visit-card h2 { margin-top: .4rem; }
.visit-card > p:not(.kicker) { color: var(--muted); margin-top: .6rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.4rem; }
@media (min-width: 900px) { .visit { padding: 0 clamp(2rem, 7vw, 7rem) 5rem; } }

.reveal { opacity: 0; transform: translateY(40px); transition: opacity .8s cubic-bezier(.22,1,.36,1), transform .8s cubic-bezier(.22,1,.36,1); }
.reveal.in { opacity: 1; transform: none; }
.facts .reveal:nth-child(2) { transition-delay: .08s; }
.facts .reveal:nth-child(3) { transition-delay: .16s; }
.facts .reveal:nth-child(4) { transition-delay: .24s; }

.demo-note { border-top: 1px solid rgba(244,239,228,.1); padding: 4rem 1.25rem 5rem; text-align: center; color: var(--muted); }
.demo-note strong { color: var(--ivory); }
.demo-note .btn { margin-top: 1.4rem; }
.back { margin-top: 2rem; }

.toast { position: fixed; z-index: 50; left: 50%; bottom: 1.5rem; transform: translate(-50%, 150%); opacity: 0; pointer-events: none; width: max-content; max-width: calc(100% - 2rem); padding: .75rem 1.25rem; border-radius: 1rem; background: var(--ivory); color: var(--navy); font-size: .9rem; box-shadow: 0 10px 40px rgba(0,0,0,.5); transition: transform .4s cubic-bezier(.22,1,.36,1), opacity .3s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* phones + big system fonts: keep the brand on one line and always leave room for the plan */
.brand, .nav-cta { white-space: nowrap; }
@media (max-width: 899px) {
  .brand span { display: none; }
  .plans-stage { grid-template-rows: auto minmax(40svh, 1fr); padding-top: 4.8rem; gap: .5rem; }
  .plans-stage h2 { font-size: clamp(1.5rem, 7vw, 2.2rem); }
  .plan-desc { display: none; }
  .plan-tabs { margin: .5rem 0 .6rem; }
  .plan-size b { font-size: 1.8rem; }
  .plan-price { margin-top: .3rem; }
}
.plan-board { background-image: linear-gradient(rgba(216,178,106,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(216,178,106,.06) 1px, transparent 1px); background-size: 24px 24px; border-radius: 1rem; }
@media (max-width: 899px) {
  .plan-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .plan-tabs button { white-space: nowrap; flex: none; }
  .plan-size, .plan-price { display: inline-block; margin: 0 1rem 0 0; vertical-align: baseline; }
  .plans-stage { grid-template-rows: auto minmax(36svh, 1fr); }
}
