/* ==========================================================================
   Project pages: sub-nav, showcase, accordion, project layout and page navigation
   ========================================================================== */

/* ==========================================================================
   Sub-nav
   ========================================================================== */

        .sub-nav {
            display: flex;
            justify-content: center;
            background: var(--glass);
            padding: 18px 0;
            position: sticky;
            top: var(--header-h);
            z-index: 99;
        }

        .sub-nav ul {
            display: flex;
            list-style: none;
            gap: 48px;
            margin: 0;
        }

        .sub-nav ul li a {
            color: white;
            text-decoration: none;
            font-family: Montserrat, sans-serif;
            font-weight: 500;
            font-size: 18px;
            letter-spacing: 2px;
            text-transform: uppercase;
            position: relative;
            display: inline-block;
            padding: 8px 6px;
            transition: color 0.25s ease, transform 0.25s ease, text-shadow 0.25s ease;
        }

        .sub-nav ul li a i {
            margin-right: 8px;
            color: var(--accent);
        }

        .sub-nav ul li a:hover,
        .sub-nav ul li a:focus-visible {
            color: var(--accent);
            transform: translateY(-2px);
        }

        /* Same cyan bar as the main nav: grows out from the centre on hover/focus and stays on the current page */
        .sub-nav ul li a::after {
            content: '';
            position: absolute;
            left: 6px;
            right: 6px;
            bottom: -3px;
            height: 2px;
            border-radius: 2px;
            background: var(--accent);
            box-shadow: 0 0 8px var(--accent);
            transform: scaleX(0);
            transition: transform 0.3s ease;
        }

        .sub-nav ul li a:hover::after,
        .sub-nav ul li a:focus-visible::after,
        .sub-nav ul li a.active::after {
            transform: scaleX(1);
        }

        .sub-nav ul li a.active {
            font-weight: bold;
            color: var(--accent);
            text-shadow: 0 0 12px rgba(255, 255, 255, 0.35);
        }

/* ==========================================================================
   Bottom page navigation
   ========================================================================== */

        .page-nav {
        display: flex;
        justify-content: space-between;
        padding: 40px 20px;
        box-sizing: border-box;
        width: 100%;
        margin: 0 auto;
        align-items: stretch;
        }

        .page-nav-prev, .page-nav-next {
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            background: var(--glass);
            text-decoration: none;
            font-family: video-light, sans-serif;
            font-size: 40px;
            font-weight: bold;
            padding: 15px 20px;
            border: 2px solid white;
            border-radius: 10px;
            transition: background 0.3s, color 0.3s, border-color 0.3s;
            box-sizing: border-box;
            width: clamp(150px, 30%, 400px);
            text-align: center;
            flex: 0 0 auto;
        }

        .page-nav-prev, .page-nav-next {
            font-size: clamp(14px, 4vw, 40px);
        }

        .page-nav-prev:hover, .page-nav-next:hover {
            background: rgba(0, 45, 52, 0.85);
            border-color: var(--accent);
        }

/* ==========================================================================
   Showcase
   ========================================================================== */

    .showcase {
        padding-top: 20px;
        max-width: 1000px;
        margin: 0 auto;
        box-sizing: border-box;
        width: 100%;
    }

    .showcase img {
        display: block;
        margin: 0 auto;
        width: 50%;
        height: auto;
        border: 5px solid var(--accent);
        border-radius: 30px;
        filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.5));
        transition: transform 0.3s ease;
    }

    .showcase img:hover {
        transform: scale(1.05);
    }

    .showcase-img-text {
        background: var(--glass);
        border-radius: 16px;
        margin: 10px 16px;
        text-align: center;
        font-family: video-light, sans-serif;
        font-size: 40px;
        padding: 10px 0px;
    }

/* ==========================================================================
   Accordion
   ========================================================================== */

.accordion {
    background: var(--glass);
    border: 2px solid var(--accent);
    border-radius: 10px;
    margin: 0 16px 15px;
}

