:root {
  --bg: #f4f7fa; --surface: #fbfdff; --ink: #111820; --muted: #5f6d7a;
  --accent: #174fbf; --accent-soft: #e8eefb; --amber: #c74718; --amber-ink: #a63a10; --line: #cbd5de;
  --line-strong: #8997a5; --code-bg: #edf2f6; --link-hover: #0e388e;
  --t-green: #1b6e3f; --t-red: #a63a10; --t-yellow: #765600; --t-blue: #174fbf; --t-magenta: #7d3a99; --t-cyan: #0d6574;
  --serif: 'Source Serif 4', 'Iowan Old Style', Palatino, Georgia, serif;
  --sans: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d151d; --surface: #16232e; --ink: #eaf0f5; --muted: #a9b6c2;
    --accent: #72a2ff; --accent-soft: #1a2c47; --amber: #ff7a45; --amber-ink: #ff7a45; --line: #31414f;
    --line-strong: #667788; --code-bg: #091119; --link-hover: #a8c5ff;
    --t-green: #7ad7a0; --t-red: #ff8a5c; --t-yellow: #e8c15a; --t-blue: #7aa8ff; --t-magenta: #d39af0; --t-cyan: #6fd0df;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d151d; --surface: #16232e; --ink: #eaf0f5; --muted: #a9b6c2;
  --accent: #72a2ff; --accent-soft: #1a2c47; --amber: #ff7a45; --amber-ink: #ff7a45; --line: #31414f;
  --line-strong: #667788; --code-bg: #091119; --link-hover: #a8c5ff;
    --t-green: #7ad7a0; --t-red: #ff8a5c; --t-yellow: #e8c15a; --t-blue: #7aa8ff; --t-magenta: #d39af0; --t-cyan: #6fd0df;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.6; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--link-hover); }
code, pre { font-family: var(--mono); }
p code { font-size: .88em; background: var(--code-bg); padding: .08em .3em; border-radius: 3px; }
pre.cmd { font-size: .88em; background: var(--code-bg); padding: .5em .8em; border-radius: 4px; overflow-x: auto; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* The top bar stays in view while the page scrolls. */
header { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
@supports (backdrop-filter: blur(8px)) {
  header { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
}
section.note h2[id] { scroll-margin-top: 88px; }
/* One section is in focus at a time: the one near the upper middle of the
   screen. The others dim (set up by the script at the end; without it, or
   when printing, everything is at full strength). */
.focus-mode .opening > .wrap, .focus-mode section.note { opacity: .38; transition: opacity .45s ease; }
.focus-mode .opening > .wrap.in-focus, .focus-mode section.note.in-focus { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .focus-mode .opening > .wrap, .focus-mode section.note { transition: none; } }
@media print { .focus-mode .opening > .wrap, .focus-mode section.note { opacity: 1; } }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 18px; flex-wrap: wrap; }
.wordmark { display: inline-flex; color: var(--ink); }
.brand { display: inline-flex; align-items: center; gap: 14px; }
.tagline { font-family: var(--mono); font-size: 12.5px; letter-spacing: .04em; color: var(--muted); padding-left: 14px; border-left: 1px solid var(--line); }
.wordmark svg { height: 34px; width: auto; display: block; }
nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; font-size: 15px; }
nav a { color: var(--ink); text-decoration: none; }
nav a:hover { color: var(--accent); }
.theme-toggle { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.theme-toggle:hover { color: var(--ink); border-color: var(--line-strong); }
.theme-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }

.opening { padding: 72px 0 64px; border-bottom: 1px solid var(--line); }
.kicker { font-family: var(--mono); font-size: 13px; color: var(--muted); letter-spacing: .04em; margin: 0 0 18px; }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 4.6vw, 52px); line-height: 1.12; letter-spacing: -.01em; margin: 0 0 24px; max-width: 22ch; }
.lede { font-size: 19px; max-width: 54ch; margin: 0; }

