@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
:root {
    --primary: #3b82f6;
    --primary-hover: #1d4ed8;
    --secondary: #1e40af;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --border: #e2e8f0;
    --shadow-color: 0 4px 20px rgba(0,0,0,0.08);
    --dark: #1e293b;
    --dark-alt: #334155;
    --text: #0f172a;
    --text-muted: #475569;
    --focus-ring: var(--accent);
    --transition-base: 0.3s cubic-bezier(0.4,0,0.2,1);
}
.dark {
    --primary: #60a5fa;
    --primary-hover: #3b82f6;
    --secondary: #1e3a8a;
    --accent: #fbbf24;
    --accent-hover: #f59e0b;
    --surface: #1e293b;
    --surface-alt: #0f172a;
    --border: #334155;
    --shadow-color: 0 4px 20px rgba(0,0,0,0.55);
    --dark: #f1f5f9;
    --dark-alt: #e2e8f0;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --focus-ring: var(--accent);
}
.gallery-item {
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 0.75rem;
    position: relative;
}

.gallery-item .skeleton {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 12rem;
    z-index: 1;
}

.gallery-item img {
    width: 100%;
    height: 12rem;
    object-fit: cover;
    border-radius: 0.5rem;
    margin-bottom: 0;
    display: block;
    position: relative;
    z-index: 2;
}
    .about-img-section .skeleton,
    .about-img-section img {
        width: 100%;
        height: 12rem;
        object-fit: cover;
        border-radius: 0.5rem;
        margin-bottom: 0;
    }
    .about-img-section p {
        margin-top: 0;
        margin-bottom: 0;
    }

.gallery-item p {
    margin-top: 0;
    margin-bottom: 0;
    margin-left: 0.25rem;
}
.gallery-item[style*="display: none"] {
    min-height: 15rem;
    visibility: hidden;
    pointer-events: none;
}
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--surface-alt);
    color: var(--text);
    scroll-behavior: smooth;
    transition: background-color var(--transition-base), color var(--transition-base);
}
.dark body {
    background-color: var(--surface-alt);
}
.glass-card {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: var(--shadow-color);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.dark .glass-card {
    background: rgba(30, 41, 59, 0.55);
    border: 1px solid rgba(255,255,255,0.08);
}
.hero-bg {
    background: linear-gradient(135deg, rgba(59,130,246,0.85) 0%, rgba(30,64,175,0.92) 100%);
}
.dark .hero-bg {
    background: linear-gradient(135deg, rgba(29,78,216,0.75) 0%, rgba(15,23,42,0.9) 100%);
}
.nav-link {
    position: relative;
}
.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--accent);
    transition: width 0.3s ease;
}
.nav-link:hover::after {
    width: 100%;
}
.active::after {
    width: 100%;
}
:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
    border-radius: 6px;
}
button:focus-visible, a:focus-visible {
    box-shadow: 0 0 0 4px rgba(0,0,0,0.12), 0 0 0 6px var(--focus-ring);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.flip-card {
    perspective: 1000px;
}
.flip-card-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}
.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}
.flip-card-front, .flip-card-back {
    backface-visibility: hidden;
}
.flip-card-back {
    transform: rotateY(180deg);
}
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.lightbox-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(20, 28, 38, 0.95);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
    padding: 2rem 2rem 1.5rem 2rem;
    max-width: 90vw;
    max-height: 90vh;
}
.lightbox-content {
    max-width: 70vw;
    max-height: 60vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
    background: #fff;
    object-fit: contain;
}
.lightbox-caption {
    margin-top: 1.5rem;
    background: rgba(30, 41, 59, 0.85);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    text-align: center;
    font-size: 1rem;
    max-width: 60vw;
    box-shadow: 0 2px 12px rgba(0,0,0,0.10);
    word-break: break-word;
}
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 1rem;
    z-index: 1001;
}
.prev {
    left: 1rem;
}
.next {
    right: 1rem;
}
.close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 1001;
}
.section-title {
    position: relative;
    display: inline-block;
}
.section-title::after {
    content: '';
    position: absolute;
    width: 50%;
    height: 4px;
    bottom: -8px;
    left: 0;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
}
.structure-item {
    transition: all 0.3s ease;
}
.structure-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
.dark .structure-item:hover {
    box-shadow: 0 10px 25px rgba(0,0,0,0.35);
}
/* Event Card - Redesigned for consistency */
.event-card {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.event-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.event-card-fixed {
    height: 440px;
    max-height: 440px;
    min-height: 440px;
}

@media (max-width: 600px) {
    .event-card-fixed {
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
    }
}

/* Event card image styling */
.event-card img {
    width: 100%;
    height: 12rem;
    object-fit: cover;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

/* Event card content area */
.event-card-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Event card title */
.event-card h3 {
    margin: 0;
    line-height: 1.4;
}

/* Event card description */
.event-card p {
    margin: 0;
    flex-grow: 1;
}

/* Event card button */
.event-card button.open-modal-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.event-card button.open-modal-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.event-card-fixed .flip-card-inner,
.event-card-fixed .flip-card-front,
.event-card-fixed .flip-card-back {
    height: 100%;
    min-height: 100%;
    max-height: 100%;
}

.event-card-fixed .flip-card-back {
    overflow-y: auto;
}
.fade-in-initial {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.8s ease-in-out forwards;
}
.skeleton {
    position: relative;
    background: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 50%, #e2e8f0 100%);
    background-size: 200% 100%;
    border-radius: 0.5rem;
    overflow: hidden;
}

.skeleton::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    height: 100%;
    width: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.8) 50%,
        transparent 100%
    );
    animation: shimmer 1.5s ease-in-out infinite;
    -webkit-animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

