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

/* ── Variables ── */
:root {
    --serif: 'DM Serif Display', serif;
    --sans: 'DM Sans', sans-serif;
    --fg: #1a1a1a;
    --fg-mid: #3d3d3d;
    --fg-muted: #555555;
    --bg: #FCF6EB;
    --border: rgba(0,0,0,0.10);
    --border-md: rgba(0,0,0,0.16);
    --radius: 10px;
    --max: 1300px;
}

/* ── Base ── */
html {
    font-size: 19px;
}

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

body {
    font-family: var(--sans);
    background-color: var(--bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.68' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='280' height='280' filter='url(%23grain)' opacity='0.3'/%3E%3C/svg%3E");
    background-blend-mode: multiply;
    color: var(--fg);
    -webkit-font-smoothing: antialiased;
    display: flex;
}

/* ── Accessibility ── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: var(--fg);
    color: var(--bg);
    padding: 0.5rem 1rem;
    font-size: 17px;
    border-radius: var(--radius);
    z-index: 999;
    transition: top 0.15s;
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

    a:focus-visible,
    button:focus-visible {
        outline: 2px solid var(--fg);
        outline-offset: 3px;
        border-radius: 2px;
    }

/* ── Sidebar ── */
.side-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    z-index: 100;
    border-right: 0.5px solid var(--border);
    overflow-y: auto;
}

.nav-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 16px;
    color: var(--fg-mid);
    margin-bottom: 2.5rem;
    transition: color 0.15s;
}

    .nav-back:hover {
        color: var(--fg);
    }

.nav-section-label {
    font-size: 13px;
    letter-spacing: 0.1em;
    color: var(--fg-muted);
    text-transform: uppercase;
    margin-bottom: 0.6rem;
    margin-top: 1.75rem;
}

.side-nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

    .side-nav-links a {
        font-family: var(--serif);
        font-size: 26px;
        line-height: 1.2;
        letter-spacing: -0.02em;
        color: var(--fg-muted);
        transition: color 0.2s;
        display: block;
    }

        .side-nav-links a:hover,
        .side-nav-links a.active {
            color: var(--fg);
        }

.nav-divider {
    height: 0.5px;
    background: var(--border);
    margin: 1.5rem 0;
}

/* ── Layout ── */
.content {
    margin-left: 240px;
    flex: 1;
    min-width: 0;
}

.wrap {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 4rem;
}

/* ── Footer ── */
footer {
    padding: 2rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 0.5px solid var(--border);
}

.footer-left {
    font-size: 14px;
    color: var(--fg-muted);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

    .footer-links a {
        font-size: 14px;
        color: var(--fg-muted);
        transition: color 0.15s;
    }

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

/* ── Fade-in ── */
@media (prefers-reduced-motion: no-preference) {
    .fade-in {
        opacity: 0;
        transform: translateY(16px);
        transition: opacity 0.55s ease, transform 0.55s ease;
    }

        .fade-in.visible {
            opacity: 1;
            transform: translateY(0);
        }
}

@media (prefers-reduced-motion: reduce) {
    .fade-in {
        opacity: 1;
        transform: none;
    }
}

/* ── Responsive ── */
@media (max-width: 700px) {
    body {
        flex-direction: column;
    }

    .side-nav {
        position: relative;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 0.5px solid var(--border);
        padding: 1.25rem 1.5rem;
        overflow-y: visible;
    }

    .side-nav-links a {
        font-size: 22px;
    }

    .content {
        margin-left: 0;
    }

    .wrap {
        padding: 0 1.5rem;
    }

    footer {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}
