/* Immersive Full Screen 3D Card Stack Styling */

:root {
    --bg-dark: #09090b; /* Midnight black */
    --bg-card: rgba(18, 18, 22, 0.75); /* Modern glassmorphic dark overlay */
    --gold: #d4af37; /* Warm golden accents */
    --gold-glow: rgba(212, 175, 55, 0.25);
    --text-primary: #f4f4f5; /* Light primary text */
    --text-muted: #a1a1aa; /* Muted secondary text */
    --border-color: rgba(255, 255, 255, 0.08); /* Soft white borders */
    --font-serif: 'Lora', Georgia, serif;
    --font-sans: 'Outfit', sans-serif;
    
    --card-width: 100vw;
    --card-height: 100vh;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow-x: hidden;
    height: 100%;
}

/* Loading Screen */
.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #dcdcdb; /* Clean light gray matching your template image background */
    z-index: 1000;
    transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.8s;
}

.loader-container.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-percentage {
    position: absolute;
    bottom: 8%; /* 8% from the bottom edge */
    left: 6%; /* 6% from the left edge */
    font-size: clamp(5rem, 15vw, 11rem); /* Massive bold layout */
    font-weight: 800; /* Extra bold */
    color: #000000; /* Dark black text */
    font-family: var(--font-sans);
    letter-spacing: -0.05em; /* Tight letter spacing matching reference image */
    line-height: 0.8;
}

/* Ambient Background elements */
.ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.glow-light {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.04;
    mix-blend-mode: screen;
}

.glow-light.top-left {
    top: -20%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--gold) 0%, transparent 70%);
}

.glow-light.bottom-right {
    bottom: -20%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, #6d3ebb, transparent 75%);
}

/* Scroll Container Setup */
.scroll-container {
    position: relative;
    width: 100%;
    height: 1000vh;
}

/* Viewport containing sticky elements */
.sticky-viewport {
    position: sticky;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #050507;
    perspective: 2000px;
    z-index: 10;
}

/* Site Header */
.site-header {
    position: absolute;
    top: 40px;
    left: 40px;
    right: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    pointer-events: none;
    mix-blend-mode: difference; /* Ensures text is visible on any image */
}

.logo {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 0.25em;
    color: #ffffff;
}

.project-year {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    color: #ffffff;
    opacity: 0.7;
}

/* Card Stack Viewport & Wrapper - Flat layout for clean full bleed */
.deck-viewport {
    position: relative;
    width: var(--card-width);
    height: var(--card-height);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transform: none; /* Flat viewport alignment for edge-to-edge images */
    transform-style: preserve-3d;
}

.deck-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

/* 3D Card Leaf Layout */
.card-leaf {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    will-change: transform, opacity;
    pointer-events: none;
}

.card-leaf.active-pointer {
    pointer-events: auto;
}

/* Full Bleed Card Content Design */
.card-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #050507; /* Dark background under images */
    border-radius: 0; /* Remove rounded corners for full screen bleed */
    box-shadow: none; /* Remove shadows */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0; /* Full bleed image fitting */
    transform-style: preserve-3d;
}

.card-content.img-container {
    background: #050507;
}

.portfolio-img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Prevent cropping while filling the dynamic aspect-ratio container */
    border-radius: 0; /* Full bleed images */
    box-shadow: none;
    transition: opacity 0.5s ease;
    opacity: 1;
}

.portfolio-img.loading {
    opacity: 0;
}

/* Dynamic overlays */
.card-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.02;
    pointer-events: none;
    background-image: 
        radial-gradient(circle at 50% 30%, rgba(255,255,255,0.06) 0%, transparent 60%),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    z-index: 10;
}

.card-shadow-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
    background: #000000;
    opacity: 0;
    border-radius: 0; /* Remove rounded corners */
    will-change: opacity;
    transition: opacity 0.1s linear;
}

