/* ------------------------------------------------------------------
   House — 3D walkthroughs from floor plans
   Same paper-and-ink family as grandpa-story. Navigation lives on the
   right; the stage (3D model or plan) fills the rest.
------------------------------------------------------------------- */

:root {
  --paper: #f6f1e6;
  --paper-2: #efe7d6;
  --paper-3: #e6dcc7;
  --ink: #2e2923;
  --ink-soft: #6a6056;
  --ink-faint: #9b9184;
  --line: #d9cdb6;
  --terracotta: #a8583c;
  --moss: #5f6d4d;
  --stage-a: #efe9dc;
  --stage-b: #d9d0be;
  --plan-floor: #f7f2e7;
  --plan-wall: #2e2923;
  --plan-line: #9b9184;
  --plan-furn: #e6dcc7;
  --plan-glass: #5f7c8a;
  --warm: #a8583c;
  --shadow: 0 18px 50px -24px rgba(60, 40, 20, 0.45);
  --radius: 16px;
  --side-w: 340px;
  --display: "Cormorant Garamond", "Times New Roman", serif;
  --body: "EB Garamond", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
a { color: var(--terracotta); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font-family: inherit; }

/* ------------------------------ shell ------------------------------ */

.shell { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) var(--side-w); }

.stage-col { position: relative; min-width: 0; min-height: 0; }
.pane { position: absolute; inset: 0; display: none; }
.pane.on { display: block; }

#stage { position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 10%, var(--stage-a) 0%, var(--stage-b) 100%); }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-soft); font-family: var(--display); font-style: italic; font-size: 1.3rem; }

.hint {
  position: absolute; left: 50%; bottom: 1.1rem; transform: translateX(-50%);
  font-size: 0.82rem; color: var(--paper);
  background: rgba(46, 41, 35, 0.62); padding: 0.3rem 0.85rem; border-radius: 999px;
  pointer-events: none; transition: opacity 0.5s ease; backdrop-filter: blur(6px); white-space: nowrap;
}

.stage-caption {
  position: absolute; left: 1rem; top: 1rem;
  padding: 0.5rem 0.9rem 0.55rem; border-radius: 12px;
  background: rgba(246, 241, 230, 0.86); border: 1px solid rgba(217, 205, 182, 0.7);
  backdrop-filter: blur(8px); pointer-events: none;
}
.stage-caption .t { font-family: var(--display); font-weight: 600; font-size: 1.15rem; line-height: 1.1; }
.stage-caption .s { font-style: italic; font-size: 0.9rem; color: var(--ink-soft); }

