/* GLARS — site styles
   Monochrome, document-like: warm paper, near-black ink, heavy rules,
   serif headings, sans body, mono labels. Colour is reserved for risk levels. */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url('../fonts/inter-latin.woff2') format('woff2');
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/jetbrains-mono-latin.woff2') format('woff2');
}

@font-face {
    font-family: 'Source Serif 4';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url('../fonts/source-serif-4-latin.woff2') format('woff2');
}

@font-face {
    font-family: 'Source Serif 4';
    font-style: italic;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/source-serif-4-italic-latin.woff2') format('woff2');
}

/* ---------- Tokens ---------- */

:root {
    color-scheme: light;

    --bg: #f7f6f3;
    --surface: #f0efe9;
    --surface-2: #e8e6df;
    --border: #ddd8d0;
    --rule: #1a1a1a;

    --ink: #1a1a1a;
    --ink-mid: #4a4a4a;
    --ink-light: #6b6b6b;

    --accent: #1a1a1a;
    --accent-ink: #4a4a4a;

    --risk-high: #b91c1c;
    --risk-medium: #a16207;
    --risk-low: #15803d;
    --risk-info: #1d4ed8;

    --footer-bg: #1a1a1a;
    --footer-ink: #f0efe9;
    --footer-ink-light: #a8a8a8;
    --footer-border: #3a3a3a;

    --font-sans: 'Inter', 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, 'Courier New', monospace;
    --font-serif: 'Source Serif 4', 'Iowan Old Style', Georgia, 'Times New Roman', serif;

    --measure: 72ch;
    --page: 1160px;
    --gutter: clamp(1rem, 4vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #141414;
        --surface: #1b1b1b;
        --surface-2: #232323;
        --border: #34322f;
        --rule: #f0efe9;
        --ink: #f0efe9;
        --ink-mid: #c9c6bf;
        --ink-light: #9d9a93;
        --accent: #f0efe9;
        --accent-ink: #c9c6bf;
        --risk-high: #f87171;
        --risk-medium: #fbbf24;
        --risk-low: #4ade80;
        --risk-info: #93c5fd;
        --footer-bg: #0b0b0b;
        --footer-border: #2a2a2a;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #141414;
    --surface: #1b1b1b;
    --surface-2: #232323;
    --border: #34322f;
    --rule: #f0efe9;
    --ink: #f0efe9;
    --ink-mid: #c9c6bf;
    --ink-light: #9d9a93;
    --accent: #f0efe9;
    --accent-ink: #c9c6bf;
    --risk-high: #f87171;
    --risk-medium: #fbbf24;
    --risk-low: #4ade80;
    --risk-info: #93c5fd;
    --footer-bg: #0b0b0b;
    --footer-border: #2a2a2a;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.65;
    color: var(--ink-mid);
    background-color: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

main {
    flex: 1;
}

h1, h2, h3, h4 {
    font-family: var(--font-serif);
    color: var(--ink);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.005em;
    margin-bottom: 0.75rem;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); font-weight: 650; letter-spacing: -0.015em; line-height: 1.06; }
h2 { font-size: clamp(1.55rem, 3vw, 2.05rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p {
    margin-bottom: 1rem;
}

p:last-child {
    margin-bottom: 0;
}

strong {
    color: var(--ink);
    font-weight: 700;
}

a {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--ink-light);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color 0.15s, text-decoration-color 0.15s;
}

a:hover {
    text-decoration-color: var(--ink);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

ul, ol {
    padding-left: 1.25rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.35rem;
}

li > ul {
    margin: 0.35rem 0 0;
}

code, pre, kbd {
    font-family: var(--font-mono);
    font-size: 0.875em;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

img, svg {
    max-width: 100%;
}

[hidden] {
    display: none !important;
}

::selection {
    background: var(--ink);
    color: var(--bg);
}

.container {
    width: 100%;
    max-width: var(--page);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.skip-link {
    position: absolute;
    left: var(--gutter);
    top: -3rem;
    z-index: 100;
    padding: 0.5rem 1rem;
    background: var(--ink);
    color: var(--bg);
    font-weight: 700;
    text-decoration: none;
}

.skip-link:focus {
    top: 0.75rem;
}

/* Mono "eyebrow" label used above headings and in metadata */
.eyebrow {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-light);
    margin-bottom: 0.75rem;
}

/* ---------- Header ---------- */

.site-header {
    border-bottom: 2px solid var(--rule);
}

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 2rem;
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
}

.wordmark {
    display: inline-flex;
    flex-direction: column;
    gap: 0.2rem;
    text-decoration: none;
    color: var(--ink);
}

.wordmark:hover {
    color: var(--ink);
}

.wordmark-name {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.65rem;
    line-height: 1;
    letter-spacing: 0.06em;
}

.wordmark-dot {
    color: var(--ink-light);
}

.wordmark-tag {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-light);
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 1.5rem;
}

.site-nav a {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--ink-light);
    padding: 0.35rem 0;
    border-bottom: 2px solid transparent;
}

.site-nav a:hover {
    color: var(--ink);
}

.site-nav a[aria-current="page"] {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.theme-toggle:hover {
    border-color: var(--rule);
}

.theme-toggle .icon-sun { display: none; }

:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* ---------- Hero ---------- */

.hero-section {
    padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(2rem, 5vw, 3.5rem);
    border-bottom: 1px solid var(--border);
    margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.hero-content h1 {
    max-width: 18ch;
    margin-bottom: 1.25rem;
}

.hero-content p {
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    line-height: 1.5;
    max-width: 52ch;
    color: var(--ink-mid);
}

/* ---------- Layout ---------- */

.main-content {
    min-width: 0;
}

.content-grid {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4rem);
}

.sidebar {
    position: sticky;
    top: 1.5rem;
    align-self: start;
}

.toc {
    border-top: 3px solid var(--rule);
    padding-top: 1rem;
}

.toc::before {
    content: 'Contents';
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-light);
    margin-bottom: 0.75rem;
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc li {
    margin: 0;
}

.toc a {
    display: block;
    padding: 0.4rem 0 0.4rem 0.75rem;
    border-left: 2px solid var(--border);
    font-size: 0.875rem;
    color: var(--ink-light);
    text-decoration: none;
}

.toc a:hover {
    color: var(--ink);
}

.toc a.active {
    color: var(--ink);
    font-weight: 700;
    border-left-color: var(--accent);
}

.content-section {
    margin-bottom: clamp(3rem, 6vw, 4.5rem);
    scroll-margin-top: 1.5rem;
}

.content-section > h2 {
    padding-top: 1rem;
    border-top: 3px solid var(--rule);
    margin-bottom: 1.25rem;
}

.content-section > p {
    max-width: var(--measure);
}

/* ---------- Generic card system ---------- */

.principle-card,
.resource-card,
.component-card,
.factor-item,
.enforcement-category,
.interaction-type,
.data-category,
.use-case,
.phase,
.entity,
.callout {
    background: transparent;
    border: 1px solid var(--border);
    border-top: 3px solid var(--rule);
    padding: 1.5rem;
}

.components-grid,
.factor-grid,
.enforcement-categories,
.interaction-types,
.use-cases {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.principle-card h3,
.resource-card h3 {
    margin-bottom: 0.6rem;
}

.principle-card p,
.resource-card p,
.use-case p {
    font-size: 0.95rem;
}

.resource-card {
    display: flex;
    flex-direction: column;
    transition: background-color 0.15s;
}

.resource-card:hover {
    background: var(--surface);
}

.resource-card p {
    flex: 1;
    margin-bottom: 1.25rem;
}

.resource-link {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--ink);
}

.principles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0;
}

@media (min-width: 561px) and (max-width: 1000px) {
    .principles-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.resource-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.hero-content .hero-detail {
    margin-top: 1rem;
    font-size: 1rem;
    max-width: 62ch;
}

/* ---------- Quote ---------- */

.author-quote {
    margin: 0 0 clamp(2.5rem, 6vw, 4rem);
    padding: 0 0 0 1.5rem;
    border-left: 3px solid var(--rule);
    max-width: 62rem;
}

.quote-icon {
    display: none;
}

.author-quote p {
    font-family: var(--font-serif);
    font-size: clamp(1.2rem, 2.4vw, 1.5rem);
    line-height: 1.45;
    font-weight: 400;
    color: var(--ink);
    margin-bottom: 0.85rem;
}

.quote-attribution {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.05rem;
    color: var(--ink-mid);
}

.quote-attribution::before {
    content: '\2014\00a0';
}

/* ---------- Info / callout cards ---------- */

.info-card {
    background: var(--surface);
    border-left: 3px solid var(--rule);
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    max-width: var(--measure);
}

.info-header {
    margin-bottom: 0.5rem;
}

.info-header h3 {
    margin: 0;
}

.info-icon {
    display: none;
}

.info-card ul {
    margin: 0.75rem 0 1rem;
}

.callout {
    background: var(--surface);
    margin: 1.5rem 0;
}

.callout h3 {
    margin-top: 0;
}

/* ---------- Component / factor cards (Evolution) ---------- */

.component-header,
.phase-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.component-header h3,
.phase-header h3 {
    margin: 0;
}

.component-icon,
.phase-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--bg);
    background: var(--ink);
}

