/**
 * Gallery plugin - public styles.
 * Everything is scoped under "gtl-" classes so the theme layout is untouched.
 *
 * Colors come from the settings page as CSS variables:
 *   --gtl-primary   main color   (default #3d94f0)
 *   --gtl-accent    button/dates (default #3daf6b)
 *   --gtl-base      text color   (default #ffffff)
 */

.gtl-home,
.gtl-home *,
.gtl-all,
.gtl-all *,
.gtl-single,
.gtl-single *,
.gtl-lb,
.gtl-lb * {
        box-sizing: border-box;
}

/* ============ [gallery_home] - Homepage ============ */

/*
 * Normal in-flow section: it always fits inside whatever container the
 * theme gives it, so the left and right cards can never be clipped.
 */
.gtl-home {
        position: relative;
        width: 100%;
        background: var(--gtl-primary, #3d94f0);
        padding: 56px 20px 64px;
        font-family: inherit;
}

.gtl-home-bg {
        position: absolute;
        inset: 0;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        pointer-events: none;
}

.gtl-home-inner {
        position: relative;
        width: 100%;
        max-width: 1140px;
        margin: 0 auto;
}

.gtl-home-title {
        color: var(--gtl-base, #ffffff);
        text-align: center;
        font-size: clamp(24px, 3.4vw, 34px);
        font-weight: 800;
        letter-spacing: 0.01em;
        margin: 0 0 36px;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/*
 * minmax(0, 1fr) lets every column shrink below its content width, so the
 * three columns always share the available space exactly - no overflow,
 * no half-hidden cards on the left or right edge.
 */
.gtl-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 24px;
}

.gtl-card {
        position: relative;
        display: block;
        min-width: 0;
        aspect-ratio: 4 / 3;
        border-radius: 10px;
        overflow: hidden;
        box-shadow: 0 4px 16px rgba(15, 23, 42, 0.18);
        transform: translateY(0);
        transition: transform 0.35s ease, box-shadow 0.35s ease;
        text-decoration: none;
}

.gtl-card:hover,
.gtl-card:focus-visible {
        transform: translateY(-5px);
        box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28), 0 0 0 2px var(--gtl-accent, #3daf6b);
}

.gtl-card-img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        object-fit: cover;
        display: block;
        transition: transform 0.6s ease;
}

.gtl-card:hover .gtl-card-img {
        transform: scale(1.06);
}

.gtl-card-img-placeholder {
        background: linear-gradient(135deg, rgba(var(--gtl-base-rgb, 255, 255, 255), 0.35), rgba(var(--gtl-base-rgb, 255, 255, 255), 0.08));
}

.gtl-card-fade {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        display: block;
        padding: 48px 14px 12px;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.82) 78%);
}

