/* ========================================
   Portfolio Showcase Overlay Styles
   ======================================== */

.showcase-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    z-index: 900;
    /* Below nav (1000) so nav stays visible */
    display: flex;
    padding-top: 80px;
    /* Clear the nav */
    background: transparent;
    /* Rely on body shader background */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    overflow: hidden;
}

.showcase-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Fade out main content when showcase is open */
body.showcase-active main {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

/* ── Left Panel: Project List ──────────────────────────────── */
.project-panel {
    width: 380px;
    min-width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 40px 32px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.project-panel::-webkit-scrollbar {
    width: 4px;
}

.project-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.project-panel-header {
    margin-bottom: 40px;
}

.panel-label {
    display: block;
    font-family: var(--font-primary);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-accent-orange);
    margin-bottom: 12px;
    font-weight: 600;
}

.panel-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 400;
    line-height: 1.15;
    color: var(--color-text-primary);
}

/* ── Project List Items ────────────────────────────────────── */
.project-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.project-item {
    position: relative;
    padding: 14px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.3s var(--spring-smooth);
    user-select: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.project-item::before {
    content: '•';
    font-style: normal;
    font-size: 1.4rem;
    line-height: 1;
    color: rgba(255, 255, 255, 0.25);
    transition: color 0.3s ease;
}

.project-item:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.04);
}

.project-item:hover::before {
    color: rgba(255, 255, 255, 0.5);
}

.project-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.project-item.active::before {
    color: var(--color-accent-orange);
}

.project-list-empty {
    padding: 24px 18px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.9rem;
    font-style: italic;
    line-height: 1.6;
}

.design-disclaimer {
    margin-top: auto;
    padding: 24px 18px 0;
    font-family: var(--font-primary);
    font-size: 0.65rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.35);
    text-align: left;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ── Right Panel: Slide Viewer ─────────────────────────────── */
.viewer-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 80px 24px 0;
    /* Increased right padding to prevent close button clipping */
    min-width: 0;
}

.viewer-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: calc(70vh * 16 / 9);
    /* Lock max width to 16:9 of max height to prevent overflow (70vh gives good padding) */
    position: relative;
    /* Anchor for close button */
}

.viewer-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 20px;
    /* overflow: hidden clips zoomed content to rounded corners (close btn is in .viewer-wrapper, not here) */
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
}

/* Close button for overlay */
.viewer-close-btn {
    position: absolute;
    top: 0px;
    right: -60px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.25s var(--spring-smooth);
}

.viewer-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: scale(1.05);
}

.viewer-close-btn svg {
    width: 24px;
    height: 24px;
}

.viewer-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: rgba(255, 255, 255, 0.25);
    font-size: 1rem;
    font-style: italic;
}

.viewer-empty-state .empty-icon {
    width: 64px;
    height: 64px;
    opacity: 0.15;
}

.viewer-slides {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.slide-display {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* Mask edges: content remains within bounds */
    min-height: 0;
    width: 100%;
    /* Size containment so documents don't resize the viewer */
    contain: layout style;
}

.slide-display img,
.slide-display canvas,
.slide-display video,
.slide-display>.slide-item {
    position: absolute;
    /* Cross-fade overlap */
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 20px;
    opacity: 0;
    transform: scale(0.98);
    /* Start slightly smaller for entry effect */
    transition:
        opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    /* Stale slides don't intercept interactions */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.slide-display img.slide-visible,
.slide-display canvas.slide-visible,
.slide-display video.slide-visible,
.slide-display .slide-item.slide-visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
    will-change: transform;
}

/* Zoom cursor states */
.slide-display.zoomed {
    cursor: grab;
}

.slide-display.zoomed:active {
    cursor: grabbing;
}

.slide-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1 !important;
    /* Always visible regardless of slide transition */
    transition: opacity 0.4s ease;
    z-index: 5;
}

.slide-loading::after {
    content: '';
    width: 36px;
    height: 36px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: slideSpinner 0.8s linear infinite;
}

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

/* ── Controls ────────────────────────────────────────── */
.viewer-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px 0 0;
    /* Padding above controls now that it's outside */
    flex-shrink: 0;
}

.slide-arrow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s var(--spring-smooth);
}

.slide-arrow:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    color: #fff;
    transform: scale(1.05);
}

.slide-arrow:active {
    transform: scale(0.92);
}

.slide-arrow:disabled {
    opacity: 0.2;
    cursor: default;
    pointer-events: none;
}

.slide-indicators {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 500px;
    /* Increased from 200px to comfortably fit 16+ dots */
    overflow-x: auto;
    scrollbar-width: none;
    scroll-behavior: smooth;
}

.slide-indicators::-webkit-scrollbar {
    display: none;
}

.slide-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.slide-dot.active {
    background: var(--color-accent-orange);
    width: 24px;
    border-radius: 4px;
}

.slide-counter {
    font-family: var(--font-primary);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.1em;
    white-space: nowrap;
    min-width: 55px;
    text-align: center;
}

/* Hide the inner project header completely per user request */
.viewer-project-header {
    display: none;
}

@media (max-width: 900px) {

    /* Full-screen column layout */
    .showcase-overlay {
        flex-direction: column;
        padding-top: 100px;
    }

    /* --- Project Panel: compact vertical list --- */
    .project-panel {
        width: 100%;
        min-width: 0;
        max-height: 25vh;
        padding: 12px 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .project-panel-header {
        display: none;
        /* Save vertical space on mobile */
    }

    .project-list {
        flex-direction: column;
        gap: 2px;
    }

    .project-item {
        padding: 10px 14px;
        font-size: 0.65rem;
        border-radius: 8px;
        position: relative;
    }

    /* Left-side active indicator bar (replaces bullet) */
    .project-item::before {
        content: '';
        position: absolute;
        left: 0;
        top: 25%;
        height: 50%;
        width: 3px;
        border-radius: 2px;
        background: transparent;
        transition: background 0.3s ease;
        font-size: 0;
        /* Remove the bullet character */
    }

    .project-item.active::before {
        background: var(--color-accent-orange);
    }

    /* --- Viewer Panel: edge-to-edge 16:10 --- */
    .viewer-panel {
        padding: 8px;
        flex: 1;
        min-height: 0;
    }

    .viewer-wrapper {
        height: 100%;
        max-width: 100%;
    }

    .viewer-container {
        border-radius: 14px;
        aspect-ratio: 16 / 10;
        width: 100%;
        max-height: 100%;
        flex: none;
        /* Respect aspect-ratio instead of flex grow */
    }

    /* Close button: inside top-right on mobile */
    .viewer-close-btn {
        right: 8px;
        top: 8px;
        width: 36px;
        height: 36px;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    /* Compact controls */
    .viewer-controls {
        padding: 12px 0 0;
        gap: 12px;
    }

    .showcase-overlay.gallery-mode .viewer-panel {
        padding-left: 8px;
    }
}

/* ── Gallery Mode Overrides ───────────────────────────────── */
.showcase-overlay.gallery-mode .project-panel {
    display: none;
}

.showcase-overlay.gallery-mode .viewer-panel {
    padding-left: 80px;
}