* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: Outfit, "Segoe UI", sans-serif;
    background:
        radial-gradient(900px 420px at 50% -10%, rgba(186, 214, 240, 0.16), transparent 60%),
        linear-gradient(180deg, #070b16 0%, #121e36 55%, #0b1628 100%);
    min-height: 100vh;
    padding: 36px 16px 56px;
    color: #16324a;
}

html.dark body {
    background:
        radial-gradient(900px 420px at 50% -10%, rgba(120, 160, 210, 0.08), transparent 60%),
        linear-gradient(180deg, #05070d 0%, #10182a 55%, #070d16 100%);
}

.dark-toggle {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    color: #16324a;
    border: none;
    width: 42px;
    height: 42px;
    font-size: 1rem;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

html.dark .dark-toggle {
    background: #1a2436;
    color: #f0e68c;
}

.document-page {
    background: #f7f8fb;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 28px;
    padding: 42px 36px 36px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    width: 680px;
    max-width: 100%;
    margin: 0 auto;
}

html.dark .document-page {
    background: #141b2b;
    border-color: #243049;
    color: #e4eaf3;
}

.document-page h1 {
    font-family: Fraunces, Georgia, serif;
    font-size: 2.15rem;
    font-weight: 560;
    color: #12283d;
    letter-spacing: 0.01em;
    line-height: 1.15;
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: none;
}

.document-page h1.brand {
    letter-spacing: 0.2em;
    font-weight: 520;
    font-size: 1.7rem;
}

html.dark .document-page h1 { color: #e7f0fa; }

.meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
    flex-wrap: wrap;
}

.x-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: #12283d;
    color: #f7f8fb;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
}

.x-link:hover { background: #1d4060; }

.ca {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    background: #fff;
    border-radius: 14px;
    padding: 6px 6px 6px 14px;
    box-shadow: inset 0 0 0 1px #e3e8f0;
}

.ca-label {
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    color: #7b8da3;
    font-weight: 600;
    flex: none;
}

#ca-value {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 0.9rem;
    color: #12283d;
    background: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#ca-copy {
    margin-left: auto;
    border: none;
    background: #e8eef6;
    color: #12283d;
    border-radius: 10px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    flex: none;
}

#ca-copy:hover { background: #d7e2ef; }

html.dark .ca {
    background: #101722;
    box-shadow: inset 0 0 0 1px #2a3850;
}

html.dark .x-link { background: #e7f0fa; color: #102033; }
html.dark #ca-value { color: #e7f0fa; }
html.dark .ca-label { color: #8aa0b8; }
html.dark #ca-copy { background: #243049; color: #e7f0fa; }

.chapter-grid { margin-top: 22px; }

.chapter-grid a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 12px;
    margin: 0 -12px;
    text-decoration: none;
    border-radius: 14px;
    color: #12283d;
}

.chapter-grid a + a { border-top: 1px solid transparent; }

.chapter-grid .ch-num {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: #8aa0b8;
    width: 1.6rem;
    flex: none;
}

.chapter-grid b {
    display: block;
    font-weight: 600;
    font-size: 0.98rem;
    letter-spacing: 0.01em;
    color: #12283d;
}

.chapter-grid a span span,
.chapter-grid a > span:last-child {
    display: block;
    font-size: 0.82rem;
    color: #6d8298;
}

.chapter-grid a:hover {
    background: #fff;
}

html.dark .chapter-grid a { color: #e7f0fa; }
html.dark .chapter-grid b { color: #e7f0fa; }
html.dark .chapter-grid a:hover { background: #1c2638; }
html.dark .chapter-grid .ch-num,
html.dark .chapter-grid a > span:last-child { color: #93a6be; }

.declarations { margin-top: 28px; }

.declaration {
    background: #fff;
    border-radius: 18px;
    padding: 16px 18px 18px;
    box-shadow: inset 0 0 0 1px #e6ebf3;
}

.declaration + .declaration { margin-top: 12px; }

.decl-label {
    display: block;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #7b8da3;
    margin-bottom: 8px;
    font-weight: 600;
}

.declaration p,
.document-page .declaration p {
    font-family: Outfit, "Segoe UI", sans-serif;
    font-size: 0.95rem;
    line-height: 1.65;
    color: #3d5168;
    margin-top: 0;
}

.declaration p + p { margin-top: 8px; }

html.dark .declaration {
    background: #101722;
    box-shadow: inset 0 0 0 1px #2a3850;
}

html.dark .decl-label { color: #8aa0b8; }
html.dark .declaration p,
html.dark .document-page .declaration p { color: #c5d2e2; }

.kicker {
    margin-top: 10px;
    font-family: Outfit, sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #7b8da3;
    font-weight: 600;
}

html.dark .kicker { color: #93a6be; }

.document-page > p,
.document-page article p {
    font-family: "Source Serif 4", Georgia, serif;
}

.document-page p {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 1.12rem;
    color: #243246;
    line-height: 1.75;
    margin-top: 1.05em;
}

html.dark .document-page p { color: #d5deea; }

.document-page blockquote {
    margin: 1.2em 0 0;
    padding: 14px 18px;
    border: none;
    border-radius: 16px;
    background: #fff;
    box-shadow: inset 3px 0 0 #9fb4c9;
    color: #2c4158;
    font-size: 1.05rem;
    line-height: 1.65;
}

.document-page blockquote p {
    margin-top: 0.35em;
    font-size: 1.02rem;
}

.document-page blockquote p:first-child { margin-top: 0; }

html.dark .document-page blockquote {
    background: #101722;
    color: #d5deea;
    box-shadow: inset 3px 0 0 #6e88a8;
}

.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 36px;
    padding-top: 16px;
    border-top: 1px solid #e3e8f0;
    font-family: Outfit, sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 600;
}

.chapter-nav a {
    color: #5d7590;
    text-decoration: none;
}

.chapter-nav a:hover { color: #12283d; }

html.dark .chapter-nav { border-top-color: #2a3850; }
html.dark .chapter-nav a { color: #9eb0c6; }
html.dark .chapter-nav a:hover { color: #e7f0fa; }

@media (max-width: 700px) {
    .document-page { padding: 28px 18px 24px; border-radius: 22px; }
    .document-page h1.brand { letter-spacing: 0.14em; font-size: 1.4rem; }
    .ca { width: 100%; }
}
