/* Lunar Weddings — Interactive builder v1
   Cream / gold luxury. Preview prototype, not the public site. */
:root {
  --cream: #ECE4D9;
  --cream-deep: #E0D4C4;
  --cream-deeper: #D4C6B3;
  --cream-light: #F7F2EB;
  --cream-wash: #FBF8F3;
  --gold: #C9A227;
  --gold-dim: #A8881F;
  --gold-soft: rgba(201, 162, 39, 0.22);
  --gold-line: rgba(201, 162, 39, 0.45);
  --ink: #1A1A1A;
  --ink-soft: #3A342C;
  --muted: #6B6258;
  --paper: #FBF8F3;
  --shadow: 0 18px 50px rgba(40, 30, 16, 0.12);
  --radius: 14px;
  --header-h: 72px;
  --summary-h: 92px;
  --sans: "Noto Sans TC", "Noto Sans CJK TC", "PingFang HK", "Microsoft JhengHei", sans-serif;
  --serif: "Cormorant Garamond", "Noto Serif CJK TC", Georgia, serif;
  --cinzel: "Cinzel", "Cormorant Garamond", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(201,162,39,0.08), transparent 50%),
    linear-gradient(180deg, var(--cream-light), var(--cream) 40%, var(--cream-deep));
  min-height: 100vh;
  letter-spacing: 0.01em;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: var(--header-h);
  padding: 0 28px;
  background: rgba(247, 242, 235, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gold-line);
}
.brand {
  display: flex; align-items: center; gap: 16px; text-decoration: none; color: inherit; min-width: 0;
}
.brand img { height: 46px; width: auto; }
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-text strong {
  font-family: var(--cinzel);
  font-weight: 500;
  letter-spacing: 0.16em;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--ink);
}
.brand-text span {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.badge {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid var(--gold);
  color: var(--gold-dim);
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(201,162,39,0.08);
}
.lang-toggle {
  display: inline-flex; border: 1px solid var(--gold-line); border-radius: 999px; overflow: hidden;
  background: var(--cream-light);
}
.lang-toggle button {
  border: 0; background: transparent; padding: 6px 12px; font-size: 12px; color: var(--muted);
}
.lang-toggle button[aria-pressed="true"] {
  background: var(--ink); color: var(--cream-light);
}

/* Q0 */
.q0 {
  max-width: 1100px;
  margin: 48px auto 80px;
  padding: 0 24px;
  text-align: center;
}
.kicker {
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold-dim);
  margin-bottom: 10px;
}
.q0 h1, .panel-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(32px, 4vw, 52px);
  margin: 0 0 12px;
  letter-spacing: 0.02em;
}
.lede { color: var(--muted); max-width: 640px; margin: 0 auto 36px; line-height: 1.7; font-size: 15px; }
.q0-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
.q0-card {
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--gold-soft);
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
  color: inherit;
}
.q0-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.q0-card img { height: 170px; width: 100%; object-fit: cover; background: var(--cream-deep); }
.q0-card .body { padding: 18px 20px 22px; }
.q0-card h2 {
  font-family: var(--serif); font-weight: 500; font-size: 28px; margin: 0 0 6px;
}
.q0-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

/* App shell */
.app { display: none; }
.app.is-open { display: block; }
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.9fr);
  gap: 22px;
  padding: 20px 22px calc(var(--summary-h) + 24px);
  max-width: 1560px;
  margin: 0 auto;
  align-items: start;
}

