/* =====================================================================
   1. DESIGN TOKENS
   ===================================================================== */
:root {
  --limestone: #ECE6DC;
  --charcoal:  #23211E;
  --oak:       #B98A5A;
  --olive:     #5F6A45;
  --sky:       #E8D3B5;

  --bg:        var(--limestone);
  --surface:   #F5F1EA;
  --surface-2: #E3DCCF;
  --text:      var(--charcoal);
  --muted:     #5E574D;
  --line:      rgba(35, 33, 30, .16);
  --line-strong: rgba(35, 33, 30, .34);
  --accent:    var(--olive);
  --accent-text: #F5F1EA;
  --oak-ui:    var(--oak);
  --danger:    #9A3B26;
  --focus:     var(--charcoal);
  --nav-bg:    rgba(236, 230, 220, .74);
  --scrim:     rgba(35, 33, 30, .45);

  --font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(35,33,30,.06), 0 12px 40px -18px rgba(35,33,30,.28);
  --max: 1280px;
  --gutter: clamp(20px, 4vw, 56px);
  --nav-h: 68px;
  color-scheme: light;
}

/* Dark palette — used when the OS prefers dark (and no manual choice),
   or when the user picks dark with the toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #1B1A17;
    --surface:   #242220;
    --surface-2: #2E2B27;
    --text:      #ECE6DC;
    --muted:     #B6AC9D;
    --line:      rgba(236, 230, 220, .14);
    --line-strong: rgba(236, 230, 220, .32);
    --accent:    #9DA97A;
    --accent-text: #1B1A17;
    --oak-ui:    #C99B6B;
    --danger:    #E58C73;
    --focus:     #ECE6DC;
    --nav-bg:    rgba(27, 26, 23, .72);
    --scrim:     rgba(0, 0, 0, .6);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 40px -18px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg:        #1B1A17;
  --surface:   #242220;
  --surface-2: #2E2B27;
  --text:      #ECE6DC;
  --muted:     #B6AC9D;
  --line:      rgba(236, 230, 220, .14);
  --line-strong: rgba(236, 230, 220, .32);
  --accent:    #9DA97A;
  --accent-text: #1B1A17;
  --oak-ui:    #C99B6B;
  --danger:    #E58C73;
  --focus:     #ECE6DC;
  --nav-bg:    rgba(27, 26, 23, .72);
  --scrim:     rgba(0, 0, 0, .6);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 40px -18px rgba(0,0,0,.7);
  color-scheme: dark;
}

/* =====================================================================
   2. BASE
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .3s ease, color .3s ease;
}
img, svg, canvas { display: block; max-width: 100%; }
h1, h2, h3, h4 { font-weight: 300; line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(40px, 6.2vw, 92px); }
h2 { font-size: clamp(32px, 4.4vw, 64px); }
h3 { font-size: clamp(22px, 2vw, 28px); line-height: 1.2; letter-spacing: -0.01em; }
h4 { font-size: 19px; font-weight: 500; letter-spacing: 0; line-height: 1.3; }
p { margin: 0 0 1em; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--sky); color: var(--charcoal); }

/* Visible keyboard focus everywhere. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 10px;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: clamp(80px, 11vw, 160px) 0; }
.section + .section { border-top: 1px solid var(--line); }
.eyebrow {
  font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 18px; font-weight: 500;
}
.lead { font-size: clamp(19px, 1.6vw, 22px); color: var(--muted); max-width: 60ch; font-weight: 300; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.sample-note {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: 999px; padding: 4px 12px;
}

/* =====================================================================
   3. BUTTONS, FIELDS, CHIPS
   ===================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  border: 1px solid var(--text); background: var(--text); color: var(--bg);
  font-size: 16px; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: transform .2s ease, background-color .2s ease, color .2s ease, border-color .2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--text); }
.btn--olive { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn--small { min-height: 44px; padding: 0 16px; font-size: 15px; }
.btn--danger { background: transparent; color: var(--danger); border-color: currentColor; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; flex: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px; border-radius: 999px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--line-strong); color: var(--muted); background: transparent;
  white-space: nowrap;
}
.chip--olive { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.chip--oak { border-color: var(--oak-ui); color: var(--text); }

/* =====================================================================
   5. HERO — sticky 3D stage
   ===================================================================== */
