/* Systems page only. Shared components are in assets/site.css. */

.sys-hero .status-legend { margin-top: .2rem; }

/* ---------- The shared record: hub ---------- */
.hub { --bus: color-mix(in srgb, var(--muted) 45%, transparent);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, .85fr) minmax(0, 1fr); align-items: center; gap: 0 2.6rem; position: relative; }
.hub-core { grid-column: 2; grid-row: 1; display: grid; gap: .45rem; text-align: center; padding: 1.6rem 1.2rem;
  background: var(--sign); color: var(--sign-fg); border-radius: 10px; position: relative; z-index: 1;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--sign) 16%, transparent), 0 24px 40px -28px rgba(0,0,0,.6); }
.hub-core .sub-label { color: color-mix(in srgb, var(--sign-fg) 78%, transparent); }
.hub-core b { font: 800 1.7rem/1 var(--font-display); text-transform: uppercase; letter-spacing: .01em; }
.hub-core-list { font-size: .8rem; line-height: 1.5; color: color-mix(in srgb, var(--sign-fg) 88%, transparent); }
.hub-nodes { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; position: relative; }
.hub-left { grid-column: 1; grid-row: 1; }
.hub-right { grid-column: 3; grid-row: 1; }
/* the bus: a vertical line beside each column, with a spur to every node and one into the core */
.hub-nodes::before { content: ""; position: absolute; top: 1.2rem; bottom: 1.2rem; width: 0; border-left: 2px solid var(--bus); }
.hub-left::before { right: -1.3rem; }
.hub-right::before { left: -1.3rem; }
.hub-nodes::after { content: ""; position: absolute; top: 50%; width: 1.3rem; border-top: 2px solid var(--bus); }
.hub-left::after { right: -2.6rem; }
.hub-right::after { left: -2.6rem; }
.hub-nodes li { position: relative; }
.hub-nodes li::after { content: ""; position: absolute; top: 50%; width: 1.3rem; border-top: 2px solid var(--bus); }
.hub-left li::after { right: -1.3rem; }
.hub-right li::after { left: -1.3rem; }
.hub-nodes a { display: flex; align-items: center; gap: .6rem; padding: .6rem .85rem; border-radius: 6px; text-decoration: none;
  font-weight: 600; font-size: .92rem; color: var(--fg); background: var(--surface); border: 1.5px solid var(--line); transition: border-color .15s ease; }
