:root {
    --bg-color: #fdfbf7;
    /* soft cream */
    --text-color: #2b4238;
    /* dark muted mint/emerald */
    --accent-gold: #c39887;
    /* pastel rose gold/copper */
    --accent-emerald: #e8f0eb;
    /* very pale pastel green */
    --card-bg: #ffffff;
    --border-color: #eeddd3;

    --font-heading: 'Cinzel', serif;
    --font-body: 'Inter', sans-serif;
}

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

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

h1,
h2,
h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-color);
}

.hidden {
    display: none !important;
}

/* --- Login Screen --- */
#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-color);
}

.login-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../optimized_photos/walima/walima_075.webp');
    background-size: cover;
    background-position: center;
    /* Make image prominent, shiny, and bright */
    filter: brightness(1.1) contrast(1.05) saturate(1.1);
    opacity: 1;
}

/* Subtle dark vignette to make text pop, replacing thick white overlay */
.login-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 40%, rgba(0, 0, 0, 0.4) 100%);
}

.login-content {
    position: relative;
    z-index: 2;
    /* High see-thru glassmorphism */
    background: rgba(255, 255, 255, 0.15);
    padding: 3rem;
    border-radius: 12px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    /* Delicate Islamic-inspired border */
    border: 1px solid rgba(255, 255, 255, 0.3);
    outline: 2px solid rgba(255, 255, 255, 0.1);
    outline-offset: -10px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    /* Safari support */
}

.login-content h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #fff;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
}

.login-content p {
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
    letter-spacing: 1px;
    color: #f1f5f9;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

#login-form input {
    padding: 1rem;
    /* Dark see-thru glass for inputs makes white text extremely legible */
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #fff;
    font-size: 1.1rem;
    font-family: var(--font-body);
    transition: all 0.3s ease;
    border-radius: 6px;
    backdrop-filter: blur(8px);
}

#login-form input:focus {
    outline: none;
    border-color: var(--accent-gold);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

#login-form input::placeholder {
    color: #e2e8f0;
    opacity: 1;
}

#login-form button {
    padding: 1rem;
    background: var(--accent-gold);
    color: #fff;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-heading);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

#login-form button:hover {
    background: #b58977;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(195, 152, 135, 0.3);
}

#login-error {
    color: #e07a5f;
    font-size: 0.9rem;
    display: none;
}

/* --- Main Layout --- */
.site-header {
    text-align: center;
    padding: 4rem 1rem 3rem;
    background: var(--accent-emerald);
    border-bottom: 1px solid var(--border-color);
}

.site-header h1 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.site-header nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem 3rem;
}

.site-header nav a {
    color: var(--text-color);
    text-decoration: none;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    letter-spacing: 1px;
    transition: color 0.3s ease;
    padding-bottom: 5px;
    border-bottom: 2px solid transparent;
}

.site-header nav a:hover {
    color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
}

/* --- Video Section --- */
.video-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-top: 2rem;
}

.video-item {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    aspect-ratio: 16 / 9;
}

.video-item iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-item:hover {
    border-color: var(--accent-gold);
    box-shadow: 0 15px 30px rgba(43, 66, 56, 0.08);
}

.gallery-section {
    padding: 5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 4rem;
    position: relative;
    color: var(--text-color);
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 2px;
    background: var(--accent-gold);
    margin: 1.5rem auto 0;
}

/* JS Distributed Masonry */
.gallery-grid {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.masonry-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.grid-item {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 20px;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    /* Force Hardware Acceleration to fix browser disappearing bug in columns */
    transform: translateZ(0);
    will-change: transform;
    min-height: 100px;
    display: inline-block;
    width: 100%;
}

.grid-item:hover {
    transform: translateY(-5px) translateZ(0);
    box-shadow: 0 15px 30px rgba(43, 66, 56, 0.08);
    border-color: var(--accent-gold);
}

.grid-item img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

.full-res-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease;
    pointer-events: none;
}

.full-res-overlay.loaded {
    opacity: 1;
}

/* Lightbox */
#lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(253, 251, 247, 0.95);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

#lightbox-img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(43, 66, 56, 0.15);
    border: 1px solid var(--border-color);
}

#lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    color: var(--text-color);
    font-size: 45px;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
    z-index: 10002;
}

#lightbox-close:hover {
    color: var(--accent-gold);
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(253, 251, 247, 0.4);
    color: var(--text-color);
    border: none;
    font-size: 2.5rem;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.3s ease, color 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 60px;
    height: 60px;
    z-index: 10001;
}

.lightbox-nav:hover {
    background: rgba(253, 251, 247, 0.9);
    color: var(--accent-gold);
}

#lightbox-prev {
    left: 20px;
}

#lightbox-next {
    right: 20px;
}

footer {
    text-align: center;
    padding: 3rem;
    background: var(--accent-emerald);
    border-top: 1px solid var(--border-color);
    font-family: var(--font-heading);
    color: #7b8d86;
}

@media (max-width: 1024px) {
    /* Responsive handled by JS masonry columns */
}

@media (max-width: 768px) {
    .site-header h1 {
        font-size: 2.2rem;
    }

    .site-header nav {
        gap: 1rem 1.5rem;
    }

    .login-bg {
        background-image: url('../optimized_photos/walima/walima_081.webp');
    }

    #login-overlay {
        align-items: flex-end;
        padding-bottom: 3rem;
    }

    /* Responsive handled by JS masonry columns */
    .video-grid {
        grid-template-columns: 1fr;
    }

    .gallery-section {
        padding: 3rem 1rem;
    }

    .login-content {
        padding: 2.5rem 1.5rem;
    }
}

/* Scroll to Top Button */
#scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--accent-gold);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(195, 152, 135, 0.4);
    transition: transform 0.3s ease, background 0.3s ease, opacity 0.3s ease, visibility 0.3s;
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
}

#scroll-to-top:hover {
    background: #b58977;
}