.phase-icon {
    background: transparent;
    color: var(--ink);
    border: 2px solid var(--rule);
}

.component-card p {
    font-size: 0.95rem;
}

.factor-item h4,
.enforcement-category h4,
.interaction-type h4,
.data-category h4 {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.factor-item p,
.enforcement-category p,
.interaction-type p {
    font-size: 0.95rem;
}

.factor-metrics,
.data-category ul {
    list-style: none;
    padding: 0;
    margin: 0.85rem 0 0;
}

.factor-metrics li,
.data-category li {
    position: relative;
    padding-left: 1rem;
    font-size: 0.9rem;
}

.factor-metrics li::before,
.data-category li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 0.4rem;
    height: 2px;
    background: var(--ink-light);
}

/* Tags and badges: mono, outlined, no fills */
.metric-tag,
.multiplier-tag,
.effect-tag,
.risk-badge,
.risk-badge-small {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.4;
    padding: 0.1rem 0.45rem;
    border: 1px solid currentColor;
    color: var(--ink-light);
    white-space: nowrap;
}

.metric-tag { color: var(--ink); }
.multiplier-tag { color: var(--ink); }

.effect-tag.positive,
.risk-badge-high,
.risk-badge.high { color: var(--risk-high); }

.effect-tag.negative,
.risk-badge-low,
.risk-badge.low { color: var(--risk-low); }

.effect-tag.variable,
.risk-badge-medium,
.risk-badge.medium { color: var(--risk-medium); }

.risk-badge-small {
    margin-left: 0.5rem;
    vertical-align: 2px;
}

.score-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--ink-light);
}

.score-bar {
    flex: 1;
    height: 6px;
    background: var(--surface-2);
}

.score-fill {
    height: 100%;
    background: var(--ink);
}

