/* ---- Mechanism figures (docs/checkii-ai-design-brief.md §6: motion only to
   reinforce system activity). Every figure here draws a real artefact: the
   authority boundary a job passes, the network paths the applied policy
   manifest permits, the signature over the published sample, the benchmark
   rows. One easing, three durations, paper and ink, 1px strokes. ---- */
:root {
  --dur-1: .18s;   /* micro: hover, press */
  --dur-2: .5s;    /* reveal, draw */
  --dur-3: 1.6s;   /* system activity: a job moving, a bar filling */
}

/* ---- A. the authority boundary, as a job sees it ---- */
.boundary { grid-column: 1 / -1; margin: 36px 0 0; padding: 0; border-top: 1px solid var(--border); padding-top: 18px; }
.boundary figcaption { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-family: var(--font-body); font-size: 12px; font-weight: 500; letter-spacing: .01em; color: var(--muted); margin-bottom: 10px; }
.boundary figcaption b { font-weight: 500; color: var(--fg); }
.boundary svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-mono); }
/* On a phone the 1200-unit schematic would shrink its labels below legibility; keep it drawn at a readable scale and let it scroll sideways, like a plan on a table. */
@media (max-width: 719px) { .boundary .scroller { overflow-x: auto; -webkit-overflow-scrolling: touch; } .boundary svg { min-width: 860px; } }
.boundary .rail { stroke: var(--border-strong); stroke-width: 1; }
.boundary .gate rect { fill: var(--card); stroke: var(--fg); stroke-width: 1; }
.boundary .gate text { fill: var(--fg); font-size: 11px; }
.boundary .gate .idx { fill: var(--muted); }
.boundary .gate .sub { fill: var(--muted); font-size: 10px; }
.boundary .stamp { font-size: 11px; fill: var(--verified); opacity: 0; }
.boundary .stamp.refused { fill: var(--fg); }
.boundary .job { fill: var(--signal); }
.boundary .job.b { fill: none; stroke: var(--fg); stroke-width: 1.5; }
.boundary .trail { stroke: var(--signal); stroke-width: 1; stroke-dasharray: 1090; stroke-dashoffset: 1090; }
.boundary .halt { stroke: var(--fg); stroke-width: 1; opacity: 0; }
/* Static end state when motion is off: everything that would have happened, shown. */
.boundary .stamp.ok, .boundary .halt { opacity: 1; }
.boundary .trail { stroke-dashoffset: 0; }
.boundary .job.a { transform: translateX(1090px); }
.boundary .job.b { transform: translateX(528px); }
@media (prefers-reduced-motion: no-preference) {
  .boundary.run .stamp.ok, .boundary.run .halt { opacity: 0; }
  .boundary.run .trail { stroke-dashoffset: 1090; animation: bnd-trail 12s linear infinite; }
  .boundary.run .job.a { transform: none; animation: bnd-a 12s linear infinite; }
  .boundary.run .job.b { transform: none; animation: bnd-b 12s linear infinite; }
  .boundary.run .stamp.ok.g1 { animation: bnd-stamp-1 12s linear infinite; }
  .boundary.run .stamp.ok.g2 { animation: bnd-stamp-2 12s linear infinite; }
  .boundary.run .stamp.ok.g3 { animation: bnd-stamp-3 12s linear infinite; }
  .boundary.run .stamp.ok.g4 { animation: bnd-stamp-4 12s linear infinite; }
  .boundary.run .stamp.ok.g5 { animation: bnd-stamp-5 12s linear infinite; }
  .boundary.run .halt { animation: bnd-halt 12s linear infinite; }
  @keyframes bnd-a {
    0% { transform: translateX(0); } 10% { transform: translateX(170px); } 16% { transform: translateX(170px); }
    26% { transform: translateX(400px); } 32% { transform: translateX(400px); }
    42% { transform: translateX(630px); } 48% { transform: translateX(630px); }
    58% { transform: translateX(860px); } 64% { transform: translateX(860px); }
    74% { transform: translateX(1090px); } 96% { transform: translateX(1090px); } 100% { transform: translateX(1090px); }
  }
  @keyframes bnd-trail { 0% { stroke-dashoffset: 1090; } 74% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; } }
  @keyframes bnd-stamp-1 { 0% { opacity: 0; } 13% { opacity: 0; } 15% { opacity: 1; } 96% { opacity: 1; } 100% { opacity: 0; } }
  @keyframes bnd-stamp-2 { 0% { opacity: 0; } 29% { opacity: 0; } 31% { opacity: 1; } 96% { opacity: 1; } 100% { opacity: 0; } }
  @keyframes bnd-stamp-3 { 0% { opacity: 0; } 45% { opacity: 0; } 47% { opacity: 1; } 96% { opacity: 1; } 100% { opacity: 0; } }
  @keyframes bnd-stamp-4 { 0% { opacity: 0; } 61% { opacity: 0; } 63% { opacity: 1; } 96% { opacity: 1; } 100% { opacity: 0; } }
  @keyframes bnd-stamp-5 { 0% { opacity: 0; } 77% { opacity: 0; } 79% { opacity: 1; } 96% { opacity: 1; } 100% { opacity: 0; } }
  @keyframes bnd-b {
    0% { transform: translateX(0); opacity: 0; } 30% { transform: translateX(0); opacity: 0; } 33% { opacity: 1; }
    43% { transform: translateX(170px); } 49% { transform: translateX(170px); }
    59% { transform: translateX(400px); } 65% { transform: translateX(400px); }
    75% { transform: translateX(528px); } 96% { transform: translateX(528px); opacity: 1; } 100% { opacity: 0; }
  }
  @keyframes bnd-halt { 0% { opacity: 0; } 75% { opacity: 0; } 78% { opacity: 1; } 96% { opacity: 1; } 100% { opacity: 0; } }
}

