:root {
    --ink: #14201A;
    --ink-soft: #4B5A52;
    --paper: #F7F5EF;
    --paper-raised: #FFFFFF;
    --line: #E4E0D4;

    --accent: #3FAE8F;
    --accent-deep: #1A6E52;
    --accent-tint: #E6F7F1;

    --font-display: "Fraunces", "Georgia", serif;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;

    --transition-base: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--paper);
    color: var(--ink);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

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

a {
    color: inherit;
}

/* ==========================================================================
     Header
     ========================================================================== */

header {
    padding: 26px 0;
    border-bottom: 1px solid var(--line);
    background: var(--paper-raised);
    position: sticky;
    top: 0;
    z-index: 10;
}

header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
    text-decoration: none;
    color: var(--ink);
}

.nav-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.86rem;
    font-family: var(--font-body);
    transition: background var(--transition-base), border-color var(--transition-base), transform var(--transition-base);
    white-space: nowrap;
}

a.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--ink);
    color: var(--paper);
}

.btn-primary:hover {
    background: var(--accent-deep);
}

.btn-secondary {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent-deep);
}

/* ---- Hamburger toggle (mobile only) ---- */

.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
    content: "";
    display: block;
    width: 20px;
    height: 2px;
    background: var(--ink);
    position: relative;
    transition: transform var(--transition-base), opacity var(--transition-base);
}

.nav-toggle span::before {
    position: absolute;
    top: -6px;
}

.nav-toggle span::after {
    position: absolute;
    top: 6px;
}

.nav-toggle.is-open span {
    background: transparent;
}

.nav-toggle.is-open span::before {
    transform: translateY(6px) rotate(45deg);
}

.nav-toggle.is-open span::after {
    transform: translateY(-6px) rotate(-45deg);
}

/* ==========================================================================
     Page head
     ========================================================================== */

.page-head {
    padding: 56px 0 8px;
}

.page-head h1 {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}

.page-head .updated {
    font-size: 0.85rem;
    color: var(--ink-soft);
}

/* ==========================================================================
     Intro
     ========================================================================== */

.intro {
    padding: 24px 0 8px;
}

.intro p {
    color: var(--ink-soft);
    max-width: 620px;
    margin-bottom: 14px;
    font-size: 1rem;
}

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

/* ==========================================================================
     Table of contents
     ========================================================================== */

.toc {
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 22px 26px;
    margin: 32px 0;
}

.toc h2 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.toc ol {
    margin-left: 20px;
    color: var(--ink);
    columns: 2;
    column-gap: 28px;
}

.toc li {
    margin-bottom: 8px;
    font-size: 0.9rem;
    break-inside: avoid;
}

.toc a {
    color: var(--ink-soft);
    text-decoration: none;
    transition: color var(--transition-base);
}

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

/* ==========================================================================
     Sections
     ========================================================================== */

section {
    padding: 34px 0;
    border-top: 1px solid var(--line);
    scroll-margin-top: 90px;
}

section h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 14px;
    letter-spacing: -0.01em;
}

section h3 {
    font-family: var(--font-display);
    font-size: 1.02rem;
    font-weight: 600;
    margin: 22px 0 10px;
}

section p {
    color: #3A3A3A;
    margin-bottom: 12px;
    max-width: 640px;
}

section ul,
section ol {
    color: #3A3A3A;
    margin: 0 0 14px 22px;
    max-width: 620px;
}

section li {
    margin-bottom: 7px;
}

section p:last-child,
section ul:last-child,
section ol:last-child {
    margin-bottom: 0;
}

section strong {
    color: var(--ink);
    font-weight: 600;
}

/* ==========================================================================
     Data table
     ========================================================================== */

table.data-table {
    border-collapse: collapse;
    width: 100%;
    max-width: 660px;
    margin: 16px 0;
    font-size: 0.88rem;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
}

table.data-table th,
table.data-table td {
    text-align: left;
    padding: 11px 15px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

table.data-table tr:last-child th,
table.data-table tr:last-child td {
    border-bottom: none;
}

table.data-table th {
    font-weight: 700;
    color: var(--ink-soft);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--paper);
}

table.data-table td {
    color: #3A3A3A;
}

table.data-table tr:hover td {
    background: var(--accent-tint);
}

/* ==========================================================================
     Footer
     ========================================================================== */

footer {
    padding: 32px 0;
    border-top: 1px solid var(--line);
    margin-top: 12px;
}

footer .wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

footer p {
    font-size: 0.82rem;
    color: var(--ink-soft);
}

footer .links {
    display: flex;
    gap: 18px;
}

footer .links a {
    font-size: 0.82rem;
    color: var(--ink-soft);
    text-decoration: none;
}

footer .links a:hover {
    color: var(--ink);
}

/* ==========================================================================
     Back to top
     ========================================================================== */

.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--paper);
    border: none;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px -4px rgba(20, 32, 26, 0.3);
    transition: background var(--transition-base), opacity var(--transition-base);
    z-index: 20;
}

.back-to-top.is-visible {
    display: flex;
}

.back-to-top:hover {
    background: var(--accent-deep);
}

.back-to-top svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

@media (max-width: 600px) {
    .wrap {
        padding: 0 18px;
    }

    .page-head {
        padding: 40px 0 8px;
    }

    .page-head h1 {
        font-size: 1.5rem;
    }

    section {
        padding: 26px 0;
        scroll-margin-top: 76px;
    }

    .toc {
        padding: 18px 20px;
    }

    .toc ol {
        columns: 1;
    }

    /* Hamburger mode */
    header .wrap {
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .nav-buttons {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 10px;
        background: var(--paper-raised);
        border-bottom: 1px solid var(--line);
        padding: 16px 18px 20px;
        box-shadow: 0 10px 20px rgba(20, 32, 26, 0.06);
    }

    .nav-buttons.is-open {
        display: flex;
    }

    .nav-buttons a.btn {
        width: 100%;
        text-align: center;
    }

    table.data-table {
        font-size: 0.8rem;
    }

    table.data-table th,
    table.data-table td {
        padding: 8px 10px;
    }

    .back-to-top {
        bottom: 18px;
        right: 18px;
    }
}