/* The context address bar and the Spatial Spine screen.
 *
 * Kept in its own stylesheet because it is the one surface that is not the handoff's layout: the
 * handoff has no spatial screen, so nothing here has a token to inherit from except the palette.
 */

/* ============================================================== the context address
 * Fixed at the bottom, OUTSIDE #smooth-wrapper, mirroring #depth's geometry.
 *
 * It is deliberately NOT a second sticky band at the top. `.hero` already owns that slot and its
 * compression is scrubbed against a tuned start:0 end:150, so a band above it would compress at
 * the wrong scroll offset. `.mast` is not sticky at all, so mounting it there would have meant
 * "never unmounts" without meaning "always visible". The competitor idiom (XYZ Platform) also
 * runs its persistent context strip along the bottom.
 */
#address {
  position: fixed; inset-inline: var(--rail-w) 0; bottom: 0; z-index: 48;
  pointer-events: none;
}
#address .abar {
  pointer-events: auto;
  display: flex; align-items: center; gap: 6px;
  padding: 8px calc(var(--pad) + 4px);
  background: var(--canvas);
  border-top: 1px solid var(--hairline);
  box-shadow: 0 -2px 14px oklch(0.227 0.004 286 / .05);
}
#address .aicon svg {
  width: 16px; height: 16px; display: block;
  fill: none; stroke: var(--stone-text); stroke-width: 1.7;
}
#address .aseg {
  display: flex; align-items: baseline; gap: 7px;
  padding: 5px 11px; border-radius: var(--r-pill);
  border: 1px solid var(--hairline); background: var(--canvas);
  font: inherit; cursor: default;
}
#address .aseg.act { cursor: pointer; }
#address .aseg.act:hover { border-color: var(--ink); }
#address .aseg.on { border-color: var(--ink); }
#address .ak {
  font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--stone-text);
}
#address .av { font-size: 13px; font-weight: 600; color: var(--ink); unicode-bidi: isolate; }
#address .asep { color: var(--stone-text); font-style: normal; display: inline-block; }
/* the chevron points INTO the narrowing, so it has to turn around in RTL */
:dir(rtl) #address .asep { transform: scaleX(-1); }
#address .agrow { flex: 1; }
#address .awbs {
  font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--stone-text);
}
/* the bar is fixed, so the scroll column has to end above it */
/* only the screens that actually show the bar pay for it */
body:has(#address .abar) #smooth-content { padding-bottom: 76px; }

/* ===================================================================== spine */
.spine > .panel, .spine .roompan { padding: 16px 18px; }
.spine {
  display: grid; grid-template-columns: 272px minmax(0, 1fr) 300px;
  gap: var(--pad); align-items: start;
}
@media (max-width: 1180px) { .spine { grid-template-columns: 1fr; } }
.spine .ph { font-size: 13px; font-weight: 700; letter-spacing: .02em; margin: 0 0 10px; }
.spine .hint { font-size: 11.5px; color: var(--stone-text); margin: 12px 0 0; line-height: 1.45; }
.spine .foot { font-size: 11.5px; color: var(--stone-text); margin: 12px 0 0; line-height: 1.5; }

/* ---- hero band ---- */
.sband { display: flex; gap: 10px; flex-wrap: wrap; }
.sfig {
  flex: 1 1 170px; background: var(--card); border: 1px solid var(--hairline);
  border-radius: var(--r-md); padding: 14px 16px;
}
.sfig .sv {
  font-size: 26px; font-weight: 700; color: var(--ink); line-height: 1.1;
  unicode-bidi: isolate; direction: ltr;
}
.sfig .sk { font-size: 12.5px; font-weight: 600; color: var(--ink); margin-top: 3px; }
.sfig .ss { font-size: 11.5px; color: var(--stone-text); margin-top: 2px; }
.sclaim {
  font-size: 12.5px; color: var(--slate); line-height: 1.55; margin: 12px 0 0; max-width: 78ch;
}

/* ---- the stack: storeys by elevation, T levels as sub-bands of their own slab ---- */
.stack { display: flex; flex-direction: column; gap: 3px; }
.band {
  display: grid; grid-template-columns: 30px 42px minmax(0, 1fr) auto; align-items: center; gap: 7px;
  padding: 7px 8px; border: 1px solid transparent; border-radius: var(--r-sm);
  background: none; font: inherit; cursor: pointer; text-align: start;
}
.band:hover { background: var(--surface); }
.band.sel { border-color: var(--ink); background: var(--surface); }
.band.tier-sub { margin-inline-start: 16px; padding-block: 4px; }
.band.tier-sub .blab { font-size: 11px; }
.band .blab { font-size: 12.5px; font-weight: 700; color: var(--ink); unicode-bidi: isolate; }
.band .belev {
  font-size: 11px; color: var(--stone-text); unicode-bidi: isolate; direction: ltr;
  font-variant-numeric: tabular-nums;
}
.band .bnum {
  font-size: 11px; color: var(--stone-text); unicode-bidi: isolate; white-space: nowrap;
}
.band.empty .bnum { font-style: italic; }
.sbar {
  display: flex; height: 7px; min-width: 0; border-radius: var(--r-pill);
  overflow: hidden; background: var(--hairline);
}
.sbar i { display: block; height: 100%; }
.sbar.none i { width: 100%; background: var(--hairline-soft); }

/* ---- the plate ----
 * Rooms are DIVS clipped to their real IfcSpace outline, never SVG paths: audit() resolves a
 * foreground against getComputedStyle().backgroundColor walked up the tree, and an SVG fill is
 * invisible to it, so a label on a dark tint would be audited against the panel behind it and
 * would pass while being unreadable.
 */
.plate {
  position: relative; width: 100%; background: var(--surface);
  border: 1px solid var(--hairline); border-radius: var(--r-sm); overflow: hidden;
}
.room {
  position: absolute; border: 0; padding: 0; margin: 0; font: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  outline: none; transition: filter .12s ease;
}
.room:hover { filter: brightness(.95); }
.room.sel { filter: none; box-shadow: inset 0 0 0 2px var(--ink); z-index: 2; }
.room:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.rlab {
  font-size: 11px; font-weight: 600; color: var(--ink); line-height: 1.1;
  padding: 0 3px; text-align: center; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; max-width: 100%; unicode-bidi: isolate; direction: ltr;
}

/* 🔴 IGNORANCE IS THE INK.
 * Drawn the obvious way round -- colour where we found something, white where we did not -- the
 * plan says exactly what every competitor's plan says, and a client reads the blanks as "not built"
 * because that is how every plan they have ever seen works. So it is inverted: the two states that
 * mean WE DID NOT LOOK are the heaviest marks on the plate, and verified work recedes to a pale
 * wash. The result is a building-shaped picture of what we do not know.
 *
 * Each state sets background-color explicitly as well as any gradient: audit() reads
 * backgroundColor, and a background-image alone computes as transparent, which would walk the
 * contrast check straight past the tint to the panel behind it.
 */
.is-verified { background-color: oklch(0.967 0.021 182); }
.is-mixed    { background-color: oklch(0.969 0.026 78); }
.is-poor     { background-color: oklch(0.957 0.032 24); }
/* never assessed: the densest mark on the plan */
.is-unseen {
  background-color: oklch(0.469 0.027 272);
  background-image: repeating-linear-gradient(45deg,
    oklch(0.227 0.004 286) 0 5px, oklch(0.469 0.027 272) 5px 10px);
}
/* looked at, and still cannot tell: a texture, not the deviation hue */
.is-unclear {
  background-color: oklch(0.800 0.012 275);
  background-image: repeating-linear-gradient(-45deg,
    oklch(0.800 0.012 275) 0 4px, oklch(0.700 0.016 275) 4px 8px);
}
/* no record at all: solid, mid-weight, unmistakably filled */
.is-none { background-color: oklch(0.741 0.018 275); }

.room.is-unseen .rlab { color: var(--on-nav-strong); }
.room.is-verified, .room.is-mixed, .room.is-poor {
  box-shadow: inset 0 0 0 1px oklch(0.227 0.004 286 / .10);
}
.room.is-none, .room.is-unseen, .room.is-unclear { box-shadow: inset 0 0 0 1px oklch(1 0 0 / .35); }

/* ---- legend, which is also the record count per state ---- */
.evlegend { display: flex; flex-wrap: wrap; gap: 7px 16px; margin-top: 14px; }
.evkey { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px;
  color: var(--slate); white-space: nowrap; flex: 0 0 auto; }
.evkey b { font-weight: 600; color: var(--ink); }
.evkey em { font-style: normal; color: var(--stone-text); font-variant-numeric: tabular-nums; }
.sw {
  width: 11px; height: 11px; border-radius: 3px; display: inline-block; flex: none;
  box-shadow: inset 0 0 0 1px oklch(0.227 0.004 286 / .14);
}

.platehead { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.platehead .ph { margin: 0; }
.metricsw {
  margin-inline-start: auto; display: flex; gap: 2px;
  background: var(--surface); border-radius: var(--r-pill); padding: 2px;
}
.metricsw button {
  font: inherit; font-size: 12px; font-weight: 600; border: 0; cursor: pointer;
  padding: 5px 12px; border-radius: var(--r-pill); background: none; color: var(--stone-text);
}
.metricsw button.on { background: var(--ink); color: var(--on-nav-strong); }

/* ---- the room panel ---- */
.roompan header { margin-bottom: 12px; }
.roompan h2 { font-size: 15px; margin: 0; color: var(--ink); unicode-bidi: isolate; }
.roompan .rmeta {
  font-size: 11.5px; color: var(--stone-text); margin: 3px 0 0;
  unicode-bidi: isolate; direction: ltr;
}
.evrows { display: flex; flex-direction: column; gap: 7px; }
.evrow {
  display: grid; grid-template-columns: 11px 1fr auto; align-items: center; gap: 8px;
  font-size: 12px; color: var(--slate);
}
.evrow b { color: var(--ink); font-variant-numeric: tabular-nums; }
.evrow .evtrack {
  grid-column: 2 / -1; height: 4px; background: var(--bar-track);
  border-radius: var(--r-pill); overflow: hidden;
}
.evrow .evtrack i { display: block; height: 100%; background: var(--stone-text); }
.rseen { font-size: 11.5px; color: var(--stone-text); margin: 12px 0 0;
  unicode-bidi: isolate; direction: ltr; }
.noev { font-size: 12.5px; color: var(--slate); line-height: 1.55; margin: 0; }
.syschips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.syschips .chip {
  font: inherit; font-size: 11px; cursor: pointer; border: 1px solid var(--hairline);
  background: var(--canvas); color: var(--slate); border-radius: var(--r-pill); padding: 3px 9px;
}
.syschips .chip.on { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.syschips .chip em { font-style: normal; color: var(--stone-text); margin-inline-start: 3px; }
.muted { font-size: 12.5px; color: var(--stone-text); }

.platecount { margin-inline-start: auto; font-size: 11.5px; color: var(--stone-text); }
