/* ==========================================================================
   Galeria — Page Styles
   ========================================================================== */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }

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

::selection {
    background-color: var(--color-gold-light);
    color: var(--color-dark);
}

/* Scroll Reveal */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.scroll-reveal.revealed { opacity: 1; transform: translateY(0); }

/* ==========================================================================
   SHARED NAV (same as historia/cerimonia)
   ========================================================================== */

.top-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    display: flex; justify-content: space-between; align-items: center;
    padding: 28px 48px;
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.top-nav.hidden { opacity: 0; pointer-events: none; transform: translateY(-16px); }

.nav-logo { position: relative; width: 42px; height: 42px; flex-shrink: 0; }
.nav-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity 0.4s ease; }
.nav-logo .logo-light { opacity: 1; }
.nav-logo .logo-dark  { opacity: 0; }

.top-nav-links { display: flex; gap: 36px; list-style: none; }
.top-nav-links a {
    font-family: var(--font-body); font-size: 11px; font-weight: 300;
    letter-spacing: 0.2em; text-transform: uppercase; text-decoration: none;
    color: rgba(255,255,255,0.75); position: relative; padding-bottom: 4px;
    transition: color 0.3s ease;
}
.top-nav-links a::after { content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 1px; background: var(--color-gold-light); transition: width 0.3s ease; }
.top-nav-links a:hover { color: #fff; }
.top-nav-links a:hover::after { width: 100%; }
.top-nav-links li.active a { color: #fff; }
.top-nav-links li.active a::after { width: 100%; background: var(--color-gold); }

.top-nav-toggle {
    display: none; flex-direction: column; gap: 5px; width: 28px;
    background: none; border: none; cursor: pointer; padding: 6px; z-index: 510;
}
.top-nav-toggle span { display: block; width: 100%; height: 1.5px; background: rgba(255,255,255,0.85); border-radius: 2px; transition: transform 0.3s ease, opacity 0.3s ease; }
.top-nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(4.5px, 4.5px); }
.top-nav-toggle.active span:nth-child(2) { opacity: 0; }
.top-nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(4.5px, -4.5px); }

/* Sidebar */
.sidebar-trigger {
    position: fixed; top: 24px; right: 28px; z-index: 300;
    width: 50px; height: 50px; border-radius: 50%; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: rgba(44,44,44,0.85); backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    opacity: 0; transform: scale(0.6); pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease, background 0.3s ease;
}
.sidebar-trigger.visible { opacity: 1; transform: scale(1); pointer-events: auto; }
.sidebar-trigger:hover { background: rgba(60,60,60,0.95); }
.sidebar-trigger.active { background: transparent; box-shadow: none; }