/* Preview column */
.preview-col { position: sticky; top: calc(var(--header-h) + 12px); }
.stage-frame {
  background: #1a1612;
  border-radius: 18px;
  padding: 12px 12px 10px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(201,162,39,0.35);
}
.stage-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 8px 10px; color: var(--cream);
  font-size: 12px; letter-spacing: 0.08em;
}
.stage-toolbar .tabs { display: flex; gap: 6px; }
.stage-toolbar .tabs button {
  background: transparent; border: 1px solid rgba(236,228,217,0.25);
  color: var(--cream); border-radius: 999px; padding: 4px 12px; font-size: 12px;
}
.stage-toolbar .tabs button[aria-pressed="true"] {
  background: var(--gold); color: var(--ink); border-color: var(--gold);
}
.zoom-btns { display: flex; gap: 4px; }
.zoom-btns button {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid rgba(236,228,217,0.3); background: transparent; color: var(--cream);
}
.stage-viewport {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #2a241c;
  aspect-ratio: 16 / 10;
}
.stage {
  position: absolute; inset: 0;
  transform-origin: center center;
  transition: transform 0.25s ease;
}
.stage img.layer, .stage .layer {
  position: absolute; pointer-events: none;
}
.layer-bg { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.layer-carpet, .layer-spots { inset: 0; width: 100%; height: 100%; object-fit: cover; }
 .layer-arch {
  left: 50%; top: 48%;
  transform: translate(-50%, -50%);
  height: 92%;
  width: auto;
  max-width: 86%;
  object-fit: contain;
  filter: drop-shadow(0 14px 24px rgba(0,0,0,0.14));
  -webkit-mask-image: radial-gradient(ellipse 74% 78% at 50% 48%, #000 64%, transparent 100%);
  mask-image: radial-gradient(ellipse 74% 78% at 50% 48%, #000 64%, transparent 100%);
}
.stage.is-ox .layer-arch {
  height: 96%; max-width: 96%; top: 50%;
  -webkit-mask-image: none;
  mask-image: none;
}
.layer-pillar {
  bottom: 10%;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,0.2));
}
.layer-pillar.tall { height: 54%; }
.layer-pillar.short { height: 43%; }
.layer-pillar.L-out { left: 3.5%; }
.layer-pillar.L-in { left: 14%; }
.layer-pillar.R-in { right: 14%; left: auto; }
.layer-pillar.R-out { right: 3.5%; left: auto; }
.layer-flora {
  left: 50%;
  bottom: 9%;
  transform: translateX(-50%);
  width: 54%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,0.15));
}
.layer-flora.sides { width: 86%; bottom: 8%; z-index: 4; }
.layer-flora.mid { width: 48%; bottom: 9.5%; z-index: 5; }
.layer-flora.both { width: 86%; bottom: 8%; z-index: 5; }