/* Hero trace: one session as SASY sees it. */
.trace { margin: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 18px 20px 20px; font-family: var(--mono); font-size: 13px; line-height: 1.5; }
.trace figcaption { color: var(--muted); font-size: 11.5px; letter-spacing: .06em; margin: 0 0 12px; }
.trace ol { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.trace ol::before { content: ""; position: absolute; left: 4px; top: 14px; bottom: 14px; border-left: 1px solid var(--line-strong); }
.trace li { position: relative; padding: 6px 0; display: flex; flex-wrap: wrap; gap: 0 10px; }
.trace li::before { content: ""; position: absolute; left: -22px; top: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--accent); }
.trace li.call::before { background: var(--amber); border-color: var(--amber); }
.trace .t { color: var(--ink); font-weight: 500; }
.trace .a { color: var(--muted); }
.trace .verdict { margin: 14px 0 0; padding: 10px 12px; border-left: 3px solid var(--amber); background: var(--code-bg); font-family: var(--sans); font-size: 14px; line-height: 1.45; }
.trace .verdict b { display: block; font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; color: var(--amber-ink); font-weight: 500; margin-bottom: 2px; }
/* Hero comparison: the same request with and without the untrusted note. */
.compare { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-top: 44px; }
/* "Read more" links at the end of a section: where each one goes, then its title. */
.more { display: flex; flex-direction: column; gap: 6px; margin: 22px 0 0; }
.more a { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: baseline; text-decoration: none; color: var(--accent); width: fit-content; max-width: 100%; }
.more a:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 3px; }
.more-kind { font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
/* Text that explains the box above it. */
section.note p.caption { font-family: var(--serif); font-style: italic; color: var(--muted); }
section.note p.caption code { font-style: normal; }
.compare-label { grid-column: 1 / -1; margin: 0 0 4px; max-width: 62ch; font-family: var(--serif); font-style: italic; font-size: 19px; line-height: 1.5; color: var(--ink); }
.compare .trace { display: flex; flex-direction: column; }
.compare .trace ol { flex: 1; }
.trace li.untrusted::before { border-color: var(--amber); }
.trace li.call.ok::before { background: var(--t-green); border-color: var(--t-green); }
.trace .q { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.trace .verdict.ok { border-left-color: var(--t-green); }
.trace .verdict.ok b { color: var(--t-green); }

.band { border-bottom: 1px solid var(--line); }
section.note { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 64px 0; }
section.note > div, .foot > div { min-width: 0; }
.rail { font-family: var(--mono); font-size: 13px; color: var(--muted); letter-spacing: .04em; }
/* Text beside its visual, where both fit. */
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: start; }
.split .start + p { margin-top: 14px; }
.split.wide-visual { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 48px; }
.split > div > :last-child { margin-bottom: 0; }
.split .arch, .split .start { margin: 0; max-width: none; }
.split .start { grid-template-columns: minmax(0, 1fr); }
section.note h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 3vw, 34px); line-height: 1.2; margin: 0 0 20px; max-width: 28ch; }
section.note p { max-width: 64ch; margin: 0 0 16px; }

/* Architecture diagram: inline SVG that follows the page theme. */
.arch { margin: 8px 0 24px; max-width: 760px; }
.arch svg { display: block; width: 100%; height: auto; }
.arch .mobile { display: none; }
.arch .group { fill: none; stroke: var(--line-strong); stroke-dasharray: 4 4; }
.arch .group-label { fill: var(--muted); font-family: var(--mono); font-size: 12px; letter-spacing: .06em; }
.arch .box { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.2; }
.arch .engine { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.arch .chip { fill: var(--surface); stroke: var(--accent); stroke-width: 1; }
.arch .title { fill: var(--ink); font-family: var(--sans); font-size: 15px; font-weight: 600; }
.arch .sub { fill: var(--muted); font-family: var(--sans); font-size: 13px; }
.arch .edge { stroke: var(--muted); stroke-width: 1.4; fill: none; }
.arch .head { fill: var(--muted); }
.arch .edge-label { fill: var(--muted); font-family: var(--mono); font-size: 12.5px; }
.arch .edge-label.narrow { font-size: 11px; }  /* fits the gap between two boxes */
.arch .deny { stroke: var(--amber); }
.arch .head-deny { fill: var(--amber); }
.arch .deny-label { fill: var(--amber-ink); }
.arch .g-edge { stroke: var(--line-strong); stroke-width: 1.2; }
.arch .g-node { fill: var(--surface); stroke: var(--accent); stroke-width: 1.3; }
.arch .g-call { fill: var(--amber); }

.code-block { margin: 24px 0; max-width: 760px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--code-bg); }
.code-head { font-family: var(--mono); font-size: 12px; color: var(--muted); padding: 8px 18px; border-bottom: 1px solid var(--line); }
pre.code { margin: 0; padding: 18px; font-size: 14px; line-height: 1.7; overflow-x: auto; }
pre.code .c { color: var(--muted); }

