/* Halaman Homes house viewer: "Clay model" */

@font-face {
  font-family: 'Manrope';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/manrope-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/manrope-700.woff2') format('woff2');
}

:root {
  --bg: #F6F3EE;
  --ground: #ECE7DE;
  --ink: #1F1D1A;
  --muted: #5F594F;
  --panel: #FFFFFF;
  --panel-line: #E2DBCF;
  --road: #DDD7CC;
  --road-edge: #C4BBAC;
  --avail: #D8E5CC;
  --avail-strong: #2E6B4E;
  --res: #F0E1BF;
  --res-strong: #8A5A0F;
  --sold: #E3DED5;
  --sold-strong: #6E685E;
  --wall: #F4F1EB;
  --wall-side: #D6CDBF;
  --floor: #FBF9F5;
  --builtin: #C9BBA4;
  --select: #B9D4A8;
  --select-strong: #1F4D37;
  --accent: #2E6B4E;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --gutter: 16px;
  --tap: 46px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 500;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; }

/* ------------------------------------------------------------- stage */

#stage {
  position: fixed;
  inset: 0;
  touch-action: none; /* we own pan/pinch */
}
#stage canvas { display: block; width: 100%; height: 100%; }
#labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* ------------------------------------------------------------- header */

.bar {
  position: fixed;
  z-index: 3;
  top: 0; left: 0; right: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) var(--gutter) 8px;
  pointer-events: none;
}
.brand {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.bar h1 {
  margin: 2px 0 0;
  font-size: 17px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.bar .spec {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* ------------------------------------------------------------- dock */

.dock {
  position: fixed;
  z-index: 3;
  left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 var(--gutter) calc(env(safe-area-inset-bottom, 0px) + 8px);
  pointer-events: none;
}
.dock > * { pointer-events: auto; }

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  order: 2;
}

.seg {
  display: flex;
  padding: 3px;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
}
.seg[hidden] { display: none; }
.seg.wide, .plan-btn.wide { grid-column: 1 / -1; }

.seg button,
.plan-btn {
  min-height: var(--tap);
  border: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out), opacity 160ms ease;
}
.seg button {
  flex: 1;
  padding: 0 8px;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
}
.seg button[aria-pressed='true'] { background: var(--accent); color: #fff; }

.plan-btn {
  padding: 0 14px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  color: var(--ink);
}
.plan-btn[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: #fff; }

.seg button:active,
.plan-btn:active,
.card-close:active { transform: scale(0.97); }

:focus-visible { outline: 2px solid var(--select-strong); outline-offset: 2px; }

.note {
  order: 3;
  margin: 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}

/* ------------------------------------------------------------- room card */

.card {
  order: 1;
  position: relative;
  padding: 14px 56px 14px 16px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(60, 50, 30, 0.1);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out), visibility 0s linear 0s;
}
.card[data-open='false'] {
  opacity: 0;
  transform: translateY(8px);
  visibility: hidden;
  pointer-events: none;
  position: absolute;
  transition: opacity 140ms ease, transform 140ms ease, visibility 0s linear 140ms;
}
@starting-style {
  .card[data-open='true'] { opacity: 0; transform: translateY(8px); }
}
.card h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--select-strong);
}
.card .size {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 700;
}
.card .size span { color: var(--muted); font-weight: 500; }
.card .included {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.card .included:empty { display: none; }
.card-close {
  position: absolute;
  top: 4px; right: 4px;
  width: var(--tap); height: var(--tap);
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 160ms ease;
}

/* ------------------------------------------------------------- labels (CSS2D) */

.room-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 10.5px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 0 3px var(--floor), 0 0 3px var(--floor), 0 0 6px var(--floor);
}
.rl-dims { display: none; font-weight: 500; color: var(--muted); font-size: 9.5px; }
.rl-area { display: none; }
.room-label.plan { white-space: normal; }
.room-label.plan .rl-dims { display: block; }
.room-label.selected { color: var(--select-strong); font-size: 11.5px; }
.room-label.selected .rl-dims { display: block; color: var(--select-strong); font-size: 10.5px; font-weight: 700; }
.room-label.selected .rl-area { display: inline; }
.room-label.selected .rl-size, .room-label.selected .rl-area { white-space: nowrap; }

.dim-label {
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg);
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
}

/* ------------------------------------------------------------- loading / errors */

.status {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background: var(--bg);
  color: var(--muted);
  font-size: 15px;
  transition: opacity 240ms ease;
}
.status[hidden] { display: none; }
.status.done { opacity: 0; pointer-events: none; }

/* ------------------------------------------------------------- desktop: left panel */

@media (min-width: 860px) {
  .bar { right: auto; width: 360px; padding: 24px 24px 0; }
  .bar h1 { font-size: 19px; }
  .dock {
    right: auto; left: 0; top: 112px; bottom: 0;
    width: 360px;
    padding: 0 24px 24px;
    justify-content: flex-start;
  }
  .controls { order: 1; }
  .card { order: 2; }
  .card[data-open='false'] { position: absolute; }
  .note { order: 3; margin-top: auto; text-align: left; }
}

@media (hover: hover) and (pointer: fine) {
  .seg button:not([aria-pressed='true']):hover { background: var(--bg); color: var(--ink); }
  .plan-btn[aria-pressed='false']:hover { background: var(--bg); }
  .card-close:hover { background: var(--bg); }
}

@media (prefers-reduced-motion: reduce) {
  .card, .card[data-open='false'] { transition: opacity 120ms ease; transform: none; }
  .seg button, .plan-btn, .card-close { transition: background-color 120ms ease, color 120ms ease; }
  .seg button:active, .plan-btn:active, .card-close:active { transform: none; }
  .status { transition: none; }
}


/* ------------------------------------------------------------- footer line: the note, and the studio badge on the right */

.foot {
  order: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.foot .note { order: 0; flex: 1; min-width: 0; margin: 0; text-align: left; }
.demo-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: transform 160ms var(--ease-out), background-color 160ms ease;
}
.demo-badge:active { transform: scale(0.97); }
body.clean .demo-badge { display: none; }
@media (min-width: 860px) { .foot { order: 9; margin-top: auto; } }
@media (hover: hover) and (pointer: fine) { .demo-badge:hover { background: var(--bg); } }
@media (prefers-reduced-motion: reduce) { .demo-badge { transition: background-color 120ms ease; } .demo-badge:active { transform: none; } }
