/* --- VARIABLES & RESET --- */
:root {
    --gold: #c5a059;
    --gold-hover: #b08d48;
    --text-dark: #2c2c2c;
    --text-light: #666;
    --bg-color: #faf9f6;
    --white: #ffffff;
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 20px 50px -10px rgba(197, 160, 89, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Lato', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    line-height: 1.6;
    background-image: radial-gradient(#e6d3a3 0.5px, transparent 0.5px);
    background-size: 20px 20px;
}

/* --- HEADER SECTION --- */
header {
    text-align: center;
    padding: 80px 20px 50px;
    background: linear-gradient(to bottom, #fff 0%, var(--bg-color) 100%);
    position: relative;
}

h1 {
    font-family: 'Great Vibes', cursive;
    font-size: 4.5rem;
    margin: 0;
    color: var(--text-dark);
    font-weight: 400;
    line-height: 1.1;
    text-shadow: 2px 2px 0px rgba(255, 255, 255, 0.8);
}

.subtitle {
    font-family: 'Playfair Display', serif;
    text-transform: uppercase;
    letter-spacing: 5px;
    font-size: 1.1rem;
    color: var(--gold);
    margin-top: 5px;
    margin-bottom: 35px;
    display: block;
    font-weight: 600;
}

.divider {
    height: 2px;
    width: 80px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    margin: 0 auto 30px;
    opacity: 0.6;
}

/* --- TAB NAVIGATION --- */
.tab-navigation {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
}

.tab-btn {
    background: transparent;
    border: none;
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 10px 20px;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--gold);
}

.tab-btn.active {
    color: var(--text-dark);
    border-bottom-color: var(--gold);
}

/* --- VIDEO CARD --- */
.video-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    margin-bottom: 30px;
}

.video-container {
    padding-bottom: 56.25%;
    /* 16:9 Aspect Ratio */
    position: relative;
    height: 0;
    background: radial-gradient(circle at center, #3a3a3a, #111);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-info {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.video-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.video-download-btn {
    text-decoration: none;
    color: var(--gold);
    border: 1px solid var(--gold);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.video-download-btn:hover {
    background: var(--gold);
    color: white;
}

/* --- GALLERY GRID --- */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 60vh;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    opacity: 0;
    animation: fadeIn 1.2s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* --- PHOTO CARD --- */
.photo-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.4s ease;
    cursor: pointer;
    position: relative;
    transform: translateZ(0);
}

.photo-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}

.image-wrapper {
    width: 100%;
    height: 380px;
    position: relative;
    overflow: hidden;
    background-color: #f0f0f0;
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease, opacity 0.3s ease;
    display: block;
    opacity: 0;
}

.photo-card img.loaded {
    opacity: 1;
}

.photo-card:hover img {
    transform: scale(1.08);
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.4), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.photo-card:hover .card-overlay {
    opacity: 1;
}

/* --- VIDEO FACADE & PLAY BUTTON --- */
.video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background 0.3s ease;
    cursor: pointer;
    z-index: 2;
}

.play-button::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 18px solid white;
    margin-left: 4px;
    /* Optical centering */
}

.video-container:hover .play-button {
    transform: translate(-50%, -50%) scale(1.1);
    background: var(--gold);
}

/* --- SKELETON LOADING --- */
.skeleton-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    margin-bottom: 30px;
}

.skeleton-image {
    padding-bottom: 56.25%;
    background-color: #eee;
    position: relative;
    overflow: hidden;
}

.skeleton-text {
    height: 20px;
    background-color: #eee;
    margin: 20px;
    width: 60%;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

/* Shimmer Animation */
.skeleton-image::after,
.skeleton-text::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transform: translateX(-100%);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* --- SHARE BUTTONS --- */
.share-container {
    display: flex;
    gap: 10px;
    margin-right: auto;
    /* Push download btn to right if flex container */
    padding-right: 15px;
}

.share-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    text-decoration: none;
    transition: transform 0.2s;
    font-family: sans-serif;
    /* For raw symbol fallback */
    font-weight: bold;
}

.share-btn:hover {
    transform: scale(1.1);
}

.share-fb {
    background-color: #1877f2;
}

.share-wa {
    background-color: #25d366;
}

.download-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-dark);
    padding: 10px 18px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 0.85rem;
    font-weight: 700;
    font-family: 'Lato', sans-serif;
    z-index: 2;
}

.photo-card:hover .download-btn {
    opacity: 1;
    transform: translateY(0);
}

.download-btn:hover {
    background: var(--gold);
    color: white;
}