.score-fill.w-40 { width: 40%; }
.score-fill.w-55 { width: 55%; }
.score-fill.w-65 { width: 65%; }
.score-fill.w-70 { width: 70%; }
.score-fill.w-75 { width: 75%; }

.implementation-note {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    font-size: 0.925rem;
    color: var(--ink-mid);
}

/* Data sensitivity tiers */
.data-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.data-category { padding: 1.25rem; }
.data-category.critical { border-top-color: var(--risk-high); }
.data-category.sensitive { border-top-color: var(--risk-medium); }
.data-category.confidential { border-top-color: var(--ink-light); }
.data-category.restricted { border-top-color: var(--risk-info); }
.data-category.public { border-top-color: var(--risk-low); }

.implementation-phases {
    margin: 1.5rem 0;
    display: grid;
    gap: 1.25rem;
}

.phase ul {
    margin: 0;
}

/* ---------- Example / formula cards ---------- */

.example-card,
.formula-card {
    border: 1px solid var(--border);
    border-top: 3px solid var(--rule);
    margin: 1.5rem 0;
}

.example-card > h3,
.formula-card > h3 {
    margin: 0;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.example-content {
    padding: 1.5rem;
}

.formula {
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    overflow-x: auto;
}

.formula-text {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--ink);
    margin: 0;
    white-space: pre-wrap;
}

.formula-text .variable {
    font-style: italic;
}

.formula-explanation {
    padding: 1rem 1.5rem 1.25rem;
    font-size: 0.925rem;
}

/* ---------- Tables ---------- */

.table-scroll {
    overflow-x: auto;
    margin: 1.5rem 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.925rem;
}

.table-scroll table {
    margin: 0;
}

th, td {
    padding: 0.7rem 0.85rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}

th {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-light);
    border-bottom: 2px solid var(--rule);
}

td strong {
    white-space: nowrap;
}

/* ---------- Call to action ---------- */

.call-to-action {
    margin: clamp(2.5rem, 6vw, 4rem) 0 0;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    background: var(--surface);
    border-top: 3px solid var(--rule);
}

.call-to-action h3 {
    font-size: clamp(1.3rem, 2.5vw, 1.6rem);
}

.call-to-action p {
    max-width: 56ch;
    margin-bottom: 1.5rem;
}

.cta-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.cta-button {
    display: inline-block;
    padding: 0.75rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    border: 2px solid var(--rule);
    transition: background-color 0.15s, color 0.15s;
}

.cta-button.primary {
    background: var(--ink);
    color: var(--bg);
}

.cta-button.primary:hover {
    background: var(--ink-mid);
    border-color: var(--ink-mid);
}

.cta-button.secondary {
    color: var(--ink);
}

.cta-button.secondary:hover {
    background: var(--ink);
    color: var(--bg);
}

/* ---------- Journey timeline (Follow the data) ----------
   Static: every stage, power and connection is visible at once, on screen
   and on paper. Time runs left to right, or top to bottom on narrow screens
   and in print. */

.timeline {
    margin: 2.5rem 0 3.5rem;
}

.timeline-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1.5rem;
    padding-top: 0.85rem;
    border-top: 2px solid var(--rule);
}

.timeline-head h2 {
    margin: 0;
}

.timeline-meta {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-light);
}

.timeline-lede {
    max-width: var(--measure);
    margin: 0.85rem 0 0;
}

.timeline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.5rem;
    margin: 1.25rem 0 1.75rem;
    padding: 0;
    list-style: none;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--ink-light);
}

.timeline-legend li {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
}

.tl-key {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.tl-key.high { background: var(--risk-high); }
.tl-key.medium { background: var(--risk-medium); }

.tl-hint {
    color: var(--ink-mid);
}

.tl-stages {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* The time axis, with an arrowhead */
.tl-stages::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 0;
    right: 6px;
    height: 2px;
    background: var(--rule);
}

.tl-stages::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 0;
    border: 5px solid transparent;
    border-left: 7px solid var(--rule);
    border-right: 0;
}

.tl-stage {
    position: relative;
    margin: 0;
    padding-top: 1.75rem;
}

/* The stage marker on the axis */
.tl-stage::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--ink);
    box-shadow: 0 0 0 4px var(--bg);
}

.tl-stage-head {
    min-height: 8rem;
    padding-bottom: 0.6rem;
}

.tl-when,
.tl-where,
.tl-power-meta {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--ink-light);
}

.tl-when {
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.tl-stage-title {
    margin: 0.35rem 0 0;
    font-size: 1.05rem;
    line-height: 1.25;
}

.tl-where {
    margin-top: 0.45rem;
}

/* Each stage's powers hang from a rail under its marker */
.tl-powers {
    margin: 0 0 0 6px;
    padding: 0 0 0 1rem;
    list-style: none;
    border-left: 1px solid var(--border);
}

/* Each power has a left and right edge that lights up when it is on the
   selected path (see timeline.js); everything else dims and blurs. */
.tl-power {
    position: relative;
    margin: 0 0 0.2rem;
    padding: 0.35rem 0.6rem 0.5rem;
    border-left: 2px solid transparent;
    border-right: 2px solid transparent;
    cursor: pointer;
    transition: opacity 0.2s ease, filter 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.tl-power::before {
    content: '';
    position: absolute;
    top: 0.77rem;
    left: calc(-1rem - 2px - 4.5px);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ink-light);
    box-shadow: 0 0 0 3px var(--bg);
}

.tl-power.high::before { background: var(--risk-high); }
.tl-power.medium::before { background: var(--risk-medium); }
.tl-power.high .tl-level { color: var(--risk-high); }
.tl-power.medium .tl-level { color: var(--risk-medium); }

.tl-power-name {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.25;
}

.tl-power-meta {
    margin: 0.2rem 0 0;
}

/* Collapsed to name and meta line; the "why it matters here" sentence opens
   for the power you point at, tab to or tap. Still read by screen readers
   (it is clipped, not removed) and always shown in print. */
.tl-power-why {
    max-height: 0;
    margin: 0;
    overflow: hidden;
    opacity: 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--ink-mid);
    transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.2s ease;
}

