/* ---- CASCADE LAYER ------------------------------------------------------
 *
 * Everything the kit ships sits in ONE layer named `overscan`, so a consumer's
 * own CSS beats it without a specificity fight and without !important. That is
 * close to mandatory for a distributed kit: an app should be able to restyle a
 * panel by writing a plain rule.
 *
 * ⚠️ ONE layer, deliberately, NOT a sub-layer per file. Sub-layers look tidier
 * and would silently reorder the kit against itself: layer order beats
 * specificity, so a high-specificity rule in an early file that currently wins
 * would start losing to a low-specificity rule in a later one. A single layer
 * preserves source order exactly, so nothing inside the kit changes.
 *
 * Unlayered author CSS wins over all of it. That is the point.
 */

@layer overscan {
/* Compartments and flow paths, each lit by what it reported. */

ov-schematic {
  display: grid;
  gap: 6px;
  font-family: var(--ov-font-mono);
  font-size: var(--ov-size-1);
  letter-spacing: 1px;
  color: var(--ov-dim);
}

.ov-schematic__svg {
  display: block;
  inline-size: 100%;
  block-size: var(--ov-schematic-height, 300px);
  background: var(--ov-field);
  border: var(--ov-bezel) solid var(--ov-line-strong);
}

.ov-schematic__label, .ov-schematic__note, .ov-schematic__plabel, .ov-schematic__xx, .ov-schematic__void {
  font-family: var(--ov-font-mono);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.ov-schematic__label { font-size: 10px; fill: var(--ov-ink); }
.ov-schematic__note { font-size: 9px; fill: var(--ov-dim); }
.ov-schematic__plabel { font-size: 8px; fill: var(--ov-dim); }

/* Rooms. The fill is the state; a room with no report gets the hatch and no
 * fill at all, so it can never read as a quiet green. */
.ov-schematic__room rect { stroke: var(--ov-line-strong); stroke-width: 1; fill: transparent; }
.ov-schematic__room.is-ok rect { fill: color-mix(in srgb, var(--ov-accent) 14%, transparent); }
.ov-schematic__room.is-caution rect { fill: color-mix(in srgb, var(--ov-accent-2) 22%, transparent); }
.ov-schematic__room.is-alarm rect { fill: color-mix(in srgb, var(--ov-alarm) 30%, transparent); stroke: var(--ov-alarm); }
.ov-schematic__room.is-alarm .ov-schematic__note { fill: var(--ov-alarm); }
.ov-schematic__room.is-off rect { stroke-dasharray: 3 3; }
.ov-schematic__room.is-none rect { stroke: var(--ov-alarm); stroke-dasharray: 2 3; }
.ov-schematic__room.is-none .ov-schematic__note { fill: var(--ov-alarm); }
/* Strong enough to read as a mark, not as texture: this hatch IS the claim. */
.ov-schematic__hatch { stroke: color-mix(in srgb, var(--ov-alarm) 45%, transparent); stroke-width: 1.2; }

/* Stale: the last state, faded, with its age. A qualifier, not a refusal. */
.ov-schematic__room.is-stale rect, .ov-schematic__part.is-stale { opacity: 0.45; }
.ov-schematic__room.is-stale .ov-schematic__note { fill: var(--ov-alarm); }

/* Parts. */
.ov-schematic__part rect, .ov-schematic__part circle, .ov-schematic__part path {
  fill: var(--ov-field);
  stroke: var(--ov-accent);
  stroke-width: 1.4;
}
.ov-schematic__part.is-block rect, .ov-schematic__part.is-block circle, .ov-schematic__part.is-block path { stroke: var(--ov-dim); }
.ov-schematic__part.is-fault rect, .ov-schematic__part.is-fault circle, .ov-schematic__part.is-fault path { stroke: var(--ov-alarm); }
.ov-schematic__part .ov-schematic__glyph { fill: none; }
.ov-schematic__bar { stroke: var(--ov-ink); stroke-width: 2; }
.ov-schematic__xx { font-size: 11px; fill: var(--ov-alarm); }

/* Pipes: three claims, three looks. Flowing moves and carries arrows; dry is
 * a plain faint line; undetermined is broken and still, in the alarm colour,
 * because "we cannot say" must not look like either answer. */
.ov-schematic__pipe { fill: none; stroke-width: 2; }
.ov-schematic__pipe.is-flowing {
  stroke: var(--ov-accent);
  stroke-dasharray: 6 4;
  animation: ov-schematic-flow 0.9s linear infinite;
}
.ov-schematic__pipe.is-dry { stroke: var(--ov-line); }
.ov-schematic__pipe.is-undetermined { stroke: var(--ov-alarm); stroke-dasharray: 1 5; stroke-linecap: round; opacity: 0.8; }
.ov-schematic__arrow { fill: var(--ov-accent); }
@keyframes ov-schematic-flow { to { stroke-dashoffset: -10; } }
@media (prefers-reduced-motion: reduce) {
  /* Direction survives without motion: the arrows carry it. */
  .ov-schematic__pipe.is-flowing { animation: none; }
}

.ov-schematic__void { font-size: 11px; fill: var(--ov-alarm); }

.ov-schematic__readout { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.ov-schematic__readout .is-doubt { color: var(--ov-alarm); }
}