/* ---- B. the two planes, interactive: what each node may reach ---- */
.plane .node[data-node] { cursor: pointer; transition: background var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease); }
.plane .node[data-node]:hover, .plane .node[data-node]:focus-visible { background: color-mix(in srgb, var(--signal) 8%, transparent); outline: none; }
.plane .node[data-node][aria-pressed="true"] { box-shadow: inset 3px 0 0 var(--signal); background: color-mix(in srgb, var(--signal) 10%, transparent); }
.plane .node.reach-allowed { box-shadow: inset 3px 0 0 var(--verified); }
.plane .node.reach-denied { opacity: .55; }
.plane .node.reach-denied b { text-decoration: line-through; text-decoration-color: var(--signal-ink); text-decoration-thickness: 1px; }
.plane .node[data-node] { position: relative; }
.plane .node[data-node]::after { content: "select"; position: absolute; right: 14px; top: 10px; font-family: var(--font-body); font-size: 11px; font-weight: 500; letter-spacing: .01em; color: var(--muted); opacity: 0; transition: opacity var(--dur-1) var(--ease); }
.plane .node[data-node]:hover::after { opacity: 1; }
.plane.dark .node[data-node]::after { color: var(--dark-muted); }
.plane.dark .node[data-node][aria-pressed="true"] { background: rgba(250,248,243,0.08); }
.plane.dark .node[data-node]:hover { background: rgba(250,248,243,0.06); }
.paths { margin-top: 12px; border: 1px solid var(--border-strong); background: var(--bg); }
.paths .head { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-family: var(--font-body); font-size: 12px; font-weight: 500; letter-spacing: .01em; color: var(--muted); }
.paths .head b { color: var(--fg); font-weight: 500; }
.paths .empty { padding: 14px; color: var(--muted); font-size: 13px; }
.paths ol { list-style: none; margin: 0; padding: 0; }
.paths li { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 9px 14px; border-top: 1px solid var(--border); font-size: 13px; }
.paths li:first-child { border-top: 0; }
.paths .st { font-family: var(--font-body); font-size: 12px; font-weight: 500; letter-spacing: .01em; }
.paths .st.allowed { color: var(--verified); } .paths .st.allowed::before { content: ""; display: inline-block; width: 6px; height: 6px; background: var(--signal); margin-right: 8px; vertical-align: 1px; }
.paths .st.denied { color: var(--fg); } .paths .st.denied::before { content: ""; display: inline-block; width: 6px; height: 6px; border: 1px solid var(--fg); margin-right: 8px; vertical-align: 1px; }
.paths .how { font-family: var(--font-body); font-size: 11px; font-weight: 500; letter-spacing: .01em; color: var(--muted); white-space: nowrap; }
.paths .how.verified { color: var(--verified); }
.paths .to code { font-size: 12px; }
.paths .foot { padding: 10px 14px; border-top: 1px solid var(--border); font-family: var(--font-body); font-size: 11px; font-weight: 500; letter-spacing: .01em; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) { .paths li { animation: reveal var(--dur-2) var(--ease) both; } }

