:root {
    --bg-color: #000000;
    --text-color: #ffffff;
    --text-muted: #999999;
    --accent-color: #a6192e;
    --border-color: rgba(255, 255, 255, 0.1);

    --font-heading: 'NeueMachina-Ultrabold', sans-serif;
    --font-body: 'NeueMachina-Regular', sans-serif;
}

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

body.detail-active {
    height: 100vh;
    overflow: hidden;
}

/* Navbar */
.detail-topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    font-family: var(--font-heading);
    font-size: 18px;
    /* Changed from 28px */
    font-weight: normal;
    color: #ffdf99;
    background-color: #000000;
    border-bottom: none;
}

.back-link {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
    text-transform: none;
    /* Match "Back" case */
    font-size: 28px;
}

.back-arrow {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.back-link:hover {
    opacity: 0.7;
    color: inherit;
}

.topbar-title {
    color: inherit;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    text-transform: none;
    font-weight: bold;
}

.topbar-nav {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-btn {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.3s;
    text-transform: none;
}

.nav-btn:hover {
    opacity: 0.7;
    color: inherit;
}

.nav-divider {
    color: rgba(255, 223, 153, 0.3);
}

/* Layout Container */
.detail-container {
    display: flex;
    height: 100vh;
    padding-top: 65px;
    /* offset topbar */
}

/* Left Nav - Vertical Progress Tabs */
.geo-tabs {
    flex: 0 0 100px;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-right: 1px solid var(--border-color);
    background-color: var(--bg-color);
    z-index: 10;
}

.geo-tab {
    position: relative;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-color);
    transition: background 0.3s ease;
}

.geo-tab:last-child {
    border-bottom: none;
}

.geo-tab .progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0%;
    /* Dynamic progress */
    background: #fff;
    z-index: 1;
    transition: height 0.05s linear;
}

.geo-tab .tab-text {
    position: relative;
    z-index: 5;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 4px;
    text-transform: uppercase;
    mix-blend-mode: difference;
    /* Inverts text */
    writing-mode: vertical-rl;
    /* Fixed vertical text */
    text-orientation: upright;
    white-space: nowrap;
}

.geo-tab:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Scroll Progress Logic handled by JS */

/* Right Content Area */
.content-scroll {
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
    position: relative;
}

/* Hide scrollbar for cleaner look */
.content-scroll::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

.content-wrapper {
    padding: 10vh 12vw 15vh 8vw;
    display: flex;
    flex-direction: column;
    gap: 15vh;
    /* huge gap between sections */
}

/* Section styling */
.detail-section {
    position: relative;
    padding-top: 40px;
    /* offset for anchor scroll */
}

.section-title {
    display: flex;
    flex-direction: column;
    /* Stack Part X and Title */
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 40px;
}

.section-num {
    font-family: var(--font-heading);
    font-size: 72px;
    /* Large 72px font */
    font-weight: normal;
    line-height: 1;
    color: #ffffff;
    /* Primary white color */
    opacity: 1;
    text-transform: uppercase;
    display: flex;
    align-items: center;
}

.section-num::before {
    content: "PART ";
    /* Added "PART" prefix */
}

.section-title h2 {
    font-family: 'NeueMachina-Regular', sans-serif;
    font-size: 1.2rem;
    /* Smaller subtitle */
    font-weight: normal;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.section-desc {
    visibility: hidden;
    /* Hide text but keep space */
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 60px;
    max-width: 700px;
}

/* Demo image gallery */
.image-gallery {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.demo-image {
    width: 100%;
    margin-bottom: 20px;
    position: relative;
    background-color: transparent;
}

/* Spinner Styles */
.demo-image.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 2;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.demo-image img,
.demo-image video {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.demo-image:not(.is-loading) img,
.demo-image:not(.is-loading) video {
    opacity: 1;
}

/* Response for large screens */
@media (min-width: 1024px) {

    .demo-image,
    .section-title,
    .gallery-item-wrapper {
        width: 70vw;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Optional: Keep a very subtle dimming if desired, but request asked for 'original colors' */
/* .demo-image img:hover { ... } - REMOVED */

.image-gallery.no-gap {
    gap: 0;
}

.image-gallery.no-gap .demo-image {
    margin-bottom: 0;
}

.image-gallery.gap-16 {
    gap: 16px;
}

.demo-image.audio-toggle {
    cursor: pointer;
}

.audio-toggle-capsule {
    position: absolute;
    bottom: 24px;
    right: 24px;
    padding: 8px 16px;
    background: #fff;
    color: #000;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.5px;
    z-index: 10;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.capsule-text {
    white-space: nowrap;
}

.playing-text {
    display: none;
}

/* UI States */
.audio-toggle.playing-audio .audio-toggle-capsule {
    background: #000;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.audio-toggle.playing-audio .muted-text {
    display: none;
}

.audio-toggle.playing-audio .playing-text {
    display: block;
}

.demo-image.audio-toggle:hover .audio-toggle-capsule {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Play/Pause Button */
.play-pause-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 15;
    opacity: 0;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.demo-image:hover .play-pause-btn {
    opacity: 1;
}

.play-pause-btn svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}

.play-pause-btn .play-icon {
    display: block;
}

.play-pause-btn .pause-icon {
    display: none;
}

.video-playing .play-icon {
    display: none;
}

.video-playing .pause-icon {
    display: block;
}

.play-pause-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%) scale(1.1);
}

.image-gallery.gap-16 .demo-image {
    margin-bottom: 0;
}

.image-gallery.gap-24 {
    gap: 24px;
}

.image-gallery.gap-24 .demo-image {
    margin-bottom: 0;
}

.demo-image:hover {
    filter: grayscale(0%) contrast(1);
}

.demo-image.overlay-container {
    position: relative;
}

.demo-image.overlay-container img.overlay-img {
    position: absolute;
    top: 0;
    height: 100%;
    width: auto;
    max-width: none;
    object-fit: contain;
    pointer-events: none;
    z-index: 5;
    background-color: transparent !important;
}

.demo-image.overlay-container img.overlay-img.left {
    left: 0;
}

.demo-image.overlay-container img.overlay-img.right {
    right: 0;
}

.demo-image.overlay-container img.overlay-img.full {
    left: 0;
    width: 100%;
}

.video-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 20;
    pointer-events: none;
}

.video-progress-bar {
    width: 0%;
    height: 100%;
    background: #ffdf99;
    /* Matching the accent beige color */
    transition: width 0.1s linear;
}

/* Labels for Project 6 */
.gallery-item-label {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-align: left;
}

/* Force left alignment for Project 6 specifically if requested */
#detail-6 .demo-image,
#detail-6 .gallery-item-wrapper {
    margin-left: 0;
    width: 70vw;
}

#detail-6 .content-wrapper {
    align-items: flex-start;
}

/* Mobile Adaptation (width < 768px) */
@media (max-width: 768px) {

    /* 4. Detail Page: Left Tab 40px, Right Image Column 85% */
    .geo-tabs {
        flex: 0 0 40px !important;
    }

    .geo-tab .tab-text {
        font-size: 11px;
        letter-spacing: 2px;
    }

    .content-wrapper {
        padding: 40px 20px;
    }

    .demo-image,
    .section-title,
    .gallery-item-wrapper,
    #detail-6 .demo-image,
    #detail-6 .gallery-item-wrapper {
        width: 100% !important;
        margin-left: 0;
        margin-right: 0;
    }

    .section-num {
        font-size: 48px;
    }

    /* 5. Hide detail topbar title and nav on mobile */
    .topbar-title,
    .topbar-nav {
        display: none !important;
    }
}