.accordion-btn {
    width: 100%;
    background: rgba(0, 0, 0, 0.15);
    border: none;
    color: white;
    font-family: video-light, sans-serif;
    font-size: 28px;
    font-weight: bold;
    padding: 20px;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s;
    overflow: hidden;
    border-radius: 10px;
}

.accordion-btn:hover {
    background: rgba(0, 0, 0, 0.28);
}

.accordion-btn.open {
    border-bottom: 2px solid var(--accent);
    border-radius: 10px 10px 0 0;
    /* Stay visible under the sticky header and sub-nav while the section is open, so it can be closed from anywhere in it.
       --subnav-h is measured by script.js. */
    position: sticky;
    top: calc(var(--header-h) + var(--subnav-h, 0px));
    z-index: 98;
    background: rgb(8, 58, 69);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* Close button at the bottom of each open panel */
.accordion-close-row {
    padding: 0 20px 24px;
    text-align: center;
}

.accordion-close {
    cursor: pointer;
}

@media (max-width: 768px) {
    .accordion-btn.open {
        font-size: 22px;
        padding: 14px 16px;
    }
}

.accordion-icon {
    transition: transform 0.3s ease;
}

.accordion-btn.open .accordion-icon {
    transform: rotate(45deg);
}

/* visibility keeps collapsed content (links, lightbox images) out of the tab order and screen readers */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    transition: max-height 0.4s ease, padding 0.3s ease, visibility 0s linear 0.4s;
    padding: 0 20px;
}

.accordion-content.open {
    max-height: 12000px;
    padding: 20px;
    overflow: visible;
    visibility: visible;
    transition: max-height 0.4s ease, padding 0.3s ease, visibility 0s;
}

/* ==========================================================================
   Project layout
   ========================================================================== */

    .project-hero {
        width: 100%;
        max-height: 600px;
        overflow: hidden;
        position: relative;
    }

    .project-hero img {
        width: 100%;
        height: 600px;
        object-fit: cover;
        display: block;
        filter: drop-shadow(0px 4px 10px rgba(0,0,0,0.5));
    }

    /* Dark fade behind the title so it stays readable on any image */
    .project-hero::after {
        content: '';
        position: absolute;
        inset: auto 0 0 0;
        height: 50%;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
        pointer-events: none;
    }

    /* Website screenshots already have their own text, so skip the title overlay and its dark fade */
    .project-hero-plain::after {
        display: none;
    }

    .project-hero-title {
        z-index: 1;
        position: absolute;
        bottom: 30px;
        left: 40px;
        font-family: video-light, sans-serif;
        font-size: 60px;
        font-weight: bold;
        text-shadow: 2px 4px 10px rgba(0,0,0,0.8);
    }

    .project-body {
        display: flex;
        gap: 40px;
        max-width: 1200px;
        margin: 0 auto;
        padding: 40px 20px;
        box-sizing: border-box;
    }

    .project-main {
        flex: 3;
    }

    .project-sidebar {
        flex: 1;
        position: sticky;
        align-self: flex-start;
        background: rgba(0, 0, 0, 0.15);
        border: 2px solid var(--accent);
        border-radius: 10px;
        padding: 20px;
        box-sizing: border-box;
        top: calc(var(--header-h) + var(--subnav-h, 0px) + var(--accordion-h, 0px) + 20px);
        max-height: calc(100vh - var(--header-h) - var(--subnav-h, 0px) - var(--accordion-h, 0px) - 40px);
        overflow-y: auto;
    }

    .project-sidebar h3 {
        font-family: video-light, sans-serif;
        font-size: 24px;
        font-weight: bold;
        margin-bottom: 15px;
        border-bottom: 2px solid var(--accent);
        padding-bottom: 10px;
    }

    .specs-list {
        list-style: none;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 15px;
        margin-top: 15px;
    }

    .specs-list li {
        font-family: Montserrat, sans-serif;
        font-size: 16px;
        line-height: 1.5;
        border-bottom: 1px solid rgba(255,255,255,0.2);
        padding-bottom: 15px;
    }

    .specs-list li:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

