/* ============================================
   GSPI — Zero-Scroll Panel-Unfold Website
   ============================================ */

:root {
    --blue-900: #0a1628;
    --blue-800: #0f2447;
    --blue-700: #153267;
    --blue-600: #1a4080;
    --blue-500: #2563eb;
    --blue-400: #3b82f6;
    --blue-300: #60a5fa;
    --blue-200: #93c5fd;
    --blue-100: #dbeafe;
    --blue-50:  #eff6ff;
    --gold: #f59e0b;
    --gold-light: #fbbf24;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    color: var(--gray-800);
    background: #1A3A6B;
    line-height: 1.6;
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ============================================
   STAGE — Fixed full-viewport container
   ============================================ */

.stage {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: -webkit-fill-available;
    background: #1A3A6B;
    overflow: hidden;
}

/* ============================================
   PORTRAIT LAYER — always behind everything
   ============================================ */

.portrait-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease;
}

.portrait-layer img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    object-position: bottom center;
    opacity: 0.1;
    transition: opacity 2.5s ease;
}

/* Extra portrait images — hidden on desktop */
.portrait-pitaji,
.portrait-founder {
    display: none;
}

/* ============================================
   PARTICLES
   ============================================ */

.particles {
    position: absolute;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    bottom: 0;
    width: 2px;
    height: 2px;
    background: rgba(147, 197, 253, 0.25);
    border-radius: 50%;
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    0%   { transform: translateY(0) scale(0); opacity: 0; }
    10%  { opacity: 0.5; transform: translateY(-15vh) scale(1); }
    80%  { opacity: 0.3; }
    100% { transform: translateY(-85vh) scale(0.3); opacity: 0; }
}

/* ============================================
   PANELS — 4 blocks that slide over the portrait
   Each panel tucks behind the one to its left
   ============================================ */

.panels {
    position: absolute;
    inset: 0;
    z-index: 10;
    overflow: hidden;
    pointer-events: none;
}

/* Arrow hint on last open panel (not the 4th) */
@keyframes arrowPulse {
    0%, 100% { transform: translateX(0); opacity: 0.8; }
    50%      { transform: translateX(6px); opacity: 1; }
}

.panel.last-open::after {
    content: 'Click';
    position: absolute;
    right: -24px;
    bottom: 10%;
    width: 0;
    height: 0;
    border-top: 30px solid transparent;
    border-bottom: 30px solid transparent;
    border-left: 40px solid #4A8FD4;
    z-index: 10;
    animation: arrowPulse 2s ease-in-out infinite;
    font-family: var(--font-sans);
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--white);
    line-height: 0;
    letter-spacing: 0.5px;
    padding-left: 0;
    text-indent: -34px;
}

.panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 25%;
    height: 100%;
    pointer-events: auto;
    will-change: transform;
    /* Hidden: slid off-screen to the left */
    transform: translateX(-100%);
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Z-index so earlier panels sit on top */
.panel[data-panel="0"] { z-index: 4; }
.panel[data-panel="1"] { z-index: 3; }
.panel[data-panel="2"] { z-index: 2; }
.panel[data-panel="3"] { z-index: 1; }

/* Visible — each panel slides to its column */
.panel[data-panel="0"].unfolded { transform: translateX(0); }
.panel[data-panel="1"].unfolded { transform: translateX(100%); }
.panel[data-panel="2"].unfolded { transform: translateX(200%); }
.panel[data-panel="3"].unfolded { transform: translateX(300%); }


/* ---- Panel face (the visible front) ---- */
.panel-face {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: clamp(24px, 3vw, 48px);
    padding-top: 8vh;
    position: relative;
    overflow: hidden;
}

/* Subtle left border between panels */
.panel-face::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 0;
    bottom: 10%;
    width: 1px;
    background: rgba(59, 130, 246, 0.15);
}

.panel[data-panel="0"] .panel-face::before {
    display: none;
}

/* Color themes per panel: white → sky blue gradient */
.panel--about {
    background: rgba(26, 58, 107, 0.95);
}
.panel--mission {
    background: rgba(34, 72, 128, 0.95);
}
.panel--programs {
    background: rgba(50, 100, 165, 0.95);
}
.panel--contact {
    background: rgba(70, 130, 200, 0.95);
}

/* All panels are dark — light text throughout (default styles apply) */

/* ---- Panel content ---- */
.panel-content {
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease 0.25s, transform 0.5s var(--ease-out-expo) 0.25s;
}

.panel.unfolded .panel-content {
    opacity: 1;
    transform: translateY(0);
}

.panel-label {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--blue-200);
    margin-bottom: 16px;
    opacity: 0.9;
}

.panel-content h2 {
    font-family: var(--font-serif);
    font-size: clamp(1.3rem, 2.2vw, 2rem);
    font-weight: 900;
    color: var(--white);
    line-height: 1.2;
    margin-bottom: 20px;
}