.tl-power:hover .tl-power-why,
.tl-power:focus-within .tl-power-why,
.tl-power.is-origin .tl-power-why {
    max-height: 14rem;
    margin-top: 0.4rem;
    opacity: 1;
}

.tl-power:focus-visible {
    outline: 2px solid var(--rule);
    outline-offset: 2px;
}

.tl-stages.has-path .tl-power:not(.is-path),
.tl-stages.has-path .tl-stage:not(.is-path) .tl-stage-head {
    opacity: 0.35;
    filter: blur(0.75px);
}

.tl-stage-head {
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.tl-power.is-path {
    border-left-color: var(--rule);
    border-right-color: var(--rule);
}

.tl-power.is-origin {
    background: var(--surface);
}

/* The path in words: for screen readers on screen, printed on paper */
.tl-power-links {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tl-refs {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 400;
    vertical-align: super;
}

.tl-ref {
    margin-left: 0.2em;
    text-decoration: none;
}

.tl-ref::before { content: '['; }
.tl-ref::after { content: ']'; }

.timeline-summary {
    max-width: var(--measure);
    margin: 0.5rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--ink-mid);
}

.timeline-sources {
    margin-top: 1.25rem;
    font-size: 0.8rem;
}

.timeline-sources-title {
    margin: 0 0 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-light);
}

.timeline-sources ol {
    margin: 0;
    padding-left: 1.5rem;
    columns: 2 22rem;
    column-gap: 2rem;
}

.timeline-sources li {
    margin: 0 0 0.25rem;
    break-inside: avoid;
}

.journey-detail-title {
    margin: 0 0 1.25rem;
    padding-top: 0.85rem;
    border-top: 2px solid var(--rule);
}

/* Narrow screens and print: time runs top to bottom */
@media (max-width: 900px), print {
    .tl-stages {
        grid-template-columns: minmax(0, 1fr);
    }

    .tl-stages::before {
        top: 0;
        bottom: 6px;
        left: 6px;
        right: auto;
        width: 2px;
        height: auto;
    }

    .tl-stages::after {
        top: auto;
        bottom: 0;
        left: 2px;
        right: auto;
        border: 5px solid transparent;
        border-top: 7px solid var(--rule);
        border-bottom: 0;
    }

    .tl-stage {
        padding: 0 0 1.25rem 2rem;
    }

    .tl-stage::before {
        top: 0.1rem;
    }

    .tl-stage-head {
        min-height: 0;
        padding-bottom: 0.6rem;
    }

    .tl-powers {
        margin-left: 0;
    }
}

@media print {
    .tl-power {
        break-inside: avoid;
    }

    .tl-stages.has-path .tl-power,
    .tl-stages.has-path .tl-stage-head {
        opacity: 1;
        filter: none;
    }

    .tl-power.is-path {
        border-color: transparent;
    }

    .tl-power-why {
        max-height: none;
        margin-top: 0.4rem;
        opacity: 1;
    }

    .tl-power-links {
        position: static;
        width: auto;
        height: auto;
        margin: 0.3rem 0 0;
        overflow: visible;
        clip: auto;
        white-space: normal;
        font-size: 0.75rem;
        color: var(--ink-mid);
    }

    /* Keep a stage heading with its first power: the invisible block below
       the heading needs room on the same page, so a heading with no space
       under it moves to the next page instead of being left alone. */
    .tl-stage-head {
        break-inside: avoid;
    }

    .tl-stage-head::after {
        content: '';
        display: block;
        height: 7rem;
        margin-bottom: -7rem;
    }

    .tl-stage::before,
    .tl-power::before {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* ---------- Journey page ---------- */

.journey-diagram {
    position: relative;
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.connection-lines {
    display: none;
}

.entity {
    position: relative;
    background: var(--bg);
}

.entity:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 2.6rem;
    bottom: calc(-1.5rem - 1px);
    width: 2px;
    height: 1.5rem;
    background: var(--rule);
}

.entity > p {
    max-width: var(--measure);
}

.entity-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.entity-code {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--bg);
    background: var(--ink);
}

.entity-title {
    font-size: 1.35rem;
    margin: 0;
}

.entity-subtitle {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-light);
    margin: 0.25rem 0 0;
}

.jurisdiction-agencies {
    margin: 1.25rem 0;
}

.jurisdiction-agencies h4 {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-light);
}

.agency-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.agency-list li {
    margin: 0;
    padding: 0.2rem 0.6rem;
    background: var(--surface);
    font-size: 0.85rem;
}

.jurisdiction-factors {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
    gap: 0.85rem;
    margin-top: 1rem;
}

.jurisdiction-factor {
    padding: 0.9rem 1rem;
    border-left: 3px solid var(--border);
    background: var(--surface);
    font-size: 0.9rem;
}

.jurisdiction-factor > div > div {
    margin-top: 0.3rem;
}

.factor-high { border-left-color: var(--risk-high); }
.factor-medium { border-left-color: var(--risk-medium); }
.factor-low { border-left-color: var(--risk-low); }