/* ---- C. verify the published sample, in the browser ---- */
.bundle .verify { padding: 12px 14px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bundle .verify .btn { height: 34px; padding: 0 12px; }
.bundle .verify .pin { font-size: 10px; color: var(--muted); text-transform: uppercase; overflow-wrap: anywhere; }
.bundle ol.steps-v { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.bundle ol.steps-v li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 12px; align-items: start; }
.bundle ol.steps-v li::before { content: none; }   /* the bundle's own list tick is not for these rows */
.bundle ol.steps-v li:first-child { border-top: 0; }
.bundle ol.steps-v li i { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--fg); margin-top: 3px; font-style: normal; font-size: 9px; line-height: 10px; text-align: center; }
.bundle ol.steps-v li.ok i { background: var(--verified); border-color: var(--verified); color: #fff; }
.bundle ol.steps-v li.ok i::before { content: "\2713"; }
.bundle ol.steps-v li.fail i { border-color: var(--fg); background: var(--fg); color: var(--primary-fg); }
.bundle ol.steps-v li.fail i::before { content: "\2715"; }
.bundle ol.steps-v li.wait i { border-style: dashed; }
.bundle ol.steps-v li span { color: var(--muted); display: block; overflow-wrap: anywhere; }
.bundle ol.steps-v li span.d { font-size: 11px; }
.bundle .verdict { padding: 12px 14px; border-top: 1px solid var(--border); font-family: var(--font-body); font-size: 12px; font-weight: 500; letter-spacing: .01em; display: flex; justify-content: space-between; gap: 12px; }
.bundle .verdict b { font-weight: 500; }
.bundle .verdict.valid b { color: var(--verified); }
.bundle .verdict.invalid b { color: var(--fg); }
@media (prefers-reduced-motion: no-preference) { .bundle ol.steps-v li { transition: background var(--dur-2) var(--ease); } .bundle ol.steps-v li.ok { animation: reveal var(--dur-2) var(--ease) both; } }

/* ---- D. the console preview behaves like a console ---- */
@media (prefers-reduced-motion: no-preference) {
  .oprow .p i { transition: width var(--dur-3) var(--ease); }
  .ledger li { animation: reveal var(--dur-2) var(--ease) both; }
}

/* ---- E. the benchmark rows, drawn ---- */
.bench { margin: 14px 0 0; padding: 0; border: 1px solid var(--border); background: var(--card); }
.bench figcaption { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-family: var(--font-body); font-size: 12px; font-weight: 500; letter-spacing: .01em; color: var(--muted); }
.bench ol { list-style: none; margin: 0; padding: 6px 14px 10px; }
.bench li { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 12px; align-items: center; padding: 7px 0; border-top: 1px solid var(--border); }
.bench li > div:first-child { min-width: 0; }
.bench li::before { content: none; }
.bench li:first-child { border-top: 0; }
.bench .lbl { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.bench .bar { position: relative; display: block; width: 100%; height: 8px; background: var(--bg); border: 1px solid var(--border); box-sizing: border-box; }
.bench .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--signal); }
.bench .bar i.range { background: color-mix(in srgb, var(--signal) 45%, transparent); }
.bench .bar i.lo { background: var(--signal); }
.bench .val { font-family: var(--font-mono); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.bench .ceiling { position: absolute; top: -4px; bottom: -4px; width: 1px; background: var(--fg); }
@media (prefers-reduced-motion: no-preference) {
  .bench.drawn .bar i { transition: width var(--dur-3) var(--ease); }
}
