/* Dwelling library — scoped entirely under .dwelling-library, which
 * library.js puts on its own host element. Nothing here may leak into the
 * layout tool, so every rule starts at that root and no bare element or
 * shared class (.pill, .input, .btn-*) is redefined; those come from
 * mck-chrome.css and are used as-is. */

.dwelling-library { display: block; }

/* ---- Intro and the honesty note ---------------------------------------- */

.dwelling-library .dl-intro h2 { font-size: 1.05rem; color: var(--moss-dark); margin: 0 0 4px; }
.dwelling-library .dl-lede { font-size: 0.85rem; color: var(--muted); margin: 0 0 12px; max-width: 78ch; }

/* Deliberately loud. A schematic plan next to a real dimension reads as an
 * architectural drawing unless something on the page says otherwise. */
.dwelling-library .dl-honesty {
  background: var(--sand-pale);
  border-left: 3px solid var(--moss);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 0.8rem;
  line-height: 1.5;
  max-width: 92ch;
}
.dwelling-library .dl-honesty p { margin: 0 0 6px; }
.dwelling-library .dl-honesty p:last-child { margin-bottom: 0; }
.dwelling-library .dl-basis-inline { vertical-align: baseline; }

/* ---- Controls ----------------------------------------------------------- */

.dwelling-library .dl-controls {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
  margin: 16px 0 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.dwelling-library .dl-filter { display: block; }
.dwelling-library .dl-filter .label { margin-bottom: 4px; }
.dwelling-library .dl-filter .input { width: auto; min-width: 150px; }
.dwelling-library .dl-count { margin-left: auto; font-size: 0.75rem; color: var(--muted); }

/* ---- Room key ----------------------------------------------------------- */

.dwelling-library .dl-legend {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  font-size: 0.72rem; color: var(--muted); margin-bottom: 16px;
}
.dwelling-library .dl-key { display: inline-flex; align-items: center; gap: 6px; }
.dwelling-library .dl-swatch {
  width: 12px; height: 10px; border: 1px solid #c9c4b8; border-radius: 2px; display: inline-block;
}
.dwelling-library .dl-swatch-party { width: 12px; height: 0; border: none; border-top: 3px solid var(--wood); }

/* ---- Grid and cards ----------------------------------------------------- */

.dwelling-library .dl-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px;
}
.dwelling-library .dl-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
}
.dwelling-library .dl-plan { background: #fbfaf7; border-bottom: 1px solid var(--border); padding: 8px; }
.dwelling-library .dl-svg { display: block; width: 100%; height: auto; }
.dwelling-library .dl-plan-missing { font-size: 0.75rem; color: var(--muted); padding: 24px 0; text-align: center; }
.dwelling-library .dl-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.dwelling-library .dl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dwelling-library .dl-code { margin: 0; font-size: 0.9rem; font-weight: 700; color: var(--moss-dark); }
.dwelling-library .dl-basis { cursor: help; white-space: nowrap; }
.dwelling-library .dl-tags { margin: 0; font-size: 0.75rem; color: var(--muted); }

.dwelling-library .dl-kv { margin: 0; display: grid; gap: 3px; }
.dwelling-library .dl-kv > div { display: flex; gap: 8px; font-size: 0.78rem; }
.dwelling-library .dl-kv dt { color: var(--muted); flex: 0 0 108px; }
.dwelling-library .dl-kv dd { margin: 0; font-weight: 600; }
.dwelling-library .dl-sub { font-weight: 400; color: var(--muted); }

.dwelling-library .dl-seen { margin: 0; font-size: 0.72rem; color: var(--muted); line-height: 1.45; }
.dwelling-library .dl-seen-label {
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; font-size: 0.64rem;
  display: block; margin-bottom: 1px;
}
.dwelling-library .dl-seen-none { font-style: italic; }

.dwelling-library .dl-empty,
.dwelling-library .dl-status { font-size: 0.85rem; color: var(--muted); padding: 30px 0; }
.dwelling-library .dl-error { color: var(--status-red); }

/* ---- The schematic plan -------------------------------------------------
 * The SVG viewBox is in metres, so every stroke uses non-scaling-stroke and a
 * pixel width: a 6.9 m one-bedder and a 44 m two-level duplex pair otherwise
 * draw their walls at wildly different apparent weights. */

.dwelling-library .dl-svg text {
  text-anchor: middle;
  font-family: inherit;
  font-weight: 600;
  fill: var(--wood);
}
.dwelling-library .dl-svg rect,
.dwelling-library .dl-svg line { vector-effect: non-scaling-stroke; }

.dwelling-library .dl-el-floor-base { fill: #fff; }
.dwelling-library .dl-el-room { stroke: #c9c4b8; stroke-width: 1; }
.dwelling-library .dl-el-floor-outline { fill: none; stroke: var(--wood); stroke-width: 1.6; }
.dwelling-library .dl-el-party-wall { stroke: var(--wood); stroke-width: 3.5; }
.dwelling-library .dl-el-scale-bar,
.dwelling-library .dl-el-scale-tick { stroke: var(--muted); stroke-width: 1; }

.dwelling-library .dl-el-room-label { fill: #6b665f; font-weight: 500; }
.dwelling-library .dl-el-floor-label { fill: var(--muted); font-weight: 700; }
.dwelling-library .dl-el-dim-label { fill: var(--wood); }
.dwelling-library .dl-el-scale-label { fill: var(--muted); font-weight: 400; }

/* Room fills: brand tints only. These read as diagram categories, not status,
 * so the red/amber/blue status layer is deliberately not used here. */
.dwelling-library .dl-kind-living      { fill: #e2ebdc; background: #e2ebdc; }
.dwelling-library .dl-kind-kitchen     { fill: #e9e4d6; background: #e9e4d6; }
.dwelling-library .dl-kind-dining      { fill: var(--sand-pale); background: var(--sand-pale); }
.dwelling-library .dl-kind-bed         { fill: var(--water-pale); background: var(--water-pale); }
.dwelling-library .dl-kind-bath        { fill: #dbe7e9; background: #dbe7e9; }
.dwelling-library .dl-kind-service     { fill: #efece6; background: #efece6; }
.dwelling-library .dl-kind-circulation { fill: #fbfaf7; background: #fbfaf7; }

@media (max-width: 560px) {
  .dwelling-library .dl-grid { grid-template-columns: 1fr; }
  .dwelling-library .dl-count { margin-left: 0; }
}