.interaction {
    border: 1px solid var(--border);
    border-top: 3px solid var(--rule);
    background: var(--surface);
    padding: 1.5rem;
}

.interaction-title {
    font-size: 1.35rem;
}

.interaction .jurisdiction-factor {
    background: var(--bg);
}

.vector-notation {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--ink);
    padding: 1rem 1.25rem;
    background: var(--surface);
    border-left: 3px solid var(--rule);
    overflow-wrap: anywhere;
    margin: 0.75rem 0 2rem;
}

.example-rows {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1.25rem;
}

.example-rows > div > div:not(.example-header) {
    color: var(--ink);
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.example-rows p {
    font-size: 0.875rem;
}

.example-header {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-light);
    margin-bottom: 0.35rem;
}

/* ---------- Deep Dive (long-form prose) ---------- */

.prose {
    max-width: 52rem;
}

.prose > p,
.prose > ul,
.prose > ol,
.prose > blockquote {
    max-width: var(--measure);
}

.prose h2 {
    margin-top: clamp(3rem, 6vw, 4rem);
    padding-top: 1rem;
    border-top: 3px solid var(--rule);
    scroll-margin-top: 1.5rem;
}

.prose h3 {
    margin-top: 2rem;
    scroll-margin-top: 1.5rem;
}

.prose h4 {
    margin-top: 1.5rem;
}

.prose blockquote {
    margin: 1.25rem 0;
    padding: 0.25rem 0 0.25rem 1.25rem;
    border-left: 3px solid var(--border);
    color: var(--ink-mid);
}

.prose pre {
    margin: 1.25rem 0;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border-left: 3px solid var(--rule);
    overflow-x: auto;
}

.prose pre code {
    color: var(--ink);
    white-space: pre-wrap;
}

.prose :not(pre) > code {
    padding: 0.1rem 0.35rem;
    background: var(--surface-2);
    color: var(--ink);
    overflow-wrap: anywhere;
}

.prose > ul ul {
    margin-bottom: 0;
}

.prose .doc-contents {
    columns: 2 16rem;
    column-gap: 2rem;
    list-style: none;
    padding: 0;
}

.prose .doc-contents li {
    break-inside: avoid;
}

.prose .doc-contents ul {
    list-style: none;
    padding-left: 1rem;
}

.prose .references li {
    overflow-wrap: anywhere;
    font-size: 0.9rem;
}

/* Small labelled tiles used in the roadmap summary */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
    gap: 0.75rem;
    margin: 1rem 0 1.5rem;
    list-style: none;
    padding: 0;
}

.tile-grid li {
    margin: 0;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-top: 3px solid var(--rule);
    font-size: 0.9rem;
}

.tile-grid strong,
.tile-grid span {
    display: block;
}

.tile-grid strong {
    margin-bottom: 0.2rem;
}

.tile-grid .tile-value {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--ink);
}

.tile-grid .amplifying { border-top-color: var(--risk-high); }
.tile-grid .mitigating { border-top-color: var(--risk-low); }
.tile-grid .critical { border-top-color: var(--risk-high); }
.tile-grid .sensitive { border-top-color: var(--risk-medium); }
.tile-grid .confidential { border-top-color: var(--ink-light); }
.tile-grid .restricted { border-top-color: var(--risk-info); }
.tile-grid .public { border-top-color: var(--risk-low); }

.use-case h3 {
    margin-top: 0;
}

/* ---------- 404 ---------- */

.not-found {
    padding: clamp(3rem, 10vw, 7rem) 0;
}

.not-found .code {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--ink);
}

/* ---------- How to use ---------- */

.how-to {
    margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.how-to > h2,
.calc-title {
    padding-top: 1rem;
    border-top: 3px solid var(--rule);
    margin-bottom: 1.5rem;
}

.steps {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
}

.step {
    margin: 0;
    padding: 1.25rem;
    border: 1px solid var(--border);
    background: var(--surface);
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin-bottom: 0.85rem;
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--bg);
    background: var(--ink);
}

.step h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.step p {
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
}

.step .step-aside {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    color: var(--ink-light);
}

.scale {
    margin: 0.5rem 0 0.75rem;
    border-top: 1px solid var(--border);
}

.scale > div {
    display: grid;
    grid-template-columns: 4rem 1fr;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.scale dt {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--ink);
}

.how-to-tip {
    margin-top: 1.25rem;
    font-size: 0.95rem;
    color: var(--ink-mid);
}

.step-tag {
    display: inline-block;
    margin-right: 0.4rem;
    padding: 0.05rem 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    vertical-align: 0.2em;
    color: var(--bg);
    background: var(--ink);
}

@media (max-width: 1000px) {
    .steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .steps {
        grid-template-columns: 1fr;
    }
}

/* ---------- Roadmap ---------- */

.roadmap {
    margin-bottom: clamp(3rem, 8vw, 5rem);
}

.roadmap > h2 {
    padding-top: 1rem;
    border-top: 3px solid var(--rule);
}

.roadmap-intro {
    max-width: var(--measure);
}

.roadmap-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 1.25rem;
}

.roadmap-list li {
    margin: 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    scroll-margin-top: 1.5rem;
}

.roadmap-list .step-num {
    background: transparent;
    color: var(--ink);
    border: 2px solid var(--rule);
}

.roadmap-list h3 {
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
}

.roadmap-list p {
    font-size: 0.9rem;
}

/* ---------- Juri links ---------- */

.ext-mark {
    margin-left: 0.2em;
}

