:root {
    --ink: #22231f;
    --paper: #fbfaf7;
    --line: rgba(34, 35, 31, .13);
    --wine: #7c4c58;
    --sage: #47685e;
    --gold: #c0a06a;
    --cream: #fffdf8;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

img {
    display: block;
    max-width: 100%;
}

button,
a {
    font: inherit;
}

.public-gallery {
    background: var(--paper);
}

.gallery-hero {
    position: relative;
    min-height: 92vh;
    display: grid;
    align-items: end;
    overflow: hidden;
    color: #fff;
    background: #1d1d1b;
}

.hero-slideshow,
.hero-slide,
.hero-shade {
    position: absolute;
    inset: 0;
}

.hero-slide {
    opacity: 0;
    background-position: center;
    background-size: cover;
    transform: scale(1.04);
    transition: opacity 1.6s ease, transform 7s ease;
}

.hero-slide.active {
    opacity: 1;
    transform: scale(1);
}

.hero-shade {
    background:
        linear-gradient(180deg, rgba(0, 0, 0, .25), rgba(0, 0, 0, .18) 36%, rgba(0, 0, 0, .74)),
        linear-gradient(90deg, rgba(0, 0, 0, .48), transparent 70%);
}

.gallery-hero-content {
    position: relative;
    z-index: 2;
    width: min(960px, calc(100% - 36px));
    margin: 0 auto;
    padding: 120px 0 clamp(44px, 9vh, 86px);
}

.public-eyebrow {
    margin: 0 0 14px;
    color: var(--gold);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.gallery-hero h1 {
    max-width: 860px;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3rem, 11vw, 8.5rem);
    font-weight: 400;
    line-height: .94;
    overflow-wrap: anywhere;
}

.gallery-hero h1.title-xl {
    font-size: clamp(2.5rem, 7.5vw, 5.5rem);
    line-height: 1.0;
}

.gallery-hero h1.title-xxl {
    font-size: clamp(2rem, 5.5vw, 3.8rem);
    line-height: 1.05;
}

.event-date {
    margin: 18px 0 0;
    color: rgba(255, 255, 255, .78);
    font-size: 1rem;
    font-weight: 700;
}

.intro-message {
    max-width: 720px;
    margin-top: 24px;
    color: rgba(255, 255, 255, .88);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.08rem, 2vw, 1.45rem);
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

.public-button {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .46);
    border-radius: 999px;
    padding: 12px 22px;
    color: #211f1b;
    background: #fff;
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
    transition: transform .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
}

.public-button:hover {
    transform: translateY(-1px);
}

.public-button.secondary {
    color: #fff;
    background: rgba(255, 255, 255, .08);
    backdrop-filter: blur(10px);
}

.gallery-content {
    width: min(1440px, calc(100% - 24px));
    margin: 0 auto;
    padding: clamp(42px, 8vw, 92px) 0 90px;
}

.gallery-section-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.gallery-section-header h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.9rem, 4vw, 4rem);
    font-weight: 400;
}

.photo-grid {
    display: flex;
    align-items: flex-start;
    gap: clamp(10px, 1.6vw, 20px);
}

.masonry-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.6vw, 20px);
}

.photo-tile {
    margin: 0;
}

/* Infinite Scroll Loader */
.infinite-scroll-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
    width: 100%;
    margin-top: 20px;
}

.infinite-scroll-loader.hidden {
    display: none;
}

.loader-dots {
    display: flex;
    gap: 8px;
}

.loader-dots span {
    width: 10px;
    height: 10px;
    background-color: var(--gold);
    border-radius: 50%;
    display: inline-block;
    animation: pulse-dots 1.4s infinite ease-in-out both;
}