@-webkit-keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}
.skeleton-fade {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.skeleton-loaded {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

/* Hide skeleton when image is loaded */
.gallery-item img.skeleton-loaded ~ .skeleton,
.gallery-item img[data-skeleton].skeleton-loaded + .skeleton {
    opacity: 0;
    pointer-events: none;
}
.force-skeleton .skeleton {
    display: block !important;
}
.force-skeleton img.skeleton-fade {
    opacity: 0 !important;
}
#back-to-top {
    transition: opacity 0.4s, visibility 0.4s;
}
#back-to-top.visible {
    opacity: 1 !important;
    pointer-events: auto !important;
}
#back-to-top:not(.visible) {
    opacity: 0 !important;
    pointer-events: none !important;
}
#mobile-menu {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4,0,0.2,1), opacity 0.3s;
}
#mobile-menu.menu-open {
    max-height: 500px;
    opacity: 1;
}
#preloader {
    transition: opacity 0.8s cubic-bezier(0.4,0,0.2,1), visibility 0.8s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    background: #0a2240;
}
#preloader.hide {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}


.preloader-fadein {
    opacity: 0;
    animation: preloader-fadein 1.2s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes preloader-fadein {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (min-width: 768px) {
    .preloader-typing {
        font-size: 3rem;
    }
}

.hamburger {
    width: 40px;
    height: 40px;
    position: relative;
    z-index: 60;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.hamburger .bar {
    display: block;
    width: 24px;
    height: 3px;
    margin: 3px 0;
    background: #334155;
    border-radius: 2px;
    transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
}
.dark .hamburger .bar {
    background: #f1f5f9;
}
.hamburger.open .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.hamburger.open .bar:nth-child(2) {
    opacity: 0;
}
.hamburger.open .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

@media (max-width: 600px) {
    .lightbox-inner {
        padding: 1rem 0.5rem 1rem 0.5rem;
    }
    .lightbox-content {
        max-width: 95vw;
        max-height: 40vh;
    }
    .lightbox-caption {
        max-width: 90vw;
        font-size: 0.95rem;
        padding: 0.75rem 0.5rem;
    }
    .bg-white.rounded-lg.p-8 {
        max-width: 92vw !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(40px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.animate-modal-in {
    animation: modalIn 0.4s cubic-bezier(0.4,0,0.2,1);
}

.modal-blur-bg {
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
} 
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .55rem .95rem;
    font-size: .85rem;
    font-weight: 500;
    background: var(--primary);
    color: #fff;
    border-radius: .65rem;
    transition: background-color var(--transition-base), color var(--transition-base), transform var(--transition-base);
}
.theme-toggle-btn:hover {
    background: var(--primary-hover);
}
.dark .theme-toggle-btn {
    background: var(--accent);
    color: #0f172a;
}
.dark .theme-toggle-btn:hover {
    background: var(--accent-hover);
}
.theme-toggle-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --- Strong dark theme overrides --- */

/* Global surfaces */
.dark body {
    background-color: #020617; /* very dark navy */
    color: var(--text);
}

.dark nav,
.dark footer,
.dark section#home,
.dark section#about,
.dark section#structure,
.dark section#events,
.dark section#gallery,
.dark section#contact {
    background-color: #020617;
    color: var(--text);
}

/* Hero overlay remains readable */
.dark .hero-bg {
    background: linear-gradient(135deg, rgba(15,23,42,0.95) 0%, rgba(15,23,42,1) 100%);
}

/* Override common light backgrounds */
.dark .bg-white,
.dark .bg-gray-50,
.dark .bg-blue-600 {
    background-color: #020617 !important;
}

/* About section: Visi & Misi cards */
.dark #about .bg-blue-100,
.dark #about .bg-amber-100 {
    background-color: rgba(15,23,42,0.9) !important; /* dark card base */
    border-radius: 0.9rem;
    border: 1px solid rgba(148,163,184,0.5);
    box-shadow: 0 18px 40px rgba(0,0,0,0.7);
}

/* Keep Visi & Misi headings with their original colors */
.dark #about .bg-blue-100 h4 {
    color: #2563eb !important; /* blue-600 */
}

.dark #about .bg-amber-100 h4 {
    color: #d97706 !important; /* amber-600 */
}

.dark #about .bg-blue-100 p,
.dark #about .bg-amber-100 p {
    color: #cbd5f5 !important; /* soft but clearly readable */
}

