/*
  HABITAT foundation layer
  Components consume semantic tokens only. Primitive palettes live exclusively
  in the theme scopes below and the accent ramp is generated by brand-system.js.
*/

:root {
  --font-display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --font-interface: "Hanken Grotesk", "Avenir Next", Helvetica, sans-serif;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --duration-instant: 120ms;
  --duration-fast: 180ms;
  --duration-base: 280ms;
  --duration-slow: 480ms;
  --ease-standard: cubic-bezier(.2, .7, .2, 1);
  --ease-emphasized: cubic-bezier(.16, 1, .3, 1);

  --radius-panel: 2px;
  --radius-control: 4px;
  --radius-full: 999px;
  --control-height: 44px;
  --header-height: 68px;
  --nav-height: 52px;
  --chapter-height: 72px;
  --plan-width: min(35vw, 520px);

  --brand-50: oklch(97% .02 72);
  --brand-100: oklch(93% .03 72);
  --brand-200: oklch(85% .05 72);
  --brand-300: oklch(76% .07 72);
  --brand-400: oklch(66% .08 72);
  --brand-500: oklch(56% .09 72);
  --brand-600: oklch(48% .09 72);
  --brand-700: oklch(40% .08 72);
  --brand-800: oklch(31% .06 72);
  --brand-900: oklch(23% .04 72);
  --brand-950: oklch(17% .03 72);
  --accent: var(--brand-600);
  --accent-text: #fffaf0;
}

html[data-rounding="straight"] { --radius-panel: 0px; --radius-control: 2px; }
html[data-rounding="soft"] { --radius-panel: 8px; --radius-control: 10px; }
html[data-density="compact"] { --control-height: 40px; }

html[data-theme="light"] {
  --primitive-canvas: #f2efe8;
  --primitive-paper: #faf8f3;
  --primitive-raised: #fffdf8;
  --primitive-ink: #20201d;
  --primitive-muted: #66655f;
  --primitive-faint: #8a8880;
  --primitive-line: #d4d0c7;
  --primitive-line-strong: #aaa69d;
  --primitive-overlay: rgba(242, 239, 232, .92);
  --primitive-shadow: rgba(30, 29, 25, .12);
  --primitive-focus: #204f69;

  --surface: var(--primitive-canvas);
  --surface-raised: var(--primitive-raised);
  --surface-muted: var(--primitive-paper);
  --surface-inverse: var(--primitive-ink);
  --text: var(--primitive-ink);
  --text-muted: var(--primitive-muted);
  --text-faint: var(--primitive-faint);
  --text-inverse: var(--primitive-paper);
  --border: var(--primitive-line);
  --border-strong: var(--primitive-line-strong);
  --overlay: var(--primitive-overlay);
  --shadow: var(--primitive-shadow);
  --focus: var(--primitive-focus);
  --success: #356744;
  --danger: #9b322b;
}

html[data-theme="dark"] {
  --primitive-canvas: #151614;
  --primitive-paper: #1b1d1a;
  --primitive-raised: #232520;
  --primitive-ink: #f1eee6;
  --primitive-muted: #b1afa7;
  --primitive-faint: #85847d;
  --primitive-line: #393a35;
  --primitive-line-strong: #5b5b54;
  --primitive-overlay: rgba(21, 22, 20, .94);
  --primitive-shadow: rgba(0, 0, 0, .34);
  --primitive-focus: #91c9e3;

  --surface: var(--primitive-canvas);
  --surface-raised: var(--primitive-raised);
  --surface-muted: var(--primitive-paper);
  --surface-inverse: var(--primitive-ink);
  --text: var(--primitive-ink);
  --text-muted: var(--primitive-muted);
  --text-faint: var(--primitive-faint);
  --text-inverse: var(--primitive-canvas);
  --border: var(--primitive-line);
  --border-strong: var(--primitive-line-strong);
  --overlay: var(--primitive-overlay);
  --shadow: var(--primitive-shadow);
  --focus: var(--primitive-focus);
  --success: #89b694;
  --danger: #ed8d83;
}

