/* =========================================================
   JING 静 — MAP VARIANT
   Mobile-first. Architectural plan as homepage.
   ========================================================= */

:root {
  --cream: #F4ECDA;
  --paper: #F8F2E5;
  --ink: #1A1814;
  --ink-70: rgba(26, 24, 20, 0.7);
  --ink-50: rgba(26, 24, 20, 0.5);
  --ink-30: rgba(26, 24, 20, 0.3);
  --ink-12: rgba(26, 24, 20, 0.12);
  --walnut: #5C4533;
  --jade: #7A9888;
  --clay: #C97B5B;

  --ease-quiet: cubic-bezier(.16, 1, .3, 1);
  --t-panel: 700ms;
  --t-soft: 380ms;

  --f-display: 'Fraunces', 'Noto Serif SC', Georgia, serif;
  --f-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --f-zh: 'Noto Serif SC', 'Songti SC', serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  --gutter: clamp(20px, 6vw, 36px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  min-height: 100dvh;
  position: relative;
}

img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* ---------- Paper grain ---------- */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 1000;
  opacity: 0.35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.1  0 0 0 0 0.09  0 0 0 0 0.08  0 0 0 0.18 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- Header ---------- */
.site-header {
  padding: 28px var(--gutter) 8px;
  text-align: center;
  position: relative;
  z-index: 2;
}
.brand-mark {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--ink);
}
.brand-sub {
  margin-top: 8px;
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.28em;
  color: var(--ink-50);
}

/* ---------- HERO / FLOOR PLAN ---------- */
.hero {
  padding: 20px var(--gutter) 40px;
  position: relative;
  z-index: 2;
}

.plan-wrap {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 18px auto 28px;
  padding: 18px 14px 24px;
  background: var(--paper);
  border: 0.6px solid var(--ink-30);
  box-shadow:
    0 1px 0 var(--ink-12),
    0 20px 40px -28px rgba(26,24,20,0.25);
}

/* Title block (top-left of drawing) */
.title-block {
  position: absolute;
  top: 14px;
  left: 14px;
  display: grid;
  gap: 2px;
  z-index: 2;
}
.tb-row {
  display: flex;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 7.5px;
  letter-spacing: 0.15em;
  color: var(--ink-70);
}
.tb-k { color: var(--ink-50); min-width: 44px; }
.tb-v { color: var(--ink); }

/* Compass (top-right) */
.compass {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 38px;
  height: 38px;
  z-index: 2;
  opacity: 0.85;
}

/* The floor plan SVG */
.floor-plan {
  width: 100%;
  height: auto;
  display: block;
  margin: 32px auto 8px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.room-fill {
  transition: fill var(--t-soft) var(--ease-quiet);
}

.hit {
  fill: transparent;
  cursor: pointer;
  outline: none;
  transition: fill 280ms var(--ease-quiet);
}
.hit:hover,
.hit:focus-visible {
  fill: rgba(248, 242, 229, 0.5);
}
.hit:focus-visible {
  outline: 1.5px dashed var(--ink-70);
  outline-offset: -4px;
}
.hit:active {
  fill: rgba(124, 99, 65, 0.12);
}

/* Ball dots: slow pulse */
.dot {
  transform-origin: center;
  transform-box: fill-box;
  animation: dot-breathe 4.8s ease-in-out infinite;
}
.dot-walnut { animation-delay: -0.6s; }
.dot-jade   { animation-delay: -1.4s; }
.dot-clay   { animation-delay: -2.2s; }

@keyframes dot-breathe {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.08); }
}

/* Scale bar */
.scale-bar {
  margin: 14px auto 0;
  width: 180px;
  display: grid;
  gap: 3px;
}
.sb-track {
  height: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border: 0.6px solid var(--ink-70);
}
.sb-seg { display: block; height: 100%; }
.sb-dark { background: var(--ink); }
.sb-light { background: transparent; }
.sb-ticks {
  display: flex;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-size: 7.5px;
  letter-spacing: 0.1em;
  color: var(--ink-70);
}

/* Hero copy below plan */
.hero-copy {
  text-align: center;
  margin-top: 28px;
}
.hero-headline {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(34px, 9vw, 52px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  display: grid;
  gap: 6px;
}
.hero-headline .en { font-style: italic; }
.hero-headline .zh {
  font-family: var(--f-zh);
  font-size: clamp(20px, 5.5vw, 28px);
  font-style: normal;
  letter-spacing: 0.3em;
  color: var(--ink-70);
  font-weight: 300;
}
.prompt {
  margin-top: 18px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--ink-70);
  text-transform: uppercase;
}
.prompt .zh-inline {
  display: block;
  margin-top: 6px;
  font-family: var(--f-zh);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: none;
}

