/* ===== CSS Variables ===== */
:root {
    --green-primary: #0A7E4B;
    --green-dark: #065A35;
    --green-light: #E8F5EE;
    --blue-primary: #1B4F8A;
    --blue-light: #E8EFF8;
    --orange-primary: #E87722;
    --orange-light: #FFF3EB;
    --purple-primary: #6C3FA0;
    --purple-light: #F3EEF9;
    --text-dark: #1A1A2E;
    --text-medium: #4A4A6A;
    --text-light: #7A7A9A;
    --bg-light: #F5F7FA;
    --bg-white: #FFFFFF;
    --border-color: #E2E8F0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --shadow-xl: 0 12px 40px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    min-height: 100dvh;
}

a {
    text-decoration: none;
    color: inherit;
}

img, video, svg {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== Header ===== */
.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    padding: 16px clamp(12px, 4vw, 24px);
    padding-top: calc(16px + env(safe-area-inset-top));
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.logo-section {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 1;
}

.logo-box {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon {
    width: 120px;
    width: clamp(80px, 20vw, 120px);
    height: auto;
    object-fit: contain;
    display: block;
}

.logo-text { display: none; }
.logo-title { font-size: 18px; font-weight: 800; color: var(--green-primary); letter-spacing: 1px; }
.logo-subtitle { font-size: 9px; color: var(--text-light); font-weight: 500; letter-spacing: 0.5px; }
.page-title { display: none; }

.lang-toggle {
    display: flex;
    background: var(--bg-light);
    border-radius: 30px;
    padding: 4px;
    border: 1px solid var(--border-color);
    margin-left: auto;
}

.lang-btn {
    padding: 8px 18px;
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 26px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: var(--text-medium);
}

.lang-btn.active {
    background: var(--green-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

@media (hover: hover) {
    .lang-btn:hover:not(.active) {
        background: var(--border-color);
    }
}

/* ===== Hero Section ===== */
.hero {
    padding: 40px 24px;
    padding: clamp(24px, 5vw, 40px) clamp(12px, 4vw, 24px);
    max-width: 1200px;
    margin: 0 auto;
}

.hero-card {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 50px 40px;
    padding: clamp(1.25rem, 4vw, 3rem);
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--green-light);
    border: 1px solid #C8E6D5;
    border-radius: 40px;
    padding: 10px 24px;
    margin-bottom: 28px;
}

.badge-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.badge-icon svg {
    width: 22px;
    height: 22px;
}

.badge-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--green-primary);
}

.hero-heading {
    font-size: 36px;
    font-size: clamp(1.5rem, 4vw + 0.5rem, 2.25rem);
    font-weight: 800;
    color: var(--blue-primary);
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero-description {
    font-size: 16px;
    font-size: clamp(14px, 2vw, 16px);
    color: var(--text-medium);
    max-width: 650px;
    margin: 0 auto 32px;
    line-height: 1.7;
}

.hero-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    min-height: 44px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--green-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(10, 126, 75, 0.3);
}

@media (hover: hover) {
    .btn-primary:hover {
        background: var(--green-dark);
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(10, 126, 75, 0.4);
    }
}

.btn-secondary {
    background: var(--blue-light);
    color: var(--blue-primary);
    border: 1px solid #C8D8EC;
}

@media (hover: hover) {
    .btn-secondary:hover {
        background: #D6E4F5;
        transform: translateY(-2px);
    }
}

/* ===== Stats Section ===== */
.stats-section {
    padding: 0 24px 40px;
    padding: 0 clamp(12px, 4vw, 24px) clamp(24px, 5vw, 40px);
    max-width: 1200px;
    margin: 0 auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    padding: clamp(16px, 3vw, 28px) clamp(12px, 2vw, 20px);
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    container-type: inline-size;
}

@container (max-width: 200px) {
    .stat-value { font-size: 1.25rem; }
}

.stat-card-link {
    cursor: pointer;
    display: block;
}

@media (hover: hover) {
    .stat-card-link:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
        border-color: var(--green-primary);
    }
}

