/* =============================================
   Gallery Block — taubenloft/gallery
   Figma 1:2584 (1920×852)
   Universal card model: image OR text OR both (text overlay on image).
   ─────────────────────────────────────────────
   Section bg:    #EAEBE6
   Padding:       96 / 240 / 96 / 240
   Grid:          4×2, 342×320 per card, gap 24
   Text:          24/28.8 weight 500, color depends on bg
   ============================================= */

.tl-gallery {
    background: #eaebe6;
    color: #333a42;
    font-family: 'Nunito Sans', 'Nunito Sans Fallback', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    padding: 96px 24px;
}
.tl-gallery__container {
    max-width: 1200px;
    margin: 0 auto;
}
.tl-gallery__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* ── Card base — colors come from inline CSS vars (--card-bg, --card-text) ─ */
.tl-gallery__card {
    aspect-ratio: 282 / 320;        /* Figma 2026-05 desktop: card 282×320 */
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 32px;
    text-align: center;
    box-sizing: border-box;
    background: var(--card-bg, #787d84);
    color: var(--card-text, #eaebe6);
}
/* ANY card with an image: the photo is the background, card itself is transparent.
   Tint overlay (when text+image present) is drawn by ::before below. */
.tl-gallery__card--has-image {
    background: transparent;
}
.tl-gallery__card--has-image:not(.tl-gallery__card--has-text):not(.tl-gallery__card--has-cta) {
    padding: 0;       /* pure photo card — no inner padding */
}

/* ── Photo (background fill) ────────────────────── */
.tl-gallery__photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    z-index: 0;
}

/* Universal overlay: any image card draws bg color as tint over the photo.
   Alpha channel controls overlay strength (set alpha=0 for pure-photo card,
   alpha=1 for solid color hiding photo, anything in between = tinted photo).
   --card-bg is set inline from PHP via ACF color_picker with enable_opacity. */
.tl-gallery__card--has-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--card-bg, transparent);
    z-index: 1;
    pointer-events: none;
}

/* ── Content (text + CTA) ───────────────────────── */
.tl-gallery__content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}
.tl-gallery__text {
    margin: 0;
    font-size: 24px;
    line-height: 28.8px;
    font-weight: 600;             /* Figma 2026-05 verified: SemiBold 600 */
    letter-spacing: 0;
    color: inherit;
}

/* Text-as-link variant — text_url filled → text gets arrow ↗ icon + link styling */
.tl-gallery__text--link {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    color: inherit !important;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s;
}
.tl-gallery__text--link:hover,
.tl-gallery__text--link:focus {
    opacity: 0.85;
    color: inherit !important;
    text-decoration: none;
}
.tl-gallery__text--link > span {
    display: inline;
}
.tl-gallery__text--link svg {
    flex: 0 0 auto;
    align-self: center;
    width: 20px;
    height: 20px;
    transition: transform 0.25s ease-out;
}
.tl-gallery__text--link:hover svg,
.tl-gallery__text--link:focus svg {
    transform: translate(3px, -3px);
}

/* CTA link inside content */
.tl-gallery__cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: inherit !important;
    font-size: 14px;
    line-height: 19.6px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 6px;
    text-decoration-thickness: 1px;
    transition: opacity 0.2s;
}
.tl-gallery__cta:hover,
.tl-gallery__cta:focus { opacity: 0.7; color: inherit !important; }
.tl-gallery__cta svg {
    display: block;
    transition: transform 0.25s ease-out;
}
.tl-gallery__cta:hover svg,
.tl-gallery__cta:focus svg {
    transform: translate(2px, -2px);
}

/* ── Play button overlay (video cards) ──────────────
   Figma 2026-05: glassmorphism — white 10% fill + #EAEBE6 border + blur + inner shadow.
   NOT solid white. */
.tl-gallery__play {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);             /* Figma: white fill opacity 0.1 */
    border: 0.5px solid #eaebe6;                       /* Figma 2026-05: stroke #EAEBE6 weight 0.5 */
    backdrop-filter: blur(12px);                       /* Figma 2026-05 verified: BACKGROUND_BLUR radius=12 */
    -webkit-backdrop-filter: blur(12px);
    box-shadow: inset 0 4px 8px rgba(160, 160, 160, 0.5);  /* Figma 2026-05: INNER_SHADOW alpha 0.5 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    pointer-events: none;
}
.tl-gallery__play svg {
    width: 28px;
    height: 28px;
    margin-left: 4px;
    color: #ececed;                                    /* Figma 2026-05 verified: triangle fill #ECECED */
}