.scroll-cue {
  margin: 38px auto 0;
  width: 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.scroll-cue span:first-child {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.32em;
  color: var(--ink-50);
  white-space: nowrap;
  writing-mode: horizontal-tb;
}
.cue-line {
  width: 1px;
  height: 56px;
  background: linear-gradient(to bottom, var(--ink-30), transparent);
  animation: cue-drop 2.6s ease-in-out infinite;
  transform-origin: top;
}
@keyframes cue-drop {
  0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
  50%      { transform: scaleY(1);   opacity: 1; }
}

/* ---------- Generic section styling ---------- */
.section {
  padding: 64px var(--gutter);
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}
.section-label {
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.32em;
  color: var(--ink-50);
  margin-bottom: 18px;
}
.section-h {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(26px, 6.5vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 24px;
}
.section-h em { font-style: italic; color: var(--ink-70); }

/* ---------- House note ---------- */
.house-note {
  border-top: 0.6px solid var(--ink-30);
  padding-top: 48px;
}
.lede {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(22px, 5.5vw, 30px);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 22px;
}
.house-text {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-70);
  max-width: 540px;
}

/* ---------- Lab ---------- */
.lab {
  border-top: 0.6px solid var(--ink-30);
}
.lab-figure {
  margin: 28px auto;
  max-width: 340px;
}
.lab-note {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--ink-50);
  text-transform: uppercase;
  margin-top: 12px;
}

/* ---------- Colorways ---------- */
.colorways {
  border-top: 0.6px solid var(--ink-30);
}
.swatch-list {
  list-style: none;
  display: grid;
  gap: 0;
  margin-top: 14px;
  border-top: 0.6px solid var(--ink-30);
}
.swatch {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 0.6px solid var(--ink-30);
}
.swatch-chip {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 0.6px solid var(--ink-30);
  display: block;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.swatch-name {
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.22em;
  color: var(--ink);
}
.swatch-code {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-50);
}

/* ---------- Product ---------- */
.product {
  border-top: 0.6px solid var(--ink-30);
}
.product-card {
  margin-top: 28px;
  padding: 36px 24px;
  background: var(--paper);
  border: 0.6px solid var(--ink-30);
}
.product-ball {
  display: flex; justify-content: center;
  margin-bottom: 32px;
}
.ball-3d {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,0.55), transparent 38%),
    radial-gradient(circle at 70% 75%, rgba(0,0,0,0.18), transparent 50%),
    radial-gradient(circle at 50% 50%, #F0E8D6, #C9BFA9 65%, #6C5E48 100%);
  box-shadow:
    0 30px 50px -22px rgba(26,24,20,0.45),
    inset 0 -10px 28px rgba(0,0,0,0.18);
}
.ball-paper {
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,0.65), transparent 38%),
    radial-gradient(circle at 70% 75%, rgba(0,0,0,0.18), transparent 50%),
    radial-gradient(circle at 50% 50%, #FBF7EC, #ECE2C9 65%, #8C7C5C 100%);
}
.ball-walnut {
  background:
    radial-gradient(circle at 32% 28%, rgba(255,236,210,0.55), transparent 38%),
    radial-gradient(circle at 70% 75%, rgba(0,0,0,0.35), transparent 50%),
    radial-gradient(circle at 50% 50%, #8E6D55, #5C4533 60%, #2D1F14 100%);
}
.ball-jade {
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,0.55), transparent 38%),
    radial-gradient(circle at 70% 75%, rgba(0,0,0,0.22), transparent 50%),
    radial-gradient(circle at 50% 50%, #A8C2B2, #7A9888 60%, #3F5448 100%);
}
.ball-clay {
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,0.55), transparent 38%),
    radial-gradient(circle at 70% 75%, rgba(0,0,0,0.22), transparent 50%),
    radial-gradient(circle at 50% 50%, #E29F80, #C97B5B 60%, #6F3D26 100%);
}

.spec {
  display: grid;
  gap: 0;
  border-top: 0.6px solid var(--ink-30);
}
.spec-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 0.6px solid var(--ink-30);
}
.spec-row dt {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--ink-50);
  text-transform: uppercase;
  padding-top: 2px;
}
.spec-row dd {
  font-family: var(--f-display);
  font-size: 16px;
  line-height: 1.3;
  color: var(--ink);
}