.panel-content h2 em {
    font-style: italic;
    color: var(--blue-100);
}

.panel-content p {
    font-size: clamp(0.8rem, 1vw, 0.95rem);
    color: var(--blue-50);
    line-height: 1.7;
    margin-bottom: 24px;
    max-width: 280px;
}

.panel-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel-list li {
    font-size: clamp(0.75rem, 0.95vw, 0.88rem);
    color: var(--blue-50);
    line-height: 1.5;
    padding-left: 16px;
    position: relative;
}

.panel-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    background: var(--blue-100);
    border-radius: 50%;
}

.panel-list li strong {
    color: var(--white);
    font-weight: 700;
}

/* Stats */
.panel-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.panel-stat-num {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--blue-100);
    line-height: 1;
}

.panel-stat-txt {
    font-size: 0.8rem;
    color: var(--blue-200);
    font-weight: 500;
    letter-spacing: 1px;
}

/* Panel logo/portrait image */
.panel-portrait {
    position: absolute;
    bottom: -2%;
    left: 50%;
    transform: translateX(-50%);
    width: 120%;
    max-height: 55vh;
    object-fit: contain;
    object-position: bottom center;
    z-index: 1;
    opacity: 0.9;
}

.panel-portrait--founder {
    width: 65%;
    max-height: 57vh;
}

/* Mobile-only logo inside panels — hidden on desktop */
.panel-logo-mobile {
    display: none;
}

/* Buttons */
.panel-actions {
    position: absolute;
    bottom: 8%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2;
}

.panel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    min-width: 140px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s var(--ease-out-expo);
    cursor: pointer;
    text-align: center;
}

.panel-btn--primary {
    background: var(--white);
    color: var(--blue-700);
}

