/* wgf-house-builder - Housing Planner chrome (spec M4, in-game recut wave 2).
 * Rides the chrome kit window; only planner-specific layout lives here. Kit
 * components consumed (one home each, never forked): .wgf-window, .wgf-btn-red,
 * .wgf-btn-dark, .wgf-input--search, .wgf-actionbar/.wgf-slot, .wgf-keycap/
 * .wgf-keylegend, .wgf-tip--overlay, .wgf-plate-row__icon, .wgf-rowstripe,
 * .wgf-scroll. Also linked by the /housing/ hub for the CTA. */

/* Hub CTA (consumed by housing_app.py). Squared per the container law; the full
   swap to .wgf-btn-red is the hub lane's brick - these rules retire with it. */
.wgf-hb-cta-row { margin: 14px 0 0; }
.wgf-hb-cta {
  display: inline-block;
  border: 1px solid #f0c744;
  border-radius: 0;
  background: linear-gradient(#2a2213, #1d1913);
  color: #f0c744;
  padding: 9px 18px;
  font-weight: 600;
  text-decoration: none;
}
.wgf-hb-cta:hover { background: linear-gradient(#3a2f18, #241e14); color: #ffe08a; }
.wgf-hb-cta-sub { margin-left: 10px; color: #a99e86; font-size: .85rem; }

.wgf-hb__body { padding: 0; }

/* The window title carries the page h1 (no web hero - the window IS the identity). */
.wgf-hb-title {
  margin: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

/* Count chip on the title plate (ig-58 top-right count). Empty span collapses. */
.wgf-hb-count {
  margin-left: 10px;
  font-family: var(--font-game);
  font-size: .72rem;
  font-weight: 600;
  font-variant: normal;
  color: var(--wgf-gold-bright, #ffd978);
}
.wgf-hb-count:not(:empty) {
  padding: 2px 8px;
  border: 1px solid var(--wgf-metal-soft, #2e2e2e);
  background: rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* Top toolbar strip: kit buttons on a dark plate seam. */
.wgf-hb-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid #3a332a;
  background: #16120d;
}
.wgf-hb-import { cursor: pointer; }
.wgf-hb-import input { display: none; }

/* Status strip: the interface voice - gold Friz small-caps, not grey web text. */
.wgf-hb-status {
  margin-left: auto;
  color: var(--wgf-gold, #f0c744);
  font-family: var(--font-game);
  font-size: .82rem;
  font-variant: small-caps;
  letter-spacing: 0.03em;
  text-shadow: var(--text-ink-outline, 1px 1px 2px rgba(0, 0, 0, 0.9));
}

/* ---------------------------------------------------------------- the stage */
/* Desktop composition contract (fix wave 5): the stage row height is driven by
   the VIEWPORT, never by catalog content, so on load at 1080p the floor grid,
   the Tip empty state and the ig-60 action bar all sit above the fold. The
   380px budget covers the fixed chrome around the row: site nav + breadcrumb +
   window title plate + planner toolbar above, footer note + window rim below.
   The catalog column scrolls inside itself (.wgf-hb-list is the overflow home).
   Canvas sizing contract stays intact: stagewrap positions, #wgf-hb-stage is
   absolute inset 0, and the JS resize() reads the resolved clientWidth/Height. */
.wgf-hb-main {
  display: flex;
  height: clamp(420px, calc(100vh - 380px), 820px);
}
.wgf-hb-stagewrap { position: relative; flex: 1 1 auto; min-width: 0; }
#wgf-hb-stage { position: absolute; inset: 0; }
#wgf-hb-stage canvas { display: block; width: 100%; height: 100%; }

/* The stage sits in a framed plate: metal corner braces + inset rim painted
   ABOVE the canvas (the .wgf-window corner recipe on a pseudo layer). */
.wgf-hb-stagewrap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    url(/assets/ui/ui-frame-metal-cornertopleft-2x.png) top left / 40px auto no-repeat,
    url(/assets/ui/ui-frame-metal-cornertopright-2x.png) top right / 40px auto no-repeat,
    url(/assets/ui/ui-frame-metal-cornerbottomleft-2x.png) bottom left / 26px auto no-repeat,
    url(/assets/ui/ui-frame-metal-cornerbottomright-2x.png) bottom right / 26px auto no-repeat;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.65),
    inset 0 2px 8px rgba(0, 0, 0, 0.55);
}

/* Empty-state Tip overlay (kit .wgf-tip--overlay): above canvas, below controls. */
#wgf-hb-tip { z-index: 2; padding: 0 56px; }

/* Pointer-gated Tip wording: mouse copy (click, W A S D) only where a hovering
   fine pointer exists; touch-primary devices read touch verbs instead. */
.wgf-hb-tip__touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .wgf-hb-tip__mouse { display: none; }
  .wgf-hb-tip__touch { display: inline; }
  /* Walk mode needs a keyboard; touch keeps the drone camera (honest absence,
     and the 5-slot bar keeps fitting 390px phones). The JS toggle is gated the
     same way, so the slot and the feature disappear together. */
  .wgf-hb-editorbar [data-hb-tool="walk"] { display: none; }
}

/* ---------------------------------------------------- ig-60 editor action bar */
.wgf-hb-editorbar {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 3;
}
.wgf-hb-editorbar .wgf-slot__icon { color: var(--wgf-gold-bright, #ffd978); }

/* ------------------------------------------------------ ig-59 keybind legend */
.wgf-hb-legend {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 3;
  max-width: 300px;
  pointer-events: none;              /* the floating card never eats camera drags */
}
.wgf-hb-legend summary {
  pointer-events: auto;
  cursor: pointer;
  list-style: none;
  display: inline-block;
  float: right;
  padding: 3px 10px;
  border: 1px solid var(--wgf-metal-soft, #2e2e2e);
  background: rgba(0, 0, 0, 0.55);
  color: var(--wgf-gold, #f0c744);
  font-family: var(--font-game);
  font-size: .78rem;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  text-shadow: var(--text-ink-outline, 1px 1px 2px rgba(0, 0, 0, 0.9));
}
.wgf-hb-legend summary::-webkit-details-marker { display: none; }
.wgf-hb-legend[open] summary { margin-bottom: 8px; }
.wgf-hb-legend > .wgf-keylegend {
  clear: both;
  row-gap: 10px;
  padding: 10px 4px;
}
.wgf-hb-keys { display: inline-flex; gap: 4px; }
.wgf-hb-mouseglyph { width: 15px; height: 17px; display: block; }

/* ---------------------------------------------------------------- the catalog */
.wgf-hb-catalog {
  flex: 0 0 264px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #3a332a;
  background: #131009;
}
.wgf-hb-searchwrap { margin: 10px; }
.wgf-hb-list { overflow-y: auto; flex: 1 1 auto; padding: 0 8px 10px; }

/* Decor rows: slate list rows with the kit's honest empty icon-slot plate
   (catalog ships no icon field yet - the data brick lives in model_bake). */
.wgf-hb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 0;
  background: none;
  color: #e8ddc7;
  padding: 5px 6px;
  font: inherit;
  font-size: .85rem;
}
.wgf-hb-item__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wgf-hb-item:hover { border-color: #4a4133; background: rgba(240, 199, 68, 0.06); }
.wgf-hb-item.is-armed {
  border-color: #f0c744;
  color: #f0c744;
  background: rgba(240, 199, 68, 0.1);
}
.wgf-hb-empty { color: #7d7460; font-size: .85rem; padding: 8px; }

/* Catalog group headers (House Shell / Structure / Decor): gold small-caps
   strips in the interface voice, same register as the legend summary. */
.wgf-hb-group {
  margin: 8px 0 2px;
  padding: 3px 6px;
  border-bottom: 1px solid #3a332a;
  color: var(--wgf-gold, #f0c744);
  font-family: var(--font-game);
  font-size: .75rem;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  text-shadow: var(--text-ink-outline, 1px 1px 2px rgba(0, 0, 0, 0.9));
}
/* The active house shell row (one shell at a time; click again removes). */
.wgf-hb-item.is-active {
  border-color: #f0c744;
  color: #f0c744;
  background: rgba(240, 199, 68, 0.1);
}

/* ------------------------------------------------------- rooms/layout panel */
/* Blizzard's own "Rooms" vocabulary as a side plate at the top of the sidebar.
   Honest state: the one open plot row, a DISABLED Add Room and the Tip saying
   why (room layout data is not in the datamined build). Collapses on phones
   exactly like the ig-59 legend (wgf-hb-rooms.js drops [open] under 860px). */
.wgf-hb-rooms {
  flex: 0 0 auto;
  border-bottom: 1px solid #3a332a;
  background: #16120d;
  padding: 8px 10px;
}
.wgf-hb-rooms summary {
  cursor: pointer;
  list-style: none;
  color: var(--wgf-gold, #f0c744);
  font-family: var(--font-game);
  font-size: .8rem;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  text-shadow: var(--text-ink-outline, 1px 1px 2px rgba(0, 0, 0, 0.9));
}
.wgf-hb-rooms summary::-webkit-details-marker { display: none; }
.wgf-hb-rooms[open] summary { margin-bottom: 6px; }
.wgf-hb-room-list { list-style: none; margin: 0 0 8px; padding: 0; }
.wgf-hb-room {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 0;
  padding: 3px 4px;
  color: #e8ddc7;
  font-size: .85rem;
}
.wgf-hb-room.is-active { border-color: #f0c744; background: rgba(240, 199, 68, 0.08); }
.wgf-hb-room > .wgf-hb-room__name { flex: 1 1 auto; }     /* SSR row, pre-hydration */
.wgf-hb-room__pick {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 2px;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
}
.wgf-hb-room__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wgf-hb-room.is-active .wgf-hb-room__name { color: #f0c744; }
.wgf-hb-room__meta { flex: 0 0 auto; color: #7d7460; font-size: .72rem; }
.wgf-hb-room__btn {
  flex: 0 0 auto;
  border: 1px solid var(--wgf-metal-soft, #2e2e2e);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #cfc4a9;
  font: inherit;
  font-size: .72rem;
  padding: 2px 7px;
  cursor: pointer;
}
.wgf-hb-room__btn:hover { border-color: #4a4133; color: #ffe08a; }
.wgf-hb-room__rename {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #f0c744;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #f0c744;
  font: inherit;
  font-size: .85rem;
  padding: 1px 4px;
}
.wgf-hb-room-add[disabled] { opacity: 0.55; cursor: not-allowed; }
.wgf-hb-rooms__tip {
  margin: 6px 0 0;
  color: #7d7460;
  font-size: .75rem;
  line-height: 1.45;
}

/* Footer note as a muted Friz strip on the plate (no floating web paragraph). */
.wgf-hb-note {
  margin: 0;
  padding: 8px 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.6);
  background: rgba(0, 0, 0, 0.3);
  color: #a99e86;
  font-family: var(--font-game);
  font-size: .78rem;
  line-height: 1.5;
}

/* ---------------------------------------------------------------- small screens */
@media (max-width: 860px) {
  /* Phones keep the proven stacked composition: content-driven heights again. */
  .wgf-hb-main { flex-direction: column; height: auto; }
  .wgf-hb-stagewrap { min-height: 52vh; }
  .wgf-hb-catalog { flex: 0 0 auto; border-left: 0; border-top: 1px solid #3a332a; max-height: 34vh; }
  .wgf-hb-editorbar { bottom: 8px; }
  .wgf-hb-legend { max-width: 230px; }
  #wgf-hb-tip { padding: 0 16px; }
}
@media (max-width: 420px) {
  /* 390px phones: the 5-slot bar (~360px with caps) still fits; drop the gap air. */
  .wgf-hb-editorbar .wgf-actionbar { gap: 2px; }
  .wgf-hb-toolbar { padding: 8px; gap: 6px; }
  .wgf-hb-status { flex-basis: 100%; margin-left: 0; }
}