.juri-tip {
    position: fixed;
    z-index: 50;
    display: grid;
    gap: 0.35rem;
    padding: 0.8rem 0.95rem;
    font-size: 0.82rem;
    line-height: 1.45;
    text-align: left;
    color: var(--bg);
    background: var(--ink);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

.juri-tip strong,
.juri-tip small {
    color: inherit;
}

.juri-tip strong {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.juri-tip small {
    font-size: 0.75rem;
    opacity: 0.75;
}

/* ---------- Calculator ---------- */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hero-compact {
    padding: clamp(2rem, 5vw, 3.25rem) 0 clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 0;
    border-bottom: none;
}

.hero-compact h1 {
    max-width: none;
}

.calculator {
    margin-bottom: clamp(3rem, 8vw, 5rem);
}

.calc-examples {
    margin-bottom: 1.75rem;
}

.calc-result {
    margin-top: 0;
}

.calc-select,
.calc-text,
.calc-number {
    font: inherit;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0;
}

.calc-select {
    width: 100%;
    max-width: 34rem;
    padding: 0.65rem 2.25rem 0.65rem 0.85rem;
    font-weight: 600;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
    background-position: calc(100% - 1.15rem) 55%, calc(100% - 0.8rem) 55%;
    background-size: 0.35rem 0.35rem;
    background-repeat: no-repeat;
    cursor: pointer;
}

.calc-select:hover,
.calc-text:hover,
.calc-number:hover {
    border-color: var(--ink-light);
}

.template-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.template-button {
    padding: 0.55rem 0.85rem;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: left;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0;
    cursor: pointer;
}

.template-button:hover {
    border-color: var(--rule);
}

.template-button[aria-pressed="true"] {
    color: var(--bg);
    background: var(--ink);
    border-color: var(--ink);
}

.example-explainer {
    margin-top: 1.25rem;
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border-left: 3px solid var(--rule);
}

.example-explainer h2 {
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    margin-bottom: 0.5rem;
}

.example-explainer .eyebrow {
    margin-bottom: 0.5rem;
}

.example-summary {
    color: var(--ink);
}

.example-explainer p {
    font-size: 0.95rem;
    max-width: var(--measure);
}

.example-more {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
}

.example-more[open] summary {
    margin-bottom: 0.75rem;
}

.example-sources {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

.example-sources ul {
    margin: 0;
    font-size: 0.875rem;
}

.calc-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: start;
}

.calc-inputs fieldset {
    border: none;
    margin-bottom: 2rem;
}

.calc-inputs legend {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.25rem;
}

.calc-legend-note {
    font-size: 0.875rem;
    color: var(--ink-light);
    margin-bottom: 0.5rem;
}

.calc-field {
    padding: 1rem 0 1.1rem;
    border-bottom: 1px solid var(--border);
}

.calc-field-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.calc-field-head label {
    flex: 1;
    font-weight: 700;
    color: var(--ink);
}

.calc-code {
    display: inline-block;
    min-width: 2.2rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ink-light);
}

.calc-weight {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-light);
    white-space: nowrap;
}

.calc-number {
    width: 4.25rem;
    padding: 0.3rem 0.4rem;
    font-family: var(--font-mono);
    font-weight: 700;
    text-align: right;
}

.calc-range {
    --fill: 0%;
    display: block;
    width: 100%;
    height: 1.5rem;
    background: transparent;
    appearance: none;
    cursor: pointer;
}

.calc-range::-webkit-slider-runnable-track {
    height: 4px;
    background: linear-gradient(to right, var(--ink) var(--fill), var(--surface-2) var(--fill));
}

.calc-range::-moz-range-track {
    height: 4px;
    background: var(--surface-2);
}

.calc-range::-moz-range-progress {
    height: 4px;
    background: var(--ink);
}

.calc-range::-webkit-slider-thumb {
    appearance: none;
    width: 1.1rem;
    height: 1.1rem;
    margin-top: calc(-0.55rem + 2px);
    background: var(--bg);
    border: 2px solid var(--ink);
    border-radius: 50%;
}

.calc-range::-moz-range-thumb {
    width: 1rem;
    height: 1rem;
    background: var(--bg);
    border: 2px solid var(--ink);
    border-radius: 50%;
}

.calc-range:focus-visible {
    outline-offset: 2px;
}

.calc-hint,
.calc-rationale {
    font-size: 0.85rem;
    color: var(--ink-light);
    margin: 0.35rem 0 0;
}

.calc-rationale {
    color: var(--ink-mid);
    padding-left: 0.75rem;
    border-left: 2px solid var(--border);
}

.calc-help,
.calc-explainer {
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.calc-help summary,
.calc-explainer summary {
    display: inline-block;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-light);
    list-style: none;
}

.calc-help summary::-webkit-details-marker,
.calc-explainer summary::-webkit-details-marker {
    display: none;
}

.calc-help summary::before,
.calc-explainer summary::before {
    content: '+ ';
}

.calc-help[open] summary::before,
.calc-explainer[open] summary::before {
    content: '\2212  ';
}

.calc-help summary:hover,
.calc-explainer summary:hover {
    color: var(--ink);
}

.calc-help[open] {
    padding: 0.85rem 1rem;
    background: var(--surface);
}

.calc-help[open] summary {
    margin-bottom: 0.5rem;
}

.calc-help ul {
    margin: 0.5rem 0 0.75rem;
}

.calc-field-title {
    flex: 1;
    margin: 0;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0;
}

.calc-value {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ink-light);
    white-space: nowrap;
}

