/* ═══════════════════════════════════════════════════════════════════
   Jetfolio Support Docs — one document treatment
   Design System 2.0 (Phase 7 consolidation)

   Loaded by every reference page under pages/reference/ (the former
   support-docs/guides + regulatory, moved 2026-09-06), after css/tokens.css
   + css/kit.css.

   This file replaced twelve page-local <style> blocks that carried
   four competing templates and a different hero gradient per page.
   The recipe here is the same one the rest of the product uses:
     page ground var(--bg-primary) · white card wells with 1px
     var(--line), var(--radius-lg), var(--shadow-card) · 22px/700
     ink page title · 17px section headings over hairlines · DM Sans
     body held to a readable measure · kit pills for status.
   No gradients, no hero banners — these are reference documents.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 15px;
    line-height: 1.65;
    color: var(--ink-body);
    background: var(--bg-primary);
}

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

/* Anchor targets clear the top edge when jumped to from Quick Nav */
[id] { scroll-margin-top: 1rem; }

/* ── Document chrome ──────────────────────────────────────────────── */
.doc-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.doc-topbar-inner {
    max-width: 1060px;
    margin: 0 auto;
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.doc-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    border-radius: var(--radius-sm);
}
.doc-back:hover { color: var(--accent-deep); text-decoration: underline; }

.doc-brand {
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--ink);
}

.doc-footer {
    margin-top: auto;
    border-top: 1px solid var(--line);
    background: var(--surface);
    padding: 1.25rem 1.5rem;
}
.doc-footer p {
    max-width: 1060px;
    margin: 0 auto;
    font-size: 0.8125rem;
    color: var(--ink-2);
}
.doc-footer a { color: var(--accent); text-decoration: none; }
.doc-footer a:hover { text-decoration: underline; }

/* ── Page shell ───────────────────────────────────────────────────── */
.guide-container {
    flex: 1;
    width: 100%;
    max-width: 1060px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

/* ── Page title: 22px/700 ink + one-line subtitle ─────────────────── */
.guide-header {
    margin: 0 0 1.5rem;
}
.guide-header h1 {
    margin: 0;
    font-size: 1.375rem;          /* 22px */
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--ink);
}
.guide-header p {
    margin: 0.35rem 0 0;
    font-size: 0.9375rem;
    color: var(--ink-2);
    max-width: 80ch;
}

/* ── Content well ─────────────────────────────────────────────────── */
.content-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 1.75rem;
    margin: 0 0 1.25rem;
}
.content-card > *:first-child { margin-top: 0; }
.content-card > *:last-child { margin-bottom: 0; }
/* long URLs and citations wrap rather than push the page sideways */
.content-card { overflow-wrap: break-word; }

.content-card h2 {
    margin: 2rem 0 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--line);
    font-size: 1.0625rem;         /* 17px */
    font-weight: 700;
    line-height: 1.35;
    color: var(--ink);
}
.content-card h3 {
    margin: 1.75rem 0 0.55rem;
    font-size: 0.9375rem;         /* 15px */
    font-weight: 700;
    color: var(--ink);
}
.content-card h4 {
    margin: 1.25rem 0 0.45rem;
    font-size: 0.875rem;          /* 14px */
    font-weight: 700;
    color: var(--ink);
}

.content-card p { margin: 0 0 0.85rem; max-width: 80ch; }
.content-card ul,
.content-card ol { margin: 0 0 0.95rem; padding-left: 1.35rem; }
.content-card li { margin-bottom: 0.35rem; max-width: 80ch; }
.content-card li:last-child { margin-bottom: 0; }
.content-card strong { font-weight: 600; color: var(--ink); }
.content-card em { color: var(--ink-body); }

.content-card a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.content-card a:hover { color: var(--accent-deep); }

.content-card code,
.doc-callout code {
    font-family: var(--font-mono); font-variant-numeric: tabular-nums;
    font-size: 0.9em;
    background: var(--wash);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.05rem 0.32rem;
    color: var(--ink);
    overflow-wrap: anywhere;
}

/* ── Quick navigation: one chip row ───────────────────────────────── */
.quick-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
}
.quick-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.8rem;
    background: var(--wash);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--accent);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.content-card .quick-nav-btn { text-decoration: none; }
