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

:root {
    --sidebar-width: 265px;
    --header-height: 6rem;
    --orange: #e87722;
    --purple: #6b2fa0;
    --purple-light: #cfa8f5;
    --text: #111111;
    --name-color: #aaaaaa;
    --transition: 0.15s ease;
}

body {
    font-family: 'Atkinson Hyperlegible Next', sans-serif;
    font-weight: 400;
    background: #ffffff;
    color: var(--text);
}


/* ─── HEADER ──────────────────────────────────────────── */

#site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #ffffff;
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 0 2rem;
}

#site-name {
    font-size: 3rem;
    font-weight: 200;
    color: var(--name-color);
    letter-spacing: 0.06em;
    cursor: pointer;
    user-select: none;
    /* shift down to optically centre the x-height rather than the full line box */
    transform: translateY(0.4em);
}

#mobile-menu-btn {
    display: none;
}


/* ─── SIDEBAR ─────────────────────────────────────────── */

#sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    padding: 2rem;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 50;
}

#main-nav {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: block;
    text-decoration: none;
    color: var(--text);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    padding: 0.3rem 0.5rem;
    margin-left: -0.5rem;
    border-radius: 2px;
    transition: color var(--transition), background-color var(--transition);
}

.nav-item:hover,
.nav-item.hover {
    color: var(--orange);
}

.nav-item.active {
    color: var(--purple-light);
    background: #111111;
}

.nav-spacer {
    height: 2rem;
}

#project-nav {
    display: flex;
    flex-direction: column;
}

.project-nav-item {
    display: block;
    text-decoration: none;
    color: var(--text);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    padding: 0.3rem 0.5rem;
    margin-left: -0.5rem;
    border-radius: 2px;
    cursor: pointer;
    transition: color var(--transition), background-color var(--transition);
}

.project-nav-item:hover,
.project-nav-item.hover {
    color: var(--orange);
}

.project-nav-item.active {
    color: var(--purple-light);
    background: #111111;
}


/* ─── MAIN CONTENT ────────────────────────────────────── */

#content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    padding: 2.5rem 3rem;
}


/* ─── VIEWS ───────────────────────────────────────────── */

.view {
    display: none;
}

.view.active {
    display: block;
}


/* ─── PROJECT GRID ────────────────────────────────────── */

#project-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem 1.5rem;
}

.grid-cell {
    cursor: pointer;
}

.grid-cell-image-wrapper {
    position: relative;
    overflow: hidden;
}

.grid-cell-image-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(232, 119, 34, 0);
    transition: background var(--transition);
    pointer-events: none;
}

.grid-cell:hover .grid-cell-image-wrapper::after,
.grid-cell.hover .grid-cell-image-wrapper::after {
    background: rgba(232, 119, 34, 0.18);
}

.grid-cell.active .grid-cell-image-wrapper::after {
    background: rgba(107, 47, 160, 0.18);
}

.grid-cell-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    background: #e0e0e0;
}

.grid-cell-title {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text);
    transition: color var(--transition);
}

.grid-cell:hover .grid-cell-title,
.grid-cell.hover .grid-cell-title {
    color: var(--orange);
}

.grid-cell.active .grid-cell-title {
    color: var(--purple);
}


/* ─── DETAIL VIEW ─────────────────────────────────────── */

#view-detail {
    position: relative;
}

#detail-nav-bar {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 0.5rem;
}

.detail-arrow {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text);
    padding: 0.25rem 0.4rem;
    transition: color var(--transition);
    line-height: 1;
}

.detail-arrow:hover {
    color: var(--orange);
}

.detail-arrow:disabled {
    color: #cccccc;
    cursor: default;
}

#detail-content {
    max-width: 700px;
    margin: 0 auto;
    padding-top: 3rem;
}

.detail-title {
    font-size: 2rem;
    font-weight: 400;
    line-height: 1.2;
    margin-bottom: 0.4rem;
}

.detail-year {
    font-size: 0.85rem;
    color: #888888;
    margin-bottom: 2.5rem;
}

.detail-body p {
    font-size: 1rem;
    line-height: 1.75;
    margin-bottom: 1.25rem;
    color: var(--text);
}

.detail-body img {
    width: 100%;
    height: auto;
    display: block;
    margin: 2rem 0;
}


/* ─── ABOUT & PUBLICATIONS ────────────────────────────── */

.text-content {
    max-width: 700px;
    margin: 0 auto;
    padding-top: 3rem;
}

.text-content h2 {
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 2rem;
    color: var(--text);
}

.text-content p {
    font-size: 1rem;
    line-height: 1.75;
    margin-bottom: 1.25rem;
    color: var(--text);
}

.text-content a {
    color: var(--text);
    text-underline-offset: 3px;
    transition: color var(--transition);
}

.text-content a:hover {
    color: var(--orange);
}


/* ─── MOBILE MENU OVERLAY ─────────────────────────────── */

#mobile-menu {
    display: none;
    position: fixed;
    inset: 0;
    background: #ffffff;
    z-index: 200;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 3rem 2.5rem;
    gap: 1.75rem;
}

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

#mobile-menu-close {
    position: absolute;
    top: 1.1rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text);
    padding: 0.4rem;
    line-height: 1;
    transition: color var(--transition);
}

#mobile-menu-close:hover {
    color: var(--orange);
}

#mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mobile-nav-item {
    font-size: 1.2rem;
    letter-spacing: 0.06em;
    color: var(--text);
    text-decoration: none;
    transition: color var(--transition);
}

.mobile-nav-item:hover {
    color: var(--orange);
}


/* ─── MOBILE ──────────────────────────────────────────── */

@media (max-width: 768px) {

    :root {
        --header-height: 3.5rem;
    }

    #site-header {
        justify-content: space-between;
        padding: 0 1.25rem;
    }

    #site-name {
        font-size: 1.5rem;
        transform: translateY(0.15em);
    }

    #mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        font-size: 1.4rem;
        cursor: pointer;
        color: var(--text);
        padding: 0.4rem 0.5rem;
        line-height: 1;
        transition: color var(--transition);
    }

    #mobile-menu-btn:hover {
        color: var(--orange);
    }

    #sidebar {
        display: none;
    }

    #content {
        margin-left: 0;
        padding: 1.25rem;
    }

    #project-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem 0.75rem;
    }

    #detail-content {
        max-width: 100%;
        padding-top: 2.5rem;
    }

    .detail-title {
        font-size: 1.5rem;
    }

    .text-content {
        padding-top: 2rem;
    }

}
