/* Bounded Authority signer — site tokens + layout.
   Actor accents are reserved: amber = issuer, teal = holder, emerald = verifier,
   red = tamper/failure only. */

:root {
  --ink: #0f172a;
  --ink-2: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --hero: #0f172a;
  --hero-card: #1e293b;
  --hero-ink: #e2e8f0;
  --issuer: #b45309;
  --issuer-soft: #fef3c7;
  --issuer-line: #fcd34d;
  --holder: #0f766e;
  --holder-soft: #ccfbf1;
  --holder-line: #2dd4bf;
  --verifier: #047857;
  --verifier-soft: #d1fae5;
  --verifier-line: #34d399;
  --fail: #dc2626;
  --fail-soft: #fee2e2;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 72px; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--bg); line-height: 1.55; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h2 { font-size: 1.65rem; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; }
p { margin: .3em 0 .8em; }
a { color: inherit; }
code { font-family: var(--mono); font-size: .88em; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 5px; padding: .06em .35em; white-space: nowrap; }
pre { font-family: var(--mono); font-size: .82rem; }
.ic { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.ic.big { width: 1.7em; height: 1.7em; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.dim { color: var(--muted); }

/* the [BAP] wordmark */
.wordmark { font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.wordmark i { font-style: normal; color: var(--holder-line); font-weight: 500; }
.hero-mark { font-size: 1.15rem; margin-right: 10px; vertical-align: -.1em; }

/* family nav */
.familynav { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 40; }
.familynav nav { max-width: 1100px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 18px; }
.familynav .brand { font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 7px; font-size: 1.05rem; }
.familynav .fam { display: flex; gap: 16px; flex: 1; flex-wrap: wrap; }
.familynav a { text-decoration: none; color: var(--muted); font-size: .92rem; }
.familynav a:hover { color: var(--ink); }
.familynav a.here { color: var(--holder); font-weight: 600; }
.familynav a.gh { color: var(--ink); border: 1px solid var(--line-2); padding: 3px 10px; border-radius: 999px; font-size: .88rem; }
.footer { position: static; border-top: 1px solid var(--line); border-bottom: 0; margin-top: 72px; background: var(--bg-soft); }
.footer .fine { color: var(--muted); font-size: .8rem; max-width: 300px; }

/* hero — centered, balanced */
.hero { background: var(--hero); color: var(--hero-ink); padding: 68px 0 56px; text-align: center; }
.hero .wrap { display: flex; flex-direction: column; align-items: center; }
.hero .kicker { display: flex; align-items: center; text-transform: uppercase; letter-spacing: .18em; font-size: .74rem; color: var(--holder-line); margin: 0 0 16px; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.7rem); margin: 0 0 16px; max-width: 820px; }
.hero h1 em { font-style: normal; color: #fbbf24; }
.hero .lede { max-width: 720px; color: #cbd5e1; font-size: 1.02rem; margin: 0 auto 22px; }
.hero-actions { display: flex; gap: 12px; margin: 6px 0 36px; flex-wrap: wrap; justify-content: center; }
.custody-note { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: .9rem; color: #cbd5e1; margin: 26px 0 8px; flex-wrap: wrap; }
.pill { border: 1px solid #334155; background: var(--hero-card); color: #94a3b8; border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-family: var(--mono); }
.badges { list-style: none; display: flex; gap: 14px; justify-content: center; padding: 0; margin: 10px 0 0; color: #94a3b8; font-size: .8rem; font-family: var(--mono); }

/* the animated flow strip */
.flow { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.flow .actor { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 1px solid #334155; background: var(--hero-card); border-radius: 12px; padding: 12px 16px; min-width: 108px; }
.flow .actor span { font-weight: 600; font-size: .92rem; }
.flow .actor small { color: #94a3b8; font-size: .74rem; }
.flow .actor.issuer { border-color: var(--issuer-line); color: var(--issuer-line); }
.flow .actor.holder { border-color: var(--holder-line); color: var(--holder-line); }
.flow .actor.verifier { border-color: var(--verifier-line); color: var(--verifier-line); }
.flow .artifact { display: flex; align-items: center; gap: 6px; color: #94a3b8; font-family: var(--mono); font-size: .82rem; opacity: .55; transition: opacity .4s, color .4s; }
.flow .artifact.arrived { opacity: 1; color: #fbbf24; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 10px; border: 1px solid transparent; padding: 9px 16px; font: inherit; font-size: .93rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: transform .06s ease, box-shadow .15s ease; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--holder-line); color: var(--hero); }
.btn.primary:hover { box-shadow: 0 0 0 4px rgba(45, 212, 191, .25); }
.btn.ghost { border-color: #334155; color: var(--hero-ink); font-family: var(--mono); font-size: .82rem; }
.btn.subtle { background: var(--bg-soft); border-color: var(--line-2); color: var(--ink); }
.btn.actorbtn.issuer { background: var(--issuer-soft); border-color: var(--issuer-line); color: var(--issuer); width: 100%; justify-content: center; }
.btn.actorbtn.holder { background: var(--holder-soft); border-color: var(--holder-line); color: var(--holder); width: 100%; justify-content: center; }
.btn.actorbtn.verifier { background: var(--verifier-soft); border-color: var(--verifier-line); color: var(--verifier); width: 100%; justify-content: center; }
.btn.danger { background: #fff; border-color: #fca5a5; color: var(--fail); font-size: .88rem; }
.btn.danger:not([disabled]):hover { background: var(--fail-soft); }

/* section scaffolding — .wrap's margin shorthand (0 auto) resets margin-top with
   higher specificity, so the rhythm rule must out-rank it: main > section.wrap. */
main > section.wrap { margin-top: 96px; }
main > section.wrap:first-of-type { margin-top: 84px; }
main section { margin-top: 96px; }
.sec-head { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; margin: 0 0 10px; padding-top: 8px; }
.sec-head h2 { margin-top: 0; }
.sec-head p { color: var(--muted); max-width: 620px; flex: 1 1 380px; margin: 0; font-size: .95rem; }
.sec-head .btn { margin-left: auto; }

/* the why band (the 98%) */
.why-head { text-align: center; max-width: 720px; margin: 0 auto 30px; }
.why-head h2 { font-size: 1.9rem; }
.why-head p { color: var(--muted); font-size: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.whycard { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.whycard h3 { font-size: 1.02rem; margin-bottom: 10px; }
.whycard h3 s { text-decoration-color: var(--fail); text-decoration-thickness: 2px; }
.whycard .pain { color: var(--muted); font-size: .88rem; border-left: 3px solid var(--line-2); padding-left: 12px; }
.whycard .answer { font-size: .88rem; color: var(--ink); background: var(--verifier-soft); border-radius: 10px; padding: 10px 12px; margin: 12px 0 0; }
.whycard .answer .ic { color: var(--verifier); margin-right: 4px; }
.whycard .answer strong { color: var(--verifier); }

/* use-case cards */
.casecard { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; }
.casecard h3 { font-size: .98rem; margin: 0 0 4px; }
.casecard .ctx { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.casecard .pain { color: var(--muted); font-size: .85rem; border-left: 3px solid var(--line-2); padding-left: 12px; margin: 0; }
.casecard .grantline { font-family: var(--mono); font-size: .74rem; background: var(--bg-soft); border: 1px dashed var(--line-2); border-radius: 8px; padding: 6px 10px; margin: 12px 0; color: var(--holder); }
.casecard .answer { font-size: .85rem; color: var(--ink); background: var(--verifier-soft); border-radius: 10px; padding: 10px 12px; margin: auto 0 0; }
.casecard .answer .ic { color: var(--verifier); margin-right: 4px; }
.cases-grid { align-items: stretch; }

/* the three lanes */
.lanes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 22px; }
.lane { border: 1.5px solid var(--line-2); border-radius: 14px; padding: 16px; background: var(--bg); display: flex; flex-direction: column; gap: 12px; min-height: 320px; position: relative; }
.lane header { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1rem; }
.lane.issuer { border-color: var(--issuer-line); }
.lane.holder { border-color: var(--holder-line); }
.lane.verifier { border-color: var(--verifier-line); }
.lane.flash { animation: laneflash .5s ease 2; }
@keyframes laneflash { 50% { box-shadow: 0 0 0 5px rgba(100, 116, 139, .18); } }
.role-badge { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; border-radius: 999px; padding: 2px 9px; background: var(--bg-soft); border: 1px solid var(--line-2); color: var(--muted); margin-left: auto; }
.role-badge.issuer { background: var(--issuer-soft); border-color: var(--issuer-line); color: var(--issuer); }
.role-badge.holder { background: var(--holder-soft); border-color: var(--holder-line); color: var(--holder); }
.keychip { font-family: var(--mono); font-size: .76rem; border: 1px dashed var(--line-2); border-radius: 9px; padding: 7px 10px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.keychip b { color: var(--ink); font-weight: 600; }
.keychip .thumb { color: var(--muted); }
.props { margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: .88rem; }
.props dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.props dd { margin: 0; }
.card-slot { flex: 1; border: 1.5px dashed var(--line-2); border-radius: 10px; display: grid; place-items: center; min-height: 118px; color: var(--muted); font-size: .82rem; text-align: center; padding: 8px; position: relative; }
.card-slot::before { content: attr(data-empty); }
.card-slot .artifact-card { animation: land .35s ease; }
@keyframes land { from { transform: translateY(-14px); opacity: 0; } }

/* artifact cards (clickable → wire viewer) */
.artifact-card { border: 1.5px solid; border-radius: 10px; padding: 10px 12px; background: var(--bg); cursor: pointer; width: 100%; text-align: left; font: inherit; position: relative; }
.artifact-card:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, .08); }
.artifact-card .t { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: .9rem; }
.artifact-card .meta { font-family: var(--mono); font-size: .72rem; color: var(--muted); margin-top: 4px; word-break: break-all; }
.artifact-card.grant { border-color: var(--issuer-line); color: var(--issuer); }
.artifact-card.proof { border-color: var(--holder-line); color: var(--holder); }
.artifact-card.tampered { border-color: var(--fail); color: var(--fail); }
.artifact-card.tampered::after { content: "⚠ tampered"; position: absolute; top: -9px; right: 8px; background: var(--fail); color: #fff; font-size: .64rem; font-weight: 700; border-radius: 999px; padding: 1px 8px; letter-spacing: .06em; }
.artifact-card.selected { outline: 2.5px solid var(--ink); outline-offset: 2px; }

/* verdict */
.verdict { display: flex; gap: 10px; align-items: center; border-radius: 10px; border: 1.5px solid var(--line-2); padding: 10px 12px; font-size: .92rem; min-height: 52px; }
.verdict[data-state="ok"] { border-color: var(--verifier-line); background: var(--verifier-soft); color: var(--verifier); }
.verdict[data-state="fail"] { border-color: var(--fail); background: var(--fail-soft); color: var(--fail); animation: shake .3s ease; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.verdict .verdict-text b { font-family: var(--mono); }
#facts { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
#facts summary { cursor: pointer; padding: 7px 12px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--bg-soft); }
#facts pre { margin: 0; padding: 12px; max-height: 300px; overflow: auto; background: var(--hero); color: #a5f3fc; font-size: .74rem; }

/* tamper deck + wire viewer */
.tamper, .wireviewer { margin-top: 26px; border: 1.5px solid var(--line-2); border-radius: 14px; padding: 16px 18px; background: var(--bg-soft); }
.tamper h3 small, .wireviewer h3 small { color: var(--muted); font-weight: 400; }
.tamper-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(186px, 1fr)); gap: 10px; }
.hint { color: var(--muted); font-size: .86rem; margin: 10px 0 0; min-height: 1.2em; }
.hint.fail { color: var(--fail); font-family: var(--mono); font-size: .8rem; }
.seg-tabs { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.seg-tabs button { font-family: var(--mono); font-size: .76rem; border: 1px solid var(--line-2); background: var(--bg); border-radius: 8px; padding: 4px 12px; cursor: pointer; color: var(--muted); }
.seg-tabs button.on { border-color: var(--ink); color: var(--ink); font-weight: 700; }
pre.wire { background: var(--hero); color: #f1f5f9; border-radius: 10px; padding: 14px; overflow: auto; max-height: 260px; font-size: .78rem; line-height: 1.6; margin: 0; }
pre.wire .hl { background: var(--fail); color: #fff; border-radius: 3px; padding: 0 2px; }
pre.wire .k { color: #93c5fd; }
pre.wire .ok { color: #6ee7b7; }

/* properties band */
.props-band { background: var(--bg-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 40px 0 12px; margin-top: 84px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; padding-bottom: 26px; }
.grid4 article { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.grid4 .ic.big { color: var(--holder); }
.grid4 p { color: var(--muted); font-size: .88rem; margin: 6px 0 0; }

/* signers + code */
table.signers { border-collapse: collapse; width: 100%; font-size: .93rem; }
table.signers th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 2px solid var(--line-2); padding: 8px 10px; }
table.signers td { border-bottom: 1px solid var(--line); padding: 12px 10px; }
pre.code { background: var(--hero); color: #e2e8f0; border-radius: 12px; padding: 18px 20px; overflow: auto; font-size: .8rem; line-height: 1.65; }
pre.code.slim { padding: 12px 16px; font-size: .78rem; }
.install-row { margin-top: 14px; }

@media (max-width: 960px) {
  .lanes { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: repeat(2, 1fr); }
  .grid3 { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .grid4 { grid-template-columns: 1fr; }
  .familynav nav { flex-wrap: wrap; gap: 8px; }
}

/* fact panels: designed key/value view, raw JSON behind a toggle */
.factlabel { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 6px 0 4px; }
.facts { display: flex; flex-direction: column; }
.factrow { display: grid; grid-template-columns: minmax(110px, 32%) 1fr; gap: 10px; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: .78rem; align-items: baseline; }
.factrow:last-child { border-bottom: 0; }
.fk { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; overflow-wrap: anywhere; }
.fv { font-family: var(--mono); overflow-wrap: anywhere; }
.factrow.nest { display: block; }
.subfacts { margin-top: 3px; padding-left: 10px; border-left: 2px solid var(--line-2); }
details.raw { margin-top: 8px; }
details.raw summary { cursor: pointer; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
details.raw pre { background: var(--hero); color: #a5f3fc; border-radius: 8px; padding: 10px; overflow: auto; max-height: 220px; font-size: .7rem; margin: 6px 0 0; }
#facts-body { padding: 12px; max-height: 340px; overflow: auto; }

/* the artifact accordion */
.acc { border: 1.5px solid var(--line-2); border-radius: 12px; overflow: hidden; background: var(--bg); }
.acc { margin-top: 10px; }
.acc:first-child { margin-top: 0; }  /* rhythm holds across containers, not just siblings */
.acc-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--bg-soft); border: 0; cursor: pointer; font: inherit; font-weight: 650; color: var(--ink); text-align: left; }
.acc-head:hover { background: #eef2f7; }
.acc-head > .ic:first-child { color: var(--muted); }
.acc-title { font-size: .92rem; }
.acc-chip { font-size: .7rem; color: var(--holder); border: 1px solid var(--holder-line); background: var(--bg); border-radius: 999px; padding: 1px 9px; }
.acc-chev { margin-left: auto; color: var(--muted); transition: transform .25s ease; }
.acc.open .acc-chev { transform: rotate(180deg); }
.acc-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .28s ease; }
.acc.open .acc-body { grid-template-rows: 1fr; }
.acc-inner { overflow: hidden; }
.acc.open .acc-inner { padding: 12px 14px; }

/* fields inside an accordion: definition rows, not a data dump */
.field { display: flex; align-items: baseline; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.field:last-child { border-bottom: 0; }
.fl { flex: 0 0 38%; color: var(--muted); font-size: .84rem; font-weight: 500; }
.fvs { flex: 1; min-width: 0; font-size: .86rem; overflow-wrap: anywhere; }
.val.mono, .chip.mono { font-family: var(--mono); font-size: .78rem; }
.chip { display: inline-block; background: var(--bg-soft); border: 1px solid var(--line-2); border-radius: 7px; padding: 1px 7px; cursor: help; }
.field.group { display: block; }
.group-inner { margin-top: 4px; padding-left: 12px; border-left: 2px solid var(--line-2); }


/* raw-JSON code box (facts area) */
pre.codebox { background: var(--hero); color: #a5f3fc; border-radius: 10px; padding: 12px 14px; overflow: auto; max-height: 320px; font-size: .74rem; line-height: 1.55; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
/* panel headers: badge icon + title + subtitle line (replaces the run-on h3+small) */
.panel-head { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.panel-badge { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; background: var(--bg); border: 1.5px solid var(--line-2); border-radius: 9px; color: var(--holder); }
.panel-badge .ic { width: 17px; height: 17px; stroke-width: 2.1; }
.panel-titles { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.panel-title { font-size: 1rem; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.panel-sub { font-size: .8rem; color: var(--muted); font-weight: 400; }

/* the family lifecycle band: define → agree → authorize */
.lifecycle { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 10px; align-items: stretch; }
.lstep { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--line-2); border-radius: 14px; padding: 16px; background: var(--bg); text-decoration: none; color: var(--ink); }
.lstep:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, .08); }
.lmark { font-weight: 800; letter-spacing: .02em; white-space: nowrap; font-size: 1rem; padding-top: 1px; }
.lmark i { font-style: normal; font-weight: 500; color: var(--muted); }
.lstep b { display: block; font-size: .95rem; margin-bottom: 3px; }
.lstep small { color: var(--muted); font-size: .8rem; line-height: 1.45; display: block; }
.lstep.now { border-color: var(--accent, #2dd4bf); background: var(--bg-soft); position: relative; }
.lstep.now::after { content: "this protocol"; position: absolute; top: -9px; right: 10px; background: var(--accent, #2dd4bf); color: #0f172a; font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; border-radius: 999px; padding: 1px 8px; }
.larrow { display: grid; place-items: center; color: var(--muted); font-size: 1.3rem; font-weight: 300; }
@media (max-width: 900px) { .lifecycle { grid-template-columns: 1fr; } .larrow { transform: rotate(90deg); padding: 2px 0; } }
