/* ============================================================
   fetchOnce — Whitepaper Stylesheet
   Standalone. Loads independently of style.css.
   Designed to look like a formal government/academic document.
   ============================================================ */

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

:root {
    --wp-navy:       #0f2040;
    --wp-navy-mid:   #1e3a5f;
    --wp-navy-light: #2d5282;
    --wp-rule:       #c8d4e0;
    --wp-text:       #1a1a1a;
    --wp-muted:      #4a5568;
    --wp-bg:         #ffffff;
    --wp-surface:    #f7f9fc;
    --wp-accent:     #b91c1c;  /* classification red */
    --wp-font-body:  'Source Serif 4', 'Palatino Linotype', Palatino, Georgia, serif;
    --wp-font-head:  'Barlow', 'Helvetica Neue', Arial, sans-serif;
    --wp-font-mono:  'IBM Plex Mono', 'Courier New', Courier, monospace;
}

html, body {
    background: var(--wp-bg);
    color: var(--wp-text);
    font-family: var(--wp-font-body);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* ── Page wrapper ─────────────────────────────────────────── */
.wp-page {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

/* ── Classification banner ───────────────────────────────── */
.wp-classification-bar {
    background: var(--wp-navy);
    color: #ffffff;
    font-family: var(--wp-font-head);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-align: center;
    padding: 0.35rem 1rem;
    margin: 0 -2rem 0;
}

/* ── Cover page ──────────────────────────────────────────── */
.wp-cover {
    border-bottom: 3px solid var(--wp-navy);
    padding: 3.5rem 0 2.5rem;
    margin-bottom: 2.5rem;
}

.wp-cover-org {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.wp-cover-org img {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.wp-cover-org-name {
    font-family: var(--wp-font-head);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--wp-navy);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.3;
}

.wp-cover-org-name span {
    display: block;
    font-weight: 400;
    color: var(--wp-muted);
    letter-spacing: 0;
    text-transform: none;
    font-size: 0.8rem;
}

.wp-doc-type {
    font-family: var(--wp-font-head);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--wp-navy-light);
    margin-bottom: 0.75rem;
}

.wp-cover h1 {
    font-family: var(--wp-font-head);
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--wp-navy);
    line-height: 1.2;
    margin-bottom: 0.4rem;
}

.wp-cover-subtitle {
    font-family: var(--wp-font-head);
    font-size: 1.1rem;
    color: var(--wp-muted);
    margin-bottom: 2rem;
    font-weight: 400;
}

.wp-cover-rule {
    border: none;
    border-top: 1px solid var(--wp-rule);
    margin: 2rem 0;
}

/* Document metadata grid */
.wp-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem 2rem;
    margin-bottom: 2rem;
}

.wp-meta-cell dt {
    font-family: var(--wp-font-head);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--wp-muted);
    margin-bottom: 0.2rem;
}

.wp-meta-cell dd {
    font-size: 0.95rem;
    color: var(--wp-navy);
    font-weight: 600;
}

.wp-meta-cell dd.status-public {
    color: #166534;
}

/* Abstract */
.wp-abstract-label {
    font-family: var(--wp-font-head);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--wp-muted);
    margin-bottom: 0.5rem;
}

.wp-abstract {
    font-size: 0.97rem;
    color: var(--wp-text);
    line-height: 1.75;
    border-left: 3px solid var(--wp-navy);
    padding-left: 1.25rem;
}

/* ── Table of contents ────────────────────────────────────── */
.wp-toc {
    background: var(--wp-surface);
    border: 1px solid var(--wp-rule);
    border-left: 4px solid var(--wp-navy);
    padding: 1.5rem 1.75rem;
    margin-bottom: 3rem;
}

.wp-toc-heading {
    font-family: var(--wp-font-head);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wp-navy);
    margin-bottom: 1rem;
}

.wp-toc ol {
    list-style: none;
    counter-reset: toc-item;
    padding: 0;
    columns: 2;
    column-gap: 2rem;
}

.wp-toc li {
    counter-increment: toc-item;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
    break-inside: avoid;
}

.wp-toc a {
    color: var(--wp-navy-mid);
    text-decoration: none;
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.wp-toc a::before {
    content: counter(toc-item) ".";
    font-family: var(--wp-font-head);
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--wp-muted);
    flex-shrink: 0;
}