/* plan pane */
#pane-plan { overflow-y: auto; padding: 1.6rem 1.8rem 2.5rem; background: var(--paper); }
.plan-head { display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.plan-head h2 { margin: 0; font-family: var(--display); font-weight: 500; font-size: 1.7rem; }
.plan-head .scale { color: var(--ink-soft); font-style: italic; font-size: 0.95rem; }
.planwrap { background: var(--plan-floor); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem; box-shadow: var(--shadow); overflow-x: auto; }
.planwrap svg { display: block; width: 100%; height: auto; min-width: 440px; }
.legend { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: 0.85rem; color: var(--ink-soft); margin: 0.8rem 0 0; }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.sw { width: 1.2rem; height: 0; border-top: 3px solid var(--plan-wall); }
.sw.glass { border-top-color: var(--plan-glass); }
.sw.gone { border-top: 3px dashed var(--warm); }
#plan-notes { max-width: 68ch; margin-top: 1rem; }

/* ------------------------------ sidebar ------------------------------ */

.side {
  background: var(--paper-2);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 1.8rem 1.5rem 2rem;
  display: flex; flex-direction: column; gap: 1.5rem;
}
.brand { color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-vi { display: block; font-family: var(--display); font-weight: 600; font-size: 1.7rem; line-height: 1.05; }
.brand-en { display: block; margin-top: 0.25rem; font-style: italic; color: var(--ink-soft); font-size: 0.95rem; }
.brand-rule { display: block; width: 42px; height: 2px; background: var(--terracotta); margin-top: 0.9rem; border-radius: 2px; }

.side h2, .side .label {
  margin: 0 0 0.5rem;
  font-family: var(--body);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.side section { display: flex; flex-direction: column; }

.nav-link {
  display: grid; grid-template-columns: 1.5rem 1fr; gap: 0.5rem; align-items: start;
  padding: 0.5rem 0.65rem; margin: 0 -0.65rem; border-radius: 10px; color: var(--ink);
  transition: background 0.2s ease;
}
.nav-link:hover { background: rgba(168, 88, 60, 0.07); text-decoration: none; }
.nav-link.active { background: rgba(168, 88, 60, 0.11); }
.nav-link.active .num { color: var(--terracotta); }
.nav-link.disabled { opacity: 0.45; pointer-events: none; }
.nav-link .num { font-family: var(--display); font-weight: 600; color: var(--ink-faint); }
.nav-link .vi { display: block; line-height: 1.2; }
.nav-link .en { display: block; font-style: italic; font-size: 0.88rem; color: var(--ink-soft); }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; }
.seg button, .opt, .chip {
  appearance: none; cursor: pointer; font: inherit; color: var(--ink);
  background: rgba(255, 255, 255, 0.45); border: 1px solid var(--line); border-radius: 10px;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  text-align: left;
}
.seg button { padding: 0.45rem 0.7rem; text-align: center; font-size: 0.95rem; }
.seg button[aria-pressed="true"], .opt[aria-pressed="true"], .chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.opt { padding: 0.6rem 0.8rem; display: flex; flex-direction: column; gap: 0.05rem; }
.opt b { font-family: var(--display); font-weight: 600; font-size: 1.1rem; line-height: 1.1; }
.opt small { font-style: italic; color: inherit; opacity: 0.75; font-size: 0.88rem; }
.opt[aria-pressed="true"] small { opacity: 0.8; }
.opts { display: flex; flex-direction: column; gap: 0.4rem; }
.views { display: flex; flex-direction: column; gap: 2px; }
.views button {
  appearance: none; cursor: pointer; font: inherit; color: var(--ink);
  background: transparent; border: 0; border-radius: 10px; text-align: left;
  display: grid; grid-template-columns: 1.5rem 1fr; gap: 0.5rem; padding: 0.45rem 0.65rem; margin: 0 -0.65rem;
  transition: background 0.2s ease;
}
.views button:hover { background: rgba(168, 88, 60, 0.07); }
.views button[aria-pressed="true"] { background: rgba(168, 88, 60, 0.12); }
.views button .num { font-family: var(--display); font-weight: 600; color: var(--ink-faint); }
.views button[aria-pressed="true"] .num { color: var(--terracotta); }
.views button .en { display: block; font-style: italic; font-size: 0.88rem; color: var(--ink-soft); }
.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip { padding: 0.35rem 0.75rem; border-radius: 999px; font-size: 0.9rem; }
.chip[hidden] { display: none; }

.details { border-top: 1px solid var(--line); padding-top: 1.2rem; }
.details-head { display: flex; align-items: baseline; gap: 0.6rem; }
.details-head h3 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.35rem; flex: 1; }
.details-toggle { appearance: none; border: 1px solid var(--line); background: transparent; color: var(--ink-soft); font: inherit; font-size: 0.85rem; padding: 0.15rem 0.6rem; border-radius: 999px; cursor: pointer; }
#details-body { margin-top: 0.6rem; }
.lede { font-family: var(--display); font-size: 1.15rem; line-height: 1.45; margin: 0.2rem 0 0.8rem; }
#details-body h3 { margin: 1.1rem 0 0.35rem; font-family: var(--body); font-weight: 500; font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-faint); }
#details-body ul { margin: 0; padding-left: 1.05rem; font-size: 0.95rem; }
#details-body li { margin: 0.3rem 0; }
#details-body li::marker { color: var(--terracotta); }
#details-body table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
#details-body td { padding: 0.3rem 0; border-bottom: 1px solid var(--line); color: var(--ink-soft); }
#details-body td:last-child { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.note { font-size: 0.88rem; color: var(--ink-soft); border-left: 2px solid var(--terracotta); padding-left: 0.7rem; margin: 1.1rem 0 0; }

.side-foot { margin-top: auto; padding-top: 1rem; display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.9rem; }
.side-foot a { color: var(--ink-soft); }

/* ------------------------------ hub page ------------------------------ */

.hub { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) var(--side-w); }
.hub-main { padding: 3rem 3rem 4rem; max-width: 980px; }
.eyebrow { margin: 0 0 0.5rem; font-size: 0.74rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--terracotta); }
h1 { margin: 0; font-family: var(--display); font-weight: 500; font-size: clamp(2.3rem, 4vw, 3.4rem); line-height: 1.05; }
.subtitle { margin: 0.4rem 0 0; font-family: var(--display); font-style: italic; font-size: 1.35rem; color: var(--ink-soft); }
.hub-lede { margin: 1.2rem 0 0; font-size: 1.12rem; color: var(--ink-soft); max-width: 640px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.4rem; margin-top: 2.4rem; }
.card {
  display: block; color: var(--ink); background: rgba(255, 255, 255, 0.5); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform 0.25s ease;
}
.card:hover { transform: translateY(-4px); text-decoration: none; }
.card .thumb { height: 170px; background: var(--paper-3); position: relative; }
.card .thumb svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.card .body { padding: 1rem 1.2rem 1.2rem; }
.card .k { font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); }
.card h3 { margin: 0.3rem 0 0.3rem; font-family: var(--display); font-weight: 600; font-size: 1.4rem; }
.card p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }
.card.soon { opacity: 0.6; pointer-events: none; }
.card.soon .thumb { background: repeating-linear-gradient(45deg, var(--paper-3) 0 10px, var(--paper-2) 10px 20px); }

/* ------------------------------ responsive ------------------------------ */

@media (max-width: 900px) {
  html, body { height: auto; }
  .shell { display: flex; flex-direction: column; height: auto; }
  .stage-col { height: 62vh; min-height: 380px; }
  .side { border-left: 0; border-top: 1px solid var(--line); padding: 1.4rem 1.2rem 2rem; gap: 1.2rem; }
  .side-foot { margin-top: 0.5rem; }
  .hub { grid-template-columns: 1fr; }
  .hub-main { padding: 2rem 1.2rem 3rem; }
  #pane-plan { padding: 1rem 1rem 2rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
