/*
 * Smart Rafiki — operations portal.
 *
 * Every token here is lifted from DESIGN.md rather than invented for a docs
 * theme, per RULES.md. The guide is a product surface: if it looks unrelated to
 * the console, it teaches people the wrong thing about what is official.
 *
 * Layer 0 (brand) is the five blues and nothing else. There is no brand green
 * and no brand red — status colour is Layer 2 and is never used as a CTA or as
 * decoration.
 */

:root {
    /* Layer 0 — brand, immovable */
    --paper: #f6f6f3;
    --blue-light: #7294fe;
    --blue: #3854f6;
    --blue-dark: #1c2d8f;
    --navy: #050b34;

    /* Neutrals in use */
    --n-100: #f1f1f1;
    --n-200: #e5e5e5;
    --n-400: #b5b5b5;
    --n-600: #888888;
    --ink: #282828;
    --white: #ffffff;

    /* Layer 2 — semantic only */
    --success: #0e7c5a;
    --success-tint: #dcf2ea;
    --warning: #b45309;
    --warning-tint: #fdf0dc;
    --error: #b3261e;
    --error-tint: #fbe7e5;

    --measure: 68ch;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    /* Reading register: wdth 100, wght 400. 20px base, not 16 — DESIGN.md §3. */
    font-family: Archivo, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-variation-settings: "wdth" 100, "wght" 400;
    font-size: 18px;
    line-height: 1.62;
    -webkit-font-smoothing: antialiased;
}

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

/* ── Masthead ─────────────────────────────────────────────────────── */

header.top {
    background: var(--navy);
    color: var(--white);
    padding: 28px 0 30px;
    margin-bottom: 40px;
}
header.top .wrap { padding-bottom: 0; }
header.top a.home { color: var(--blue-light); text-decoration: none; font-variation-settings: "wdth" 100, "wght" 600; }
header.top a.home:hover { text-decoration: underline; }
.brandline {
    font-variation-settings: "wdth" 118, "wght" 800;
    font-size: 13px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--blue-light);
    margin: 0 0 6px;
}
h1 {
    /* Display register */
    font-variation-settings: "wdth" 116, "wght" 800;
    font-size: clamp(30px, 4.6vw, 46px);
    line-height: 1.1;
    margin: 0 0 10px;
    letter-spacing: -.01em;
}
header.top h1 { color: var(--white); }
.sub { color: var(--n-400); margin: 0; max-width: var(--measure); }

/* Build stamp — Rule 8. A guide with no stamp cannot be audited. */
.stamp {
    margin-top: 18px;
    font-family: "Martian Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-variation-settings: "wdth" 87, "wght" 400;
    font-size: 11px;
    color: var(--n-400);
    letter-spacing: -.02em;
}
.stamp b { color: var(--white); font-weight: 400; }

/* ── Actor cards ──────────────────────────────────────────────────── */

