/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-primary: #DEE5DB;
    --color-secondary: #91AE7E;
    --color-tertiary: #B1BBAC;
    --color-accent: #91AE7E;
    --color-white: #ffffff;
    --color-dark: #333333;
    --color-text: #555555;
    
    --font-display: 'Red Hat Display', sans-serif;
    --font-text: 'Red Hat Text', sans-serif;
    
    --sidebar-width: 280px;
    --mobile-nav-height: 70px;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden; /* ensure no horizontal scroll */
}

body {
    font-family: var(--font-text);
    background-color: var(--color-primary);
    color: var(--color-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Desktop Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--color-tertiary);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

/* Logo space */
.logo-container {
    margin-bottom: 2rem;
}

.logo {
    width: 160px;
    height: 160px;
    border-radius: 0; /* Make square instead of circular */
    object-fit: cover;
    border: 4px solid var(--color-secondary);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    margin-bottom: 2rem;
}

.nav-link {
    display: block;
    padding: 1rem 1.25rem;
    background: rgba(222, 229, 219, 0.6);
    color: var(--color-dark);
    text-decoration: none;
    border-radius: 12px;
    text-align: center;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    background: var(--color-secondary);
    color: var(--color-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(145, 174, 126, 0.3);
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: auto;
}

.social-link img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.social-link:hover img {
    transform: scale(1.1);
}

/* Sidebar Alianse button - exact image size, no rounding/padding */
.alianse-button {
    display: block; /* full row like other buttons */
    width: 100%; /* match sidebar button width */
    margin: 0;
}
.alianse-button img {
    display: block;
    width: 100% !important; /* scale image to fill button width */
    height: auto !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transition: none !important;
}
.alianse-button:hover img { /* disable hover lift */
    transform: none !important;
    box-shadow: none !important;
}

/* Mobile Alianse button - exact image size, no rounding/padding */
.alianse-button-mobile {
    display: none; /* shown on mobile in media query */
    width: auto;
    margin: 0;
}
.alianse-button-mobile img {
    display: block;
    /* remove width:auto !important; height:auto !important; to avoid conflicts */
    border-radius: 0 !important;
    box-shadow: none !important;
    transition: none !important;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-tertiary) 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 4rem 2rem;
    position: relative;
}

.hero-content {
    margin-bottom: 4rem;
}

.hero-title {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 300;
    color: var(--color-white);
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.hero-subtitle {
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

.gallery-container {
    background: var(--color-white);
    border-radius: 20px;
    padding: 1rem;
    border: 3px solid var(--color-tertiary); /* visible outer line matching sidemenu */
    overflow: hidden; /* prevent hover effects from overlapping the border */
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    width: 100%;
}

/* Clean, responsive gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.gallery-item {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 14px;
    background: transparent; /* avoid dark background showing in rounded corners */
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    transition: transform .18s ease, box-shadow .18s ease;
    border: 2px solid var(--color-tertiary);
    box-sizing: border-box;
}

.gallery-item:hover {
    box-shadow: 0 12px 30px rgba(0,0,0,.18);
    transform: none; /* keep shadow effect only */
}

/* Media fills and consistent squares */
.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    display: block;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    transition: transform .35s ease;
    border-radius: 0 !important;
}

.gallery-item:hover img,
.gallery-item:hover video {
    transform: scale(1.03);
}

/* Subtle hover veil instead of emoji */
.gallery-item::after {
    content: "";
    position: absolute;
    inset: 2px; /* leave space for the 2px border */
    background: radial-gradient(120% 120% at 50% 50%, rgba(255,255,255,.12) 0%, rgba(0,0,0,0) 55%),
                linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.06));
    opacity: 0;
    transition: opacity .2s ease;
    pointer-events: none;
    border-radius: 12px; /* parent 14px radius minus 2px inset/border */
}

.gallery-item:hover::after {
    opacity: .6;
}

/* Remove old overlays/icons if still present */
.gallery-overlay,
.gallery-icon,
.video-play-overlay {
    display: none !important;
}

/* Accessibility */
.gallery-item:focus-visible {
    outline: 2px solid #8ab4f8;
    outline-offset: 3px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .gallery-item,
    .gallery-item img,
    .gallery-item video {
        transition: none !important;
    }
}

/* Remove fixed heights from legacy rules */
.gallery-item img,
.gallery-video-thumb,
.video-thumbnail img,
.video-thumbnail-auto {
    /* override legacy fixed sizing */
    height: 100%;
    border-radius: 0 !important;
}

/* About Sections */
.about-section {
    padding: 5rem 2rem;
}

.about-section:nth-child(even) {
    background: var(--color-white);
}

.about-section.organization {
    background: var(--color-secondary);
}