.sketchfab-text {
    font-family: Montserrat, sans-serif;
    font-size: 18px;
    text-align: center;
    background: #e8fbff;
    color: #00303a;
    padding: 10px;
    border-radius: 0 0 10px 10px;
}

.sketchfab-link {
    color: #005a68;
    text-decoration: underline;
    font-weight: bold;
    transition: color 0.3s;
}

.sketchfab-link:hover {
    color: #003a44;
}
/* Section titles */
    .project-section-title {
        font-family: video-light, sans-serif;
        font-size: 36px;
        font-weight: bold;
        margin: 40px 0 20px 0;
        padding-bottom: 10px;
        border-bottom: 2px solid var(--accent);
    }

/* 3D Viewer */
    .viewer-embed {
        width: 100%;
        border-radius: 10px;
        overflow: hidden;
        border: 2px solid var(--accent);
        filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.5));
    }

    .viewer-embed iframe {
        width: 100%;
        height: 500px;
        border: none;
        display: block;
    }

    .viewer-embed video {
        width: 100%;
        display: block;
        background: #000;
    }

/* Technical Breakdown Grid */
    .breakdown-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        margin: 20px 0;
    }

    .breakdown-item img {
        width: 100%;
        height: 250px;
        object-fit: cover;
        border-radius: 10px;
        border: 2px solid var(--accent);
        filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.5));
        transition: transform 0.3s ease;
    }

    .breakdown-item img:hover {
        transform: scale(1.02);
    }

    .breakdown-item p {
        text-align: center;
        margin-top: 8px;
        font-family: Montserrat, sans-serif;
        font-weight: bold;
        font-size: 16px;
    }

/* A wide strip (such as a row of texture maps) that spans both breakdown columns */
    .breakdown-item-wide {
        grid-column: 1 / -1;
    }

    .breakdown-item-wide img {
        height: auto;
        aspect-ratio: 4 / 1;
    }

/* Detail Shots */
    .detail-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        margin: 20px 0;
    }

    .detail-item img {
        width: 100%;
        height: 200px;
        object-fit: cover;
        border-radius: 10px;
        border: 2px solid var(--accent);
        filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.5));
        transition: transform 0.3s ease;
        cursor: pointer;
    }

    .detail-item img:hover {
        transform: scale(1.05);
    }

    .detail-item p {
        text-align: center;
        margin-top: 8px;
        font-family: Montserrat, sans-serif;
        font-size: 16px;
    }

/* Project description */
    .project-description {
        font-family: Montserrat, sans-serif;
        font-size: 16px;
        line-height: 1.8;
        margin-bottom: 20px;
        max-width: 75ch;
        background-color: var(--panel);
        border: 2px solid var(--accent);
        padding: 20px;
        border-radius: 10px;
    }

/* ==========================================================================
   Small screen / mobile
   ========================================================================== */

@media (max-width: 1080px) {
    .page-nav {
        padding: 20px 10px;
        gap: 10px;
    }

    .page-nav-prev, .page-nav-next {
        padding: 10px 8px;
        width: 40%;
        text-align: center;
    }

    .sub-nav ul {
        gap: 16px;
        flex-wrap: wrap;
        justify-content: center;
        padding: 0 10px;
    }

    .sub-nav ul li a {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .project-body {
        flex-direction: column;
    }

    .project-sidebar {
        position: static;
        width: 100%;
    }

    .breakdown-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .project-hero-title {
        font-size: 36px;
    }

    /* Show the whole render instead of a centre slice; the title stays available to screen readers */
    .project-hero-render img {
        height: auto;
    }

    .project-hero-render::after {
        display: none;
    }

    .project-hero-render .project-hero-title {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    /* Show the whole website screenshot instead of a narrow slice of it */
    .project-hero-plain img {
        height: auto;
    }

    .viewer-embed iframe {
        height: 300px;
    }
}