html[data-theme="dark"][data-brand="classico"] { --primitive-canvas: #171612; --primitive-paper: #201e19; --primitive-raised: #28251e; }
html[data-theme="light"][data-brand="mineral"] { --primitive-canvas: #eef0ef; --primitive-paper: #f6f7f5; --primitive-raised: #fbfcfa; }
html[data-theme="dark"][data-brand="mineral"] { --primitive-canvas: #121719; --primitive-paper: #182024; --primitive-raised: #202a2e; }
html[data-theme="light"][data-brand="vermilion"] { --primitive-canvas: #f1eee9; --primitive-paper: #f9f6f1; }
html[data-theme="dark"][data-brand="vermilion"] { --primitive-canvas: #181412; --primitive-paper: #211a18; --primitive-raised: #2a211e; }

html, body { background: var(--surface); color: var(--text); font-family: var(--font-interface); }
body { font-size: 15px; letter-spacing: -.008em; }
button, input, textarea, select { font-family: var(--font-interface); }
h1, h2, h3, .map-mode-title, .visual-caption span { font-family: var(--font-display); font-weight: 400; letter-spacing: -.025em; }
.num, output, dd { font-variant-numeric: tabular-nums lining-nums; }
::selection { background: var(--accent); color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: var(--radius-control); }

.top {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--header-height);
  padding: 0 var(--space-5);
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(340px, 1fr);
  align-items: center;
  gap: var(--space-5);
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; flex-direction: row; align-items: center; gap: var(--space-4); min-width: 0; }
.brand b { font: 500 15px/1 var(--font-interface); letter-spacing: .24em; }
.brand i { max-width: none; margin: 0; padding-left: var(--space-4); border-left: 1px solid var(--border); color: var(--text-muted); font: 400 12px/1.3 var(--font-interface); letter-spacing: 0; }
.header-end { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); min-width: 0; }
.header-thesis { margin-right: var(--space-2); padding-right: var(--space-4); padding-left: 0; border-right: 1px solid var(--border); border-left: 0; color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.icon-control, .ghost {
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  transition: color var(--duration-fast), background var(--duration-fast), border-color var(--duration-fast);
}
.icon-control svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.icon-control:hover, .ghost:hover { background: var(--surface-raised); border-color: var(--border-strong); color: var(--text); }
.theme-toggle[aria-pressed="true"] .icon-sun { transform: rotate(45deg); }
.theme-toggle .icon-sun { transition: transform var(--duration-base) var(--ease-standard); }

.tabs {
  position: relative;
  display: flex;
  min-height: var(--control-height);
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.tabs::before { inset: 0 auto 0 0; width: 50%; border-radius: 0; background: var(--surface-inverse); transition: transform var(--duration-base) var(--ease-emphasized); }
.tabs button { min-height: var(--control-height); padding: 0 var(--space-4); color: var(--text-muted); font-size: 12px; border-radius: 0; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text-inverse); font-weight: 500; }

.module-nav {
  position: fixed;
  z-index: 45;
  top: var(--header-height);
  left: 0;
  right: 0;
  width: auto;
  height: var(--nav-height);
  padding: 0 var(--space-5);
  display: flex;
  align-items: stretch;
  gap: var(--space-6);
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  transform: none;
}
.module-nav button { position: relative; min-height: var(--nav-height); padding: 0; display: flex; align-items: center; color: var(--text-muted); opacity: 1; transform: none; }
.module-nav button::before { left: 0; right: 0; top: auto; bottom: -1px; width: auto; height: 2px; background: transparent; box-shadow: none; }
.module-nav button:hover { color: var(--text); transform: none; }
.module-nav button[aria-current="page"] { color: var(--text); }
.module-nav button[aria-current="page"]::before { background: var(--accent); box-shadow: none; }
.module-nav span { font-size: 12px; font-weight: 500; }
.module-nav small { display: none; }

#stage {
  inset: calc(var(--header-height) + var(--nav-height)) var(--plan-width) var(--chapter-height) 0;
  background: linear-gradient(180deg, var(--sky1), var(--sky2) 60%, var(--sil2));
  transition: right var(--duration-slow) var(--ease-emphasized), filter var(--duration-base);
}
body[data-plan-open="false"] #stage { right: 0; }
#gl { cursor: grab; }
.frame::before { box-shadow: inset 0 0 0 1px var(--border); opacity: 1; }

.building-toolbar {
  position: fixed;
  z-index: 32;
  top: calc(var(--header-height) + var(--nav-height) + var(--space-4));
  right: calc(var(--plan-width) + var(--space-4));
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transition: right var(--duration-slow) var(--ease-emphasized);
}
body[data-plan-open="false"] .building-toolbar { right: var(--space-4); }
.plan-toggle {
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid color-mix(in srgb, var(--text-inverse) 36%, transparent);
  border-radius: var(--radius-control);
  background: color-mix(in srgb, var(--surface-inverse) 88%, transparent);
  color: var(--text-inverse);
  backdrop-filter: none;
  font-size: 12px;
}
.plan-toggle:hover { background: var(--surface-inverse); border-color: var(--surface-inverse); color: var(--text-inverse); }
.plan-toggle[hidden] { display: none; }

.building-plan-panel {
  position: fixed;
  z-index: 21;
  top: calc(var(--header-height) + var(--nav-height));
  right: 0;
  bottom: var(--chapter-height);
  width: var(--plan-width);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  overflow: auto;
  clip-path: none;
  filter: none;
  border-left: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  box-shadow: none;
  transition: transform var(--duration-slow) var(--ease-emphasized), visibility var(--duration-slow);
}
body[data-plan-open="false"] .building-plan-panel { transform: translateX(100%); visibility: hidden; }
.selection-lockup {
  display: grid;
  grid-template-columns: 1.15fr .7fr 1fr;
  padding: 0 0 var(--space-4);
  border-bottom: 1px solid var(--border);
}
.selection-lockup p { display: grid; gap: var(--space-1); padding: 0 var(--space-3); border-left: 1px solid var(--border); }
.selection-lockup p:first-child { padding-left: 0; border-left: 0; }
.selection-lockup span { color: var(--text-muted); font-size: 10px; line-height: 1.2; text-transform: uppercase; letter-spacing: .13em; }
.selection-lockup strong { color: var(--text); font: 500 16px/1.15 var(--font-interface); }
.selection-lockup p:nth-child(2) strong, .selection-lockup p:nth-child(3) strong { font-size: 23px; }
.card { position: static; width: auto; padding: 0 0 var(--space-3); display: grid; grid-template-columns: 1fr 1.2fr; align-items: end; gap: var(--space-3); border: 0; border-bottom: 1px solid var(--border); }
.lvl { display: none; }
.card dl { grid-column: 2; display: flex; justify-self: end; gap: var(--space-4); margin: 0; font-size: 11px; }
.card dl div { display: grid; gap: 0; }
.card dt { color: var(--text-muted); }
.card dd { color: var(--text); font-weight: 500; }
.card .state { grid-column: 1; grid-row: 1; color: var(--text); font-size: 11px; }
.state i { width: 7px; height: 7px; border: 0; border-radius: var(--radius-full); background: var(--success) !important; box-shadow: none !important; }
.plan-preview { padding: var(--space-4) 0; background: transparent; color: var(--text); clip-path: none; filter: none; border-bottom: 1px solid var(--border); }
.plan-preview header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); }
.plan-preview h1 { font: 400 23px/1.15 var(--font-display); letter-spacing: -.02em; }
.plan-preview .current-unit { color: var(--accent); font: 500 18px/1 var(--font-interface); }
#buildingPlanDrawing { height: clamp(170px, 25vh, 270px); margin: var(--space-2) 0; }
.building-plan-drawing { color: var(--text-muted); background: transparent; }
.building-plan-drawing .plan-labels { fill: var(--text); }
.plan-preview > p { color: var(--text-muted); font-size: 11px; }
.enter-unit, .contact-primary, .contact-panel form button {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--accent);
  border-radius: var(--radius-control);
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: none;
  font-size: 13px;
  font-weight: 600;
  transition: filter var(--duration-fast), transform var(--duration-fast);
}
.enter-unit { width: 100%; margin: var(--space-4) 0 0; padding: 0 var(--space-4); }
.enter-unit:hover, .contact-primary:hover, .contact-panel form button:hover { filter: brightness(.92); transform: translateY(-1px); background: var(--accent); color: var(--accent-text); }
.enter-unit span { color: inherit; }
.deck { position: static; padding: 0; display: flex; flex-direction: column-reverse; align-items: stretch; gap: var(--space-4); }
.views { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border: 1px solid var(--border); background: var(--border); }
.views button { min-height: 40px; padding: 0 var(--space-2); border: 0; border-radius: 0; background: var(--surface-muted); color: var(--text-muted); backdrop-filter: none; font-size: 11px; }
.views button:hover { background: var(--surface-raised); color: var(--text); }
.views button[aria-pressed="true"] { background: var(--surface-inverse); color: var(--text-inverse); }
.hour { width: 100%; max-width: none; grid-template-columns: 1fr auto; gap: var(--space-2) var(--space-4); color: var(--text); }
.hour .lab, .period { color: var(--text-muted); font-size: 11px; }
.hour output { color: var(--text); font: 500 17px/1 var(--font-interface); }
.day-arc { height: 34px; margin: var(--space-1) var(--space-2) 0; border-color: var(--border-strong); }
.day-arc:focus-visible { border-top-color: var(--focus); box-shadow: none; }
.day-arc i { width: 10px; height: 10px; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }

.rail {
  position: fixed;
  z-index: 31;
  left: var(--space-4);
  right: auto;
  top: calc(var(--header-height) + var(--nav-height) + var(--space-4));
  bottom: calc(var(--chapter-height) + var(--space-4));
  width: 70px;
  padding: var(--space-3) var(--space-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  transform: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--overlay);
  color: var(--text);
  box-shadow: 0 18px 48px var(--shadow);
  backdrop-filter: blur(14px);
}
.rail:hover { transform: none; border-color: var(--border-strong); }
.rail-cap { color: var(--text-muted); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.floor-step { width: 44px; min-height: 30px; border-radius: var(--radius-control); color: var(--text); }
.floor-step:hover { background: var(--surface-raised); color: var(--text); }
.floor-list { display: grid; grid-template-rows: repeat(16, minmax(18px, 1fr)); width: 100%; min-height: 0; flex: 1; }
.floor-choice { position: relative; width: 100%; min-height: 18px; display: grid; place-items: center; border-radius: var(--radius-control); color: var(--text-muted); font-size: 10px; transition: background var(--duration-fast), color var(--duration-fast); }
.floor-choice::before { display: none; }
.floor-choice:hover { transform: none; background: var(--surface-raised); color: var(--text); }
.floor-choice.is-active { background: var(--surface-inverse); color: var(--text-inverse); box-shadow: none; }
.floor-bubble, .floor-caption, .floor-slider { display: none; }

.building-caption { position: fixed; z-index: 16; left: 104px; bottom: calc(var(--chapter-height) + var(--space-5)); padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-panel); background: var(--overlay); color: var(--text); box-shadow: none; backdrop-filter: blur(12px); }
.building-caption::before { display: none; }
.building-caption span { font-size: 13px; font-weight: 500; }
.building-caption p { margin-top: 2px; color: var(--text-muted); font-size: 11px; }
.chapter-bar { position: fixed; z-index: 25; inset: auto 0 0; min-height: var(--chapter-height); padding: 0 var(--space-6); display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); border-top: 1px solid var(--border); background: var(--surface); color: var(--text); }
.chapter-bar > span { font: 400 22px/1.2 var(--font-display); letter-spacing: -.02em; }
.chapter-bar button { min-height: 44px; display: flex; align-items: center; gap: var(--space-3); color: var(--text); font-size: 12px; }
.chapter-bar .current-unit { color: var(--accent); }
.chapter-bar button:hover { color: var(--accent); }
.chapter-bar button svg { width: 36px; height: 36px; padding: 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-full); }
.chapter-bar button:hover svg { transform: none; background: var(--surface-raised); }