.panel-btn--primary:hover {
    background: var(--blue-100);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.panel-btn--outline {
    background: transparent;
    color: var(--white);
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.panel-btn--outline:hover {
    border-color: var(--white);
    transform: translateY(-2px);
}

/* Icon in bottom-right corner */
.panel-icon {
    position: absolute;
    bottom: clamp(20px, 4vh, 40px);
    right: clamp(20px, 2vw, 32px);
    color: rgba(59, 130, 246, 0.15);
    z-index: 1;
}


/* ============================================
   GALLERY — Panel-native photo viewer
   ============================================ */

.gallery {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: #0a1628;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.gallery.active {
    opacity: 1;
    pointer-events: auto;
}

.gallery-close {
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 30;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--white);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
}

.gallery.active .gallery-close {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.3s;
}

.gallery-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.gallery-counter {
    position: absolute;
    top: 28px;
    right: 24px;
    z-index: 30;
    color: rgba(255, 255, 255, 0.6);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 2px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.gallery.active .gallery-counter {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.4s;
}

.gallery-track {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.gallery-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(100%);
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-slide.active {
    transform: translateX(0);
}

.gallery-slide.exited {
    transform: translateX(-30%);
}

.gallery-slide img {
    max-width: 85%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.5s ease 0.2s, transform 0.5s var(--ease-out-expo) 0.2s;
}

.gallery-slide.active img {
    opacity: 1;
    transform: scale(1);
}

.gallery-caption {
    position: absolute;
    bottom: 8%;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 400;
    text-align: center;
    max-width: 500px;
    line-height: 1.5;
    opacity: 0;
    transition: opacity 0.4s ease 0.4s;
}

.gallery-slide.active .gallery-caption {
    opacity: 1;
}

/* Gallery arrow buttons — triangle style matching panel arrows */
@keyframes galleryArrowPulseRight {
    0%, 100% { transform: translateY(-50%) translateX(0); opacity: 0.8; }
    50%      { transform: translateY(-50%) translateX(6px); opacity: 1; }
}

@keyframes galleryArrowPulseLeft {
    0%, 100% { transform: translateY(-50%) translateX(0); opacity: 0.8; }
    50%      { transform: translateY(-50%) translateX(-6px); opacity: 1; }
}

.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 30;
    width: 0;
    height: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    opacity: 0;
}

.gallery.active .gallery-arrow {
    opacity: 1;
    transition: opacity 0.3s ease 0.3s;
}

.gallery-arrow--right {
    right: 20px;
    border-top: 24px solid transparent;
    border-bottom: 24px solid transparent;
    border-left: 32px solid #4A8FD4;
    animation: galleryArrowPulseRight 2s ease-in-out infinite;
}

.gallery-arrow--left {
    left: 20px;
    border-top: 24px solid transparent;
    border-bottom: 24px solid transparent;
    border-right: 32px solid #4A8FD4;
    animation: galleryArrowPulseLeft 2s ease-in-out infinite;
}

.gallery-dots {
    position: absolute;
    bottom: 3%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery.active .gallery-dots {
    opacity: 1;
    transition-delay: 0.5s;
}

.gallery-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-dot.active {
    background: var(--white);
    transform: scale(1.4);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1024px) {
    .panel-content h2 {
        font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    }

    .panel-content p,
    .panel-list li {
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    /* Hide floating portrait layer on mobile — images are now inside panels */
    .portrait-layer {
        display: none;
    }

    /* Show panel-portrait images on mobile (About & Founder panels) */
    .panel-portrait {
        display: block;
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 220%;
        max-height: 85%;
        object-fit: contain;
        object-position: bottom center;
        z-index: 1;
        opacity: 0.85;
    }

    /* Pita Ji — bigger on mobile */
    .panel--about .panel-portrait {
        width: 150%;
    }

    .panel-portrait--founder {
        width: 110%;
        max-height: 72%;
    }

    /* Show logo inside Mission & Programs panels on mobile */
    .panel-logo-mobile {
        display: block;
        position: absolute;
        bottom: 12%;
        left: 50%;
        transform: translateX(-50%);
        width: 75%;
        max-height: 32%;
        object-fit: contain;
        opacity: 0.9;
        z-index: 1;
    }

    /* Hide particles on mobile */
    .particles {
        display: none;
    }

    /* Panels full screen on mobile */
    .panels {
        height: 100%;
    }

    .panel {
        width: 100%;
        height: 100%;
        left: 0;
        top: 0;
        transform: translateX(-100%);
    }

    /* Reverse z-index so later panels slide on top */
    .panel[data-panel="0"] { z-index: 1; }
    .panel[data-panel="1"] { z-index: 2; }
    .panel[data-panel="2"] { z-index: 3; }
    .panel[data-panel="3"] { z-index: 4; }

    /* All panels slide to same position (full width, stacking) */
    .panel[data-panel="0"].unfolded { transform: translateX(0); }
    .panel[data-panel="1"].unfolded { transform: translateX(0); }
    .panel[data-panel="2"].unfolded { transform: translateX(0); }
    .panel[data-panel="3"].unfolded { transform: translateX(0); }

    .panel-face {
        padding: 20px 20px;
        padding-top: 5vh;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        overflow-y: auto;
    }

    /* Allow portrait images to overflow on About & Founder panels */
    .panel--about .panel-face,
    .panel--contact .panel-face {
        overflow: visible;
    }

    .panel-content h2 {
        font-size: clamp(1.45rem, 5.5vw, 1.8rem);
        margin-bottom: 10px;
    }

    .panel-label {
        font-size: 0.7rem;
        margin-bottom: 8px;
        letter-spacing: 2px;
    }

    .panel-content p {
        font-size: 0.92rem;
        line-height: 1.45;
        margin-bottom: 10px;
        max-width: 100%;
    }

    .panel-list {
        gap: 8px;
    }

    .panel-list li {
        font-size: 0.9rem;
        line-height: 1.35;
    }

    .panel-stat-num {
        font-size: 2rem;
    }

    /* Full opacity panels on mobile */
    .panel--about { background: rgb(26, 58, 107); }
    .panel--mission { background: rgb(34, 72, 128); }
    .panel--programs { background: rgb(50, 100, 165); }
    .panel--contact { background: rgb(70, 130, 200); }

    /* Buttons below logo on mobile */
    .panel-actions {
        top: auto;
        bottom: 1%;
    }

    /* Arrow inside panel on mobile */
    .panel.last-open::after {
        content: 'Swipe';
        right: 12px;
        bottom: auto;
        top: 50%;
        left: auto;
        border-top: 24px solid transparent;
        border-bottom: 24px solid transparent;
        border-left: 32px solid #4A8FD4;
        border-right: none;
        width: 0;
        height: 0;
        background: none;
        clip-path: none;
        text-indent: -32px;
        font-size: 0.45rem;
        line-height: 0;
        padding: 0;
        text-align: left;
        animation: arrowPulse 2s ease-in-out infinite;
    }

    .panel-icon {
        display: none;
    }

    /* Gallery mobile */
    .gallery-close {
        top: 16px;
        left: 16px;
        font-size: 0.8rem;
        padding: 8px 16px;
    }

    .gallery-counter {
        top: 20px;
        right: 16px;
        font-size: 0.7rem;
    }

    .gallery-slide img {
        max-width: 92%;
        max-height: 65vh;
    }

    .gallery-caption {
        font-size: 0.75rem;
        max-width: 85%;
        bottom: 10%;
    }

    .gallery-arrow--right {
        border-top-width: 16px;
        border-bottom-width: 16px;
        border-left-width: 22px;
        right: 12px;
    }

    .gallery-arrow--left {
        border-top-width: 16px;
        border-bottom-width: 16px;
        border-right-width: 22px;
        left: 12px;
    }
}

@media (max-width: 480px) {
    .panel-content h2 {
        font-size: 1.2rem;
    }

    .panel-content p {
        font-size: 0.82rem;
    }

    .panel-list li {
        font-size: 0.78rem;
    }
}