.hub-nodes a:hover { border-color: var(--muted); }
.hub-nodes a::before { content: ""; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.hub-nodes .n-working a { border-color: color-mix(in srgb, var(--st-working) 60%, var(--line)); background: color-mix(in srgb, var(--st-working) 8%, var(--surface)); }
.hub-nodes .n-working a::before { background: var(--st-working); }
.hub-nodes .n-designed a { border-style: dashed; }
.hub-nodes .n-designed a::before { border: 2px solid var(--st-designed); }
.hub-key { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; margin-top: 1.1rem; justify-content: center; }
.hub-key .k { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.hub-key .k-working { background: var(--st-working); }
.hub-key .k-designed { border: 2px solid var(--st-designed); }
.hub-key > span { display: inline-flex; align-items: center; gap: .45rem; margin-right: .9rem; }
@media (max-width: 820px) {
  .hub { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .55rem; }
  .hub-core { grid-column: 1 / -1; grid-row: 1; margin-bottom: .9rem; }
  .hub-left { grid-column: 1; grid-row: 2; }
  .hub-right { grid-column: 2; grid-row: 2; }
  .hub-nodes::before, .hub-nodes::after, .hub-nodes li::after { display: none; }
}
@media (max-width: 480px) {
  .hub { gap: .45rem; }
  .hub-nodes { gap: .45rem; }
  .hub-nodes a { font-size: .8rem; padding: .55rem .6rem; gap: .45rem; line-height: 1.25; min-height: 3.35rem; }
  .hub-nodes a::before { width: 8px; height: 8px; }
  .hub-key { justify-content: flex-start; }
}

/* ---------- Follow one ticket ---------- */
.trace-title { font-size: 1.5rem; margin: clamp(2.5rem, 6vw, 3.5rem) 0 1.2rem; }
.trace { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; counter-reset: none; }
.trace li { position: relative; display: grid; gap: .55rem; align-content: start; padding: 1.4rem 1rem 0 0; border-top: 3px solid var(--st-working); min-width: 0; }
.trace li:nth-child(n+5) { border-top-color: var(--st-designed); border-top-style: dashed; }
.trace li::before { content: ""; position: absolute; top: -9px; left: 0; width: 15px; height: 15px; border-radius: 50%; background: var(--bg); border: 3px solid var(--st-working); }
.trace li:nth-child(n+5)::before { border-color: var(--st-designed); }
.trace-n { font: 600 .75rem var(--font-mono); color: var(--muted); letter-spacing: .1em; }
.trace h4 { font: 800 1.2rem/1.1 var(--font-display); text-transform: uppercase; margin: 0; }
.trace p { font-size: .88rem; color: var(--muted); margin: 0; }
.trace .status, .trace .status-row { justify-self: start; }
.trace-note { margin-top: 1.4rem; max-width: 72ch; }
.trace-note a { color: var(--clay); font-weight: 600; }
@media (max-width: 1020px) { .trace { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 2rem; } }
@media (max-width: 600px) {
  .trace { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .trace li { border-top: 0; border-left: 3px solid var(--st-working); padding: 0 0 1.6rem 1.4rem; }
  .trace li:nth-child(n+5) { border-left-color: var(--st-designed); border-left-style: dashed; }
  .trace li:last-child { padding-bottom: 0; }
  .trace li::before { top: 0; left: -9px; }
}

/* ---------- Catalogue ---------- */
.sys-filter { display: flex; flex-wrap: wrap; gap: .4rem; margin: -1rem 0 1.4rem; }
.sys-filter button { display: inline-flex; align-items: center; gap: .45rem; font: 600 .85rem var(--font-body); padding: .4rem .8rem; border-radius: 99px;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg); cursor: pointer; }
.sys-filter button span { font: 600 .72rem var(--font-mono); color: var(--muted); }
.sys-filter button:hover { border-color: var(--muted); }
.sys-filter button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.sys-filter button[aria-pressed="true"] span { color: inherit; opacity: .75; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-working { background: var(--st-working); }
.dot-designed { border: 2px solid var(--st-designed); }
.sys-filter button[aria-pressed="true"] .dot-designed { border-color: currentColor; }
.sys-filter button[aria-pressed="true"] .dot-working { background: currentColor; }
.sys-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.sys-card[hidden] { display: none; }
.sys-card h3 { font-size: 1.35rem; }
.sys-card .more { font-size: .9rem; margin-top: auto; }
.sys-saved { font: .76rem/1.5 var(--font-mono); color: var(--muted); border-top: 1px dashed var(--line); padding-top: .6rem; }
.card .sys-saved { font-size: .76rem; }
.sys-saved b { color: var(--st-working); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.sys-card[data-status="working"] { border-top: 3px solid var(--st-working); }
.sys-cad { background: color-mix(in srgb, var(--st-working) 7%, var(--bg)) !important; }
.sys-also { margin-top: 1.6rem; display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.sys-also .toc { margin: 0; }

/* ---------- Penal code ---------- */
.code-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: start; margin-bottom: 1.6rem; }
@media (max-width: 900px) { .code-layout { grid-template-columns: minmax(0, 1fr); } }
.code-layout h3.sub-label { margin-bottom: .8rem; font-family: var(--font-mono); font-size: .72rem; }
.code-layout .note { margin-top: .8rem; }
.class-table { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; font-size: .88rem; }
.ct-row { display: grid; grid-template-columns: 11rem 7.5rem 9rem minmax(0, 1fr); gap: .8rem; padding: .6rem 1rem; border-top: 1px solid var(--line); align-items: center; }
.ct-head { border-top: 0; background: var(--bg-2); font: 600 .7rem var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ct-f { font-family: var(--font-mono); font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ct-n { display: flex; align-items: center; gap: .5rem; font: 600 .82rem var(--font-mono); }
.ct-n .bar { flex: 0 0 auto; width: calc(var(--w) * .7); max-width: 4.2rem; }
.bar { display: block; height: 8px; border-radius: 2px; background: var(--clay); width: var(--w); opacity: .85; }
.cls { display: inline-block; min-width: 2.6rem; text-align: center; font: 600 .7rem/1.6 var(--font-mono); letter-spacing: .05em; border: 1px solid currentColor; border-radius: 3px; margin-right: .35rem; }
.cls.inf { color: var(--muted); } .cls.mis { color: var(--amber); } .cls.fel { color: var(--bad); }
@media (max-width: 720px) {
  .ct-head { display: none; }
  .ct-row { grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .8rem; }
  .ct-row > :nth-child(2) { grid-column: 2; grid-row: 1; }
  .ct-row > :nth-child(3) { grid-column: 1; }
  .ct-row > :nth-child(4) { grid-column: 1 / -1; color: var(--muted); font-size: .84rem; }
}
.code-titles { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1.2rem 1.2rem 1.1rem; min-width: 0; }
.title-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.title-bars li { display: grid; grid-template-columns: minmax(0, 1fr) 2.2rem; gap: .25rem .6rem; align-items: center; font-size: .84rem; }
.title-bars span { grid-column: 1 / -1; }
.title-bars .bar { background: var(--sign); }
.title-bars b { font: 600 .82rem var(--font-mono); text-align: right; }

/* Statute browser */
.code-book { margin-top: 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); min-width: 0; }
.code-book summary { cursor: pointer; padding: .9rem 1.1rem; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.code-book summary::-webkit-details-marker { display: none; }
.code-book summary::after { content: "+"; font-family: var(--font-mono); color: var(--clay); }
.code-book[open] summary::after { content: "\2212"; }
.code-book-body { padding: 0 1.1rem 1.1rem; display: grid; gap: .8rem; }
.code-book label { font-size: .85rem; font-weight: 600; }
.code-book input { width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--fg); font: 500 .9rem var(--font-mono); }
.statutes { list-style: none; margin: 0; padding: 0; max-height: 22rem; overflow-y: auto; border-top: 1px solid var(--line); font: .8rem/1.4 var(--font-mono); }
.statutes li { display: grid; grid-template-columns: 7.2rem minmax(0, 1fr) 3.6rem 5rem; gap: .6rem; padding: .45rem 0; border-bottom: 1px dashed var(--line); align-items: baseline; }
.statutes .t { font-family: var(--font-body); font-size: .88rem; }
.statutes .cl { justify-self: start; font-size: .68rem; letter-spacing: .06em; color: var(--muted); border: 1px solid currentColor; border-radius: 3px; padding: 0 .3rem; white-space: nowrap; }
.statutes .cl.mis { color: var(--amber); } .statutes .cl.fel { color: var(--bad); }
.statutes li.grp { display: block; position: sticky; top: 0; z-index: 1; background: var(--surface); padding: .6rem 0 .35rem; border-bottom: 1px solid var(--line); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--clay); font-weight: 600; }
.statutes .fl { display: inline-block; margin-left: .45rem; font: 600 .62rem/1.5 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; padding: 0 .3rem; border-radius: 3px; vertical-align: 1px; }
.statutes .fl.arrest { background: var(--bad); color: var(--surface); } .statutes .fl.court { border: 1px solid var(--amber); color: var(--amber); }
.statutes .was { display: block; font: .68rem var(--font-mono); color: var(--muted); }
.statutes .f { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .statutes li { grid-template-columns: minmax(0, 1fr) auto 4.6rem; gap: .15rem .6rem; }
  .statutes .t { grid-column: 1 / -1; grid-row: 2; }
}

/* Scene to courtroom */
.justice-flow { margin-top: clamp(2.5rem, 6vw, 3.5rem); }
.flow-title { font-size: 1.5rem; margin-bottom: 1.1rem; }
.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.6rem; }
.flow li { position: relative; display: grid; gap: .5rem; align-content: start; padding: 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.flow li:not(:last-child)::after { content: "→"; position: absolute; right: -1.25rem; top: 50%; transform: translateY(-50%); color: var(--clay); font-weight: 700; }
.flow b { font: 800 1.25rem/1.1 var(--font-display); text-transform: uppercase; }
.flow p { font-size: .88rem; color: var(--muted); }
.flow .status { justify-self: start; }
@media (max-width: 900px) {
  .flow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .flow li:nth-child(2)::after { display: none; }
}
@media (max-width: 560px) {
  .flow { grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
  .flow li:not(:last-child)::after { content: "↓"; right: auto; left: 1.2rem; top: auto; bottom: -1.3rem; transform: none; display: block; }
}

/* ---------- Records table ---------- */
.rec-table { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); overflow: hidden; }
.rt-row { display: grid; grid-template-columns: 14rem minmax(0, 1fr) 11rem; gap: 1.2rem; padding: .85rem 1.1rem; border-top: 1px solid var(--line); align-items: center; font-size: .92rem; }
.rt-row > b { font-weight: 700; }
.rt-row > span:nth-child(2) { color: var(--muted); }
.rt-head { border-top: 0; background: var(--surface); font: 600 .7rem var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
.rt-head > span:nth-child(2) { color: inherit; }
@media (max-width: 760px) {
  .rt-head { display: none; }
  .rt-row { grid-template-columns: minmax(0, 1fr) auto; gap: .35rem .8rem; }
  .rt-row > span:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 400px) {
  .rt-row { grid-template-columns: minmax(0, 1fr); }
  .rt-row > span:nth-child(3) { grid-row: 3; }
}
.rec-note { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: baseline; }

/* ---------- Money, cars, homes ---------- */
.living { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 960px) { .living { grid-template-columns: minmax(0, 1fr); } }
.living-block { display: grid; gap: .9rem; align-content: start; padding: 1.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.living-block h3 { font-size: 1.4rem; }
.living-block > p { color: var(--muted); font-size: .94rem; }
.layers { display: grid; gap: 0; margin-top: .3rem; }
.layer { display: grid; gap: .2rem; padding: .9rem 1rem; border-radius: 6px; font-size: .88rem; }
.layer b { font-size: 1rem; }
.layer > span:last-child { color: var(--muted); }
.layer-top { border: 1.5px dashed var(--clay); background: color-mix(in srgb, var(--clay) 6%, var(--surface)); margin: 0 1rem; border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 0; }
.layer-base { background: var(--sign); color: var(--sign-fg); }
.layer-base .sub-label, .layer-base > span:last-child { color: color-mix(in srgb, var(--sign-fg) 82%, transparent); }
.spec { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .6rem; }
.spec li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 0 .6rem; padding: .7rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); align-items: center; }
.spec svg { grid-row: span 2; width: 26px; height: 26px; fill: none; stroke: var(--clay); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.spec b { font-size: .88rem; line-height: 1.2; }
.spec span { font-size: .76rem; color: var(--muted); }
@media (max-width: 360px) { .spec { grid-template-columns: minmax(0, 1fr); } }
.compare { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.compare > div { display: grid; gap: .3rem; align-content: start; padding: .9rem; background: var(--bg); }
.compare > div + div { border-left: 1px solid var(--line); }
.compare b { font-size: 1rem; }
.compare p { font-size: .85rem; color: var(--muted); }
@media (max-width: 400px) { .compare { grid-template-columns: minmax(0, 1fr); } .compare > div + div { border-left: 0; border-top: 1px solid var(--line); } }

/* ---------- Voice & characters ---------- */
.channels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); overflow: hidden; }
.channel { display: grid; gap: .5rem; align-content: start; padding: 1.4rem; min-width: 0; }
.channel + .channel { border-left: 1px solid var(--line); }
.channel h3 { font-size: 1.35rem; }
.channel p { font-size: .92rem; color: var(--muted); }
.ch-ico { width: 44px; height: 44px; fill: none; stroke: var(--sign); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="dark"] .ch-ico { stroke: var(--ok); }
@media (max-width: 760px) { .channels { grid-template-columns: minmax(0, 1fr); } .channel + .channel { border-left: 0; border-top: 1px solid var(--line); } }
.people-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; margin-top: 1rem; }
@media (max-width: 760px) { .people-pair { grid-template-columns: minmax(0, 1fr); } }
.prog { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: .45rem .6rem; align-items: center; font: 600 .76rem/1.35 var(--font-mono); text-transform: uppercase; letter-spacing: .04em; }
.prog span:not(.arr) { padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.prog span:nth-child(3), .prog span:nth-child(6) { border-color: var(--sign); color: var(--sign); }
:root[data-theme="dark"] .prog span:nth-child(3), :root[data-theme="dark"] .prog span:nth-child(6) { border-color: var(--ok); color: var(--ok); }
.prog .arr { color: var(--clay); }

/* ---------- Still open ---------- */
.open-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 1rem clamp(1.5rem, 5vw, 4rem); align-items: start; }
.open-wrap .section-head { margin-bottom: 0; }
@media (max-width: 860px) { .open-wrap { grid-template-columns: minmax(0, 1fr); } }
.open-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.open-list li { display: flex; gap: .8rem; align-items: flex-start; padding: .85rem 1rem; border: 1px dashed var(--line); border-radius: 6px; background: var(--surface); font-size: .94rem; font-weight: 600; }
.open-list .status { flex: none; margin-top: .05rem; }

/* anchor targets below the sticky header */

/* CAD feature card: spans the full catalogue row (keeps the 12 other cards in full rows) */
.sys-cad { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); column-gap: 1.8rem; align-items: center; }
.sys-cad-copy { display: grid; gap: .75rem; align-content: start; }
.sys-cad img { width: 100%; height: auto; display: block; border-radius: 4px; border: 1px solid var(--line); }
@media (max-width: 760px) { .sys-cad { grid-template-columns: minmax(0, 1fr); row-gap: 1rem; } }

/* Ticket trace: badges sit on one line at the bottom of each step */
.trace li { display: flex; flex-direction: column; }
.trace li > .status, .trace li > .status-row { margin-top: auto; }
.trace li > p { margin-bottom: .2rem; }

/* ---------- Hero second paragraph and the "Try it in the playground" block ---------- */
.sys-lede-2 { font-size: 1.05rem; }
.sys-lede-2 a { color: var(--clay); text-underline-offset: 3px; }
.sys-play { margin-top: 2rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.2rem 2rem; align-items: center;
  padding: 1.4rem 1.5rem; border: 1px solid color-mix(in srgb, var(--st-working) 50%, var(--line)); border-left: 4px solid var(--st-working);
  border-radius: 8px; background: color-mix(in srgb, var(--st-working) 6%, var(--bg)); }
.sys-play > div:first-child { display: grid; gap: .5rem; }
.sys-play h3 { font-size: clamp(1.3rem, 3vw, 1.6rem); }
.sys-play p:not(.eyebrow) { color: var(--muted); font-size: .94rem; max-width: 70ch; }
.sys-play p a { color: var(--clay); text-underline-offset: 3px; }
.sys-play-ctas { display: flex; flex-wrap: wrap; gap: .6rem; }
@media (max-width: 820px) { .sys-play { grid-template-columns: minmax(0, 1fr); } }
