/* Weft. Palette inherited from wyrdin.net so this drops into the site whole.
   Amber is the wyrd showing through; green is the machine speaking — a number
   you can check, a source you can follow. Red is only ever used for a negative
   causal polarity, never for chrome. */
:root {
  --bg: #0b0e0c;
  --panel: #10140f;
  --panel-deep: #0d100d;
  --fg: #c8d6c0;
  --dim: #6b7a63;
  --green: #4ade80;
  --amber: #c9a45c;
  --border: #223024;
  --red: #e01b24;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--fg);
  font: 14px/1.5 var(--mono);
  overflow: hidden;
}

a { color: var(--amber); }
a:hover { color: var(--green); }

.app { display: grid; grid-template-columns: 310px 1fr; height: 100vh; }

/* ---- sidebar ---- */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px 16px 40px;
}
.brand { margin: 0 0 2px; font-size: 20px; letter-spacing: .18em; color: var(--amber); }
.brand-sub { margin: 0 0 16px; color: var(--dim); font-size: 11px; line-height: 1.45; }

.views { display: flex; gap: 6px; margin-bottom: 18px; }
.views button {
  flex: 1; padding: 7px 6px; cursor: pointer;
  background: var(--panel-deep); color: var(--dim);
  border: 1px solid var(--border); border-radius: 2px;
  font: inherit; font-size: 12px;
}
.views button[aria-pressed="true"] { color: var(--bg); background: var(--amber); border-color: var(--amber); }
.views button:hover:not([aria-pressed="true"]) { color: var(--fg); }

.sidebar h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .13em;
  color: var(--dim); margin: 20px 0 8px; font-weight: normal;
  border-bottom: 1px solid var(--border); padding-bottom: 5px;
}

.layer { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; cursor: pointer; }
.layer input { margin: 3px 0 0; accent-color: var(--amber); }
.layer .swatch { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; }
.layer .body { flex: 1; min-width: 0; }
.layer .name { display: block; }
.layer .meta { display: block; color: var(--dim); font-size: 11px; }
.layer .meta.stale { color: var(--red); }

select, input[type=range] { width: 100%; font: inherit; }
select {
  background: var(--panel-deep); color: var(--fg);
  border: 1px solid var(--border); border-radius: 2px; padding: 5px;
}
input[type=range] { accent-color: var(--amber); margin: 8px 0 0; }
.scrub-value { color: var(--amber); float: right; }

.loop { padding: 7px 8px; margin-bottom: 5px; cursor: pointer; border-radius: 2px;
        border: 1px solid var(--border); background: var(--panel-deep); font-size: 11px; }
.loop:hover, .loop.on { border-color: var(--amber); }
.loop .tag { font-weight: bold; margin-right: 6px; }
.loop .tag.R { color: var(--amber); }
.loop .tag.B { color: var(--green); }
.loop .path { color: var(--dim); line-height: 1.45; display: block; margin-top: 3px; }
.loop .warn { color: var(--red); }

.note { color: var(--dim); font-size: 11px; line-height: 1.5; margin: 10px 0 0; }

/* ---- stage ---- */
.stage { position: relative; overflow: hidden; }
.pane { position: absolute; inset: 0; }
/* deck.gl sizes its drawing buffer from the canvas's laid-out box, so the
   canvas has to be told to fill the pane or it sits at the 300x150 intrinsic
   default and draws nothing anyone can see. */
.pane canvas { display: block; width: 100%; height: 100%; }
.pane[hidden] { display: none; }

.readout {
  position: absolute; left: 14px; bottom: 12px; max-width: 460px;
  background: rgba(13,16,13,.94); border: 1px solid var(--border);
  border-radius: 2px; padding: 9px 11px; font-size: 11px; line-height: 1.55;
  pointer-events: none;
}
.readout .k { color: var(--dim); }
.readout .prov { color: var(--dim); margin-top: 5px; padding-top: 5px;
                 border-top: 1px solid var(--border); }
.readout .lic { color: var(--green); }
.readout:empty { display: none; }

.legend {
  position: absolute; right: 14px; bottom: 12px;
  background: rgba(13,16,13,.94); border: 1px solid var(--border);
  border-radius: 2px; padding: 9px 11px; font-size: 11px; line-height: 1.7;
}
.legend .row { display: flex; align-items: center; gap: 7px; }
.legend .bar { width: 13px; height: 3px; }
.legend .dot { width: 9px; height: 9px; border-radius: 50%; }
.legend h3 { margin: 0 0 5px; font-size: 10px; letter-spacing: .12em;
             text-transform: uppercase; color: var(--dim); font-weight: normal; }

.loading { position: absolute; inset: 0; display: grid; place-items: center;
           color: var(--dim); font-size: 12px; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 260px 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
}

/* ---- algebra ---- */
.scrollpane { overflow-y: auto; padding: 22px 26px 40px; }

.field { display: block; margin-bottom: 8px; }
.field span { display: block; color: var(--dim); font-size: 11px; margin-bottom: 3px; }

button.ghost {
  background: var(--panel-deep); color: var(--dim); font: inherit; font-size: 11px;
  border: 1px solid var(--border); border-radius: 2px; padding: 4px 9px;
  cursor: pointer; margin: 6px 5px 0 0;
}
button.ghost:hover { color: var(--fg); border-color: var(--amber); }

.cond { display: grid; grid-template-columns: 1fr auto; gap: 5px; align-items: center;
        margin-bottom: 7px; padding: 7px; border: 1px solid var(--border);
        border-radius: 2px; background: var(--panel-deep); }