.loader-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loader-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes pulse-dots {
    0%, 80%, 100% { 
        transform: scale(0);
    } 40% { 
        transform: scale(1.0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.photo-tile button {
    position: relative;
    width: 100%;
    display: block;
    padding: 0;
    border: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #e6e0d6;
    cursor: zoom-in;
}

/* Pulsing skeleton shimmer effect while image is loading */
.photo-tile button::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #e6e0d6 25%, #f2ede4 50%, #e6e0d6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.6s infinite linear;
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.photo-tile button.img-loaded::before {
    opacity: 0;
}

.photo-tile img {
    width: 100%;
    height: auto;
    object-fit: cover;
    filter: saturate(.94) contrast(1.02);
    transition: transform .45s ease, filter .45s ease;
}

.photo-tile img.lazy-image {
    opacity: 0;
    transition: opacity .28s ease, transform .45s ease, filter .45s ease;
}

.photo-tile img.lazy-image.is-loaded {
    opacity: 1;
}

.photo-tile button:hover img {
    transform: scale(1.035);
    filter: saturate(1) contrast(1.04);
}

.public-empty {
    min-height: 220px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: rgba(34, 35, 31, .72);
    background: #fff;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 74px clamp(14px, 4vw, 60px);
    background: rgba(10, 10, 9, .94);
}

.lightbox.open {
    display: flex;
}

.lightbox img {
    max-width: min(100%, 1320px);
    max-height: calc(100vh - 150px);
    border-radius: 4px;
    object-fit: contain;
    box-shadow: 0 22px 70px rgba(0, 0, 0, .42);
}

.lightbox-close,
.lightbox-nav,
.lightbox-download {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .2);
    color: #fff;
    background: rgba(255, 255, 255, .08);
    backdrop-filter: blur(8px);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.lightbox-close:hover,
.lightbox-nav:hover,
.lightbox-download:hover {
    background: rgba(255, 255, 255, .18);
    border-color: rgba(255, 255, 255, .32);
}

.lightbox-close {
    top: 18px;
    right: 18px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.lightbox-close:hover {
    transform: scale(1.06);
}

.lightbox-nav {
    top: 50%;
    width: 48px;
    height: 58px;
    border-radius: 999px;
    transform: translateY(-50%);
}

.lightbox-nav:hover {
    transform: translateY(-50%) scale(1.06);
}

.lightbox-nav.prev {
    left: 18px;
}

.lightbox-nav.next {
    right: 18px;
}

.lightbox-download {
    right: 76px;
    bottom: 20px;
    min-height: 42px;
    border-radius: 999px;
    padding: 9px 18px;
    font-weight: 800;
}

.lightbox-download.hidden {
    display: none;
}

.private-home {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    color: #fff;
    background:
        linear-gradient(145deg, rgba(34, 35, 31, .88), rgba(71, 104, 94, .74)),
        linear-gradient(90deg, #22231f, #7c4c58);
}

.private-home-shell {
    width: min(780px, 100%);
}

.private-home h1 {
    margin: 0 0 18px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.7rem, 8vw, 6.5rem);
    font-weight: 400;
    line-height: .98;
}

.private-home p:not(.public-eyebrow) {
    max-width: 560px;
    margin: 0 0 28px;
    color: rgba(255, 255, 255, .82);
    font-size: 1.08rem;
    line-height: 1.7;
}

@media (max-width: 720px) {
    .gallery-hero {
        min-height: 88vh;
    }

    .gallery-hero-content {
        width: min(100% - 28px, 960px);
        padding-bottom: 38px;
    }

    .hero-actions,
    .gallery-section-header {
        align-items: stretch;
        flex-direction: column;
    }

    .public-button,
    .hero-actions .public-button {
        width: 100%;
    }

    .lightbox {
        padding: 68px 10px;
    }

    .lightbox-nav {
        top: auto;
        bottom: 18px;
        transform: none;
        touch-action: manipulation;
    }

    .lightbox-nav:hover,
    .lightbox-nav:active {
        transform: none;
    }

    .lightbox-download {
        left: 50%;
        right: auto;
        bottom: 24px;
        transform: translateX(-50%);
    }
}

@media (max-width: 520px) {
    /* JS will create only 1 column; ensure it fills the full width */
    .masonry-col {
        flex: 1 1 100%;
    }
}

/* Tela de Carregamento da Galeria */
.gallery-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1), transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.gallery-loader.exit {
    opacity: 0;
    transform: scale(1.03);
    pointer-events: none;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    text-align: center;
}

.loader-logo {
    max-height: 90px;
    width: auto;
    object-fit: contain;
    animation: loader-pulse 2s infinite ease-in-out;
}

.loader-brand-mark {
    font-family: Georgia, serif;
    font-size: 3.5rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: #b8996a;
    animation: loader-pulse 2s infinite ease-in-out;
}

/* Spinner de Anelação Dupla Rotativa (Mais Animado) */
.loader-spinner {
    position: relative;
    width: 48px;
    height: 48px;
    border: 3.5px solid rgba(184, 153, 106, 0.12);
    border-top-color: #b8996a;
    border-radius: 50%;
    animation: loader-spin 0.9s infinite linear;
}

.loader-spinner::after {
    content: "";
    position: absolute;
    inset: 4px;
    border: 3.5px solid rgba(184, 153, 106, 0.08);
    border-bottom-color: #b8996a;
    border-radius: 50%;
    animation: loader-spin-reverse 0.65s infinite linear;
}

@keyframes loader-spin {
    to { transform: rotate(360deg); }
}

@keyframes loader-spin-reverse {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

@keyframes loader-pulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 0.92; 
        filter: drop-shadow(0 0 0px rgba(184, 153, 106, 0));
    }
    50% { 
        transform: scale(1.05); 
        opacity: 1; 
        filter: drop-shadow(0 0 16px rgba(184, 153, 106, 0.35));
    }
}