.hero { position: relative; height: 340vh; }
.hero__stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
  background: linear-gradient(180deg, #E9D7BB 0%, #EFE2CC 55%, #E5DBC9 100%);
}
:root[data-theme="dark"] .hero__stage { background: linear-gradient(180deg, #2a2420 0%, #3b2f27 60%, #231f1b 100%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero__stage { background: linear-gradient(180deg, #2a2420 0%, #3b2f27 60%, #231f1b 100%); } }

.hero__canvas { position: absolute; inset: 0; touch-action: pan-y; cursor: grab; }
.hero__canvas.is-dragging { cursor: grabbing; }
.hero__canvas canvas { width: 100% !important; height: 100% !important; }
.hero__fallback { position: absolute; inset: 0; display: none; align-items: flex-end; justify-content: flex-end; padding: 0 0 8vh; }
.hero__fallback svg { width: min(78vw, 980px); height: auto; margin-right: -2vw; }
.no-webgl .hero__fallback { display: flex; }
.no-webgl .hero__canvas, .no-webgl .hero__hud { display: none; }

/* Soft wash behind text so it stays readable over the 3D scene. */
.hero__wash { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(236,230,220,.78) 0%, rgba(236,230,220,.35) 34%, rgba(236,230,220,0) 52%); }
:root[data-theme="dark"] .hero__wash { background: linear-gradient(90deg, rgba(27,26,23,.82) 0%, rgba(27,26,23,.4) 34%, rgba(27,26,23,0) 54%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero__wash { background: linear-gradient(90deg, rgba(27,26,23,.82) 0%, rgba(27,26,23,.4) 34%, rgba(27,26,23,0) 54%); } }

.hero__copy {
  position: absolute; z-index: 2; left: var(--gutter); top: 50%; transform: translateY(-46%);
  width: min(560px, 42vw);
}
.hero__copy h1 { margin-bottom: 22px; }
.hero__copy .lead { margin-bottom: 30px; color: var(--text); opacity: .82; }
.hero__ctas { display: flex; flex-wrap: wrap; gap: 12px; }
.hero__meta { margin-top: 28px; display: flex; gap: 10px; flex-wrap: wrap; }

.hero__hud {
  position: absolute; z-index: 2; right: var(--gutter); bottom: 28px; width: min(540px, 42vw);
  display: flex; flex-direction: column; align-items: stretch; gap: 14px; pointer-events: none;
  padding: 16px 20px; border-radius: 16px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.hero__caption { min-width: 200px; }
.hero__caption-step { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.hero__caption-title { font-size: clamp(22px, 2.2vw, 30px); font-weight: 300; line-height: 1.2; }
.hero__caption-text { font-size: 15px; color: var(--muted); max-width: 36ch; margin: 0; }
.hero__progress { display: grid; gap: 10px; }
.hero__ticks { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.hero__ticks span[data-active="true"] { color: var(--text); font-weight: 500; }
.hero__bar { height: 2px; background: var(--line-strong); position: relative; overflow: hidden; border-radius: 2px; }
.hero__bar i { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0); background: var(--text); }
.hero__hint { font-size: 13px; color: var(--muted); }

@media (max-width: 900px) {
  .hero__wash { background: linear-gradient(180deg, rgba(236,230,220,.92) 0%, rgba(236,230,220,.6) 36%, rgba(236,230,220,0) 56%); }
  :root[data-theme="dark"] .hero__wash { background: linear-gradient(180deg, rgba(27,26,23,.92) 0%, rgba(27,26,23,.6) 36%, rgba(27,26,23,0) 56%); }
  .hero__copy { top: calc(var(--nav-h) + 22px); transform: none; width: auto; right: var(--gutter); }
  .hero__copy h1 { font-size: clamp(36px, 9vw, 56px); margin-bottom: 12px; }
  .hero__copy .lead { font-size: 17px; margin-bottom: 18px; }
  .hero__meta { display: none; }
  .hero__hud { left: var(--gutter); width: auto; gap: 10px; bottom: 18px; }
  .hero__fallback { align-items: flex-end; justify-content: center; padding-bottom: 14vh; }
  .hero__fallback svg { width: 110vw; margin: 0; }
}
@media (prefers-color-scheme: dark) and (max-width: 900px) {
  :root:not([data-theme="light"]) .hero__wash { background: linear-gradient(180deg, rgba(27,26,23,.92) 0%, rgba(27,26,23,.6) 36%, rgba(27,26,23,0) 56%); }
}
@media (max-width: 380px) { .hero__ctas .btn { flex: 1 1 100%; } }

/* =====================================================================
   6. STATEMENT + FACTS
   ===================================================================== */
.statement { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(32px, 6vw, 100px); align-items: end; }
.statement h2 { max-width: 16ch; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; margin: 0; border-top: 1px solid var(--line); }
.facts div { padding: 22px 0; border-bottom: 1px solid var(--line); }
.facts div:nth-child(odd) { padding-right: 18px; }
.facts dt { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.facts dd { margin: 4px 0 0; font-size: clamp(22px, 2.2vw, 30px); font-weight: 300; line-height: 1.2; }
@media (max-width: 860px) { .statement { grid-template-columns: 1fr; } }

/* =====================================================================
   7. FLOOR PLAN
   ===================================================================== */
.plan { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(28px, 4vw, 64px); align-items: start; margin-top: clamp(56px, 8vw, 110px); }
.plan__svg-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(12px, 2vw, 28px); }
.plan svg { width: 100%; height: auto; }
.plan .room rect { fill: transparent; stroke: none; transition: fill .2s ease; cursor: pointer; }
.plan .room:hover rect { fill: color-mix(in srgb, var(--oak-ui) 14%, transparent); }
.plan .room[aria-pressed="true"] rect { fill: color-mix(in srgb, var(--oak-ui) 28%, transparent); }
.plan .room:focus { outline: none; }
.plan .room:focus-visible rect { stroke: var(--focus); stroke-width: .12; }
.plan .room text { font-family: var(--font); font-size: .52px; fill: var(--text); pointer-events: none; font-weight: 500; }
.plan .room text.area { font-size: .42px; fill: var(--muted); font-weight: 400; }
.plan .wall { stroke: var(--text); stroke-width: .22; stroke-linecap: square; }
.plan .glass { stroke: var(--oak-ui); stroke-width: .1; }
.plan .outline { fill: none; stroke: var(--line-strong); stroke-width: .05; stroke-dasharray: .2 .15; }
.plan .water { fill: color-mix(in srgb, #6f9fa3 35%, transparent); stroke: var(--line-strong); stroke-width: .05; }
.plan .tree { fill: color-mix(in srgb, var(--accent) 45%, transparent); }
.plan .label-out { font-family: var(--font); font-size: .42px; fill: var(--muted); }
.plan__detail { position: sticky; top: calc(var(--nav-h) + 24px); }
.plan__detail h3 { margin-bottom: 4px; }
.plan__area { font-size: 15px; color: var(--muted); margin-bottom: 16px; }
.plan__tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; padding: 0; list-style: none; }
.plan__legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 14px; }
.plan__legend span { display: inline-flex; align-items: center; gap: 8px; }
.plan__legend i { width: 22px; height: 0; border-top: 3px solid var(--text); display: inline-block; }
.plan__legend i.g { border-top: 2px solid var(--oak-ui); }
@media (max-width: 900px) { .plan { grid-template-columns: 1fr; } .plan__detail { position: static; } }


/* =====================================================================
   12. WALKTHROUGH OVERLAY
   ===================================================================== */
.walk { position: fixed; inset: 0; z-index: 100; background: #121110; display: none; }
.walk.is-open { display: block; }
.walk__canvas { position: absolute; inset: 0; touch-action: none; cursor: grab; }
.walk__canvas.is-dragging { cursor: grabbing; }
.walk__canvas canvas { width: 100% !important; height: 100% !important; }
.walk__top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: max(16px, env(safe-area-inset-top)) 18px 16px; pointer-events: none; }
.walk__top > * { pointer-events: auto; }
.walk__room {
  background: rgba(27,26,23,.62); color: #ECE6DC; border-radius: 14px; padding: 10px 16px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.walk__room span { display: block; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; opacity: .7; }
.walk__room strong { font-weight: 300; font-size: 26px; line-height: 1.15; }
.walk__exit { background: #ECE6DC; color: #23211E; border-color: #ECE6DC; }
.walk__help {
  position: absolute; left: 18px; bottom: max(18px, env(safe-area-inset-bottom)); max-width: 360px;
  background: rgba(27,26,23,.62); color: #ECE6DC; border-radius: 14px; padding: 12px 16px; font-size: 14px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.walk__help kbd { font-family: inherit; font-size: 12px; border: 1px solid rgba(236,230,220,.4); border-radius: 6px; padding: 1px 6px; }
.walk__pad { position: absolute; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); display: none; grid-template-columns: repeat(3, 60px); grid-template-rows: repeat(2, 60px); gap: 8px; }
.walk__pad button {
  width: 60px; height: 60px; border-radius: 16px; border: 1px solid rgba(236,230,220,.3);
  background: rgba(27,26,23,.6); color: #ECE6DC; display: grid; place-items: center; touch-action: none;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); -webkit-user-select: none; user-select: none;
}
.walk__pad button svg { width: 24px; height: 24px; }
.walk__pad button.is-down { background: rgba(236,230,220,.85); color: #23211E; }
.walk__pad .up { grid-column: 2; grid-row: 1; }
.walk__pad .left { grid-column: 1; grid-row: 2; }
.walk__pad .down { grid-column: 2; grid-row: 2; }
.walk__pad .right { grid-column: 3; grid-row: 2; }
@media (hover: none), (pointer: coarse) {
  .walk__pad { display: grid; }
  .walk__help .kb { display: none; }
  .walk__help { right: auto; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 140px); max-width: 260px; }
}
@media (hover: hover) and (pointer: fine) { .walk__help .touch { display: none; } }
.walk__crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(236,230,220,.7); pointer-events: none; }


/* =====================================================================
   13. REDUCED MOTION
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .card:hover, .btn:hover { transform: none; }
}


.tour-header { display:flex; justify-content:space-between; align-items:center; gap:1rem; padding:1rem clamp(1rem,5vw,5rem); position:relative; z-index:4; background:var(--bg); border-bottom:1px solid var(--line); }
.tour-brand { text-decoration:none; font:500 clamp(1.3rem,2.4vw,1.9rem) Georgia,serif; white-space:nowrap; }
.tour-brand span { font-size:.75em; }
.tour-header nav { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:.35rem 1rem; font-size:.9rem; }
.tour-header nav a, .tour-footer a { text-underline-offset:.25em; }
.tour-footer { display:flex; justify-content:space-between; flex-wrap:wrap; gap:1rem; border-top:1px solid var(--line); padding:2rem clamp(1rem,5vw,5rem); }
.tour-skip { position:absolute; top:.5rem; left:1rem; z-index:10; transform:translateY(-200%); background:var(--bg); padding:.5rem; }
.tour-skip:focus { transform:translateY(0); }
.floorplan-fallback { display:none; }
.no-webgl .hero { height:auto; min-height:min(660px,85vh); }
.no-webgl .hero__stage { position:relative; min-height:min(660px,85vh); }
.no-webgl .hero__ctas [data-walk-start], .no-webgl #pdWalk { display:none; }
.no-webgl .floorplan-fallback { display:inline-flex; }
.no-webgl .hero__fallback { background: center / cover no-repeat url('/assets/property-courtyard.webp'); }
.no-webgl .hero__fallback svg { width:100%; opacity:0; }
.no-webgl .hero__wash { background:linear-gradient(90deg, rgba(27,24,18,.9),rgba(27,24,18,.67) 46%,rgba(27,24,18,.07)); opacity:1; }
.no-webgl .hero__copy { color:#fff9ee; opacity:1; transform:none; }
.no-webgl .hero__copy .eyebrow, .no-webgl .hero__copy .lead { color:#fff9ee; }
.no-webgl .hero__copy .btn--ghost { color:#fff9ee; border-color:#fff9ee; background:#322e23; }
.no-webgl .hero__copy .hero__meta { color:#fff9ee; }
@media (max-width:600px) {
  .tour-header { gap:.5rem; }
  .tour-header nav { gap:.6rem; font-size:.8rem; }
  .no-webgl .hero__wash { background:linear-gradient(0deg,#1b1812e8,#1b181280 72%); }
}
@media (prefers-reduced-motion:reduce) { .hero:not(.no-webgl .hero) { height:auto; } }