.quick-nav-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent-light);
    color: var(--accent-deep);
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn-primary,
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding: 0.6rem 1.1rem;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--transition-fast);
}
.content-card .btn-primary,
.content-card .back-button { color: #fff; text-decoration: none; }
.btn-primary:hover,
.back-button:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

/* ═══ Callouts ═════════════════════════════════════════════════════
   One well; the left rule and tint carry the meaning.
   ═══════════════════════════════════════════════════════════════════ */
.info-box, .tip-box, .science-box, .highlight-box, .key-points,
.regulation-box, .warning-box, .danger-box, .critical-box,
.success-box, .best-practice-box, .checklist, .mitigation-box,
.example-box, .case-study-box, .strategy-box, .template-box,
.phase-box, .pillar-box, .protocol-box, .formula-box,
.checklist-section, .algorithm-step, .sample-form {
    margin: 1.25rem 0;
    padding: 1rem 1.15rem;
    background: var(--wash);
    border: 1px solid var(--line);
    border-left: 3px solid var(--line-strong);
    border-radius: var(--radius-md);
}

.info-box > *:first-child, .tip-box > *:first-child, .science-box > *:first-child,
.highlight-box > *:first-child, .key-points > *:first-child, .regulation-box > *:first-child,
.warning-box > *:first-child, .danger-box > *:first-child, .critical-box > *:first-child,
.success-box > *:first-child, .best-practice-box > *:first-child, .checklist > *:first-child,
.mitigation-box > *:first-child, .example-box > *:first-child, .case-study-box > *:first-child,
.strategy-box > *:first-child, .template-box > *:first-child, .phase-box > *:first-child,
.pillar-box > *:first-child, .protocol-box > *:first-child, .formula-box > *:first-child,
.checklist-section > *:first-child, .algorithm-step > *:first-child, .sample-form > *:first-child {
    margin-top: 0;
}
.info-box > *:last-child, .tip-box > *:last-child, .science-box > *:last-child,
.highlight-box > *:last-child, .key-points > *:last-child, .regulation-box > *:last-child,
.warning-box > *:last-child, .danger-box > *:last-child, .critical-box > *:last-child,
.success-box > *:last-child, .best-practice-box > *:last-child, .checklist > *:last-child,
.mitigation-box > *:last-child, .example-box > *:last-child, .case-study-box > *:last-child,
.strategy-box > *:last-child, .template-box > *:last-child, .phase-box > *:last-child,
.pillar-box > *:last-child, .protocol-box > *:last-child, .formula-box > *:last-child,
.checklist-section > *:last-child, .algorithm-step > *:last-child, .sample-form > *:last-child {
    margin-bottom: 0;
}

/* A callout's title labels an aside — it is not an outline heading, so
   it is a <p class="box-title">, keeping h1..h4 correctly ordered. */
.box-title {
    display: block;
    margin: 0 0 0.5rem;
    max-width: none;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--ink);
}

/* Note / reference */
.info-box, .tip-box, .science-box, .key-points {
    background: var(--info-bg);
    border-color: #cfe0f5;
    border-left-color: var(--info-ink);
}
.info-box .box-title, .tip-box .box-title, .science-box .box-title,
.key-points .box-title { color: var(--info-ink); }

/* Regulatory citation */
.regulation-box {
    background: var(--accent-soft);
    border-color: #d3e0ef;
    border-left-color: var(--accent);
}
.regulation-box .box-title { color: var(--accent-deep); }

/* Recommended practice */
.success-box, .best-practice-box, .checklist, .mitigation-box {
    background: var(--ok-bg);
    border-color: #c9e6d4;
    border-left-color: var(--ok-ink);
}
.success-box .box-title, .best-practice-box .box-title,
.checklist .box-title, .mitigation-box .box-title { color: var(--ok-ink); }

/* Caution */
.warning-box, .highlight-box {
    background: var(--warn-bg);
    border-color: #efdcc2;
    border-left-color: var(--warn-ink);
}
.warning-box .box-title, .highlight-box .box-title { color: var(--warn-ink); }
.highlight-box strong { color: var(--warn-ink); }