.gtl-card-date {
        display: block;
        color: var(--gtl-accent-soft, #7cc99d);
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
}

.gtl-card-title {
        display: block;
        color: var(--gtl-base, #ffffff);
        font-size: 14px;
        font-weight: 700;
        line-height: 1.35;
        margin-top: 3px;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.gtl-btn-row {
        text-align: center;
        margin-top: 40px;
}

.gtl-btn {
        display: inline-block;
        background: var(--gtl-accent, #3daf6b);
        color: var(--gtl-base, #ffffff);
        font-size: 16px;
        font-weight: 800;
        padding: 14px 34px;
        border-radius: 8px;
        border: none;
        cursor: pointer;
        text-decoration: none !important;
        box-shadow: 0 4px 14px rgba(15, 23, 42, 0.22);
        transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.gtl-btn:hover,
.gtl-btn:focus-visible {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.3);
        color: var(--gtl-base, #ffffff);
        text-decoration: none !important;
}

.gtl-btn-small {
        font-size: 14px;
        padding: 11px 26px;
}

.gtl-empty {
        color: var(--gtl-base, #ffffff);
        text-align: center;
        background: rgba(0, 0, 0, 0.25);
        border-radius: 10px;
        padding: 18px 22px;
        font-size: 15px;
}

/* ============ [gallery_all] / [gallery_category] - White blocks ============ */

.gtl-all {
        width: 100%;
        max-width: 1240px;
        margin: 0 auto;
        padding: 40px 16px 56px;
}

.gtl-block {
        background: #ffffff;
        border: 1px solid #e9eef3;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 6px 24px rgba(15, 23, 42, 0.08);
        margin-bottom: 34px;
}

.gtl-block-head {
        background: linear-gradient(120deg, var(--gtl-primary, #3d94f0) 0%, var(--gtl-primary-dark, #2b6cb4) 55%, var(--gtl-primary-darker, #1f4d85) 100%);
        padding: 24px 24px 20px;
        text-align: center;
}

.gtl-block-title {
        color: var(--gtl-base, #ffffff);
        font-size: 21px;
        font-weight: 800;
        margin: 0 0 4px;
        line-height: 1.3;
}

.gtl-block-date {
        color: var(--gtl-accent-soft, #7cc99d);
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
}

.gtl-block-empty {
        color: #64748b;
        padding: 18px 24px;
        margin: 0;
}

.gtl-wall {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 10px;
        padding: 14px;
}

.gtl-photo {
        display: block;
        width: 100%;
        min-width: 0;
        padding: 0;
        margin: 0;
        border: none;
        background: none;
        cursor: pointer;
        border-radius: 6px;
        overflow: hidden;
        position: relative;
        aspect-ratio: 4 / 3;
}

.gtl-photo img {
        display: block;
        width: 100%;
        height: 100%;
        max-width: 100%;
        object-fit: cover;
        transition: transform 0.4s ease, opacity 0.4s ease;
}

.gtl-photo:hover img,
.gtl-photo:focus-visible img {
        transform: scale(1.05);
}

.gtl-pagination {
        text-align: center;
        margin-top: 8px;
        font-size: 15px;
}

.gtl-pagination .page-numbers {
        display: inline-block;
        padding: 6px 12px;
        margin: 0 2px;
        border-radius: 6px;
        background: #ffffff;
        color: #1f2430;
        text-decoration: none !important;
        border: 1px solid #e2e8f0;
}

.gtl-pagination .page-numbers.current {
        background: var(--gtl-primary, #3d94f0);
        color: var(--gtl-base, #ffffff);
        border-color: var(--gtl-primary, #3d94f0);
}

/* ============ Single event page ============ */

.gtl-single {
        width: 100%;
        max-width: 1240px;
        margin: 0 auto;
        padding: 36px 16px 56px;
}

.gtl-single-head {
        background: linear-gradient(120deg, var(--gtl-primary, #3d94f0) 0%, var(--gtl-primary-dark, #2b6cb4) 55%, var(--gtl-primary-darker, #1f4d85) 100%);
        border-radius: 12px;
        padding: 34px 24px 28px;
        text-align: center;
        margin-bottom: 22px;
}

.gtl-single-title {
        color: var(--gtl-base, #ffffff);
        font-size: 26px;
        font-weight: 800;
        margin: 0 0 6px;
        line-height: 1.3;
}

.gtl-single-date {
        color: var(--gtl-accent-soft, #7cc99d);
        font-size: 13px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
}

.gtl-single-back {
        text-align: center;
        margin-top: 30px;
}

/* ============ Responsive grids ============ */

@media (max-width: 1000px) {
        .gtl-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
        }
        .gtl-wall {
                grid-template-columns: repeat(4, minmax(0, 1fr));
        }
}

@media (max-width: 680px) {
        .gtl-grid {
                grid-template-columns: minmax(0, 1fr);
        }
        .gtl-wall {
                grid-template-columns: repeat(3, minmax(0, 1fr));
                gap: 8px;
        }
        .gtl-home {
                padding: 40px 14px 48px;
        }
}

@media (max-width: 440px) {
        .gtl-wall {
                grid-template-columns: repeat(2, minmax(0, 1fr));
        }
}

/* ============ Lightbox (stop 3) ============ */

.gtl-lb {
        position: fixed;
        inset: 0;
        z-index: 999999;
        display: none;
        font-family: inherit;
}

.gtl-lb.open {
        display: block;
}

.gtl-lb-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(10, 13, 18, 0.93);
        animation: gtlFadeIn 0.25s ease both;
}

.gtl-lb-stage {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 76px 96px 56px;
        box-sizing: border-box;
}

.gtl-lb-img {
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        border-radius: 6px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
        animation: gtlZoomIn 0.3s ease both;
}

/* Event title and date: centered across the top of the lightbox. */
.gtl-lb-meta {
        position: absolute;
        top: 20px;
        left: 70px;
        right: 70px;
        text-align: center;
        pointer-events: none;
}

.gtl-lb-title {
        color: var(--gtl-base, #ffffff);
        font-size: 17px;
        font-weight: 800;
        margin: 0;
        line-height: 1.35;
}

.gtl-lb-date {
        display: block;
        color: var(--gtl-accent-soft, #7cc99d);
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        margin-top: 4px;
}

.gtl-lb-counter {
        position: absolute;
        top: 24px;
        right: 64px;
        color: rgba(255, 255, 255, 0.85);
        font-size: 13px;
        font-weight: 700;
}

.gtl-lb-btn {
        position: absolute;
        width: 46px;
        height: 46px;
        border-radius: 50%;
        border: none;
        background: rgba(255, 255, 255, 0.14);
        color: #ffffff;
        font-size: 24px;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background 0.25s ease, transform 0.25s ease;
        padding: 0;
}

.gtl-lb-btn:hover,
.gtl-lb-btn:focus-visible {
        background: rgba(255, 255, 255, 0.28);
        transform: scale(1.06);
}

.gtl-lb-close {
        top: 16px;
        right: 16px;
        font-size: 20px;
}

.gtl-lb-prev {
        left: 18px;
        top: 50%;
        transform: translateY(-50%);
}

.gtl-lb-next {
        right: 18px;
        top: 50%;
        transform: translateY(-50%);
}

.gtl-lb-prev:hover,
.gtl-lb-prev:focus-visible {
        transform: translateY(-50%) scale(1.06);
}

.gtl-lb-next:hover,
.gtl-lb-next:focus-visible {
        transform: translateY(-50%) scale(1.06);
}

.gtl-lb-loading {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 40px;
        height: 40px;
        margin: -20px 0 0 -20px;
        border: 3px solid rgba(255, 255, 255, 0.25);
        border-top-color: var(--gtl-accent, #3daf6b);
        border-radius: 50%;
        animation: gtlSpin 0.8s linear infinite;
        opacity: 0;
        pointer-events: none;
}

.gtl-lb.is-loading .gtl-lb-loading {
        opacity: 1;
}

@keyframes gtlFadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
}

@keyframes gtlZoomIn {
        from { opacity: 0; transform: scale(0.94); }
        to { opacity: 1; transform: scale(1); }
}

@keyframes gtlSpin {
        to { transform: rotate(360deg); }
}

body.gtl-lb-open {
        overflow: hidden !important;
}
