/* ==========================================================================
   K-Construction Design Studio  —  brand system
   Monochrome / editorial:  Inter + IBM Plex Mono, ink on paper, black CTAs
   ========================================================================== */

:root {
  --ink:        #111111;
  --ink-soft:   #444444;
  --muted:      #8a8a8a;
  --paper:      #ffffff;
  --charcoal:   #17181a;
  --charcoal-2: #202225;
  --line:       #e6e6e6;
  --line-soft:  #f0f0f0;
  --fill:       #f7f7f6;
  --accent:     #b0561f;            /* warm rust — used sparingly for "quote" */
  --sel:        #111111;
  --shadow:     0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
  --header-h: 64px;
  --panel-w: 436px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

.eyebrow {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 10.5px;
  color: var(--muted);
}

/* ---------- App shell ---------------------------------------------------- */
.app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- Header ------------------------------------------------------- */
.header {
  height: var(--header-h);
  background: var(--charcoal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  flex: 0 0 auto;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img {
  height: 42px; width: auto; display: block;
  /* logo art is black on transparent → invert to white for dark header */
  filter: invert(1);
}
.brand .brand-txt { line-height: 1; }
.brand .brand-txt b {
  font-weight: 800; font-size: 15px; letter-spacing: .02em; display: block;
}
.brand .brand-txt span {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .22em;
  text-transform: uppercase; color: #b9bcc0;
}

.header-nav { display: flex; gap: 6px; }
.header-nav button {
  background: transparent; border: 0; color: #d7d9dc; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 14px; border-radius: 8px; transition: .15s;
}
.header-nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.header-nav button svg { width: 20px; height: 20px; }
.header-nav button span {
  font-family: var(--mono); font-size: 9px; letter-spacing: .1em;
  text-transform: uppercase; text-align: center; line-height: 1.25;
}

/* ---------- Sub-bar ------------------------------------------------------ */
.subbar {
  height: 34px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: flex-end;
  padding: 0 22px; border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.subbar a {
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  color: var(--ink); text-decoration: none; font-weight: 500;
  border-bottom: 1px solid var(--ink); padding-bottom: 1px;
}
.subbar a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Main split --------------------------------------------------- */
.main { display: flex; flex: 1 1 auto; min-height: 0; }

/* ---------- Viewer ------------------------------------------------------- */
.viewer { position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden; background: #cdd3d8; }
#scene { position: absolute; inset: 0; display: block; }

.viewer-tl {
  position: absolute; top: 16px; left: 16px; display: flex; gap: 10px; z-index: 10;
}
.ghost-btn {
  background: rgba(255,255,255,.92); border: 1px solid rgba(0,0,0,.12);
  color: var(--ink); cursor: pointer; border-radius: 8px;
  padding: 9px 14px; display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; font-weight: 500; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); transition: .15s;
}
.ghost-btn:hover { background:#fff; transform: translateY(-1px); }
.ghost-btn svg { width: 16px; height: 16px; }

.disclaimer {
  position: absolute; top: 68px; left: 50%; transform: translateX(-50%);
  text-align: center; color: var(--ink-soft); font-size: 11px; line-height: 1.5;
  z-index: 5; max-width: 320px; pointer-events: none;
  text-shadow: 0 1px 3px rgba(255,255,255,.85), 0 0 8px rgba(255,255,255,.7);
}

/* Background switcher */
.bg-switch {
  position: absolute; top: 16px; right: 16px; z-index: 10;
  display: flex; gap: 4px; background: rgba(255,255,255,.92);
  border: 1px solid rgba(0,0,0,.1); border-radius: 10px; padding: 4px;
  box-shadow: var(--shadow); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.bg-switch button {
  border: 0; background: transparent; cursor: pointer; border-radius: 7px;
  padding: 7px 12px; font-family: var(--mono); font-size: 10px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft);
  font-weight: 500; transition: .15s;
}
.bg-switch button.active { background: var(--ink); color: #fff; }

/* Bottom control bar */
.controls {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 2px; background: rgba(255,255,255,.94);
  border: 1px solid rgba(0,0,0,.1); border-radius: 12px; padding: 6px;
  box-shadow: var(--shadow); z-index: 10; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.controls button {
  border: 0; background: transparent; cursor: pointer; border-radius: 8px;
  width: 62px; padding: 6px 0; display: flex; flex-direction: column;
  align-items: center; gap: 3px; color: var(--ink-soft); transition: .12s;
}
.controls button:hover { background: var(--fill); color: var(--ink); }
.controls button:active { transform: scale(.94); }
.controls button svg { width: 20px; height: 20px; }
.controls button span {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: .12em;
  text-transform: uppercase;
}
.controls .divider { width: 1px; background: var(--line); margin: 4px 2px; }

/* building label */
.viewer-label {
  position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%);
  text-align: center; z-index: 5; pointer-events: none;
  text-shadow: 0 1px 3px rgba(255,255,255,.55);
}
.viewer-label .name { font-weight: 700; font-size: 15px; color: var(--ink); }
.viewer-label .dims { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

.viewer-watermark {
  position: absolute; bottom: 14px; left: 16px; z-index: 4;
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(0,0,0,.32); pointer-events: none;
}

/* ---------- Right panel -------------------------------------------------- */
.panel {
  width: var(--panel-w); flex: 0 0 var(--panel-w);
  border-left: 1px solid var(--line); background: var(--paper);
  display: flex; flex-direction: column; min-height: 0;
}
.panel-actions {
  flex: 0 0 auto; display: flex; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid var(--line); background: var(--paper);
}
.btn {
  flex: 1; cursor: pointer; border-radius: 9px; padding: 12px 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; font-weight: 600; transition: .15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn svg { width: 15px; height: 15px; }
.btn-outline { background: #fff; border: 1.5px solid var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--fill); }
.btn-solid { background: var(--ink); border: 1.5px solid var(--ink); color: #fff; }
.btn-solid:hover { background: #000; }

.panel-scroll { overflow-y: auto; flex: 1 1 auto; }
.panel-scroll::-webkit-scrollbar { width: 10px; }
.panel-scroll::-webkit-scrollbar-thumb { background: #d7d7d7; border-radius: 6px; border: 3px solid #fff; }

/* ---------- Accordion ---------------------------------------------------- */
.acc { border-bottom: 1px solid var(--line); }
.acc-head {
  width: 100%; text-align: left; background: var(--fill); border: 0; cursor: pointer;
  padding: 16px 18px; display: flex; align-items: center; justify-content: space-between;
  font-family: var(--sans); font-weight: 700; font-size: 14.5px; color: var(--ink);
  transition: background .15s;
}
.acc-head:hover { background: #f0f0ee; }
.acc.open .acc-head { background: var(--paper); }
.acc-head .chev { transition: transform .2s; color: var(--muted); }
.acc.open .acc-head .chev { transform: rotate(180deg); }
.acc-head .step-no { color: var(--muted); font-family: var(--mono); font-weight: 600; margin-right: 2px; }
.acc-body { display: none; padding: 4px 18px 22px; }
.acc.open .acc-body { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.acc-body p.help { color: var(--ink-soft); font-size: 12.5px; line-height: 1.55; margin: 6px 0 16px; }

.field-label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink); font-weight: 600; margin: 18px 0 10px; display: flex; align-items: center; gap: 6px;
}
.field-label .q {
  width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--muted);
  color: var(--muted); font-size: 9px; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--sans); cursor: help;
}

/* Style grid */
.style-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.style-card {
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer;
  padding: 8px 6px 9px; text-align: center; transition: .15s; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.style-card:hover { border-color: #c7c7c7; }
.style-card.active { border-color: var(--sel); box-shadow: inset 0 0 0 1px var(--sel); }
.style-card svg { width: 100%; height: 46px; }
.style-card span { font-size: 11px; line-height: 1.2; color: var(--ink); }

/* Radio / option rows */
.opt-list { display: flex; flex-direction: column; gap: 2px; }
.opt {
  display: flex; align-items: center; gap: 11px; padding: 9px 4px; cursor: pointer;
  border-radius: 8px; transition: background .12s;
}
.opt:hover { background: var(--fill); }
.opt .dot {
  width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #bbb; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; transition: .12s;
}
.opt.sel .dot { border-color: var(--ink); }
.opt.sel .dot::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); }
.opt span { font-size: 13.5px; }

/* Chip segmented */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; cursor: pointer; border-radius: 8px;
  padding: 8px 14px; font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--ink);
  transition: .12s;
}
.chip:hover { border-color: #c7c7c7; }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Select */
select.select {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 8px;
  font-family: var(--sans); font-size: 13.5px; color: var(--ink); background: #fff; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}

/* Stepper */
.stepper-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.stepper-row .lab { font-size: 13.5px; }
.stepper { display: flex; align-items: center; gap: 0; border: 1.5px solid var(--line); border-radius: 9px; overflow: hidden; }
.stepper button {
  width: 40px; height: 40px; border: 0; background: #fff; cursor: pointer; font-size: 20px; color: var(--ink);
  display: flex; align-items: center; justify-content: center; transition: background .12s;
}
.stepper button:hover { background: var(--fill); }
.stepper .val {
  min-width: 78px; text-align: center; font-family: var(--mono); font-size: 13px; font-weight: 600;
  border-left: 1.5px solid var(--line); border-right: 1.5px solid var(--line); height: 40px; line-height: 40px;
}

/* Color swatches */
.swatch-group { margin-bottom: 6px; }
.swatch-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.swatch {
  aspect-ratio: 1; border-radius: 8px; cursor: pointer; border: 1.5px solid rgba(0,0,0,.12);
  position: relative; transition: transform .1s;
}
.swatch:hover { transform: scale(1.08); }
.swatch.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.swatch-name { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); margin: 8px 0 4px; min-height: 14px; }

/* Details summary */
.summary { font-size: 13px; }
.summary .row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.summary .row .k { color: var(--ink-soft); font-family: var(--mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.summary .row .v { font-weight: 600; text-align: right; }
.summary .row.sub { border-bottom: 2px solid var(--line); margin-top: 14px; padding-bottom: 6px; }
.summary .row.sub .k { color: var(--ink); font-weight: 700; font-size: 12px; }
.summary .row.item { padding: 6px 0; border-bottom: 1px dashed var(--line-soft); }
.summary .row.item .v { font-weight: 500; text-align: left; color: var(--ink); }

/* Opening editor (step 5) */
.cat-label { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-soft); margin: 12px 0 6px; }
.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.add-btn { border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
  border-radius: 8px; padding: 9px 8px; font-size: 12px; text-align: left; line-height: 1.25; transition: .12s; }
.add-btn:hover { border-color: var(--ink); background: #faf7f2; transform: translateY(-1px); }
.wall-btn { display: block; width: 100%; margin-top: 10px; border: 1px solid var(--line); background: #fff;
  color: var(--ink); cursor: pointer; border-radius: 8px; padding: 10px; font-family: var(--mono);
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase; transition: .12s; }
.wall-btn:hover { border-color: var(--ink); background: #faf7f2; }
.wall-btn.danger { color: #a23; border-color: #e6c9c9; }
.wall-btn.danger:hover { background: #fdf2f2; border-color: #a23; }
.sel-editor { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #faf9f6; }
.sel-meta { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); margin: -4px 0 8px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 10px;
  font-size: 13px; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: .3s; z-index: 100; font-family: var(--mono); letter-spacing: .04em;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) {
  .main { flex-direction: column; }
  .panel { width: 100%; flex: 1 1 auto; border-left: 0; border-top: 1px solid var(--line); }
  .viewer { flex: 0 0 52vh; }
  .header-nav button span { display: none; }
}
