/* Design tokens: light by default, dark when the device prefers it */
:root {
    color-scheme: light dark;

    --bg: #f5f6fb;
    --surface: #ffffff;
    --surface-alt: #eef0f8;
    --border: #e1e4f0;
    --heading: #161a2e;
    --text: #3a4160;
    --muted: #596080;
    --link: #4f3fd0;
    --link-hover: #3b2db0;
    --accent: #7c5cff;
    --accent-2: #14c8e0;
    --accent-soft: #eeeafe;
    --shadow: 0 1px 2px rgba(22, 26, 46, 0.04), 0 8px 24px rgba(22, 26, 46, 0.06);
    --radius: 16px;
    --measure: 760px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0c0e1a;
        --surface: #141729;
        --surface-alt: #1b1f36;
        --border: #2a2f4d;
        --heading: #f2f4fc;
        --text: #c3c9e2;
        --muted: #9aa3c6;
        --link: #a89fff;
        --link-hover: #c4beff;
        --accent-soft: #221f4a;
        --shadow: none;
    }
}

/* Reset and base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
    background-color: var(--bg);
    background-image: radial-gradient(60rem 24rem at 50% -8rem, var(--accent-soft), transparent 70%);
    background-repeat: no-repeat;
    padding: 2.5rem 1rem 3rem;
    -webkit-font-smoothing: antialiased;
}

/* Accessibility */
.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    padding: 0.6rem 1rem;
    background: var(--heading);
    color: var(--bg);
    border-radius: 8px;
    z-index: 10;
}

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

a:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--link);
    outline-offset: 3px;
    border-radius: 4px;
}

/* Page card */
.container {
    max-width: var(--measure);
    margin: 0 auto;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 3rem 3rem 2rem;
}

.page-header {
    margin-bottom: 2rem;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 0.9rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--link);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Typography */
h1 {
    font-size: clamp(1.75rem, 4.5vw, 2.5rem);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--heading);
    margin-bottom: 0.75rem;
}

h2 {
    font-size: 1.35rem;
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--heading);
    margin-top: 2.75rem;
    margin-bottom: 0.9rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--border);
    scroll-margin-top: 1.5rem;
}

main section:first-of-type h2 {
    margin-top: 2rem;
}

h3 {
    font-size: 1.05rem;
    font-weight: 650;
    color: var(--heading);
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text);
}

ul {
    margin-bottom: 1rem;
    padding-left: 1.4rem;
    color: var(--text);
}

li {
    margin-bottom: 0.45rem;
    padding-left: 0.2rem;
}

li::marker {
    color: var(--accent);
}

a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: color 0.15s;
}

a:hover {
    color: var(--link-hover);
    text-decoration-thickness: 2px;
}

strong {
    font-weight: 650;
    color: var(--heading);
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
    padding: 0.12em 0.4em;
    border-radius: 6px;
    background: var(--surface-alt);
    color: var(--heading);
}

.last-updated {
    font-size: 0.92rem;
    color: var(--muted);
    margin-bottom: 0;
}

.last-updated strong {
    color: var(--muted);
    font-weight: 600;
}

/* Summary callout */
.callout {
    margin: 0 0 1.5rem;
    padding: 1.1rem 1.25rem;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 12px;
}

.callout h2 {
    all: unset;
    display: block;
    font-weight: 700;
    color: var(--heading);
    margin-bottom: 0.4rem;
}

.callout ul {
    margin-bottom: 0;
}

.callout li:last-child {
    margin-bottom: 0;
}

/* Table of contents */
.toc {
    margin-bottom: 1.5rem;
    padding: 1.1rem 1.25rem;
    background: var(--surface-alt);
    border-radius: 12px;
}

.toc summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--heading);
}

.toc ol {
    margin: 0.75rem 0 0;
    padding-left: 1.4rem;
    columns: 2;
    column-gap: 2rem;
}

.toc li {
    margin-bottom: 0.3rem;
    break-inside: avoid;
}

.toc a {
    text-decoration: none;
}

.toc a:hover {
    text-decoration: underline;
}

/* Index: policy cards */
.policy-list {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 1rem;
}

.policy-list li {
    margin: 0;
    padding: 0;
}

.policy-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--heading);
    text-decoration: none;
    transition: border-color 0.15s, transform 0.15s;
}

.policy-card:hover {
    color: var(--heading);
    border-color: var(--accent);
    transform: translateY(-1px);
    text-decoration: none;
}

.policy-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.policy-text {
    flex: 1;
    min-width: 0;
}

.policy-name {
    display: block;
    font-weight: 700;
    font-size: 1.05rem;
}

.policy-desc {
    display: block;
    font-size: 0.92rem;
    color: var(--muted);
}

.policy-arrow {
    flex: none;
    color: var(--link);
    font-weight: 700;
}

/* Footer */
footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted);
}

footer p {
    color: inherit;
    margin-bottom: 0;
}

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

    a,
    .policy-card {
        transition: none;
    }

    .policy-card:hover {
        transform: none;
    }
}

/* Mobile */
@media (max-width: 640px) {
    body {
        padding: 1rem 0.75rem 2rem;
    }

    .container {
        padding: 1.75rem 1.25rem 1.5rem;
        border-radius: 12px;
    }

    .toc ol {
        columns: 1;
    }

    h2 {
        font-size: 1.2rem;
    }
}

/* Print: plain black on white, show link addresses */
@media print {
    :root {
        --bg: #fff;
        --surface: #fff;
        --surface-alt: #fff;
        --border: #ccc;
        --heading: #000;
        --text: #000;
        --muted: #333;
        --link: #000;
        --accent-soft: #fff;
        --shadow: none;
    }

    body {
        background: #fff;
        padding: 0;
    }

    .container {
        border: 0;
        padding: 0;
    }

    .skip-link,
    .toc {
        display: none;
    }

    main a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.85em;
    }
}
