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

body, h1, h2, p, ul {
    margin: 0;
    padding: 0;
    text-align: center;
    background: white;
    color: black;
}

p {
    text-align: justify;
}

body {
    font-family: "Crimson Text", serif;
    /* font-family: "Times", serif; */
    font-weight: normal;
}

nav ul {
    list-style: none;
}

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 180px; /* fallback; overridden dynamically by nav.js */
}

main h2 {
    padding: 10px;
}

header {
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    background: white;
    padding: 50px 0;
    z-index: 1000;
}

header h1 {
    margin-bottom: 10px;
}

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

nav {
    padding: 10px 0;
}

nav ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1em;
    padding: 0;
    margin: 0;
}

nav a {
    color: black;
    text-decoration: none;
    font-weight: normal;
    padding: 5px 10px;
    white-space: nowrap;
}

nav a.active {
    font-weight: bold;
}

img {
    max-width: 80%;
    height: auto;
}

main ul {
    padding: 0 5em;
}
main ul li {
    padding: 5px;
    list-style: none;
    text-align: left;
}

.nav-container {
    max-width: 80%;
    margin: 0 auto;
    border-bottom: 3px double black;
    position: relative;
}

/* ── Hamburger button (hidden on desktop) ── */
.hamburger {
    display: none;
}

/* Fullscreen overlay (hidden by default) */
#mobile-menu-overlay {
    display: none;
}

/* ── Responsive: small screens ── */
@media (max-width: 600px) {
    
    body {
        font-size: 16px;
        line-height: 1.4;
    }
    
    header {
        padding: 0;
    }

    /* Title + hamburger on one row, title centered */
    .header-bar {
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        max-width: 80%;
        margin: 0 auto;
        padding: 16px 0;
    }

    header h1 {
        margin: 0;
        text-align: center;
        flex: 1;
    }

    /* Show the double line on mobile, but hide the desktop nav links */
    .nav-container {
        max-width: 80%;
        margin: 0 auto;
        border-bottom: 3px double black;
    }

    #main-nav {
        display: none;
    }

    /* Hide header (title + double line) when overlay is open */
    body.menu-open header {
        display: none;
    }

    /* Tighter horizontal padding on mobile and align with nav line width */
    main {
        max-width: 80%;
        width: 100%;
        padding: 0;
        margin: 0 auto;
    }

    main p,
    main ul,
    main img,
    main video,
    main iframe {
        width: 100%;
        margin: 0;
        padding-left: 0;
        padding-right: 0;
    }

    /* Make images align to same width boundaries as text on small screens */
    img {
        max-width: 100%;
        width: 100%;
        height: auto;
        display: block;
        margin-left: auto;
        margin-right: auto;
    }

    /* Hamburger button — absolute so it doesn't shift the centered title */
    .hamburger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        width: 36px;
        height: 36px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 4px;
        position: absolute;
        right: 0;
    }

    .hamburger span {
        display: block;
        width: 22px;
        height: 2px;
        background: black;
        border-radius: 2px;
    }

    /* Fullscreen overlay */
    #mobile-menu-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: white;
        z-index: 2000;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    #mobile-menu-overlay.is-open {
        display: flex;
    }

    /* ✕ close button — top right of overlay */
    .close-btn {
        position: absolute;
        top: 20px;
        right: 10%;
        width: 36px;
        height: 36px;
        background: none;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .close-btn span {
        display: block;
        position: absolute;
        width: 22px;
        height: 2px;
        background: black;
        border-radius: 2px;
    }

    .close-btn span:nth-child(1) { transform: rotate(45deg); }
    .close-btn span:nth-child(2) { transform: rotate(-45deg); }

    /* Overlay nav links */
    #mobile-menu-overlay nav ul {
        flex-direction: column;
        align-items: center;
        gap: 0.5em;
        list-style: none;
        padding: 0;
        margin: 0;
    }

    #mobile-menu-overlay nav a {
        font-size: 1.4em;
        padding: 12px 20px;
        display: block;
    }
}