.calc-value.is-scored {
    padding: 0.15rem 0.5rem;
    color: var(--bg);
    background: var(--ink);
}

.calc-what {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.calc-factors {
    font-size: 0.875rem;
    color: var(--ink-light);
}

.calc-manual {
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

.calc-manual summary {
    display: inline-block;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-light);
    list-style: none;
}

.calc-manual summary::-webkit-details-marker {
    display: none;
}

.calc-manual summary::before {
    content: '+ ';
}

.calc-manual[open] summary::before {
    content: '\2212  ';
}

.calc-manual summary:hover {
    color: var(--ink);
}

.calc-manual[open] {
    padding: 0.85rem 1rem;
    background: var(--surface);
}

.calc-manual-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.75rem 0 0.25rem;
}

.calc-manual-row label {
    font-weight: 600;
    color: var(--ink);
}

.calc-coverage {
    margin: 0.75rem 0 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: var(--ink);
    border-left: 3px solid var(--risk-medium);
    background: var(--surface);
}

/* Scoring guide inside each component */

.guide-why {
    font-size: 0.9rem;
    color: var(--ink-mid);
}

.guide-questions {
    border: none;
    margin: 0.75rem 0;
}

.calc-inputs .guide-questions legend {
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--ink-light);
    margin-bottom: 0.25rem;
}

.guide-q {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.4rem 1rem;
    align-items: center;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
}

.guide-q-text {
    margin: 0;
    font-size: 0.95rem;
    color: var(--ink);
}

.guide-options {
    display: flex;
    gap: 0.25rem;
}

.guide-option {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-mid);
    border: 1px solid var(--border);
    background: var(--bg);
    cursor: pointer;
}

.guide-option input {
    position: absolute;
    opacity: 0;
    inset: 0;
    cursor: pointer;
}

.guide-option:has(input:checked) {
    color: var(--bg);
    background: var(--ink);
    border-color: var(--ink);
}

.guide-option:has(input:focus-visible) {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.guide-result {
    min-height: 1.3em;
    margin: 0.5rem 0 0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ink);
}

.calc-band {
    margin: 0.4rem 0 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: var(--ink-mid);
    background: var(--surface);
}

.calc-band:empty {
    display: none;
}

.calc-band strong {
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.guide-title {
    margin: 0.75rem 0 0.25rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-light);
}

.guide-bands {
    margin: 0 0 0.75rem;
    border-top: 1px solid var(--border);
}

.guide-bands > div {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.guide-bands dt {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--ink);
}

.guide-bands > div.is-current {
    background: var(--bg);
    box-shadow: inset 3px 0 0 var(--rule);
}

.guide-bands > div.is-current dd {
    color: var(--ink);
}

.guide-rules {
    margin: 0 0 0.75rem;
    padding-left: 1.1rem;
    font-size: 0.85rem;
    color: var(--ink-light);
}

.guide-rules li + li {
    margin-top: 0.3rem;
}

@media (max-width: 560px) {
    .guide-q {
        grid-template-columns: 1fr;
    }

    .guide-bands > div {
        grid-template-columns: 1fr;
        gap: 0.1rem;
    }
}

/* Result panel */

.calc-result {
    position: sticky;
    top: 1.25rem;
}

.calc-result-inner {
    border: 1px solid var(--border);
    border-top: 3px solid var(--rule);
    padding: 1.5rem;
    background: var(--bg);
}

.calc-score {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
}

.calc-score output {
    font-family: var(--font-serif);
    font-size: clamp(3.5rem, 8vw, 4.75rem);
    font-weight: 650;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.calc-score-max {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--ink-light);
}

.calc-empty {
    margin: 0.75rem 0 1rem;
    font-size: 0.9rem;
    color: var(--ink-light);
}

.calc-save {
    margin-top: 1rem;
}

.calc-save #vector {
    margin-top: 0.25rem;
}

.calc-result-inner .calc-disclaimer {
    margin: 1.25rem 0 0;
}

.calc-score .level-badge {
    margin-left: auto;
    align-self: center;
}

.level-badge {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 2px solid currentColor;
}

.level-badge.low { color: var(--risk-low); }
.level-badge.medium { color: var(--risk-medium); }
.level-badge.high { color: var(--risk-high); }

.calc-level-note {
    margin: 0.85rem 0 1.25rem;
    font-size: 0.875rem;
}

.calc-disclaimer,
.calc-note {
    font-size: 0.78rem;
    color: var(--ink-light);
}

.calc-disclaimer {
    margin: -0.5rem 0 1.25rem;
    padding: 0.6rem 0.75rem;
    border-left: 2px solid var(--border);
}

.calc-note {
    margin: 0.6rem 0 0;
}

.calc-breakdown {
    margin: 0;
    border-top: 1px solid var(--border);
}