/* Replay of a recorded demo run (data in demo/message-flow.json). */
.term { margin: 24px 0; max-width: 760px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--code-bg); }
.term-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 10px 6px 16px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--muted); }
.term-controls { display: flex; gap: 6px; }
.term-bar button { font: inherit; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 4px; padding: 2px 8px; cursor: pointer; }
.term-bar button:hover:enabled { color: var(--ink); border-color: var(--line-strong); }
.term-bar button:disabled { opacity: .5; cursor: default; }
.term-bar button.waiting { color: var(--accent); border-color: var(--accent); }
.term-pause { min-width: 76px; }
.term-bar button { white-space: nowrap; }
.term-out { margin: 0; height: 440px; overflow: auto; padding: 14px 16px; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; color: var(--ink); white-space: pre; }
.term-out .b { font-weight: 600; }
.term-out .d { color: var(--muted); }
.term-out .green { color: var(--t-green); } .term-out .red { color: var(--t-red); }
.term-out .yellow { color: var(--t-yellow); } .term-out .blue { color: var(--t-blue); }
.term-out .magenta { color: var(--t-magenta); } .term-out .cyan { color: var(--t-cyan); }
.term-out .cmd, .term-out .gray { color: var(--muted); }
.term-out .rule { display: block; overflow: hidden; }

/* Policy check card: numbered rules and the analyzer's findings. */
.rules, .report { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--code-bg); }
.report { margin-top: 16px; background: var(--surface); }
.rules-head { font-family: var(--mono); font-size: 12px; color: var(--muted); padding: 8px 16px; border-bottom: 1px solid var(--line); }
.rules ol { list-style: none; margin: 0; padding: 10px 0; counter-reset: rule; }
.rules li { counter-increment: rule; display: grid; grid-template-columns: 30px minmax(0, 1fr); padding: 6px 16px 6px 8px; border-left: 3px solid transparent; }
.rules li::before { content: counter(rule); font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; padding: 2px 10px 0 0; }
.rules li.added { border-left-color: var(--amber); background: var(--surface); }
.rules pre { margin: 0; font-family: var(--mono); font-size: 13px; line-height: 1.55; white-space: pre; overflow-x: auto; color: var(--ink); }
.rules pre .k { color: var(--accent); }
.rules pre .c { color: var(--muted); }
.rules .tag { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--amber-ink); margin-bottom: 2px; }
.report ul { list-style: none; margin: 0; padding: 6px 16px 10px; }
.report li { padding: 8px 0; display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 12px; font-size: 15.5px; line-height: 1.5; }
.report li + li { border-top: 1px solid var(--line); }
.report b { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .04em; padding-top: 3px; }
.report b.contradiction { color: var(--amber-ink); }
.report b.redundant { color: var(--accent); }