.sidebar-trigger-icon { display: flex; flex-direction: column; gap: 5px; width: 18px; }
.sidebar-trigger-icon span { display: block; width: 100%; height: 1.5px; background: #fff; border-radius: 2px; transition: transform 0.3s ease, opacity 0.3s ease; }
.sidebar-trigger.active .sidebar-trigger-icon span:nth-child(1) { transform: rotate(45deg) translate(4.5px, 4.5px); }
.sidebar-trigger.active .sidebar-trigger-icon span:nth-child(2) { opacity: 0; }
.sidebar-trigger.active .sidebar-trigger-icon span:nth-child(3) { transform: rotate(-45deg) translate(4.5px, -4.5px); }

.sidebar-panel {
    position: fixed; top: 0; right: 0; width: 340px; height: 100vh; z-index: 250;
    background: rgba(44,44,44,0.97); backdrop-filter: blur(20px);
    display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
    padding: 80px 56px;
    transform: translateX(100%); transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.sidebar-panel.open { transform: translateX(0); }
.sidebar-panel-links { list-style: none; display: flex; flex-direction: column; gap: 32px; }
.sidebar-panel-links a {
    font-family: var(--font-display); font-size: 1.5rem; font-weight: 300;
    letter-spacing: 0.12em; text-transform: uppercase;
    color: rgba(255,255,255,0.5); text-decoration: none;
    transition: color 0.3s ease, padding-left 0.3s ease;
}
.sidebar-panel-links a:hover, .sidebar-panel-links a.current { color: #fff; padding-left: 12px; }

.sidebar-backdrop { position: fixed; inset: 0; z-index: 240; background: rgba(0,0,0,0.3); opacity: 0; pointer-events: none; transition: opacity 0.4s ease; }
.sidebar-backdrop.visible { opacity: 1; pointer-events: auto; }

/* Floating Logo */
.floating-logo {
    position: fixed; top: 28px; left: 48px; z-index: 110;
    width: 42px; height: 42px;
    opacity: 0; pointer-events: none; transition: opacity 0.4s ease;
}
.floating-logo.visible { opacity: 1; pointer-events: auto; }
.floating-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity 0.4s ease; }
.floating-logo .logo-light { opacity: 0; }
.floating-logo .logo-dark  { opacity: 1; }
.floating-logo.on-dark .logo-light { opacity: 1; }
.floating-logo.on-dark .logo-dark  { opacity: 0; }

/* Mobile Overlay */
.mobile-menu-overlay {
    position: fixed; inset: 0; z-index: 500;
    background: var(--color-cream);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: opacity 0.5s ease, visibility 0.5s ease;
}
.mobile-menu-overlay.active { opacity: 1; visibility: visible; }
.mobile-menu-links { list-style: none; text-align: center; }
.mobile-menu-links li { margin: 24px 0; transform: translateY(16px); opacity: 0; transition: transform 0.35s ease, opacity 0.35s ease; }
.mobile-menu-overlay.active .mobile-menu-links li { transform: translateY(0); opacity: 1; }
.mobile-menu-overlay.active .mobile-menu-links li:nth-child(1) { transition-delay: 0.08s; }
.mobile-menu-overlay.active .mobile-menu-links li:nth-child(2) { transition-delay: 0.14s; }
.mobile-menu-overlay.active .mobile-menu-links li:nth-child(3) { transition-delay: 0.20s; }
.mobile-menu-overlay.active .mobile-menu-links li:nth-child(4) { transition-delay: 0.26s; }
.mobile-menu-overlay.active .mobile-menu-links li:nth-child(5) { transition-delay: 0.32s; }
.mobile-menu-overlay.active .mobile-menu-links li:nth-child(6) { transition-delay: 0.38s; }
.mobile-menu-overlay.active .mobile-menu-links li:nth-child(7) { transition-delay: 0.44s; }
.mobile-menu-links a { font-family: var(--font-display); font-size: 2rem; font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-dark); text-decoration: none; }

/* ==========================================================================
   PAGE HERO
   ========================================================================== */
.page-hero {
    position: relative; min-height: 50vh;
    display: flex; align-items: center; justify-content: center;
    background-color: var(--color-dark); padding: 140px 48px 64px;
}
.page-hero::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 30%, rgba(156,175,136,0.06) 0%, transparent 70%);
    pointer-events: none;
}
.page-hero-content { position: relative; z-index: 1; text-align: center; color: #fff; max-width: 640px; }
.page-hero-label {
    font-family: var(--font-body); font-size: 10px; font-weight: 300;
    letter-spacing: 0.4em; text-transform: uppercase;
    color: rgba(255,255,255,0.35); display: block; margin-bottom: 32px;
}
.page-hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 300;
    letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 28px;
}
.page-hero-line { width: 48px; height: 1px; background: var(--color-gold); margin: 0 auto; opacity: 0.5; }

.page-hero-content > * { opacity: 0; transform: translateY(20px); animation: heroIn 0.8s ease forwards; }
.page-hero-content > *:nth-child(1) { animation-delay: 0.1s; }
.page-hero-content > *:nth-child(2) { animation-delay: 0.25s; }
.page-hero-content > *:nth-child(3) { animation-delay: 0.4s; }
@keyframes heroIn { to { opacity: 1; transform: translateY(0); } }

/* ==========================================================================
   GALLERY INTRO
   ========================================================================== */
.gallery-intro {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
    padding: 80px 48px 40px;
}

.gallery-intro p {
    font-family: var(--font-display);
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    font-weight: 400;
    font-style: italic;
    color: var(--color-text-light);
    line-height: 1.8;
}

/* ==========================================================================
   MASONRY GALLERY GRID — CSS multicolumn (Pinterest-style)
   --------------------------------------------------------------------------
   Por que multicolumn em vez de CSS Grid:
   - Mantém o aspect ratio original de cada foto (sem crop forçado).
   - Sem buracos: o algoritmo de coluna preenche naturalmente.
   - Pura CSS, sem JS adicional (sem Masonry.js, sem isotope).
   - As classes .tall/.wide vindas do accessor getSizeClassAttribute do
     model GalleryPhoto se tornam inertes — ficam no markup mas não fazem
     nada visualmente. Não há necessidade de mudar a blade nem o model.
   ========================================================================== */
.gallery-section {
    padding: 0 48px 100px;
    background: var(--color-cream);
}

/* Masonry em GRID, preenchido linha-a-linha (igual à ordem do admin).
   Antes era column-count (preenchia coluna-a-coluna), o que embaralhava a
   ordem visual. grid-auto-rows fino + grid-row-end via JS (resizeGalleryItems
   em gallery.blade) dá o efeito masonry mantendo a ordem de leitura. */
.gallery-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 1px;
    column-gap: 16px;
}

.gallery-item {
    position: relative;
    display: block;
    width: 100%;
    /* altura real definida por JS; fallback antes do JS medir as imagens */
    grid-row-end: span 250;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    background: var(--color-cream-dark);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
                filter 0.4s ease;
}