/* Hazard */
.danger-box, .critical-box {
    background: var(--bad-bg);
    border-color: #efcccc;
    border-left-color: var(--bad-ink);
}
.danger-box .box-title, .critical-box .box-title { color: var(--bad-ink); }

/* Structural wells (example, case study, strategy, template, phase,
   pillar, protocol, formula) keep the neutral .box-title ink. */
/* Some callouts label themselves with a bare leading <strong> rather
   than a title element — give it the same block treatment. */
.key-points > strong:first-child,
.info-box > strong:first-child,
.tip-box > strong:first-child,
.regulation-box > strong:first-child,
.warning-box > strong:first-child,
.highlight-box > strong:first-child,
.danger-box > strong:first-child,
.critical-box > strong:first-child,
.success-box > strong:first-child,
.best-practice-box > strong:first-child {
    display: block;
    margin-bottom: 0.35rem;
}
.info-box > strong:first-child,
.tip-box > strong:first-child,
.key-points > strong:first-child { color: var(--info-ink); }
.warning-box > strong:first-child,
.highlight-box > strong:first-child { color: var(--warn-ink); }
.danger-box > strong:first-child,
.critical-box > strong:first-child { color: var(--bad-ink); }
.success-box > strong:first-child,
.best-practice-box > strong:first-child { color: var(--ok-ink); }
.regulation-box > strong:first-child { color: var(--accent-deep); }

/* ── Check-marked lists ───────────────────────────────────────────── */
.checklist ul { list-style: none; margin-left: 0; padding-left: 0; }
.checklist li {
    position: relative;
    padding-left: 1.4rem;
}
.checklist li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.45em;
    width: 0.85em;
    height: 0.85em;
    background-color: var(--ok-ink);
    -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* ── Verification checklists (open boxes, meant to be worked) ─────── */
.checklist-section { border-left-color: var(--accent); }
.checklist-section ul { list-style: none; margin-left: 0; padding-left: 0; }
.checklist-section li {
    position: relative;
    padding: 0.45rem 0 0.45rem 1.5rem;
    margin-bottom: 0;
    border-bottom: 1px solid var(--line);
}
.checklist-section li:last-child { border-bottom: none; }
.checklist-section li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.75em;
    width: 0.85em;
    height: 0.85em;
    border: 1.5px solid var(--line-strong);
    border-radius: 2px;
    background: var(--surface);
}

/* ── Regulation reference chip ────────────────────────────────────── */
.regulation-ref {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.05rem 0.4rem;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono); font-variant-numeric: tabular-nums;
    font-size: 0.78rem;
    color: var(--accent-deep);
    white-space: nowrap;
}

/* ── Frequency badges → kit pill shape, token status pairs ────────── */
.frequency-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 0.5rem;
    padding: 3.5px 10px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
    vertical-align: middle;
}
.frequency-daily     { background: var(--bad-bg);     color: var(--bad-ink); }
.frequency-weekly    { background: var(--warn-bg);    color: var(--warn-ink); }
.frequency-monthly   { background: var(--neutral-bg); color: var(--neutral-ink); }
.frequency-quarterly { background: var(--ok-bg);      color: var(--ok-ink); }
.frequency-annual    { background: var(--info-bg);    color: var(--info-ink); }

/* ── Tables: always scroll inside their own card ──────────────────── */
.comparison-table {
    width: 100%;
    margin: 1.25rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}
.comparison-table table {
    width: 100%;
    min-width: 540px;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.comparison-table th {
    padding: 0.65rem 0.85rem;
    background: var(--wash);
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: left;
    white-space: nowrap;
}
.comparison-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--line);
    color: var(--ink-body);
    vertical-align: top;
}
.comparison-table tbody tr:nth-child(even) { background: #fbfcfe; }
.comparison-table tr:last-child td { border-bottom: none; }

/* ── Card grids (features, factors) ───────────────────────────────── */
.feature-grid,
.factor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.85rem;
    margin: 1.25rem 0;
}
.feature-card,
.factor-card {
    background: var(--wash);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
}
.feature-card .box-title,
.factor-card .box-title { margin-bottom: 0.4rem; }
.feature-card p,
.factor-card p { margin: 0 0 0.5rem; font-size: 0.875rem; }
.feature-card > *:last-child,
.factor-card > *:last-child { margin-bottom: 0; }