.calc-breakdown > div {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.calc-breakdown dt {
    color: var(--ink-mid);
}

/* Perspective score: the Base score adjusted for where the question is asked from */

.calc-perspective {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px solid var(--rule);
}

.calc-perspective h3 {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
}

.persp-fields {
    display: grid;
    gap: 0.3rem;
    margin: 0.85rem 0;
}

.persp-fields label {
    margin-top: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.persp-fields .calc-select {
    width: 100%;
}

.persp-score output {
    font-size: clamp(2.5rem, 6vw, 3.25rem);
}

.persp-changed {
    font-weight: 600;
}

.persp-factors {
    margin: 0.75rem 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--border);
}

.persp-factors li {
    margin: 0;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.persp-factors p {
    margin: 0.25rem 0 0;
    color: var(--ink-mid);
}

.persp-factors .persp-source {
    font-size: 0.8rem;
}

.persp-factor-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.persp-mult {
    font-family: var(--font-mono);
    font-weight: 700;
    white-space: nowrap;
}

.persp-mult.up { color: var(--risk-high); }
.persp-mult.down { color: var(--risk-low); }

.persp-none {
    color: var(--ink-mid);
}

/* Weight receipt: every number and where it comes from, like a till receipt */
.receipt-title {
    margin: 1rem 0 0;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-light);
}

.receipt {
    margin: 0.75rem 0 0.25rem;
    padding: 0.75rem 0.85rem;
    list-style: none;
    background: var(--surface);
    border-top: 2px dashed var(--border);
    border-bottom: 2px dashed var(--border);
    font-size: 0.8rem;
}

.receipt li {
    margin: 0 0 0.55rem;
}

.receipt-line {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    font-family: var(--font-mono);
}

.receipt-label {
    font-weight: 700;
}

.receipt-leader {
    flex: 1;
    min-width: 1rem;
    border-bottom: 1px dotted var(--ink-light);
    transform: translateY(-0.25em);
}

.receipt-value {
    font-weight: 700;
    white-space: nowrap;
}

.receipt-note {
    margin: 0.15rem 0 0;
    color: var(--ink-mid);
    line-height: 1.45;
}

.receipt-kind {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-light);
}

.receipt-kind-measured { color: var(--risk-low); }
.receipt-kind-changed,
.receipt-kind-judgement { color: var(--risk-medium); }

.receipt .receipt-total {
    margin: 0.75rem 0 0;
    padding-top: 0.6rem;
    border-top: 2px solid var(--rule);
}

.receipt-total .receipt-line {
    font-size: 0.95rem;
}

.persp-weights {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.45rem 0.75rem;
    margin: 0.75rem 0;
    font-size: 0.85rem;
}

.calc-breakdown dd {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--ink-light);
}

.calc-breakdown .is-driver dt,
.calc-breakdown .is-driver dd {
    color: var(--ink);
    font-weight: 700;
}

.calc-breakdown .is-driver dt::after {
    content: ' \2190  sets score';
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-light);
}

.calc-driver {
    margin: 0.75rem 0 1.25rem;
    font-size: 0.85rem;
    color: var(--ink-light);
}

.calc-save code {
    display: block;
    padding: 0.75rem 0.85rem;
    background: var(--surface);
    color: var(--ink);
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}

.calc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.calc-button {
    padding: 0.45rem 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
    background: transparent;
    border: 1px solid var(--rule);
    border-radius: 0;
    cursor: pointer;
}

.calc-button:hover {
    background: var(--ink);
    color: var(--bg);
}

.calc-status {
    min-height: 1.3em;
    margin: 0.5rem 0 0;
    font-size: 0.8rem;
    color: var(--ink-light);
}

.calc-explainer {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

.calc-explainer pre {
    margin: 0.75rem 0;
    padding: 0.85rem;
    background: var(--surface);
    color: var(--ink);
    font-size: 0.74rem;
    line-height: 1.6;
    overflow-x: auto;
}

.calc-explainer p {
    font-size: 0.825rem;
}

.calc-text {
    width: 100%;
    margin: 0.75rem 0 0.5rem;
    padding: 0.5rem 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.calc-mini {
    display: none;
}

/* ---------- Footer ---------- */

.site-footer {
    margin-top: clamp(3rem, 8vw, 6rem);
    background: var(--footer-bg);
    color: var(--footer-ink-light);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.footer-inner {
    padding-top: 1.75rem;
    padding-bottom: 1.75rem;
}

.footer-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem 2rem;
}

.footer-row + .footer-row {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--footer-border);
}

.site-footer p {
    margin: 0;
}

.site-footer a {
    color: var(--footer-ink);
    font-weight: 700;
    text-decoration-color: var(--footer-ink-light);
}

.site-footer a:hover {
    text-decoration-color: var(--footer-ink);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
    .calc-grid {
        grid-template-columns: 1fr;
    }

    .calc-result {
        position: static;
    }

    .calc-mini {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.65rem var(--gutter);
        background: var(--bg);
        border-top: 2px solid var(--rule);
        transform: translateY(100%);
        transition: transform 0.2s;
    }

    .calc-mini.is-visible {
        transform: none;
    }

    .calc-mini .eyebrow {
        margin: 0;
    }

    .calc-mini strong {
        font-family: var(--font-serif);
        font-size: 1.5rem;
        line-height: 1;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .toc ul {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem 1rem;
    }

    .toc a {
        border-left: none;
        padding: 0.25rem 0;
    }

    .toc a.active {
        border-left: none;
        text-decoration: underline;
        text-decoration-color: var(--ink);
        text-decoration-thickness: 2px;
    }
}

@media (max-width: 560px) {
    .site-nav {
        gap: 0.25rem 1rem;
    }

    .principle-card,
    .resource-card,
    .component-card,
    .factor-item,
    .enforcement-category,
    .interaction-type,
    .phase,
    .entity,
    .callout,
    .use-case {
        padding: 1.15rem;
    }

    .example-content,
    .formula,
    .formula-explanation,
    .example-card > h3,
    .formula-card > h3 {
        padding-left: 1.15rem;
        padding-right: 1.15rem;
    }
}

@media print {
    .site-header nav,
    .theme-toggle,
    .sidebar,
    .call-to-action {
        display: none;
    }

    .site-footer {
        background: none;
        color: #000;
    }
}

.hero-content .review-date {
    margin-top: 1rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-light);
}