.stat-icon {
    width: 52px;
    width: clamp(40px, 10vw, 52px);
    height: 52px;
    height: clamp(40px, 10vw, 52px);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

.stat-icon svg {
    width: 26px;
    height: 26px;
}

.stat-icon-blue { background: var(--blue-light); color: var(--blue-primary); }
.stat-icon-green { background: var(--green-light); color: var(--green-primary); }
.stat-icon-orange { background: var(--orange-light); color: var(--orange-primary); }
.stat-icon-purple { background: var(--purple-light); color: var(--purple-primary); }

.stat-value {
    font-size: 28px;
    font-size: clamp(1.5rem, 3vw, 1.75rem);
    font-weight: 800;
    color: var(--blue-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Gallery Section ===== */
.gallery-section {
    padding: 40px 24px 60px;
    padding: clamp(24px, 5vw, 40px) clamp(12px, 4vw, 24px) clamp(40px, 8vw, 60px);
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 32px;
}

.section-title {
    font-size: 30px;
    font-size: clamp(1.5rem, 3vw + 0.5rem, 1.875rem);
    font-weight: 800;
    color: var(--blue-primary);
    margin-bottom: 8px;
}

.section-subtitle {
    font-size: 15px;
    font-size: clamp(14px, 2vw, 15px);
    color: var(--text-light);
}

.category-filter {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.filter-btn {
    padding: 10px 22px;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    background: var(--bg-white);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-medium);
    cursor: pointer;
    transition: all 0.3s ease;
}

@media (hover: hover) {
    .filter-btn:hover {
        border-color: var(--green-primary);
        color: var(--green-primary);
    }
}

.filter-btn.active {
    background: var(--green-primary);
    color: white;
    border-color: var(--green-primary);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.gallery-item {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    cursor: pointer;
    container-type: inline-size;
}

@container (max-width: 280px) {
    .gallery-item-info { padding: 12px; }
}

@media (hover: hover) {
    .gallery-item:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
    }
}

.gallery-item-image {
    width: 100%;
    height: 220px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.gallery-item-image img,
.gallery-item-image video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

@media (hover: hover) {
    .gallery-item:hover .gallery-item-image img,
    .gallery-item:hover .gallery-item-image video {
        transform: scale(1.05);
    }
}

.gallery-item-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--green-light), var(--blue-light));
}

.gallery-item-info {
    padding: 16px;
}

.gallery-item-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.gallery-item-category {
    font-size: 12px;
    font-weight: 600;
    color: var(--green-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--green-light);
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
}

.load-more-container {
    text-align: center;
}

/* ===== Register Section ===== */
.register-section {
    padding: 40px 24px;
    padding: clamp(24px, 5vw, 40px) clamp(12px, 4vw, 24px);
    max-width: 1200px;
    margin: 0 auto;
}

.register-card {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 50px 40px;
    padding: clamp(1.25rem, 4vw, 3rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    gap: clamp(20px, 4vw, 40px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    container-type: inline-size;
    container-name: register-card;
}

@container register-card (max-width: 600px) {
    .register-card {
        flex-direction: column;
        text-align: center;
    }
    .register-content .section-title,
    .register-content .section-subtitle {
        text-align: center;
    }
}

.register-content {
    flex: 1;
}

.register-content .section-title {
    text-align: left;
    margin-bottom: 12px;
}

.register-content .section-subtitle {
    text-align: left;
    margin-bottom: 24px;
}

.register-visual {
    flex-shrink: 0;
}

.register-icon-large svg {
    width: 160px;
    width: clamp(80px, 20vw, 160px);
    height: auto;
}

/* ===== Documentary Section ===== */
.documentary-section {
    padding: 40px 24px 60px;
    padding: clamp(24px, 5vw, 40px) clamp(12px, 4vw, 24px) clamp(40px, 8vw, 60px);
    max-width: 1200px;
    margin: 0 auto;
}

.video-container {
    max-width: 800px;
    margin: 0 auto;
}

.video-placeholder {
    background: linear-gradient(135deg, var(--blue-primary), var(--green-primary));
    border-radius: var(--radius-xl);
    aspect-ratio: 16 / 9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
}

@media (hover: hover) {
    .video-placeholder:hover {
        transform: scale(1.02);
        box-shadow: var(--shadow-xl);
    }
}

.play-button {
    width: 80px;
    width: clamp(60px, 15vw, 80px);
    height: 80px;
    height: clamp(60px, 15vw, 80px);
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.3);
    transition: all 0.3s ease;
}

@media (hover: hover) {
    .video-placeholder:hover .play-button {
        background: rgba(255,255,255,0.3);
        transform: scale(1.1);
    }
}

.video-label {
    color: white;
    font-size: 18px;
    font-size: clamp(16px, 3vw, 18px);
    font-weight: 600;
}

/* ===== Footer ===== */
.footer {
    background: var(--text-dark);
    color: white;
    padding: 50px 24px 0;
    padding: clamp(30px, 5vw, 50px) clamp(12px, 4vw, 24px) 0;
    padding-bottom: calc(env(safe-area-inset-bottom) + 20px);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

@media (min-width: 768px) {
    .footer-container {
        grid-template-columns: 2fr 1fr 1fr;
    }
}

.footer-brand .logo-box {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
    margin-bottom: 16px;
}

.footer-brand .logo-title { color: var(--green-primary); }
.footer-brand .logo-subtitle { color: rgba(255,255,255,0.5); }

.footer-desc {
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    line-height: 1.7;
}

.footer-links h4,
.footer-contact h4 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: white;
}

.footer-links a {
    display: block;
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    margin-bottom: 10px;
    min-height: 44px;
    display: flex;
    align-items: center;
    transition: color 0.3s;
}

@media (hover: hover) {
    .footer-links a:hover {
        color: var(--green-primary);
    }
}

.footer-contact p {
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    margin-bottom: 8px;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
    text-align: center;
}

.footer-bottom p {
    color: rgba(255,255,255,0.4);
    font-size: 13px;
}

/* ===== Lightbox ===== */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.lightbox.active {
    display: flex;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    top: calc(20px + env(safe-area-inset-top));
    right: 30px;
    right: calc(20px + env(safe-area-inset-right));
    background: none;
    border: none;
    color: white;
    font-size: 36px;
    cursor: pointer;
    z-index: 1001;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

@media (hover: hover) {
    .lightbox-close:hover {
        background: rgba(255,255,255,0.1);
    }
}

.lightbox-content {
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.lightbox-content img {
    width: 100%;
    height: 350px;
    aspect-ratio: 16 / 9;
    max-height: 60vh;
    max-height: 60dvh;
    object-fit: cover;
}

.lightbox-info {
    padding: 24px;
}

.lightbox-info h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.lightbox-info p {
    color: var(--text-medium);
    font-size: 14px;
    line-height: 1.6;
}

#lightboxCategory {
    color: var(--green-primary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* ===== Foldables and Flips ===== */
@media (horizontal-viewport-segments: 2) and (vertical-viewport-segments: 2) {
    .header-container, .hero-card, .register-card, .footer-container {
        max-width: env(viewport-segment-width 0 0);
    }
}

@media (max-width: 280px) {
    .hero-heading { font-size: 1.25rem; }
    .btn { width: 100%; }
    .lang-btn { padding: 8px 12px; font-size: 12px; }
}

/* ===== Accessibility: Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }
}

/* ===== Mobile Pagination Dots ===== */
.gallery-pagination {
    display: none; /* Hidden by default (desktop) */
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 20px 0;
    margin-top: 10px;
}

@media (max-width: 768px) {
    .gallery-pagination {
        display: flex;
    }
}

.pagination-dot {
    background: transparent;
    border: none;
    padding: 0;
    width: 44px; /* Minimum tappable area */
    height: 44px; /* Minimum tappable area */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.pagination-dot-inner {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--border-color);
    transition: all 0.3s ease;
}

.pagination-dot.active .pagination-dot-inner {
    background-color: var(--green-primary);
    transform: scale(1.5);
}

/* Respect reduced motion for the scroll action (handled in JS, but good for CSS transitions too) */
@media (prefers-reduced-motion: reduce) {
    .pagination-dot, .pagination-dot-inner {
        transition: none;
    }
}

/* ===== Admin Sidebar Layout ===== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
    background: var(--clay-bg);
}

.admin-sidebar {
    width: 280px;
    background: var(--clay-white);
    border-right: 1px solid var(--clay-border);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--clay-border);
}

.sidebar-header .logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header .logo-icon {
    width: 48px;
    height: 48px;
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--clay-primary);
    margin: 0;
}

.sidebar-header p {
    font-size: 12px;
    color: var(--clay-text-muted);
    margin: 0;
}

.sidebar-nav {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--clay-text-medium);
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
}

.nav-link:hover {
    background: var(--clay-surface);
    color: var(--clay-primary);
}

.nav-link.active {
    background: var(--clay-primary);
    color: white;
}

.admin-main {
    flex: 1;
    margin-left: 280px;
    padding: 40px;
    overflow-y: auto;
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--clay-text-dark);
}

/* Responsive Sidebar */
@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .admin-sidebar.open {
        transform: translateX(0);
    }
    
    .admin-main {
        margin-left: 0;
        padding: 24px;
    }
}

/* Mobile menu toggle (add a button in HTML if needed) */
.menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 101;
    background: var(--clay-primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
}

@media (max-width: 1024px) {
    .menu-toggle {
        display: block;
    }
}

/* ===== Gallery + Lightbox: Instagram style (append at end) ===== */

/* PART 1: GALLERY GRID (Mobile - 768px and below) */
@media (max-width: 768px) {
  /* Make gallery section edge-to-edge on mobile */
  .gallery-section {
    padding-left: 0;
    padding-right: 0;
  }
  
  /* Instagram-style 3-column grid */
  .gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    margin: 0;
    margin-bottom: 32px;
  }
  
  /* Remove card styling on mobile - pure tiles */
  .gallery-item {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    overflow: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
  
  /* Portrait 4/5 aspect ratio like Instagram */
  .gallery-item-image {
    width: 100%;
    height: 0;
    padding-top: 125%; /* 4:5 ratio fallback for old browsers */
    aspect-ratio: 4 / 5;
    aspect-ratio: 4 / 5;
    border-radius: 0;
    background: var(--bg-light);
  }
  
  /* Image fills tile completely */
  .gallery-item-image img,
  .gallery-item-image video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: none; /* Disable hover zoom on mobile */
  }
  
  /* Hide title/category on tiles (shown in viewer instead) */
  .gallery-item-info {
    display: none;
  }
  
  /* Subtle tap feedback */
  .gallery-item:active {
    opacity: 0.7;
    transform: scale(0.97);
  }
  
  /* Category filter: horizontal scrollable chips (Instagram story bar style) */
  .category-filter {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    gap: 8px;
    padding: 0 clamp(12px, 4vw, 24px);
    margin-bottom: 24px;
    scroll-snap-type: x mandatory;
  }
  
  .category-filter::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }
  
  .filter-btn {
    flex-shrink: 0;
    scroll-snap-align: start;
    padding: 8px 16px;
    font-size: 13px;
    white-space: nowrap;
  }
  
  /* Very small screens (280px-360px): 2 columns instead of 3 */
  @media (max-width: 360px) {
    .gallery-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }
  
  /* Placeholder tiles maintain ratio */
  .gallery-item-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .gallery-item-placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
  }
}

/* PART 2: LIGHTBOX VIEWER (Mobile - Full Screen Instagram Post) */
@media (max-width: 768px) {
  .lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    flex-direction: column;
    padding: 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  
  .lightbox.active {
    display: flex;
    opacity: 1;
  }
  
  /* Top bar: back button + category title + position indicator */
  .lightbox-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
  }
  
  .lightbox-close {
    position: static;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
  }
  
  .lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
  }
  
  .lightbox-category-title {
    color: white;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex: 1;
    text-align: center;
    margin: 0 12px;
  }
  
  .lightbox-position {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 500;
    min-width: 60px;
    text-align: right;
  }
  
  /* Share button (shown when supported) */
  .lightbox-share {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: none;
    cursor: pointer;
    margin-left: 8px;
    transition: background 0.2s ease;
  }
  
  .lightbox-share:hover {
    background: rgba(255, 255, 255, 0.2);
  }
  
  .lightbox-share svg {
    width: 20px;
    height: 20px;
  }
  
  /* Scrollable content area */
  .lightbox-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
  }
  
  /* Image container - centered, natural aspect ratio */
  .lightbox-media-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.95);
    flex-shrink: 0;
  }
  
  .lightbox-media-container img,
  .lightbox-media-container video,
  .lightbox-media-container iframe {
    width: 100%;
    max-height: 70vh;
    max-height: 70dvh;
    object-fit: contain;
    border-radius: 0;
    touch-action: pan-y pinch-zoom;
  }
  
  /* Caption area */
  .lightbox-caption {
    padding: 20px 16px;
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, 0.95);
    flex-shrink: 0;
  }
  
  .lightbox-title {
    font-size: 18px;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
    line-height: 1.3;
  }
  
  .lightbox-category {
    display: inline-block;
    background: var(--green-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
  }
  
  .lightbox-description {
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
  }
  
  /* Landscape mode (flips, foldables): side-by-side layout */
  @media (max-height: 500px) and (orientation: landscape) {
    .lightbox-content {
      flex-direction: row;
      align-items: center;
    }
    
    .lightbox-media-container {
      flex: 1;
      padding: 16px;
      max-height: 100%;
    }
    
    .lightbox-media-container img,
    .lightbox-media-container video,
    .lightbox-media-container iframe {
      max-height: 100%;
      max-width: 100%;
    }
    
    .lightbox-caption {
      flex: 0 0 40%;
      max-width: 40%;
      overflow-y: auto;
      max-height: 100%;
    }
  }
}