.actors { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); margin: 8px 0 0; }
.actor {
    display: block;
    background: var(--white);
    border: 1px solid var(--n-200);
    border-radius: 18px;
    padding: 22px 24px 24px;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s, transform .15s;
}
.actor:hover { border-color: var(--blue); transform: translateY(-2px); }
.actor h2 { font-variation-settings: "wdth" 114, "wght" 800; font-size: 21px; margin: 0 0 6px; color: var(--navy); }
.actor p { margin: 0; color: var(--n-600); font-size: 15.5px; line-height: 1.5; }
.who {
    display: inline-block;
    font-variation-settings: "wdth" 66, "wght" 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-size: 11px;
    color: var(--blue-dark);
    background: #e9edff;
    border-radius: 999px;
    padding: 4px 10px;
    margin-bottom: 12px;
}
.who.external { color: #6d4a12; background: var(--warning-tint); }

/* ── Body ─────────────────────────────────────────────────────────── */

h2.sec {
    font-variation-settings: "wdth" 114, "wght" 800;
    font-size: 27px;
    margin: 56px 0 6px;
    color: var(--navy);
    letter-spacing: -.01em;
}
h3.step {
    font-variation-settings: "wdth" 110, "wght" 700;
    font-size: 19.5px;
    margin: 36px 0 8px;
    color: var(--navy);
}
p, li { max-width: var(--measure); }
li { margin-bottom: 6px; }
a { color: var(--blue); }

/* Reference identifiers only — never prose, never money. DESIGN.md §3. */
code, .ref {
    font-family: "Martian Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-variation-settings: "wdth" 87, "wght" 400;
    font-size: .82em;
    letter-spacing: -.03em;
    background: var(--n-100);
    border-radius: 5px;
    padding: 1px 5px;
}

/* Money register: wdth 122, wght 800, tabular. Currency 0.6em, muted, leading. */
.money { font-variation-settings: "wdth" 122, "wght" 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.money .cur { font-size: .6em; font-variation-settings: "wdth" 100, "wght" 600; color: var(--n-600); margin-right: .28em; }

figure { margin: 20px 0 28px; max-width: 100%; }
figure img { width: 100%; border: 1px solid var(--n-200); border-radius: 12px; display: block; }
figcaption { font-size: 14px; color: var(--n-600); margin-top: 9px; max-width: var(--measure); }

/*
 * Form separates meaning, not just hue — DESIGN.md §4. A caution is a 2px left
 * rule on a tinted ground and is never a filled block, because a filled block
 * is what a primary action looks like.
 */
.note { border-left: 2px solid; padding: 14px 18px; border-radius: 0 10px 10px 0; margin: 22px 0; }
.note p:last-child { margin-bottom: 0; }
.note p:first-child { margin-top: 0; }
.note.err { border-color: var(--error); background: var(--error-tint); }
.note.warn { border-color: var(--warning); background: var(--warning-tint); }
.note.ok { border-color: var(--success); background: var(--success-tint); }
.note.info { border-color: var(--blue); background: #e9edff; }
.note .lbl {
    font-variation-settings: "wdth" 66, "wght" 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-size: 11px;
    display: block;
    margin-bottom: 4px;
}
.note.err .lbl { color: var(--error); }
.note.warn .lbl { color: var(--warning); }
.note.ok .lbl { color: var(--success); }
.note.info .lbl { color: var(--blue-dark); }

/* What the actor literally sees, quoted. Rule 5. */
.says {
    background: var(--white);
    border: 1px solid var(--n-200);
    border-radius: 10px;
    padding: 12px 16px;
    margin: 12px 0;
    max-width: var(--measure);
    font-size: 16px;
}
.says em { color: var(--n-600); font-style: normal; display: block; font-size: 13px; margin-bottom: 3px; }

table { border-collapse: collapse; width: 100%; margin: 22px 0; font-size: 15.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--n-200); vertical-align: top; }
th {
    font-variation-settings: "wdth" 66, "wght" 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-size: 11.5px;
    color: var(--n-600);
    border-bottom-color: var(--n-400);
}

.backlink { display: inline-block; margin: 34px 0 0; font-variation-settings: "wdth" 100, "wght" 600; }

footer.end { margin-top: 72px; padding-top: 22px; border-top: 1px solid var(--n-200); color: var(--n-600); font-size: 14px; }

@media (max-width: 640px) {
    body { font-size: 17px; }
    .wrap { padding: 0 18px 64px; }
}

/* ── Passphrase gate ──────────────────────────────────────────────── */

/* Hidden up front so content never flashes before the gate mounts. */
html[data-gated] body > *:not(.gate) { display: none !important; }

.gate {
    position: fixed;
    inset: 0;
    background: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 999;
}
.gate-box { width: 100%; max-width: 400px; }
.gate-box h1 { color: var(--white); font-size: 34px; margin-bottom: 8px; }
.gate-box .sub { margin-bottom: 22px; }
.gate-box input {
    width: 100%;
    font: inherit;
    font-size: 17px;
    padding: 13px 15px;
    border-radius: 12px;
    border: 1px solid #2b3a7a;
    background: #0b1547;
    color: var(--white);
    margin-bottom: 12px;
}
.gate-box input:focus { outline: 2px solid var(--blue-light); outline-offset: 1px; }
.gate-box button {
    width: 100%;
    font: inherit;
    font-variation-settings: "wdth" 100, "wght" 600;
    font-size: 16px;
    padding: 13px;
    border: 0;
    border-radius: 12px;
    background: var(--blue);
    color: var(--white);
    cursor: pointer;
}
.gate-box button:hover { background: var(--blue-light); }
.gate-err { color: #ffb4ae; font-size: 14px; margin: 12px 0 0; }

/* ── Within-guide navigation ──────────────────────────────────────── */

nav.onpage {
    background: var(--white);
    border: 1px solid var(--n-200);
    border-radius: 16px;
    padding: 18px 22px 20px;
    margin: 0 0 8px;
}
nav.onpage p {
    font-variation-settings: "wdth" 66, "wght" 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-size: 11px;
    color: var(--n-600);
    margin: 0 0 10px;
}
nav.onpage ol { margin: 0; padding-left: 20px; }
nav.onpage li { margin-bottom: 5px; }
nav.onpage a { text-decoration: none; font-variation-settings: "wdth" 100, "wght" 600; }
nav.onpage a:hover { text-decoration: underline; }
