/* ==========================================================================
   1. PAGE TYPOGRAPHY OVERRIDES
   ========================================================================== */
p {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.88);
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ==========================================================================
   2. HERO SECTION
   ========================================================================== */
.hero {
    margin: 7.5rem auto 3rem auto;
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 4.2rem);
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: lightgoldenrodyellow;
    max-width: 860px;
    margin: 0 auto;
    opacity: 0.9;
    padding: 0 1.5rem;
    font-weight: 400;
}

/* ==========================================================================
   3. GALLERY LAYOUT & CARD CONTAINER
   ========================================================================== */
.section {
    padding: 30px 20px 60px 20px;
    width: 100%;
}

.card {
    background: rgba(0, 0, 0, 0.22);
    padding: 50px 40px;
    border: 1px solid rgba(201, 168, 76, 0.35);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45), inset 0 0 20px rgba(131, 45, 189, 0.15);
    position: relative;
}

.gallery-header-bar {
    margin-bottom: 2.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
}

.gallery-header-bar h2 {
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    color: #ffffff;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.gallery-header-subtext {
    margin-top: 0.5rem;
    margin-bottom: 0;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
}

.gallery-count-badge {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent-light-gold);
    background: rgba(201, 168, 76, 0.12);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    border: 1px solid rgba(201, 168, 76, 0.3);
}

/* 50-Item Responsive Photo Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2rem;
    width: 100%;
}

/* ==========================================================================
   4. ELEGANT GOLDEN GRADIENT PHOTO FRAME ITEM
   ========================================================================== */
.gallery-photo-frame {
    position: relative;
    padding: 12px;
    background: linear-gradient(135deg, 
        #f9e1a8 0%, 
        #C9A96E 18%, 
        #8a6829 38%, 
        #fff1cb 50%, 
        #73541d 65%, 
        #E8C98C 85%, 
        #9b7631 100%);
    border-radius: 16px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7), 
                inset 0 2px 4px rgba(255, 255, 255, 0.7), 
                inset 0 -2px 4px rgba(0, 0, 0, 0.8);
    width: 100%;
    cursor: pointer;
    border: none;
    text-align: left;
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
    min-width: 0;
    background-color: transparent;
}

.gallery-photo-frame::after {
    content: '';
    position: absolute;
    inset: 5px;
    border: 1px solid rgba(75, 48, 12, 0.5);
    border-radius: 12px;
    pointer-events: none;
}

.gallery-photo-frame:hover, 
.gallery-photo-frame:focus-visible {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 22px 45px rgba(0, 0, 0, 0.85), 0 0 25px rgba(201, 168, 76, 0.45);
    outline: none;
}

.gallery-matting {
    background: #0f0407;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.9);
    width: 100%;
    display: flex;
    flex-direction: column;
}

.gallery-img-container {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 5px;
    background: #180509;
    position: relative;
    display: block;
}

.gallery-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.gallery-photo-frame:hover .gallery-img-container img,
.gallery-photo-frame:focus-visible .gallery-img-container img {
    transform: scale(1.08);
}

.gallery-caption {
    padding: 0.75rem 0.25rem 0.25rem;
    color: var(--accent-light-gold);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.35;
    font-family: var(--font-exo);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.gallery-caption-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
}

.gallery-zoom-icon {
    width: 14px;
    height: 14px;
    fill: var(--accent-light-gold);
    opacity: 0.8;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.gallery-photo-frame:hover .gallery-zoom-icon {
    transform: scale(1.2);
    opacity: 1;
}

/* ==========================================================================
   5. NATIVE <dialog> MODAL (Zero-Jank Top Layer Compositing)
   ========================================================================== */
dialog.lightbox-dialog {
    border: none;
    background: transparent;
    padding: 0;
    max-width: 950px;
    width: calc(100% - 2rem);
    margin: auto;
    overflow: visible;
    position: fixed;
    inset: 0;
    box-sizing: border-box;
}

/* Top-layer native backdrop decoupled from DOM paint */
dialog.lightbox-dialog::backdrop {
    background: rgba(12, 3, 6, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.lightbox-dialog-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    transform: translateZ(0);
    will-change: transform, opacity;
    animation: modalPop 0.25s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.lightbox-close-btn {
    position: absolute;
    top: -55px;
    right: 0;
    background: rgba(20, 5, 10, 0.85);
    border: 2px solid var(--accent-light-gold);
    color: var(--accent-light-gold);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.lightbox-close-btn:hover,
.lightbox-close-btn:focus-visible {
    background: var(--accent);
    color: #ffffff;
    border-color: #ffffff;
    transform: rotate(90deg) scale(1.1);
    outline: none;
}

.lightbox-frame-wrap {
    position: relative;
    padding: 16px;
    background: linear-gradient(135deg, 
        #f9e1a8 0%, 
        #C9A96E 18%, 
        #8a6829 38%, 
        #fff1cb 50%, 
        #73541d 65%, 
        #E8C98C 85%, 
        #9b7631 100%);
    border-radius: 20px;
    box-shadow: 0 30px 65px rgba(0, 0, 0, 0.95), 
                0 0 35px rgba(201, 168, 76, 0.4),
                inset 0 2px 4px rgba(255, 255, 255, 0.7);
    width: 100%;
}

.lightbox-frame-wrap::after {
    content: '';
    position: absolute;
    inset: 7px;
    border: 1px solid rgba(75, 48, 12, 0.6);
    border-radius: 14px;
    pointer-events: none;
}

.lightbox-matting {
    background: #0d0205;
    padding: 10px;
    border-radius: 10px;
    box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.95);
    width: 100%;
}

.lightbox-img-holder {
    width: 100%;
    max-height: 70vh;
    overflow: hidden;
    border-radius: 6px;
    background: #180509;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img-holder img {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    display: block;
}

.lightbox-caption-box {
    margin-top: 1.25rem;
    text-align: center;
    color: #ffffff;
    width: 100%;
    padding: 0 1rem;
}

.lightbox-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--accent-light-gold);
    margin-bottom: 0.35rem;
}

.lightbox-subtext {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.75);
}

/* ==========================================================================
   6. FOOTER OVERRIDES
   ========================================================================== */
.site-footer {
    margin-top: 4rem;
}

/* ==========================================================================
   7. RESPONSIVE BREAKPOINTS (GALLERY GRID & MODAL)
   ========================================================================== */
@media (max-width: 1380px) {
    .gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.75rem;
    }
}

@media (max-width: 992px) {
    .card {
        padding: 35px 25px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 680px) {
    .card {
        padding: 25px 15px;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .lightbox-close-btn {
        top: -48px;
        width: 38px;
        height: 38px;
    }
}