/* --- VIDEO CARD INFO --- */
.video-info {
    padding: 15px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.video-title {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    color: var(--text-dark);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-download-btn {
    padding: 6px 14px;
    background-color: var(--gold);
    color: white;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    transition: background 0.3s;
    white-space: nowrap;
}

.video-download-btn:hover {
    background-color: var(--gold-hover);
}

/* --- PAGINATION CONTROLS (Numbered) --- */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 60px;
    gap: 10px;
    font-family: 'Playfair Display', serif;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 16px;
    background-color: transparent;
    border: 1px solid var(--gold);
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    border-radius: 4px;
    min-width: 40px;
}

.page-btn:hover:not(:disabled) {
    background-color: var(--gold);
    color: white;
}

.page-btn.active {
    background-color: var(--gold);
    color: white;
    font-weight: 600;
}

.page-btn:disabled {
    border-color: #ddd;
    color: #ccc;
    cursor: not-allowed;
}

.page-ellipsis {
    color: var(--gold);
    padding: 0 5px;
}

/* --- MODAL (with Arrows & Loader) --- */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(40, 40, 40, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
    overflow-y: auto;
    overflow-x: hidden;
}

.modal.active {
    opacity: 1;
}

/* Centered Modal Loader */
.modal-loader {
    display: none;
    /* Hidden by default */
    position: absolute;
    top: 50%;
    left: 50%;
    /* Fixed: We use a specific keyframe that preserves this centering */
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid var(--gold);
    border-radius: 50%;
    animation: modalSpin 1s linear infinite;
    /* Using specific animation */
    z-index: 10002;
}

/* New Keyframe to preserve centering while spinning */
@keyframes modalSpin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.modal-content-wrapper {
    position: relative;
    width: 95%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    margin: auto;
    /* Ensure min size so loader is centered nicely */
    min-height: 200px;
    min-width: 200px;
}

.modal-image-container {
    position: relative;
    display: inline-block;
}

.modal-content {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 4px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: opacity 0.3s ease;
}

.modal-video-container {
    width: 80vw;
    max-width: 1000px;
    aspect-ratio: 16/9;
    background: black;
    border-radius: 4px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.modal-video-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Modal Navigation Arrows */
.modal-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    font-size: 3rem;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10001;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: var(--gold);
}

.modal-nav-btn.prev {
    left: 10px;
}

.modal-nav-btn.next {
    right: 10px;
}

.modal-actions {
    margin-top: 25px;
    display: flex;
    gap: 15px;
}

.action-btn {
    padding: 12px 35px;
    border-radius: 50px;
    text-decoration: none;
    font-family: 'Playfair Display', serif;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

.btn-download {
    background-color: var(--gold);
    color: white;
    border-color: var(--gold);
}

.btn-download:hover {
    background-color: var(--gold-hover);
    border-color: var(--gold-hover);
}

.btn-close {
    background: transparent;
    color: white;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* --- FOOTER --- */
footer {
    margin-top: 80px;
    padding: 60px 20px;
    background-color: #f8f6f2;
    text-align: center;
    border-top: 1px solid #efebe4;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 60px;
    flex-wrap: wrap;
    max-width: 900px;
    margin: 0 auto;
}

.footer-section {
    text-align: center;
}

.footer-section h3 {
    font-family: 'Lato', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: #999;
    margin-bottom: 12px;
    font-weight: 700;
}

.footer-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--text-dark);
    margin: 0 0 6px 0;
    font-weight: 600;
}

.highlight-gold {
    color: var(--gold);
}

.footer-sub {
    font-size: 0.9rem;
    color: #777;
    font-style: italic;
    font-family: 'Playfair Display', serif;
}

.footer-divider {
    height: 50px;
    width: 1px;
    background-color: #ddd;
    display: block;
}

/* Loading Spinner */
#loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px;
    color: var(--gold);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(197, 160, 89, 0.3);
    border-radius: 50%;
    border-top-color: var(--gold);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 3.5rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 40px;
    }

    .footer-divider {
        display: none;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
        gap: 20px;
    }

    .download-btn {
        opacity: 1;
        transform: translateY(0);
        bottom: 15px;
        right: 15px;
        padding: 8px 15px;
        font-size: 0.75rem;
        background: rgba(255, 255, 255, 0.9);
    }

    /* Pagination and Modal Mobile adjustments */
    .pagination-container {
        gap: 5px;
        margin-top: 40px;
    }

    .page-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
        min-width: 30px;
    }

    /* Modal Mobile Fixes */
    .modal {
        align-items: flex-start;
        padding: 10px 0;
        height: 100dvh;
        /* Use dynamic viewport height for mobile browsers */
        overflow-y: scroll;
        /* Force scrollbar track */
        -webkit-overflow-scrolling: touch;
        /* Smooth scrolling on iOS */
    }

    .modal-content-wrapper {
        width: 100%;
        padding: 15px 10px;
        margin: 0;
        min-height: auto;
        /* Allow it to shrink */
    }

    .modal-content {
        max-height: 50vh;
        /* Reduced height to ensure buttons fit */
        width: 100%;
        object-fit: contain;
    }

    .modal-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 2rem;
    }

    .modal-nav-btn.prev {
        left: 5px;
    }

    .modal-nav-btn.next {
        right: 5px;
    }

    /* Stack Modal Buttons on Mobile */
    .modal-actions {
        flex-direction: column;
        align-items: center;
        width: 100%;
        max-width: 300px;
        gap: 12px;
        margin-top: 15px;
        padding-bottom: 40px;
        /* Extra padding at bottom for safer scrolling */
    }

    .action-btn {
        width: 100%;
        text-align: center;
        padding: 10px 20px;
        font-size: 0.8rem;
        /* Slightly smaller text */
    }

    .modal-actions .share-container {
        justify-content: center;
        margin-right: 0;
    }
}

/* --- UTILITIES & HELPERS --- */
.loader-text {
    font-family: 'Playfair Display', serif;
    font-style: italic;
}

#paginationControls {
    display: none;
    /* Initially hidden */
}

.footer-copyright {
    margin-top: 60px;
    font-size: 0.7rem;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.error-message {
    text-align: center;
    color: red;
}

.info-message {
    text-align: center;
    color: #999;
    padding: 20px;
}

.empty-message {
    text-align: center;
}