/* About Ieva Section - Change to primary color background */
#about-ieva {
    background: var(--color-primary) !important; /* Changed from tertiary to primary */
}

#about-ieva .about-text h2 {
    color: var(--color-dark); /* Change back to dark text on light background */
}

#about-ieva .about-text p {
    color: var(--color-text); /* Change back to normal text color */
}

.about-content {
    display: flex;
    align-items: center;
    gap: 4rem;
    max-width: 1000px;
    margin: 0 auto;
}

.about-content.reverse {
    flex-direction: row-reverse;
}

.about-image {
    flex-shrink: 0;
}

.about-image img {
    width: 350px;
    height: 350px;
    object-fit: cover;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.about-text {
    flex: 1;
}

.about-text h2 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--color-dark);
}

.about-section.organization .about-text h2 {
    color: var(--color-white);
}

.about-text p {
    font-size: 1.15rem;
    line-height: 1.7;
    margin-bottom: 1rem;
    color: var(--color-text);
}

.about-section.organization .about-text p {
    color: rgba(255, 255, 255, 0.95);
}

.alianse-info-box {
    margin-top: 1.25rem;
    background: rgba(255,255,255,0.15);
    padding: 0.85rem 1rem;
    border: 2px solid rgba(255,255,255,0.35);
    border-radius: 14px;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #fff;
    backdrop-filter: blur(4px);
}
.alianse-info-box a {
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
}
.alianse-info-box a:hover,
.alianse-info-box a:focus-visible {
    text-decoration: none;
}

/* Activities Section */
.activities-section {
    padding: 5rem 2rem;
    background: var(--color-tertiary);
}

.section-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--color-dark);
}

.activities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.activity-card {
    background: var(--color-white);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    border: 2px solid transparent;
}

/* Contact Section */
.contact-section {
    padding: 5rem 2rem;
    background: var(--color-secondary); /* Change from white to secondary color */
}

.contact-section .section-title {
    color: var(--color-white); /* Make title white on colored background */
}

.contact-card-single {
    background: var(--color-white); /* Keep the card white for contrast */
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    max-width: 600px;
    margin: 0 auto;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(145, 174, 126, 0.2);
}

.contact-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.contact-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    object-fit: contain; /* Prevent squishing of icons */
}

.contact-info {
    display: flex;
    flex-direction: column;
}

.contact-label {
    font-size: 0.9rem;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.contact-link {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-link:hover {
    color: var(--color-dark);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 55px;
    height: 55px;
    background: var(--color-secondary);
    border: none;
    border-radius: 50%;
    color: var(--color-white);
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(145, 174, 126, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--color-tertiary);
    transform: translateY(-3px);
}

/* Mobile Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-tertiary);
    border-top: 2px solid var(--color-secondary);
    padding: 0.5rem;
    z-index: 2000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 0.5rem;
    color: var(--color-dark);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.mobile-nav-link.active,
.mobile-nav-link:hover {
    background: var(--color-secondary);
    color: var(--color-white);
}

/* Mobile Header */
.mobile-header {
    display: none; /* Hidden by default on desktop */
    background: var(--color-tertiary);
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1500;
    align-items: center;
    justify-content: space-between;
}

.mobile-header .logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mobile-header .logo {
    width: 50px;
    height: 50px;
    border-radius: 0; /* Make square */
    object-fit: cover;
    border: 2px solid var(--color-secondary);
}

.mobile-header h1 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--color-dark);
    font-weight: 600;
    margin: 0;
}

.mobile-header .social-links {
    display: flex;
    gap: 0.5rem;
    margin: 0;
}

.mobile-header .social-link img {
    width: 28px;
    height: 28px;
}