/* ---------- Reserve ---------- */
.reserve {
  border-top: 0.6px solid var(--ink-30);
}
.reserve-form {
  margin-top: 18px;
  display: grid;
  gap: 12px;
  max-width: 460px;
}
.reserve-form input {
  font: inherit;
  font-family: var(--f-mono);
  font-size: 14px;
  letter-spacing: 0.05em;
  padding: 16px 0;
  background: transparent;
  border: 0;
  border-bottom: 0.8px solid var(--ink-50);
  color: var(--ink);
  outline: none;
}
.reserve-form input::placeholder { color: var(--ink-30); }
.reserve-form input:focus { border-bottom-color: var(--ink); }
.reserve-form button {
  justify-self: start;
  margin-top: 6px;
  padding: 14px 28px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  border-radius: 0;
  transition: transform 220ms var(--ease-quiet), background 220ms;
}
.reserve-form button:hover { transform: translateY(-1px); background: var(--walnut); }
.reserve-ok {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--walnut);
  margin-top: 8px;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 56px var(--gutter) 40px;
  text-align: center;
  border-top: 0.6px solid var(--ink-30);
  position: relative;
  z-index: 2;
}
.foot-row {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--ink-70);
}
.foot-meta {
  margin-top: 8px;
  color: var(--ink-50);
  font-size: 9px;
}

/* =========================================================
   ROOM PANELS
   ========================================================= */
.panel-stage {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}
.panel-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(26,24,20,0.45);
  opacity: 0;
  transition: opacity var(--t-panel) var(--ease-quiet);
  pointer-events: none;
}
.panel-stage.is-open {
  pointer-events: auto;
}
.panel-stage.is-open::before {
  opacity: 1;
}

.room-panel {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(100%, 560px);
  max-height: 92dvh;
  transform: translate(-50%, 100%);
  background: var(--paper);
  padding: 28px var(--gutter) 40px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition:
    transform var(--t-panel) var(--ease-quiet),
    opacity calc(var(--t-panel) - 200ms) var(--ease-quiet),
    visibility 0s linear var(--t-panel);
  box-shadow: 0 -24px 60px -20px rgba(26,24,20,0.4);
  /* vignette */
  background-image:
    radial-gradient(ellipse at center, transparent 55%, rgba(26,24,20,0.08) 100%),
    linear-gradient(var(--paper), var(--paper));
}
.room-panel.is-open {
  transform: translate(-50%, 0);
  opacity: 1;
  visibility: visible;
  transition:
    transform var(--t-panel) var(--ease-quiet),
    opacity 360ms var(--ease-quiet),
    visibility 0s linear 0s;
}

.panel-close {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--ink-70);
  padding: 8px 0;
  margin-bottom: 14px;
  transition: color 200ms;
}
.panel-close:hover { color: var(--ink); }

.panel-meta {
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.32em;
  color: var(--ink-50);
  margin-bottom: 12px;
}
.panel-title {
  font-family: var(--f-display);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(34px, 9vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}
.panel-ball {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  margin: 18px 0 30px;
}
.panel-ball .ball-3d {
  width: 200px; height: 200px;
}
.ball-tag {
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.32em;
  color: var(--ink-70);
}

.panel-headline {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(22px, 5.5vw, 28px);
  line-height: 1.25;
  margin-bottom: 14px;
}
.panel-sub {
  font-size: 15px;
  color: var(--ink-70);
  line-height: 1.6;
  margin-bottom: 22px;
}
.panel-list {
  list-style: none;
  display: grid;
  gap: 10px;
  border-top: 0.6px solid var(--ink-30);
  padding-top: 16px;
}
.panel-list li {
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  color: var(--ink);
  padding-left: 18px;
  position: relative;
}
.panel-list li::before {
  content: "·";
  position: absolute;
  left: 4px;
  color: var(--ink-50);
}

/* When a panel is open, dim/lock the page */
body.panel-open {
  overflow: hidden;
}

/* Active room highlight on plan when corresponding panel open */
.room-fill.is-active {
  fill: rgba(248, 242, 229, 0.9);
  filter: drop-shadow(inset 0 0 8px rgba(26,24,20,0.1));
}

/* =========================================================
   DESKTOP UP
   ========================================================= */
@media (min-width: 760px) {
  .plan-wrap { padding: 22px 22px 28px; }
  .title-block { top: 18px; left: 22px; }
  .compass { top: 16px; right: 22px; width: 44px; height: 44px; }
  .floor-plan { margin-top: 36px; }
  .product-card { padding: 56px 48px; display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 40px; }
  .product-ball { margin-bottom: 0; }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 200ms !important;
  }
  .cue-line, .dot { animation: none !important; }
}