/* Desktop: Keep existing lightbox unchanged (above 768px) */
@media (min-width: 769px) {
  .lightbox {
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  
  .lightbox-close {
    top: 20px;
    top: calc(20px + env(safe-area-inset-top));
    right: 30px;
    right: calc(20px + env(safe-area-inset-right));
  }
}

/* Reduced motion: disable animations */
@media (prefers-reduced-motion: reduce) {
  .lightbox {
    transition: none;
  }
  
  .gallery-item {
    transition: none;
  }
}

/* Focus visible for accessibility */
.gallery-item:focus-visible,
.filter-btn:focus-visible,
.lightbox-close:focus-visible,
.lightbox-share:focus-visible {
  outline: 3px solid var(--green-primary);
  outline-offset: 2px;
}

/* ===== FIX: Mobile Gallery Overflow & Spacing (append at end) ===== */

@media (max-width: 768px) {
  /* FIX 1: Horizontal Overflow */
  /* The problem: gallery-section had padding removed (set to 0) but gallery-grid 
     has negative margin that bleeds beyond the viewport. 
     Solution: Keep section padding, make grid negative margin match it exactly,
     and use overflow-x: clip to contain the bleed. */
  
  .gallery-section {
    padding-left: clamp(12px, 4vw, 24px) !important;
    padding-right: clamp(12px, 4vw, 24px) !important;
    overflow-x: hidden; /* Fallback for older browsers */
    overflow-x: clip; /* Modern browsers - contains the negative margin bleed */
  }
  
  .gallery-grid {
    /* Negative margin must exactly match section padding to bleed edge-to-edge */
    margin-left: calc(-1 * clamp(12px, 4vw, 24px));
    margin-right: calc(-1 * clamp(12px, 4vw, 24px));
    width: calc(100% + (2 * clamp(12px, 4vw, 24px)));
  }
  
  /* FIX 2: Excess Vertical Gap */
  /* The problem: Multiple spacing elements stacking:
     - .gallery-section padding-bottom: ~40px
     - .gallery-grid margin-bottom: 32px
     - .gallery-pagination padding + margin: ~30px
     - .load-more-container (empty but taking space)
     - .register-section padding-top: ~24px
     Total: ~126px (way too much!)
     Solution: Reduce each element's spacing to target 24-32px total. */
  
  .gallery-section {
    padding-bottom: 16px !important; /* Reduced from clamp(40px, 8vw, 60px) */
  }
  
  .gallery-grid {
    margin-bottom: 8px; /* Reduced from 32px */
  }
  
  /* Pagination dots: keep 44px tap area but reduce visual spacing */
  .gallery-pagination {
    margin-top: 0; /* Remove extra margin */
    padding: 8px 0 12px; /* Reduced from 20px 0 */
  }
  
  /* Hide empty load-more container (takes up space when no more items) */
  .load-more-container:empty,
  .load-more-container:not(:has(button:not([style*="display: none"]))) {
    display: none;
    margin: 0;
    padding: 0;
    height: 0;
  }
  
  /* Reduce register section top padding */
  .register-section {
    padding-top: 16px !important; /* Reduced from clamp(24px, 5vw, 40px) */
  }
  
  /* Ensure dots don't add extra height but keep tap area */
  .pagination-dot {
    width: 44px;
    height: 44px;
    padding: 0; /* Remove padding that adds height */
  }
}

/* ===== Accessibility: Skip Link (append at end) ===== */
.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    background: var(--green-primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    z-index: 9999;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 16px;
    outline: 3px solid var(--blue-primary);
    outline-offset: 2px;
}