/* Clickable card variant — applies to video cards AND text-CTA cards */
.tl-gallery__card--linked {
    cursor: pointer;
    text-decoration: none;
    color: var(--card-text, #eaebe6);    /* keep per-card text color (not browser default link blue) */
}
.tl-gallery__card--linked:hover,
.tl-gallery__card--linked:focus {
    color: var(--card-text, #eaebe6);
    text-decoration: none;
}
.tl-gallery__card--linked:hover .tl-gallery__play,
.tl-gallery__card--linked:focus .tl-gallery__play {
    transform: translate(-50%, -50%) scale(1.08);
    transition: transform 0.25s ease;
}
/* Hovering anywhere on a linked card nudges its CTA arrow */
.tl-gallery__card--linked:hover .tl-gallery__cta svg,
.tl-gallery__card--linked:focus .tl-gallery__cta svg {
    transform: translate(2px, -2px);
}

/* ── Laptop ≤1440 ─────────────────────────────────── */
@media (max-width: 1440px) {
    ; }
}

/* ── Tablet ≤1024 ─────────────────────────────────── */
/* ── Tablet (1100-1024 → 3 cols, ≤1024 → 2 cols) ─── */
@media (max-width: 1200px) and (min-width: 1025px) {
    .tl-gallery__grid { grid-template-columns: repeat(3, 1fr); }   /* avoid 4-col text overflow */
}
@media (max-width: 1024px) {
    .tl-gallery { padding: 64px 32px; }
    .tl-gallery__grid { grid-template-columns: repeat(2, 1fr); }
    .tl-gallery__text { font-size: 20px; line-height: 24px; }
}

/* ── Modal (video popup) ────────────────────────── */
.tl-gallery__modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 32px;
    opacity: 0;
    transition: opacity 0.18s ease;
}
.tl-gallery__modal[aria-hidden="false"] {
    display: flex;
    opacity: 1;
}
.tl-gallery__modal-close {
    position: absolute;
    top: 16px;
    right: 24px;
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: opacity 0.15s;
}
.tl-gallery__modal-close:hover,
.tl-gallery__modal-close:focus { opacity: 0.7; }
.tl-gallery__modal-frame {
    width: 100%;
    max-width: 1280px;
    aspect-ratio: 16 / 9;
    position: relative;
    background: #000;
}
.tl-gallery__modal-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
body.tl-gallery-modal-open {
    overflow: hidden;
}

/* ── Mobile ≤767 — keep 2 cols until ≤480 to fill viewport ─── */
@media (max-width: 767px) {
    .tl-gallery { padding: 48px 16px; }
    .tl-gallery__grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }   /* 2 cols on tablet portrait */
    .tl-gallery__card {
        aspect-ratio: 408 / 320;       /* Figma mobile: card 408×320 (wider than tall) */
        padding: 24px 48px;             /* Figma mobile padding: 24/48 */
    }
    .tl-gallery__text {
        font-size: 24px;                /* Figma mobile 2026-05: 24/28.8 SemiBold (was 20/24) */
        line-height: 28.8px;
        font-weight: 600;
    }
}

/* ── Narrow mobile ≤600 — shrink text so long DE words fit in 2-col cards ── */
@media (max-width: 600px) {
    .tl-gallery__text {
        font-size: 16px;
        line-height: 22px;
    }
    .tl-gallery__cta {
        font-size: 13px;
        line-height: 18px;
    }
    .tl-gallery__card { padding: 16px 20px; }
}

/* ── Narrow mobile ≤480 — collapse to 1 col ─────────── */
@media (max-width: 480px) {
    .tl-gallery__grid { grid-template-columns: 1fr; gap: 24px; }
    .tl-gallery__text { font-size: 24px; line-height: 28.8px; }   /* restore desktop text size on full-width 1-col */
    .tl-gallery__card { padding: 24px 48px; }                      /* restore Figma mobile padding */
}