/* Credit Face Styling - Glassmorphic dark card in center */
.credit-content {
    background: radial-gradient(circle at center, #131316 0%, #08080a 100%);
    color: var(--text-primary);
    text-align: center;
}

.credit-content::before {
    content: '';
    position: absolute;
    top: 30px;
    left: 30px;
    right: 30px;
    bottom: 30px;
    border: 1px dashed rgba(212, 175, 55, 0.1);
    pointer-events: none;
    border-radius: 12px;
}

.credit-wrap {
    max-width: 60%;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 20;
}

.credit-title {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 0.2em;
    color: var(--gold);
    margin-bottom: 12px;
}

.divider {
    width: 60px;
    height: 1px;
    background: var(--gold);
    margin-bottom: 24px;
    opacity: 0.5;
}

.credit-sub {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.credit-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 32px;
    font-family: var(--font-serif);
    font-style: italic;
}

.restart-btn {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 12px 28px;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.restart-btn:hover {
    background: var(--gold);
    color: var(--bg-dark);
    box-shadow: 0 0 15px var(--gold-glow);
}

/* Controls Panel - Floating dark glassmorphism */
.controls-panel {
    position: absolute;
    bottom: 40px;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    padding: 10px 24px;
    border-radius: 50px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
    gap: 12px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--gold);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.progress-indicator {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    min-width: 60px;
    text-align: center;
}

#current-page-num {
    color: var(--text-primary);
    font-weight: 600;
}


/* Custom Scrollbar Progress line */
.scrollbar-custom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.02);
    z-index: 100;
}

.scrollbar-thumb {
    height: 100%;
    width: 0%;
    background: var(--gold);
    box-shadow: 0 0 8px var(--gold);
    transition: width 0.1s linear;
}

/* Scroll / Control indicator (help message) */
.scroll-indicator {
    position: absolute;
    bottom: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    z-index: 50;
    transition: opacity 0.5s ease;
}

.scroll-indicator.hide {
    opacity: 0;
}

.indicator-text {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.mouse-icon {
    width: 20px;
    height: 32px;
    border: 2px solid var(--text-muted);
    border-radius: 12px;
    position: relative;
}

.scroll-wheel {
    width: 4px;
    height: 6px;
    background: var(--gold);
    border-radius: 2px;
    position: absolute;
    top: 6px;
    left: calc(50% - 2px);
    animation: scroll-wheel-anim 1.6s infinite ease;
}

@keyframes scroll-wheel-anim {
    0% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(6px); opacity: 0.3; }
    100% { transform: translateY(0); opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .site-header {
        top: 20px;
        left: 20px;
        right: 20px;
    }
    
    .controls-panel {
        bottom: 20px;
        padding: 6px 16px;
    }
    
    .scroll-indicator {
        bottom: 85px;
    }
    
    .credit-wrap {
        max-width: 85%;
    }
    
    .credit-title {
        font-size: 2rem;
    }
}

/* Feedback Popup Modal */
.popup-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%) scale(0.92);
    width: min(90vw, 420px);
    background: rgba(18, 18, 22, 0.9);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 36px 30px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: 
        opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1),
        transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    text-align: center;
}

.popup-modal.show {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.popup-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.popup-close-btn {
    position: absolute;
    top: -20px;
    right: -10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.popup-close-btn:hover {
    color: var(--text-primary);
}

.popup-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 10px var(--gold-glow));
}

.popup-header-title {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-weight: 300;
    color: var(--gold);
    margin-bottom: 12px;
}

.popup-message {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.popup-prompt {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.popup-email-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gold);
    color: var(--bg-dark);
    text-decoration: none;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 12px 30px;
    border-radius: 40px;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.15);
}

.popup-email-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
    background: #e5be3d;
}

/* Floating QR trigger button style */
.qr-trigger {
    position: absolute;
    top: 40px;
    left: 40px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(18, 18, 22, 0.8);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 10px 18px;
    border-radius: 40px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.qr-trigger:hover {
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.15);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .qr-trigger {
        top: 20px;
        left: 20px;
        padding: 8px 14px;
        font-size: 0.7rem;
    }
}

