/* ============================================================
   Grace Mission Church — Gallery & Lightbox Styles (gallery.html)
   ============================================================ */

/* --- Gallery --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-4);
}

.gallery-item {
    border-radius: var(--radius-card);
    overflow: hidden;
    border: 1px solid var(--border-delicate);
    cursor: pointer;
    transition: transform 0.25s ease;
}

.gallery-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent-gold);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(43, 35, 31, 0.92);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: var(--sp-6);
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 85vh;
    position: relative;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--radius-soft);
}

.lightbox-caption {
    color: var(--accent-gold-light);
    text-align: center;
    margin-top: var(--sp-4);
    font-size: 0.95rem;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: none;
    border: none;
    color: var(--bg-paper-light);
    font-size: 2rem;
    cursor: pointer;
    padding: var(--sp-3);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.lightbox-close {
    top: var(--sp-4);
    right: var(--sp-4);
}

.lightbox-prev {
    left: var(--sp-4);
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: var(--sp-4);
    top: 50%;
    transform: translateY(-50%);
}


/* --- Gallery Captions & Empty State --- */
.gallery-item-caption {
    padding: var(--sp-2) var(--sp-3);
    font-size: 0.825rem;
    color: var(--ink-muted);
    background: var(--bg-paper-light);
    text-align: center;
}

.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--ink-muted);
    padding: var(--sp-8) 0;
    font-style: italic;
}

.gallery-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* ============================================================
   Gallery & Lightbox System
   ============================================================ */
.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    justify-content: center;
    margin-bottom: var(--sp-7);
}

.gallery-filter-btn {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.55rem 1.25rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-delicate);
    background: var(--bg-paper-light);
    color: var(--ink-primary);
    cursor: pointer;
    transition: all 0.25s ease;
}

.gallery-filter-btn:hover {
    border-color: var(--accent-gold);
    color: var(--accent-mahogany);
    transform: translateY(-1px);
}

.gallery-filter-btn.active {
    background: var(--accent-mahogany);
    color: var(--bg-paper-light);
    border-color: var(--accent-mahogany);
    box-shadow: var(--shadow-btn);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: var(--sp-5);
}

.gallery-item {
    background: var(--bg-paper-light);
    border: 1px solid var(--border-delicate);
    border-radius: var(--radius-card);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--accent-gold);
}

.gallery-img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: rgba(43, 35, 31, 0.04);
}

.gallery-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-item:hover .gallery-thumbnail {
    transform: scale(1.05);
}

.gallery-item-body {
    padding: var(--sp-4);
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    flex: 1;
}

.gallery-item-category {
    font-size: 0.725rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-gold);
}

.gallery-item-caption {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent-mahogany);
    line-height: 1.35;
    margin: 0;
}

.gallery-item-alt {
    font-size: 0.825rem;
    color: var(--ink-muted);
    line-height: 1.45;
    margin-top: var(--sp-1);
}

/* --- Lightbox --- */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(18, 14, 12, 0.94);
    z-index: 10000;
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    padding: var(--sp-5);
}

.lightbox.lightbox-active {
    display: flex;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 72vh;
    object-fit: contain;
    border-radius: var(--radius-soft);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
    color: var(--bg-paper-light);
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-top: var(--sp-3);
    max-width: 700px;
}

.lightbox-alt {
    color: rgba(255, 253, 247, 0.75);
    font-family: var(--font-body);
    font-size: 0.85rem;
    margin-top: 0.35rem;
    max-width: 700px;
    line-height: 1.4;
}

.lightbox-counter {
    color: var(--accent-gold);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 0.35rem;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(43, 35, 31, 0.6);
    color: var(--bg-paper-light);
    border: 1px solid rgba(197, 160, 89, 0.4);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10001;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: var(--accent-mahogany);
    border-color: var(--accent-gold);
    transform: scale(1.1);
}

.lightbox-close {
    top: var(--sp-5);
    right: var(--sp-5);
    font-size: 1.75rem;
}

.lightbox-prev {
    left: var(--sp-5);
}

.lightbox-next {
    right: var(--sp-5);
}

@media (max-width: 768px) {
    .lightbox-prev {
        left: var(--sp-2);
        width: 40px;
        height: 40px;
    }

    .lightbox-next {
        right: var(--sp-2);
        width: 40px;
        height: 40px;
    }

    .lightbox-close {
        top: var(--sp-2);
        right: var(--sp-2);
        width: 40px;
        height: 40px;
    }
}

/* --- Gallery Card Share Header & Button --- */
.gallery-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-2);
}

.gallery-card-share-btn {
    background: transparent;
    border: 1px solid var(--border-delicate);
    border-radius: var(--radius-pill);
    color: var(--ink-muted);
    font-family: var(--font-body);
    font-size: 0.725rem;
    font-weight: 500;
    padding: 0.2rem 0.55rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    line-height: 1;
}

.gallery-card-share-btn:hover {
    border-color: var(--accent-gold);
    color: var(--accent-mahogany);
    background: var(--bg-parchment);
}

/* --- Lightbox Share Panel --- */
.lightbox-share-panel {
    margin-top: var(--sp-3);
    padding: var(--sp-2) var(--sp-4);
    background: rgba(30, 24, 20, 0.85);
    border: 1px solid rgba(197, 160, 89, 0.35);
    border-radius: var(--radius-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
    width: 100%;
    max-width: 620px;
    box-sizing: border-box;
}

.lightbox-share-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent-gold);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.lightbox-share-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
}

.lightbox-share-btn {
    padding: 0.35rem 0.75rem;
    border: 1px solid rgba(255, 253, 247, 0.25);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.08);
    color: var(--bg-paper-light);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 32px;
}

.lightbox-share-btn:hover {
    background: rgba(197, 160, 89, 0.25);
    border-color: var(--accent-gold);
    color: #fff;
    transform: translateY(-1px);
}

.lightbox-share-btn.share-native {
    background: var(--accent-gold);
    color: #1a1512;
    font-weight: 600;
    border-color: var(--accent-gold);
}

.lightbox-share-btn.share-native:hover {
    background: #d8b264;
}

.lightbox-share-feedback {
    min-height: 1.2em;
    color: var(--accent-gold);
    font-size: 0.75rem;
    font-weight: 500;
}