/* Dependency graph beside the replay (data in demo/message-flow.json). */
section.note.wide { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.replay-pair { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; margin: 24px 0; }
.replay-pair .term { margin: 0; max-width: none; }
section.note.wide > div > .term { max-width: none; }
section.note.wide > div > .start { max-width: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
.replay-pair.no-graph { grid-template-columns: minmax(0, 1fr); }
.graph { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.graph .term-bar { min-height: 38px; justify-content: flex-start; }
.graph svg { display: block; width: 100%; height: auto; }
.graph .off { opacity: 0; }
.g-node, .g-edge, .g-verdict { transition: opacity .35s, stroke .35s; }
.g-node rect { fill: var(--bg); stroke: var(--muted); stroke-width: 1.2; }
.g-node.hit-src rect, .g-node.hit-deny rect { stroke: var(--amber); stroke-width: 2; }
.g-title { font-family: var(--mono); font-size: 12.5px; font-weight: 600; fill: var(--ink); }
.g-detail { font-family: var(--mono); font-size: 12px; fill: var(--muted); }
.g-tag { font-family: var(--mono); font-size: 11px; }
.g-tag.untrusted { fill: var(--amber-ink); }
.g-tag.sensitive { fill: var(--accent); }
.g-verdict { font-family: var(--mono); font-size: 11.5px; font-weight: 600; }
.g-verdict.allowed { fill: var(--t-green); }
.g-verdict.denied { fill: var(--amber-ink); }
.g-edge { fill: none; stroke: var(--muted); stroke-width: 1.3; }
.g-edge.hit { stroke: var(--amber); stroke-width: 2; }
.g-head { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) {
  .g-node, .g-edge, .g-verdict { transition: none; }
}
.g-head.hit { stroke: var(--amber); stroke-width: 2; }
pre.code .k { color: var(--accent); }

.start { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 860px; margin-bottom: 20px; }
.start-card { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 16px 18px; min-width: 0; }
.start-card .label { font-size: 13px; font-family: var(--mono); font-weight: 500; color: var(--muted); margin: 0 0 10px; letter-spacing: .03em; }
.start-card pre { margin: 0; font-size: 14px; line-height: 1.7; overflow-x: auto; white-space: pre; }
.start-card p { font-size: 14px; color: var(--muted); margin: 10px 0 0; }


footer { padding: 40px 0 56px; color: var(--muted); font-size: 14.5px; }
.foot { display: grid; grid-template-columns: 180px 1fr; gap: 32px; }
.foot ul { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.foot p { margin: 0 0 8px; max-width: 70ch; }

@media (max-width: 760px) {
  body { font-size: 16px; }
  .opening { padding: 44px 0 44px; }
  .bar { flex-wrap: nowrap; gap: 12px; padding-block: 14px; }
  .tagline { display: none; }
  .wordmark svg { height: 26px; }
  .lede, .compare-label { font-size: 17px; }
  .start, section.note.wide > div > .start { grid-template-columns: 1fr; }
  .report li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .start-card pre { white-space: pre-wrap; }
  pre.cmd { font-size: .8em; }
  .term-out { height: 380px; font-size: 11px; padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
  .term-out .rule { white-space: pre; overflow-wrap: normal; }
  .term-bar .term-label { display: none; }
  .term-bar { justify-content: flex-end; }
  section.note { gap: 12px; padding: 44px 0; }
  .foot { grid-template-columns: 1fr; gap: 12px; }
  nav { gap: 12px; font-size: 14px; flex-wrap: nowrap; }
  .theme-toggle { width: 30px; height: 30px; }
}
@media (max-width: 980px) {
  .split, .split.wide-visual { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .replay-pair { grid-template-columns: minmax(0, 1fr); }
  .graph { max-width: 420px; }
}
@media (max-width: 900px) {
  .compare { grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 32px; }
}
@media (max-width: 380px) {
  .rules pre { font-size: 12px; }
  pre.cmd { font-size: .7em; padding-inline: .6em; }
  .rules li { padding-right: 10px; }
  .wrap { padding-inline: 16px; }
  .bar { gap: 10px; }
  .wordmark svg { height: 22px; }
  nav { gap: 7px; font-size: 13px; }
  .theme-toggle { width: 28px; height: 28px; }
}
@media (max-width: 640px) {
  .arch .desktop { display: none; }
  .arch .mobile { display: block; max-width: 380px; }
}