/* Cards / tiles */
.dark .structure-item,
.dark .event-card,
.dark .gallery-item,
.dark .glass-card {
    background-color: #020617 !important;
    color: var(--text);
    border-radius: 0.75rem;
    border: 1px solid #1e293b;
    box-shadow: 0 14px 35px rgba(0,0,0,0.65);
}

/* Subtle gradient surface for cards to distinguish from page bg */
.dark .structure-item,
.dark .event-card,
.dark .gallery-item {
    background: radial-gradient(circle at top left, rgba(30,64,175,0.18), transparent 55%),
                radial-gradient(circle at bottom right, rgba(148,163,184,0.16), transparent 60%),
                #020617 !important;
}

.dark .event-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.8);
}

/* About page specific card containers (if using bg-white / rounded classes) */
.dark #about .bg-white,
.dark #about .glass-card,
.dark #about .structure-item {
    background: radial-gradient(circle at top left, rgba(56,189,248,0.16), transparent 55%),
                radial-gradient(circle at bottom right, rgba(248,250,252,0.08), transparent 60%),
                #020617 !important;
    border-color: #1d4ed8;
}

.dark #about .about-img-section img,
.dark #about .about-img-section .skeleton {
    border-radius: 0.75rem;
    border: 1px solid #1f2937;
}

.dark #about .text-gray-800,
.dark #about .text-gray-700 {
    color: #e5e7eb !important;
}

/* Text colors */
.dark .text-gray-800,
.dark .text-gray-700,
.dark .text-gray-600 {
    color: var(--text-muted) !important;
}

.dark .text-gray-400,
.dark .text-gray-500 {
    color: #9ca3af !important;
}

/* Navbar and footer contrast */
.dark nav {
    background-color: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
}

.dark footer {
    background-color: #020617;
}

/* Headings and section titles in dark mode */
.dark h1,
.dark h2,
.dark h3,
.dark h4,
.dark h5,
.dark h6,
.dark .section-title {
    color: #e5e7eb;
}

/* Nav links and footer links */
.dark .nav-link,
.dark footer a {
    color: #e5e7eb;
}
.dark .nav-link:hover,
.dark footer a:hover {
    color: var(--accent);
}

/* Hero primary buttons */
.dark #home a[href="#about"],
.dark #home a[href="#contact"],
.dark #prayer-schedule-btn {
    border-color: transparent;
}
.dark #home a[href="#about"] {
    background-color: var(--accent);
    color: #0f172a;
}
.dark #home a[href="#about"]:hover {
    background-color: var(--accent-hover);
}
.dark #home a[href="#contact"] {
    border-color: #e5e7eb;
    color: #e5e7eb;
}
.dark #home a[href="#contact"]:hover {
    background-color: rgba(148,163,184,0.12);
}
.dark #prayer-schedule-btn {
    background-color: var(--primary);
}
.dark #prayer-schedule-btn:hover {
    background-color: var(--primary-hover);
}

/* Event badges keep original colors, only adjust meta text */
.dark .event-card span.text-sm.text-gray-500 {
    color: #9ca3af !important;
}

/* Gallery captions */
.dark .gallery-item p {
    color: #e5e7eb;
}

/* Dark mode skeleton loader */
.dark .skeleton {
    background: linear-gradient(90deg, #1e293b 0%, #334155 50%, #1e293b 100%);
}

.dark .skeleton::before {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(148, 163, 184, 0.3) 50%,
        transparent 100%
    );
}

/* Contact section icons and cards */
.dark #contact .glass-card {
    background-color: rgba(15,23,42,0.95) !important;
}
.dark #contact i {
    color: #e5e7eb;
}