/* Assoc Desk — tokens, base styles and the parts both pages share (buttons, chips, the model, the diagrams).
   Sizes in rem; light first, dark follows the system. Clay and plum on warm paper: the category is blue and green. */
:root {
  --ground: #faf5ec;
  --surface: #fffdf8;
  --sunk: #f1e9db;
  --ink: #27202b;
  --ink-2: #4d4353;
  --ink-3: #6b6070;
  --line: #d6c8b2;
  --line-2: #e9dfce;
  --action: #a83e22;
  --action-ink: #ffffff;
  --action-soft: #f8e3d9;
  --plum: #5b3a66;
  --plum-soft: #efe4f1;
  --gold: #d99a1c;
  --gold-soft: #fbf0d3;
  --gold-ink: #6e4b00;
  --green: #2c6e49;
  --green-soft: #e1f0e4;
  --red: #a3271a;
  --red-soft: #fae3de;
  --blue: #2b5f9e;
  --blue-soft: #e3ecf7;
  --sky-1: #f6e7d2;
  --sky-2: #fdf8ef;
  --radius: .625rem;
  --shadow: 0 1px 2px rgba(39, 32, 43, .07), 0 6px 20px rgba(39, 32, 43, .07);
  --display: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #18131c;
    --surface: #221b27;
    --sunk: #1d1722;
    --ink: #f3ebe3;
    --ink-2: #d2c6cf;
    --ink-3: #a99ca6;
    --line: #45394d;
    --line-2: #30273a;
    --action: #f0906e;
    --action-ink: #2a130b;
    --action-soft: #40241c;
    --plum: #d1aede;
    --plum-soft: #33263a;
    --gold: #f2c56b;
    --gold-soft: #3a2f17;
    --gold-ink: #f6d58c;
    --green: #7fcf9c;
    --green-soft: #1c3324;
    --red: #ff9a88;
    --red-soft: #40201b;
    --blue: #8fbaf0;
    --blue-soft: #1d2b40;
    --sky-1: #2a2140;
    --sky-2: #1b1524;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .3);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 106.25%; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--ground); color: var(--ink); font: 1rem/1.6 var(--sans); }
h1, h2, h3 { font-family: var(--display); font-weight: 750; line-height: 1.12; letter-spacing: -.015em; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--action); text-underline-offset: .15em; }
:focus-visible { outline: .1875rem solid var(--ink); outline-offset: .125rem; border-radius: .25rem; }
[hidden] { display: none !important; }
.wrap { max-width: 80rem; margin: 0 auto; padding: 0 1.25rem; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.demo-bar { background: var(--ink); color: var(--ground); font-size: .82rem; text-align: center; padding: .4rem 1rem; }
.demo-bar b { font-weight: 700; }

.mark { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--display); font-weight: 750; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.mark svg { width: 1.8rem; height: 1.8rem; flex: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .62rem 1.05rem; border-radius: var(--radius); border: .0625rem solid var(--line);
  background: var(--surface); color: var(--ink); font: 600 .95rem/1.2 var(--sans); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--action); border-color: var(--action); color: var(--action-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.small { padding: .42rem .75rem; font-size: .88rem; }
.btn[disabled] { opacity: .55; cursor: default; }
.linkish { background: none; border: 0; padding: 0; color: var(--action); font: inherit; text-decoration: underline; cursor: pointer; }

/* state chips: a word and a shape, never colour alone */
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 650; white-space: nowrap;
  background: var(--sunk); color: var(--ink-2); border: .0625rem solid var(--line); }
.chip::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; flex: none; }
.chip.wait { background: var(--gold-soft); color: var(--gold-ink); border-color: transparent; }
.chip.wait::before { border-radius: 0; transform: rotate(45deg); }
.chip.go { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.chip.go::before { border-radius: .1rem; }
.chip.ok { background: var(--green-soft); color: var(--green); border-color: transparent; }
.chip.bad { background: var(--red-soft); color: var(--red); border-color: transparent; }
.chip.bad::before { width: 0; height: 0; background: none; border-radius: 0; border: .3rem solid transparent; border-bottom: .52rem solid currentColor; margin-top: -.3rem; }
.chip.ai { background: var(--plum-soft); color: var(--plum); border: .0625rem dashed var(--plum); }
.chip.ai::before { background: none; border: .125rem solid currentColor; }

/* ── the model ─────────────────────────────────────────────────────────── */
.scene-view { position: relative; height: clamp(19rem, 52vw, 33rem); overflow: hidden; touch-action: pan-y; cursor: grab; user-select: none;
  background: radial-gradient(120% 90% at 50% 100%, var(--sky-1), var(--sky-2) 70%); border-radius: var(--radius); }
.scene-view:active { cursor: grabbing; }
.scene-view.is-flat { cursor: default; }
.scene-stage { position: absolute; inset: 0; }
.scene-stage canvas { display: block; }
.scene-view.is-flat .scene-stage { display: grid; place-items: center; }
.scene-hot { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; pointer-events: none; }
.scene-view.is-flat .scene-hot { inset: 0; margin: auto; aspect-ratio: 1; height: 100%; max-width: 100%; }
.hot { position: absolute; transform: translate(-50%, -50%); width: 2.6rem; height: 2.6rem; padding: 0; border: 0; border-radius: 50%; background: transparent;
  pointer-events: auto; cursor: pointer; color: var(--ink); font: 700 .78rem/1 var(--sans); }
.hot span { position: absolute; left: 50%; bottom: calc(100% + .1rem); transform: translateX(-50%); white-space: nowrap; padding: .2rem .5rem; border-radius: .4rem;
  background: var(--ink); color: var(--ground); font-weight: 600; opacity: 0; pointer-events: none; }
.hot:hover span, .hot:focus-visible span, .hot[aria-pressed="true"] span { opacity: 1; }
.hot:hover { background: color-mix(in srgb, var(--surface) 30%, transparent); }
.hot:focus-visible { outline: .1875rem solid var(--ink); outline-offset: 0; background: color-mix(in srgb, var(--surface) 45%, transparent); }
.is-flat .hot { width: 1.7rem; height: 1.7rem; }
.is-flat .hot::after { content: attr(data-tag); display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: var(--surface); border: .125rem solid var(--ink); }
.is-flat .hot.s-ok::after { content: ""; background: transparent; border-style: dotted; }
.is-flat .hot.s-ai::after { border-style: dashed; }
.scene-tools { position: absolute; right: .6rem; bottom: .6rem; display: flex; gap: .3rem; }
.is-flat .scene-tools { display: none; }
.scene-tools button { width: 2.3rem; height: 2.3rem; border-radius: 50%; border: .0625rem solid var(--line); background: var(--surface); color: var(--ink); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.scene-tools button:hover { border-color: var(--ink-3); }
.scene-note { position: absolute; left: .7rem; bottom: .7rem; right: 11rem; font-size: .78rem; color: var(--ink-2); background: color-mix(in srgb, var(--surface) 85%, transparent); padding: .3rem .55rem; border-radius: .4rem; width: fit-content; max-width: 28rem; }
.flatplan { width: 100%; height: 100%; }
.flatplan .f-road { fill: none; stroke: var(--ink-3); stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
.flatplan .f-bulb { fill: var(--ink-3); opacity: .55; }
.flatplan .f-water { fill: var(--blue-soft); stroke: var(--blue); stroke-width: .4; }
.flatplan .f-tree { fill: var(--green); opacity: .35; }
.flatplan .f-lot, .flatplan .f-block, .flatplan .f-amen { fill: var(--surface); stroke: var(--ink-3); stroke-width: .4; }
.flatplan .f-lot.has { fill: var(--action-soft); stroke: var(--action); stroke-width: .7; }
.flatplan .f-block { fill: var(--sunk); stroke-width: .7; }
.flatplan .f-amen { fill: var(--plum-soft); stroke: var(--plum); }
.flatplan .f-unit { fill: var(--action); }
.flatplan .f-sel { fill: none; stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 1.5; }

/* legend of marker shapes */
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: .88rem; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: .4rem; }
.legend svg { width: 1.15rem; height: 1.15rem; flex: none; }
.legend b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ── the diagrams ──────────────────────────────────────────────────────── */
.flow { position: relative; }
.flow-canvas svg { display: block; width: 100%; height: auto; margin: 0 auto; overflow: visible; }
.flow-node rect { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.flow-node text { font: 650 14px var(--sans); fill: var(--ink-2); text-anchor: middle; }
.flow-node text.sub { font: 600 10.5px var(--sans); letter-spacing: .06em; text-transform: uppercase; fill: var(--ink-3); }
.flow-node.is-end rect { stroke-dasharray: none; fill: var(--sunk); }
.flow-node.is-past rect { stroke: var(--ink-3); }
.flow-node.is-next rect { stroke: var(--action); stroke-dasharray: 5 4; }
.flow-node.is-current rect { fill: var(--ink); stroke: var(--ink); }
.flow-node.is-current text { fill: var(--ground); }
.flow-node.is-current text.sub { fill: var(--ground); opacity: .75; }
.flow-node.is-dim { opacity: .45; }
.flow-edge path { fill: none; stroke: var(--line); stroke-width: 1.75; }
.flow-arrowhead { fill: var(--ink-3); }
.flow-edge text { font: 500 11.5px var(--mono); fill: var(--ink-3); paint-order: stroke; stroke: var(--ground); stroke-width: 4px; stroke-linejoin: round; }
.flow-edge.is-allowed path { stroke: var(--action); stroke-width: 2.5; stroke-dasharray: 7 5; }
.flow-edge.is-allowed text { fill: var(--action); font-weight: 700; }
.flow-edge.is-hot path { stroke: var(--ink); stroke-dasharray: none; stroke-width: 3; }
.flow-edge.is-past path { stroke: var(--ink-3); stroke-width: 2.25; }
.flow-edge.is-dim { opacity: .4; }
@media (prefers-reduced-motion: no-preference) { .flow-edge.is-allowed path { animation: march 1.4s linear infinite; } }
@keyframes march { to { stroke-dashoffset: -24; } }
.flow-link { fill: none; stroke: var(--plum); stroke-width: 1.5; stroke-dasharray: 3 4; }
.flow-gate .bar { fill: var(--red); transition: transform .45s ease; transform-box: fill-box; transform-origin: 50% 100%; }
.flow-gate .knob { fill: var(--surface); stroke: var(--red); stroke-width: 1.75; }
.flow-gate path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.flow-gate .mark-closed { stroke: var(--red); }
.flow-gate .mark-open { stroke: var(--green); display: none; }
.flow-gate text { font: 600 11px var(--sans); fill: var(--ink-2); paint-order: stroke; stroke: var(--ground); stroke-width: 4px; stroke-linejoin: round; }
.flow-gate.is-open .bar { fill: var(--green); transform: rotate(78deg); }
.flow-gate.is-open .knob { stroke: var(--green); }
.flow-gate.is-open .mark-closed { display: none; }
.flow-gate.is-open .mark-open { display: inline; }
.flow-gate.is-refusing .knob { fill: var(--red-soft); stroke-width: 3; }
@media (prefers-reduced-motion: reduce) { .flow-gate .bar { transition: none; } }
.flow-token circle { fill: var(--action); stroke: var(--surface); stroke-width: 2; }
.flow-token .halo { fill: var(--action); opacity: .22; stroke: none; }
.flow-bubble { position: absolute; z-index: 3; width: max-content; max-width: min(19rem, calc(100% - .5rem)); padding: .55rem .7rem; border-radius: .5rem; background: var(--ink); color: var(--ground);
  font-size: .86rem; line-height: 1.4; box-shadow: var(--shadow); display: grid; gap: .15rem; }
.flow-bubble b { font: 700 .72rem var(--mono); letter-spacing: .03em; opacity: .8; }
.flow-bubble code { font: .74rem var(--mono); opacity: .8; overflow-wrap: anywhere; }

/* refusals and confirmations, as text */
.refused { border-left: .3rem solid var(--red); background: var(--red-soft); color: var(--ink); padding: .7rem .9rem; border-radius: 0 var(--radius) var(--radius) 0; }
.refused .rule { display: block; font: .8rem var(--mono); color: var(--ink-2); margin-top: .2rem; }
.done { border-left: .3rem solid var(--green); background: var(--green-soft); padding: .7rem .9rem; border-radius: 0 var(--radius) var(--radius) 0; }

.legal { font-size: .78rem; color: var(--ink-3); max-width: 62rem; }
.legal a { color: inherit; }