.sheet {
  position: fixed;
  z-index: 56;
  top: calc(var(--header-height) + var(--space-4));
  right: var(--space-4);
  bottom: auto;
  width: min(390px, calc(100vw - 32px));
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: 0 24px 70px var(--shadow);
  backdrop-filter: none;
}
.sheet h2 { margin-bottom: var(--space-4); color: var(--text); font-size: 32px; }
.sheet dl { gap: 0; }
.sheet dl div { grid-template-columns: 105px 1fr; gap: var(--space-3); padding: var(--space-3) 0; border-color: var(--border); }
.sheet dt { color: var(--text-muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.sheet dd { color: var(--text); }
.sheet .note { color: var(--text-muted); }
.sheet .x { min-width: 44px; min-height: 44px; top: var(--space-3); right: var(--space-3); color: var(--text-muted); }

.brand-panel, .contact-panel {
  position: fixed;
  z-index: 70;
  right: var(--space-4);
  width: min(430px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: 0 28px 90px var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--duration-base), transform var(--duration-base), visibility var(--duration-base);
}
.brand-panel[data-open="true"], .contact-panel[data-open="true"] { opacity: 1; visibility: visible; transform: none; }
.brand-panel { top: calc(var(--header-height) + var(--space-3)); padding: var(--space-5); }
.brand-panel header, .contact-panel header { display: flex; align-items: start; justify-content: space-between; gap: var(--space-4); padding-bottom: var(--space-4); border-bottom: 1px solid var(--border); }
.brand-panel header span, .contact-panel header span { color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: .14em; }
.brand-panel h2 { margin-top: var(--space-2); font-size: 27px; line-height: 1.08; }
.panel-close { min-width: 44px; min-height: 44px; color: var(--text-muted); font-size: 12px; }
.panel-close:hover { color: var(--text); }
.preset-list { display: grid; margin: var(--space-4) 0; border-top: 1px solid var(--border); }
.preset-list button { min-height: 68px; padding: var(--space-3) 0; display: grid; grid-template-columns: 20px 1fr; align-items: center; gap: var(--space-3); text-align: left; border-bottom: 1px solid var(--border); color: var(--text); }
.preset-list button i { width: 14px; height: 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-full); }
.preset-list button[data-preset="classico"] i { background: var(--brand-600); }
.preset-list button[data-preset="mineral"] i { background: oklch(48% .08 226); }
.preset-list button[data-preset="vermilion"] i { background: oklch(48% .15 32); }
.preset-list button[aria-pressed="true"] i { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); }
.preset-list button span { display: grid; gap: 2px; }
.preset-list b { font-size: 13px; font-weight: 600; }
.preset-list small, .brand-panel > p { color: var(--text-muted); font-size: 12px; line-height: 1.5; }