.wp-toc a:hover { color: var(--wp-navy); text-decoration: underline; }

/* ── Sections ─────────────────────────────────────────────── */
.wp-section {
    margin-bottom: 3rem;
    padding-top: 0.25rem;
}

.wp-section + .wp-section {
    border-top: 1px solid var(--wp-rule);
    padding-top: 2.5rem;
}

.wp-section h2 {
    font-family: var(--wp-font-head);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--wp-navy);
    margin-bottom: 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--wp-navy);
}

.wp-section h3 {
    font-family: var(--wp-font-head);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--wp-navy-mid);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 1.75rem 0 0.6rem;
}

.wp-section p {
    margin-bottom: 0.9rem;
    font-size: 0.97rem;
}

.wp-section p:last-child { margin-bottom: 0; }

/* ── Lists ────────────────────────────────────────────────── */
.wp-list {
    margin: 0.75rem 0 1rem 1.5rem;
    font-size: 0.97rem;
}

.wp-list li {
    margin-bottom: 0.4rem;
    line-height: 1.6;
}

/* ── Tables ───────────────────────────────────────────────── */
.wp-table-wrap {
    overflow-x: auto;
    margin: 1rem 0 1.25rem;
}

.wp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    font-family: var(--wp-font-head);
}

.wp-table thead tr {
    background: var(--wp-navy);
    color: #ffffff;
}

.wp-table th {
    padding: 0.6rem 0.85rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.wp-table td {
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid var(--wp-rule);
    vertical-align: top;
    line-height: 1.5;
}

.wp-table tbody tr:nth-child(even) td {
    background: var(--wp-surface);
}

.wp-table td code {
    font-family: var(--wp-font-mono);
    font-size: 0.82rem;
    background: #e8edf2;
    padding: 0.1em 0.35em;
    border-radius: 2px;
}

/* ── Inline code ─────────────────────────────────────────── */
.wp-section code {
    font-family: var(--wp-font-mono);
    font-size: 0.85em;
    background: #e8edf2;
    padding: 0.1em 0.35em;
    border-radius: 2px;
    color: var(--wp-navy);
}

/* ── Footer note ──────────────────────────────────────────── */
.wp-footer-note {
    font-size: 0.85rem;
    color: var(--wp-muted);
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--wp-rule);
    font-style: italic;
}

.wp-footer-note a { color: var(--wp-navy-mid); }

/* ── Back link ────────────────────────────────────────────── */
.wp-back-link {
    display: inline-block;
    font-family: var(--wp-font-head);
    font-size: 0.82rem;
    color: var(--wp-muted);
    text-decoration: none;
    padding: 0.6rem 0;
    margin: 1rem 0 0;
    letter-spacing: 0.03em;
}

.wp-back-link:hover { color: var(--wp-navy); text-decoration: underline; }

/* ── Print ────────────────────────────────────────────────── */
@media print {
    @page {
        size: A4;
        margin: 20mm 18mm 22mm;
        @bottom-center {
            content: "fetchOnce Security Whitepaper — Page " counter(page) " of " counter(pages);
            font-family: var(--wp-font-head), sans-serif;
            font-size: 8pt;
            color: #666;
        }
        @top-right {
            content: "CONFIDENTIALITY: PUBLIC";
            font-family: var(--wp-font-head), sans-serif;
            font-size: 7pt;
            letter-spacing: 0.1em;
            color: #666;
        }
    }

    .wp-back-link { display: none; }
    .wp-classification-bar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    .wp-cover { page-break-after: always; }
    .wp-toc   { page-break-after: always; }

    .wp-section {
        page-break-inside: avoid;
    }

    .wp-section h2,
    .wp-section h3 {
        page-break-after: avoid;
    }

    .wp-table thead tr {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        display: table-header-group;
    }

    .wp-table { page-break-inside: auto; }
    .wp-table tr { page-break-inside: avoid; }

    a[href]::after {
        content: none;
    }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
    .wp-page { padding: 0 1rem 3rem; }
    .wp-cover h1 { font-size: 1.5rem; }
    .wp-toc ol { columns: 1; }
    .wp-meta-grid { grid-template-columns: 1fr 1fr; }
    .wp-table { font-size: 0.8rem; }
}