/* Mobile Styles */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }
    
    .sidebar {
        display: none;
    }
    
    .mobile-header {
        display: flex;
    }
    
    .main-content {
        margin-left: 0;
        padding-bottom: var(--mobile-nav-height);
    }
    
    .mobile-nav {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        gap: 0.25rem;
        padding: 0.35rem 0.5rem; /* slimmer */
        height: auto; /* shrink to content */
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }
    .mobile-nav::-webkit-scrollbar { display: none; }
    .mobile-nav { scrollbar-width: none; }

    .mobile-nav-link {
        flex: 0 0 auto; /* do not stretch */
        min-width: auto;
        padding: 0 0.9rem;
        height: 44px; /* one line tap target */
        line-height: 1; /* tighten */
        font-size: 0.75rem; /* smaller text to fit one line */
        white-space: nowrap; /* prevent wrapping */
        scroll-snap-align: center;
    }

    .mobile-nav-link span { display: inline-block; pointer-events: none; }
    
    /* Hide back to top button on mobile */
    .back-to-top {
        display: none;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .gallery-container {
        margin: 0 1rem;
        padding: 1rem;
        border: 3px solid var(--color-tertiary); /* keep border on mobile */
        overflow: hidden;
    }
    
    .gallery-grid {
        display: flex;
        overflow-x: auto;
        gap: 1rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
    
    .gallery-item {
        flex: 0 0 auto;
        scroll-snap-align: center;
        width: 80vw;
        max-width: 300px;
        min-width: 250px;
    }
    
    /* Ensure square thumbnails on mobile without fixed heights */
    .gallery-item img,
    .gallery-item video,
    .video-thumbnail-auto {
        height: auto !important;
        aspect-ratio: 1 / 1;
        border-radius: 0 !important;
    }
    
    /* Hide scrollbar but keep functionality */
    .gallery-grid::-webkit-scrollbar {
        display: none;
    }
    
    .gallery-grid {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    
    .about-content {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }
    
    .about-content.reverse {
        flex-direction: column;
    }
    
    .about-image img {
        width: 280px;
        height: 280px;
    }
    
    .about-text h2 {
        font-size: 2rem;
    }
    
    .about-text p {
        font-size: 1.05rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .activities-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .activity-card {
        padding: 2rem 1.5rem;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .section-container {
        padding: 0 1rem;
    }
    
    .about-section,
    .activities-section,
    .contact-section {
        padding: 3rem 1rem;
    }
    
    .hero-section {
        padding: 3rem 1rem;
    }
    
    /* Mobile video sizing fix */
    .gallery-item img,
    .video-thumbnail-auto {
        height: 400px;
        object-fit: cover;
        object-position: center;
    }
    
    /* Simple GLightbox mobile video centering */
    .glightbox-clean .gcontainer {
        padding: 0 !important;
    }
    
    .glightbox-clean .gslide-video {
        height: 90vh !important;
        width: 95vw !important;
        margin: 5vh auto !important;
        position: relative !important;
    }
    
    .glightbox-clean .gvideo-wrapper {
        height: 100% !important;
        padding-bottom: 0 !important;
    }
    
    .glightbox-clean .gvideo {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
    }
    
    /* Force GLightbox mobile video sizing with higher specificity */
    .glightbox-clean .gcontainer .gslide .gslide-video {
        height: 90vh !important;
        width: 95vw !important;
        max-height: 90vh !important;
        max-width: 95vw !important;
        margin: 5vh auto !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
    }
    
    .glightbox-clean .gcontainer .gslide .gslide-video .gvideo-wrapper {
        height: 100% !important;
        width: 100% !important;
        padding-bottom: 0 !important;
        position: relative !important;
    }
    
    .glightbox-clean .gcontainer .gslide .gslide-video .gvideo-wrapper .gvideo {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
    }
    
    /* Override any GLightbox default positioning */
    .glightbox-clean .gslide-media {
        position: static !important;
        transform: none !important;
        top: auto !important;
        left: auto !important;
        margin: 0 !important;
    }

    .alianse-button-mobile {
        display: block;
        width: 100dvw !important; /* exact device viewport width */
        max-width: 100dvw !important;
        margin-left: calc(50% - 50dvw);
        margin-right: calc(50% - 50dvw);
    }
    .alianse-button-mobile img {
        width: 100% !important;
        height: auto !important;
        display: block;
    }
}

/* Smooth scrolling and animations */
@media (prefers-reduced-motion: no-preference) {
    .nav-link,
    .activity-card,
    .contact-card,
    .gallery-item img {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* Focus styles for accessibility */
.nav-link:focus,
.mobile-nav-link:focus,
.contact-link:focus,
.back-to-top:focus {
    outline: 2px solid var(--color-secondary);
    outline-offset: 2px;
}
/* Auto-injected poster fallback (legacy, accent removed) */
.poster-section{display:flex;align-items:center;justify-content:center;position:relative;padding:2.5rem 0;}
.poster-section .poster-container{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:1rem;width:100%;}
.poster-section .poster-aspect-wrapper{--poster-ar:0.707;aspect-ratio:var(--poster-ar);width:min(100%,calc((100vh - 5rem)*var(--poster-ar)));max-height:calc(100vh - 5rem);display:flex;align-items:center;justify-content:center;}
.poster-section .poster-aspect-wrapper img{width:100%;height:100%;object-fit:contain;object-position:center;}
.poster-section.color-tertiary{background:var(--color-tertiary,#B1BBAC)!important;}
.poster-section.color-secondary{background:var(--color-secondary,#91AE7E)!important;}
.poster-section.color-primary{background:var(--color-primary,#DEE5DB)!important;}
@media (max-width:768px){.poster-section{padding:1.5rem 0;}.poster-section .poster-aspect-wrapper{width:100%;max-height:75vh;}}
/* End auto-injected poster fallback */