.contact-dock { position: fixed; z-index: 40; right: calc(var(--plan-width) + var(--space-5)); bottom: calc(var(--chapter-height) + var(--space-4)); }
body[data-plan-open="false"] .contact-dock { right: var(--space-5); }
body:not([data-experience="edificio"]) .contact-dock { bottom: var(--space-5); }
.contact-primary { min-width: 210px; padding: 0 var(--space-4); box-shadow: 0 14px 36px var(--shadow); }
.contact-primary svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.contact-panel { top: calc(var(--header-height) + var(--space-3)); bottom: var(--space-4); padding: var(--space-6); overflow: auto; }
.contact-panel h2 { margin: var(--space-6) 0 var(--space-3); font-size: clamp(34px, 4vw, 52px); line-height: .98; }
.contact-panel > p { color: var(--text-muted); line-height: 1.55; }
.contact-panel form { display: grid; gap: var(--space-4); margin-top: var(--space-6); }
.contact-panel label { display: grid; gap: var(--space-1); }
.contact-panel label span { color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.contact-panel input { width: 100%; min-height: 44px; padding: var(--space-2) 0; border: 0; border-bottom: 1px solid var(--border-strong); border-radius: 0; background: transparent; color: var(--text); font-size: 16px; }
.contact-panel input:focus { outline: 0; border-bottom-color: var(--focus); }
.contact-panel form button { padding: 0 var(--space-4); }
#leadStatus { min-height: 20px; color: var(--success); font-size: 12px; }
.whatsapp-link { min-height: 44px; margin-top: var(--space-3); display: flex; align-items: center; color: var(--text); text-decoration: underline; text-underline-offset: 4px; }
.contact-meta { display: grid; gap: var(--space-1); padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.contact-meta a { min-height: 32px; display: flex; align-items: center; color: var(--text-muted); font-size: 12px; text-decoration: none; }
.contact-meta a:hover { color: var(--text); }
.contact-panel footer { margin-top: var(--space-7); padding-top: var(--space-4); display: flex; justify-content: space-between; gap: var(--space-4); border-top: 1px solid var(--border); color: var(--text-muted); font-size: 11px; }
.contact-panel footer b { color: var(--text); letter-spacing: .18em; }

.experience {
  inset: calc(var(--header-height) + var(--nav-height)) 0 0;
  padding: var(--space-6) clamp(24px, 4vw, 64px) var(--space-7);
  background: var(--surface);
  color: var(--text);
  animation: none;
}
.experience-head { max-width: 1540px; margin-bottom: var(--space-6); padding-bottom: var(--space-5); align-items: end; border-color: var(--border); }
.experience-head h1 { max-width: 950px; color: var(--text); font-size: clamp(38px, 4.6vw, 72px); line-height: .98; }
.back-building { min-height: 44px; padding: 0 var(--space-4); border: 1px solid var(--border-strong); border-radius: var(--radius-control); color: var(--text); font-size: 12px; }
.back-building:hover { border-color: var(--text); background: var(--surface-raised); color: var(--text); }
.experience-grid, .location-layout { max-width: 1540px; gap: 1px; background: var(--border); }
.visual-board, .detail-board, .amenity-index, .common-plan-board, .map-board, .nearby-board { border: 0; border-radius: 0; background: var(--surface-raised); color: var(--text); backdrop-filter: none; }
.detail-board, .common-plan-board, .nearby-board { padding: var(--space-6); }
.detail-board h2, .common-plan-board h2 { color: var(--text); font-size: 31px; }
.detail-context, .prototype-note, .route-copy { color: var(--text-muted); }
.prototype-note { border-color: var(--border); font-size: 11px; }
.unit-facts { gap: 0; margin: var(--space-6) 0; padding: 0; border-color: var(--border); }
.unit-facts div { min-height: 88px; padding: var(--space-4) 0; display: grid; align-content: center; border-bottom: 1px solid var(--border); }
.unit-facts dt { color: var(--text-muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.unit-facts dd { color: var(--text); font: 500 23px/1.2 var(--font-interface); }
.room-list button { min-height: 48px; border-color: var(--border); color: var(--text-muted); font-size: 13px; }
.room-list button span { color: var(--text-muted); }
.room-list button[aria-pressed="true"] { background: transparent; color: var(--accent); }
.visual-caption { min-height: 76px; padding: var(--space-4) var(--space-5); border-color: var(--border); background: var(--surface-inverse); color: var(--text-inverse); }
.visual-caption p { color: color-mix(in srgb, var(--text-inverse) 72%, transparent); }
.view-switch, .webview-top-actions button, .webview-status { border: 1px solid var(--border-strong); border-radius: var(--radius-control); background: var(--overlay); color: var(--text); backdrop-filter: blur(10px); }
.view-switch { border-radius: var(--radius-control); }
.view-switch button { min-height: 40px; border-radius: 0; color: var(--text-muted); }
.view-switch button[aria-pressed="true"] { background: var(--surface-inverse); color: var(--text-inverse); }
.webview-top-actions button { min-height: 44px; padding: 0 var(--space-3); }
.webview-top-actions button[aria-pressed="true"] { background: var(--surface-inverse); color: var(--text-inverse); }
.webview-status output:last-child { color: var(--success); }
.webview-status span i { background: var(--success); box-shadow: none; }
.scene-tabs, .look-controls, .walk-controls { border-color: color-mix(in srgb, var(--text-inverse) 28%, transparent); border-radius: var(--radius-control); background: color-mix(in srgb, var(--surface-inverse) 90%, transparent); color: var(--text-inverse); backdrop-filter: none; }
.scene-tabs button, .look-controls button, .walk-controls button { min-width: 44px; min-height: 44px; color: var(--text-inverse); border-radius: var(--radius-control); }
.scene-tabs button[aria-pressed="true"], .walk-controls button:active, .walk-controls button.active { background: var(--accent); color: var(--accent-text); }
.webview-hint { background: color-mix(in srgb, var(--surface-inverse) 92%, transparent); color: var(--text-inverse); }
.floor-plan { background: var(--surface-muted); color: var(--text-muted); }
.plan-labels { fill: var(--text); }
.mode-flight, .handoff, .view-transition { background: color-mix(in srgb, var(--surface-inverse) 94%, transparent); color: var(--text-inverse); }
.amenity-index button { min-height: 64px; color: var(--text); border-color: var(--border); }
.amenity-index button span, .amenity-index small { color: var(--text-muted); }
.amenity-index button[aria-pressed="true"] { padding-left: var(--space-4); background: color-mix(in srgb, var(--accent) 10%, var(--surface-raised)); color: var(--text); box-shadow: inset 2px 0 var(--accent); }
.common-plan rect { stroke: var(--border-strong); }
.common-plan rect.active { fill: color-mix(in srgb, var(--accent) 16%, transparent); stroke: var(--accent); }
.common-plan text { fill: var(--text); }
.location-modes { border-color: var(--border); background: var(--surface); }
.location-modes button { min-height: 68px; padding: var(--space-3); border-color: var(--border); color: var(--text); }
.location-modes span { color: var(--text-muted); }
.location-modes button[aria-pressed="true"] { padding-left: var(--space-4); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); box-shadow: inset 2px 0 var(--accent); }
.map-board, .map-board > svg { background: var(--surface-muted); }
.map-blocks { fill: var(--surface-raised); stroke: var(--border); }
.map-roads { stroke: var(--border-strong); }
.map-pins text { fill: var(--text); }
.map-pins circle { fill: var(--text-muted); stroke: var(--surface-raised); }
.map-pins .home-pin circle, .map-route { fill: var(--accent); stroke: var(--accent); }
.map-pins .home-pin text { fill: var(--accent-text); }
.map-pins [data-place].active circle { fill: var(--danger); stroke: var(--surface-raised); filter: none; }
.map-pins [data-place].active text { fill: var(--text); }
.map-legend { border: 1px solid var(--border); background: var(--overlay); color: var(--text); backdrop-filter: blur(12px); }
.map-legend p { color: var(--text-muted); }
.nearby-board li { min-height: 58px; border-color: var(--border); }
.nearby-board li:hover, .nearby-board li:focus { background: var(--surface-muted); }
.nearby-board li.active { background: color-mix(in srgb, var(--accent) 10%, var(--surface-raised)); box-shadow: inset 2px 0 var(--accent); }
.nearby-board li.active span, .nearby-board span { color: var(--text); }
.nearby-board b, .nearby-board li.active b { color: var(--accent); font-family: var(--font-interface); }
.nearby-board small { color: var(--text-muted); }
.implementation-placeholder { background: color-mix(in srgb, var(--surface-inverse) 96%, transparent); color: var(--text-inverse); }
.implementation-placeholder span { color: var(--accent); }
.implementation-placeholder small { color: color-mix(in srgb, var(--text-inverse) 70%, transparent); }

.boot { background: var(--surface); color: var(--text); }
.boot b { font: 500 16px/1 var(--font-interface); letter-spacing: .24em; }
.boot p { color: var(--text-muted); }
.boot .bar { background: var(--border); }
.boot .bar i { background: var(--accent); }

@media (max-width: 1180px) {
  :root { --plan-width: min(39vw, 460px); }
  .top { grid-template-columns: auto auto 1fr; }
  .brand i, .header-thesis { display: none; }
  .header-end .icon-control span { display: none; }
  .building-plan-panel { padding: var(--space-5); }
}

@media (max-width: 860px) {
  :root { --header-height: 62px; --nav-height: 50px; --chapter-height: 66px; --plan-width: 100%; }
  .top { padding: 0 var(--space-3); grid-template-columns: 1fr auto auto; gap: var(--space-2); }
  .brand b { font-size: 13px; }
  .top > .tabs { display: none; }
  .header-end { grid-column: 2 / 4; }
  .header-end .ghost { display: none; }
  .icon-control { width: 44px; padding: 0; }
  .module-nav { padding: 0 var(--space-2); gap: 0; display: grid; grid-template-columns: repeat(4, 1fr); }
  .module-nav button { justify-content: center; min-width: 0; }
  .module-nav span { font-size: 10px; }
  #stage { right: 0; }
  .building-toolbar { top: calc(var(--header-height) + var(--nav-height) + var(--space-3)); right: var(--space-3); }
  .building-toolbar #buildingViewModes { display: none; }
  .building-plan-panel { top: calc(var(--header-height) + var(--nav-height)); bottom: var(--chapter-height); padding: var(--space-5) var(--space-4); }
  .selection-lockup { grid-template-columns: 1fr .65fr .9fr; }
  .selection-lockup strong { font-size: 13px; }
  .selection-lockup p:nth-child(2) strong, .selection-lockup p:nth-child(3) strong { font-size: 19px; }
  .rail { left: var(--space-3); top: 50%; bottom: auto; width: 58px; height: auto; transform: translateY(-50%); }
  .rail:hover { transform: translateY(-50%); }
  .floor-list { display: none; }
  .floor-bubble { display: grid; width: 44px; height: 44px; place-items: center; border-radius: var(--radius-control); background: var(--surface-inverse); color: var(--text-inverse); font: 500 20px/1 var(--font-interface); }
  .floor-caption { display: block; color: var(--text-muted); font-size: 8px; }
  .floor-caption b { color: var(--text); }
  .floor-slider { display: block; height: 150px; }
  .building-caption { left: 84px; bottom: calc(var(--chapter-height) + var(--space-3)); }
  .chapter-bar { padding: 0 var(--space-4); }
  .chapter-bar > span { display: none; }
  .chapter-bar button { width: 100%; justify-content: space-between; }
  .contact-dock { right: var(--space-3); bottom: calc(var(--chapter-height) + var(--space-3)); }
  body[data-plan-open="false"] .contact-dock { right: var(--space-3); }
  .contact-primary { min-width: 0; width: 48px; padding: 0; justify-content: center; }
  .contact-primary span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .brand-panel, .contact-panel { right: var(--space-2); width: calc(100vw - 16px); }
  .contact-panel { padding: var(--space-5); }
  .experience { padding: var(--space-5) var(--space-3) var(--space-6); }
  .experience-head { align-items: start; }
  .experience-head h1 { font-size: clamp(34px, 10vw, 54px); }
  .apartment-grid, .amenity-grid, .location-layout { grid-template-columns: 1fr; gap: 1px; }
  .visual-board, .detail-board, .amenity-index, .common-plan-board, .map-board, .nearby-board { border-radius: 0; }
  .detail-board, .common-plan-board, .nearby-board { padding: var(--space-5); }
  .amenity-index { grid-template-columns: 1fr 1fr; }
  .location-modes { grid-template-columns: repeat(3, 1fr); }
  .location-modes button { min-height: 64px; padding: var(--space-2); }
  .location-modes button[aria-pressed="true"] { padding-left: var(--space-2); box-shadow: inset 0 -2px var(--accent); }
  body:not([data-experience="edificio"]) .contact-dock { bottom: var(--space-3); }
}

@media (max-width: 560px) {
  .module-nav span { font-size: 9px; }
  .building-caption { display: none; }
  .plan-preview h1 { font-size: 21px; }
  #buildingPlanDrawing { height: 190px; }
  .views { grid-template-columns: repeat(2, 1fr); }
  .experience-head { display: grid; gap: var(--space-4); }
  .back-building { justify-self: start; }
  .webview-top-actions { top: 58px; }
  .webview-top-actions button { min-width: 44px; }
  .webview-status { top: 108px; }
  .scene-tabs button { min-width: 0; }
  .visual-caption { display: grid; gap: var(--space-1); }
  .visual-caption span { white-space: normal; }
  .unit-facts { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; animation-duration: 0s !important; }
}