/* ── Advisory-circular entries ────────────────────────────────────── */
.category-header {
    margin: 1.75rem 0 0.85rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--line);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--ink-label);
}
.ac-card {
    margin: 0.85rem 0;
    padding: 1.1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}
.ac-card .box-title {
    margin-bottom: 0.4rem;
    font-size: 0.9375rem;
}
.ac-number {
    display: inline-block;
    margin-bottom: 0.6rem;
    padding: 0.1rem 0.45rem;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono); font-variant-numeric: tabular-nums;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent-deep);
}
.ac-summary p { margin: 0 0 0.6rem; }
.ac-card .key-points { margin: 0.6rem 0 0; }

/* ── Implementation timeline ──────────────────────────────────────── */
.timeline {
    position: relative;
    margin: 1.5rem 0;
    padding-left: 1.5rem;
}
.timeline::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 1px;
    background: var(--line-strong);
}
.timeline-item { position: relative; margin-bottom: 1.5rem; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-item::before {
    content: "";
    position: absolute;
    left: -1.5rem;
    top: 0.45rem;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--surface);
}
.timeline-item .box-title { color: var(--accent-deep); }

/* ── Numbered algorithm steps ─────────────────────────────────────── */
.algorithm-step {
    position: relative;
    padding-left: 3.1rem;
    background: var(--surface);
}
.algorithm-step::before {
    content: attr(data-step);
    position: absolute;
    left: 1rem;
    top: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-deep);
    font-size: 0.75rem;
    font-weight: 700;
}

/* ── Printable sample forms (mono, deliberately plain) ────────────── */
.sample-form {
    font-family: var(--font-mono); font-variant-numeric: tabular-nums;
    font-size: 0.8125rem;
    /* the ruled lines are fixed-width by design — scroll, never re-wrap */
    overflow-x: auto;
    overflow-wrap: normal;
    word-break: normal;
}
.sample-form .box-title { font-family: var(--font-family); }
.form-field {
    margin-bottom: 0.5rem;
    padding: 0.4rem 0.55rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.form-label { font-weight: 500; color: var(--ink); }
.form-line {
    display: inline-block;
    min-width: 180px;
    max-width: 100%;
    margin-left: 0.5rem;
    border-bottom: 1px solid var(--line-strong);
}

/* ── Preformatted blocks (filing trees, CSV samples) ──────────────── */
.doc-pre {
    margin: 0;
    padding: 0.75rem 0.9rem;
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono); font-variant-numeric: tabular-nums;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--ink-body);
}

/* ── Escape hatch for tables that carry their own colour ramp
      (the SMS 5x5 risk matrix, the printable duty-log grid) ────────── */
.doc-scroll {
    margin: 1.25rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.doc-scroll table { min-width: 520px; }

/* ── Document colophon (version / disclaimer strip) ───────────────── */
.doc-colophon { color: var(--ink-2); }
.doc-colophon p { margin: 0 0 0.35rem; font-size: 0.8125rem; }
.doc-colophon p:last-child { margin-bottom: 0; }

/* ── Formula wells ────────────────────────────────────────────────── */
.formula-box code {
    display: block;
    overflow-x: auto;
    padding: 0.55rem 0.7rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ── Small screens ────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .doc-topbar-inner { padding: 0.65rem 1rem; }
    .guide-container { padding: 1.5rem 1rem 2.5rem; }
    .content-card { padding: 1.25rem; }
    .doc-footer { padding: 1.25rem 1rem; }
    .quick-nav-btn { width: 100%; justify-content: flex-start; }
    .feature-grid, .factor-grid { grid-template-columns: 1fr; }
}

/* ── Print ────────────────────────────────────────────────────────── */
@media print {
    .doc-topbar, .doc-footer, .quick-nav, .btn-primary, .back-button { display: none; }
    body { background: #fff; }
    .guide-container { max-width: none; padding: 0; }
    .content-card {
        border: none;
        box-shadow: none;
        padding: 0;
        margin-bottom: 1.5rem;
        page-break-inside: avoid;
    }
    .comparison-table { overflow: visible; }
    .comparison-table table { min-width: 0; }
}