.cond select { font-size: 11px; padding: 3px; }
.cond .row2 { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; }
.cond .row2 input[type=range] { flex: 1; }
.cond .pct { color: var(--amber); font-size: 11px; min-width: 34px; text-align: right; }
.cond .drop { background: none; border: 0; color: var(--red); cursor: pointer;
              font: inherit; padding: 0 4px; }

.alg-h { margin: 0 0 4px; font-size: 15px; color: var(--fg); font-weight: normal; }
.alg-sub { margin: 0 0 20px; color: var(--dim); font-size: 12px; line-height: 1.6; max-width: 62ch; }
.alg-block { margin-bottom: 28px; }
.alg-block h3 { font-size: 11px; letter-spacing: .13em; text-transform: uppercase;
                color: var(--dim); font-weight: normal; margin: 0 0 10px;
                border-bottom: 1px solid var(--border); padding-bottom: 5px; }
.alg-warn { border-left: 2px solid var(--red); padding: 8px 12px; margin-bottom: 18px;
            background: var(--panel); color: var(--fg); font-size: 12px; line-height: 1.6;
            max-width: 70ch; }
.alg-note { color: var(--dim); font-size: 11px; line-height: 1.6; margin-top: 9px; max-width: 70ch; }
.alg-stat { color: var(--amber); }

.verdict { padding: 8px 10px; margin-bottom: 6px; border: 1px solid var(--border);
           border-radius: 2px; background: var(--panel-deep); font-size: 11px; line-height: 1.5; }
.verdict .v { font-weight: bold; letter-spacing: .06em; }
.verdict .v.consistent   { color: var(--green); }
.verdict .v.contradicted { color: var(--red); }
.verdict .v.unreliable,
.verdict .v.inconclusive,
.verdict .v.untested     { color: var(--dim); }
.verdict .edge { color: var(--fg); }
.verdict .why { color: var(--dim); display: block; margin-top: 3px; }

svg .axis { stroke: var(--border); }
svg .tick { fill: var(--dim); font-size: 9px; }
svg .lbl  { fill: var(--dim); font-size: 10px; }

/* An interpolated series is fine to draw and misleading to difference, so it
   is marked wherever it is named rather than hidden or forbidden. */
.warn-inline { color: var(--amber); }

/* ---- scenarios ------------------------------------------------------------
   The band is the answer, so it is the loudest thing on the chart and the live
   line is drawn thin over it. Reversing that would put a single trajectory in
   the foreground, which is precisely the reading the model is trying not to
   invite. */
.band-outer  { fill: var(--green); opacity: 0.13; }
.band-inner  { fill: var(--green); opacity: 0.20; }
.band-median { fill: none; stroke: var(--green); stroke-width: 1; opacity: 0.55; }
.live-line   { fill: none; stroke: var(--amber); stroke-width: 1.6; }
.obs-dot     { fill: var(--fg); stroke: var(--bg); stroke-width: 0.6; }
.cutline     { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 3; }

.swatch-band, .swatch-live, .swatch-obs {
  display: inline-block; width: 14px; height: 8px; vertical-align: middle;
  margin-right: 2px; border-radius: 1px;
}
.swatch-band { background: var(--green); opacity: 0.35; }
.swatch-live { background: var(--amber); height: 2px; }
.swatch-obs  { background: var(--fg); width: 6px; height: 6px; border-radius: 50%; }

.scn-param { display: block; margin: 0.45rem 0; }
.scn-param .name { display: flex; justify-content: space-between; font-size: 0.78rem; }
.scn-param input[type=range] { width: 100%; }

.scn-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; margin: 0.4rem 0; }
.scn-table th { text-align: left; color: var(--dim); font-weight: 500;
                border-bottom: 1px solid var(--border); padding: 0.2rem 0.4rem; }
.scn-table td { padding: 0.2rem 0.4rem; border-bottom: 1px solid var(--panel-deep); }
.scn-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- layer groups ---------------------------------------------------------
   Built for twenty layers, not for four. A flat list stops being navigable
   somewhere around eight, and by then the fix is a rewrite rather than a
   collapse. */
.layer-group { margin-bottom: 0.35rem; }
.group-head {
  display: flex; align-items: center; gap: 0.4rem; width: 100%;
  background: none; border: 0; padding: 0.3rem 0.1rem; cursor: pointer;
  color: var(--fg); font: inherit; font-size: 0.82rem; text-align: left;
  border-bottom: 1px solid var(--border);
}
.group-head:hover { color: var(--green); }
.group-head .caret { color: var(--dim); width: 0.7em; }
.group-head .group-title { flex: 1; }
.group-head .group-count { color: var(--dim); font-size: 0.72rem;
                           font-variant-numeric: tabular-nums; }
.group-body { padding: 0.25rem 0 0.35rem 0.5rem; }
.group-note { margin: 0.1rem 0 0.35rem; font-size: 0.72rem; }

.layer .swatch {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 2px; flex: 0 0 auto;
}
/* The atlas is a white mask, so the swatch colour shows through the shape's
   negative space; inverting the blend keeps the mark readable on its own hue. */
.layer .swatch svg { mix-blend-mode: multiply; opacity: 0.85; }

.lic-btn {
  background: none; border: 0; padding: 0; cursor: pointer; font: inherit;
  font-size: inherit; color: var(--dim); text-decoration: underline dotted;
}
.lic-btn:hover { color: var(--green); }