/* Name tag on ceremony arch */
.name-tag {
  position: absolute;
  left: 50%;
  top: 26%;
  transform: translate(-50%, 0);
  width: 28%;
  z-index: 8;
  text-align: center;
  pointer-events: none;
}
.name-tag .wires {
  position: absolute; left: 0; right: 0; top: -42%;
  height: 46%;
}
.name-tag .wires span {
  position: absolute; top: 0; width: 1px; height: 100%;
  background: linear-gradient(to bottom, transparent, #C9A227 20%, #C9A227);
  opacity: 0.85;
}
.name-tag .wires span:first-child { left: 28%; }
.name-tag .wires span:last-child { right: 28%; }
.name-tag .plate {
  background: rgba(236, 228, 217, 0.94);
  border: 1px solid rgba(201, 162, 39, 0.7);
  border-radius: 3px;
  padding: 0.45em 0.5em 0.55em;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}
.name-tag .plate.black-ink { border-color: rgba(26,26,26,0.35); }
.name-tag .couple {
  font-size: clamp(16px, 2.1vw, 34px);
  line-height: 1.1;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.name-tag .plate.black-ink .couple { color: var(--ink); }
.name-tag.font-05 .couple {
  letter-spacing: 0.08em;
  font-weight: 400;
  text-transform: uppercase;
}

/* Backdrop stage */
.bd-stage { position: absolute; inset: 0; }
.bd-wall { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bd-board-wrap {
  position: absolute;
  left: 50%; top: 46%;
  transform: translate(-50%, -54%);
  width: 82%;
  height: 62%;
  display: flex; align-items: flex-end; justify-content: center;
  filter: drop-shadow(0 22px 28px rgba(0,0,0,0.22));
}
.bd-board-wrap.size-14 { width: 72%; }
.bd-board-wrap.entrance { width: 56%; height: 58%; }
.bd-board-photo {
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: center;
}
.bd-layered {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex; align-items: flex-end; justify-content: center;
}
.bd-layered .kit-centre,
.bd-layered .kit-wing,
.bd-layered .kit-extra {
  position: absolute;
  bottom: 8%;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.bd-layered .kit-centre {
  left: 50%;
  transform: translateX(-50%);
  width: 68%;
  height: 72%;
  z-index: 2;
}
.bd-layered .kit-wing.L { left: 2%; width: 22%; height: 82%; z-index: 3; }
.bd-layered .kit-wing.R { right: 2%; left: auto; width: 22%; height: 82%; z-index: 3; }
.bd-names {
  position: absolute;
  left: 50%; top: 22%;
  transform: translate(-50%, 0);
  width: 50%;
  text-align: center;
  z-index: 6;
  pointer-events: none;
}
.bd-names .couple {
  font-size: clamp(22px, 3.2vw, 54px);
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255,255,255,0.2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bd-names.black .couple { color: var(--ink); }
.bd-names.font-05 .couple { letter-spacing: 0.12em; text-transform: uppercase; }
.bd-preset-ref {
  position: absolute; right: 10px; bottom: 10px;
  width: 28%;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(201,162,39,0.5);
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  z-index: 9;
  background: #111;
}
.bd-preset-ref img { width: 100%; height: auto; }
.bd-preset-ref .cap {
  font-size: 10px; letter-spacing: 0.06em;
  padding: 4px 8px; color: var(--cream); background: rgba(0,0,0,0.65);
}

.caption {
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
  margin-top: 10px;
  font-size: 12px; color: var(--muted); line-height: 1.55;
}
.caption code { font-size: 11px; color: var(--ink-soft); }

/* Controls */
.controls-col {
  background: var(--paper);
  border: 1px solid var(--gold-soft);
  border-radius: 18px;
  box-shadow: var(--shadow);
  min-height: 200px;
  overflow: hidden;
}
.job-chipbar {
  display: flex; gap: 8px; padding: 12px 14px;
  border-bottom: 1px solid var(--gold-soft);
  background: var(--cream-light);
}
.job-chipbar button, .seg button, .tile, .swatch, .action {
  border: 1px solid var(--gold-soft);
  background: var(--cream-wash);
}
.chip, .job-chipbar button {
  border-radius: 999px; padding: 6px 12px; font-size: 12px; color: var(--ink-soft);
}
.job-chipbar button[aria-pressed="true"],
.seg button[aria-pressed="true"],
.tile[aria-pressed="true"],
.swatch[aria-pressed="true"] {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,162,39,0.25);
  background: #fff;
  color: var(--ink);
}
.section {
  border-bottom: 1px solid var(--gold-soft);
}
.section > button.sec-h {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 13px 16px;
  border: 0; background: transparent;
  font-family: var(--serif);
  font-size: 20px;
  text-align: left;
}
.section > button.sec-h .hint { font-family: var(--sans); font-size: 11px; color: var(--muted); font-weight: 400; }
.section .sec-body { padding: 0 16px 16px; display: none; }
.section.is-open .sec-body { display: block; }
.section.is-open > button.sec-h { color: var(--gold-dim); }
.label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 12px 0 8px;
}
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  border-radius: 999px; padding: 7px 12px; font-size: 13px;
}
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
}
.tile-grid.wide { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.tile {
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  text-align: left;
  display: flex; flex-direction: column;
  min-height: 0;
}
.tile img, .tile .ph {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--cream);
}
.tile .meta { padding: 7px 8px 9px; }
.tile .meta b { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.tile .meta span { display: block; font-size: 11px; color: var(--muted); }
.tile .price { color: var(--gold-dim); font-size: 11px; }
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.swatch {
  border-radius: 12px; padding: 4px 4px 8px; text-align: center;
}
.swatch img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px;
}
.swatch b { display: block; font-size: 10px; margin-top: 4px; font-weight: 600; }
.swatch span { display: block; font-size: 10px; color: var(--muted); line-height: 1.3; }
.field-row { display: flex; gap: 8px; align-items: center; }
.field-row input[type="text"] {
  flex: 1;
  border: 1px solid var(--gold-line);
  background: #fff;
  border-radius: 10px;
  padding: 9px 12px;
}
.note {
  font-size: 12px; color: var(--muted); line-height: 1.55; margin: 8px 0 0;
}
.note.warn { color: #7a3b16; }
.lock-banner {
  background: rgba(201,162,39,0.12);
  border: 1px solid var(--gold-line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 8px;
}

/* Summary dock */
.summary {
  position: sticky;
  bottom: 0; z-index: 35;
  background: rgba(26, 22, 18, 0.94);
  color: var(--cream);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--gold-line);
  padding: 10px 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}
.summary .codes { font-size: 12px; line-height: 1.5; color: rgba(236,228,217,0.85); }
.summary .codes strong { color: #fff; font-weight: 600; }
.summary .quote {
  text-align: right;
}
.summary .quote .amt {
  font-family: var(--serif);
  font-size: 28px;
  color: var(--gold);
  line-height: 1;
}
.summary .quote small { display: block; font-size: 11px; color: rgba(236,228,217,0.7); margin-top: 2px; }
.summary-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.action {
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  background: var(--gold);
  color: var(--ink);
  border-color: var(--gold);
}
.action.ghost {
  background: transparent;
  color: var(--cream);
  border-color: rgba(236,228,217,0.3);
}

/* Toast */
.toast {
  position: fixed; bottom: calc(var(--summary-h) + 16px); left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--cream);
  padding: 10px 16px; border-radius: 999px;
  font-size: 13px; opacity: 0; pointer-events: none;
  transition: 0.25s ease; z-index: 50;
  border: 1px solid var(--gold-line);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Hidden helpers */
.is-hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0,0,0,0);
}

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; padding-bottom: calc(var(--summary-h) + 80px); }
  .preview-col { position: relative; top: auto; }
  .q0-grid { grid-template-columns: 1fr; }
  .site-header { padding: 0 14px; }
  .brand img { height: 36px; }
  .summary { grid-template-columns: 1fr; text-align: left; }
  .summary .quote { text-align: left; }
  .summary-actions { justify-content: flex-start; flex-wrap: wrap; }
  .stage-viewport { aspect-ratio: 4 / 3; }
}