.gallery-item:hover img {
    transform: scale(1.04);
}

/* Overlay no hover — gradiente sutil + ícone de lupa no canto.
   Mais discreto que o overlay anterior (escurecimento total), no
   espírito de feeds tipo VSCO. */
.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
                rgba(44,44,44,0) 55%,
                rgba(44,44,44,0.45) 100%);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item-overlay svg {
    color: #fff;
    opacity: 0.95;
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

/* Em CSS multicolumn, transform: translateY em filhos pode causar
   pequenos saltos visuais durante o lazy-load das imagens (a coluna
   recalcula posições). Para evitar, no scroll-reveal dos itens da
   galeria usamos só fade — sem deslocamento vertical. */
.gallery-item.scroll-reveal,
.gallery-item.scroll-reveal.revealed {
    transform: none;
}

/* Stagger gallery items — cascade de fade-in */
.gallery-item.scroll-reveal:nth-child(1) { transition-delay: 0s; }
.gallery-item.scroll-reveal:nth-child(2) { transition-delay: 0.06s; }
.gallery-item.scroll-reveal:nth-child(3) { transition-delay: 0.12s; }
.gallery-item.scroll-reveal:nth-child(4) { transition-delay: 0.18s; }
.gallery-item.scroll-reveal:nth-child(5) { transition-delay: 0.24s; }
.gallery-item.scroll-reveal:nth-child(6) { transition-delay: 0.30s; }
.gallery-item.scroll-reveal:nth-child(7) { transition-delay: 0.36s; }
.gallery-item.scroll-reveal:nth-child(8) { transition-delay: 0.42s; }

/* ==========================================================================
   LIGHTBOX
   ========================================================================== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 600;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90vw;
    max-height: 85vh;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 78vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transition: opacity 0.3s ease;
}

.lightbox-caption {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 300;
    font-style: italic;
    color: rgba(255,255,255,0.6);
    margin-top: 20px;
    text-align: center;
    letter-spacing: 0.03em;
}

.lightbox-counter {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 0.2em;
    color: rgba(255,255,255,0.35);
}

/* Lightbox buttons */
.lightbox-close {
    position: absolute;
    top: 24px; right: 28px;
    background: none; border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    padding: 8px;
    transition: color 0.3s ease, transform 0.3s ease;
    z-index: 2;
}
.lightbox-close:hover { color: #fff; transform: scale(1.1); }

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.08);
    border: none;
    border-radius: 50%;
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
    z-index: 2;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.15); color: #fff; }
.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }

/* ==========================================================================
   CTA
   ========================================================================== */
.gallery-cta {
    padding: 100px 48px;
    background: var(--color-dark);
    text-align: center;
}
.gallery-cta-inner { max-width: 560px; margin: 0 auto; }
.gallery-cta-title {
    font-family: var(--font-script);
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 400;
    color: #fff;
    margin-bottom: 16px;
}
.gallery-cta-text {
    font-family: var(--font-body); font-size: 15px; font-weight: 300;
    color: rgba(255,255,255,0.6); margin-bottom: 36px;
}
.gallery-cta-button {
    display: inline-block; padding: 14px 40px;
    border: 1px solid var(--color-gold); border-radius: var(--radius-pill);
    font-family: var(--font-body); font-size: 12px; font-weight: 300;
    letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--color-gold); text-decoration: none; transition: all 0.3s ease;
}
.gallery-cta-button:hover { background: var(--color-gold); color: var(--color-dark); }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer-dark {
    background: var(--color-dark); color: rgba(255,255,255,0.4);
    text-transform: uppercase; font-size: 11px; letter-spacing: 0.15em;
    font-family: var(--font-body); font-weight: 300;
    display: flex; justify-content: center; padding: 16px 0;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        column-gap: 14px;
    }
}

@media (max-width: 768px) {
    .top-nav { padding: 20px 24px; }
    .top-nav-links { display: none; }
    .top-nav-toggle { display: flex; }
    .sidebar-trigger { top: 18px; right: 20px; width: 46px; height: 46px; }
    .sidebar-panel { width: 100%; padding: 80px 40px; align-items: center; }
    .sidebar-panel-links { align-items: center; }
    .sidebar-panel-links a { font-size: 1.3rem; }
    .floating-logo { left: 24px; top: 20px; width: 36px; height: 36px; }

    .page-hero { min-height: 45vh; padding: 110px 24px 48px; }

    .gallery-section { padding: 0 16px 72px; }
    .gallery-intro { padding: 60px 24px 24px; }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        column-gap: 10px;
    }

    .gallery-cta { padding: 72px 24px; }

    /* Lightbox mobile */
    .lightbox-nav { width: 44px; height: 44px; }
    .lightbox-prev { left: 12px; }
    .lightbox-next { right: 12px; }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        column-gap: 8px;
    }
}