/* KB Hero Teaser (slider interaction + indicator bars) */

/*
  Verlauf-Parameter (oben zentral):
  A) Vollflächiger Verlauf über das ganze Bild (.kb-hero-teaser__gradient)
  B) Verlauf IN der Content-Box (damit es unten nicht wie eine Fläche aussieht)
*/
.kb-hero-teaser {
    /* A) Background-Gradient über die komplette Slide */
    --kb-hero-grad-a0: 0.55;   /* unten (0%) */
    --kb-hero-grad-a1: 0.28;   /* mitte */
    --kb-hero-grad-a2: 0.00;   /* oben */
    --kb-hero-grad-p1: 45%;
    --kb-hero-grad-p2: 80%;

    /* B) Box-Gradient (ersetzt die bisherige "Fläche") */
    --kb-hero-box-a0: 0.72;    /* unten in der Box */
    --kb-hero-box-a1: 0.50;    /* mitte in der Box */
    --kb-hero-box-a2: 0.00;    /* oben in der Box */
    --kb-hero-box-p1: 55%;
    --kb-hero-box-p2: 100%;

    position: relative;
    width: 100%;
    margin-top: 0 !important;
    margin-block-start: 0 !important;
}

.kb-hero-teaser__viewport {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.kb-hero-teaser__track {
    display: flex;
    width: 100%;
    transform: translateX(0);
    transition: transform 420ms ease;
    will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
    .kb-hero-teaser__track {
        transition: none;
    }
}

.kb-hero-teaser__slide {
    position: relative;
    width: 100%;
    flex: 0 0 100%;

    aspect-ratio: 16 / 9;
    min-height: 280px;
    color: #fff;

    overflow: hidden; /* FIX: verhindert “Overlay läuft raus” */
}

.kb-hero-teaser__media {
    position: absolute;
    inset: 0;
    background-image: var(--kb-hero-img);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    z-index: 0; /* FIX: sauberes Layering */
}

.kb-hero-teaser__title a {
    color: inherit;
    text-decoration: none;
    text-underline-offset: 0;
}

.kb-hero-teaser__title a:hover,
.kb-hero-teaser__title a:focus-visible {
    text-decoration: none;
}


.kb-hero-teaser__gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(
            to top,
            rgba(0, 0, 0, var(--kb-hero-grad-a0)) 0%,
            rgba(0, 0, 0, var(--kb-hero-grad-a1)) var(--kb-hero-grad-p1),
            rgba(0, 0, 0, var(--kb-hero-grad-a2)) var(--kb-hero-grad-p2)
    );

    z-index: 1;            /* FIX: unter Content */
    pointer-events: none;  /* FIX: nix blockieren */
}

.kb-hero-teaser__content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;

    padding: 26px 20px;

    display: grid;
    gap: 10px;

    z-index: 2;

    isolation: isolate; /* FIX: ::before bleibt zuverlässig “hinter” dem Content */
}

.kb-hero-teaser__content::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
            to top,
            rgba(0, 0, 0, var(--kb-hero-box-a0)) 0%,
            rgba(0, 0, 0, var(--kb-hero-box-a1)) var(--kb-hero-box-p1),
            rgba(0, 0, 0, var(--kb-hero-box-a2)) var(--kb-hero-box-p2)
    );
    z-index: -1;

    pointer-events: none; /* FIX */
}

/* Specials chip (top-left) */
.kb-hero-teaser__specials {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 3;
}

.kb-hero-teaser__special-chip {
    display: inline-block;
    border-radius: 6px;

    /* "wie gehabt": dunkler Chip mit leichtem Schatten */
    background: rgba(0, 0, 0, 0.48);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);

    padding: 8px 16px;

    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* ... rest remains unchanged ... */

.kb-hero-teaser__meta {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.02em;
    opacity: 0.92;
}

/* Kategorien als “Badge” */
.kb-hero-teaser__category {
    display: inline-block;
    background: #f07407;
    color: #ffffff;
    padding: 2px 8px 2px 8px;
    border-radius: 2px;
    line-height: 1.2;
}

.kb-hero-teaser__title {
    margin: 0;
    line-height: 1.05;
}

.kb-hero-teaser__desc {
    margin: 0;
    max-width: 70ch;
    opacity: 0.95;

    /* Teaser begrenzen (falls länger, nicht alles anzeigen) */
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

/* Short-Teaser: niemals clampen (Desktop/Tablet) */
.kb-hero-teaser__desc--full {
    overflow: visible !important;
    display: block !important;
    -webkit-box-orient: initial !important;
    -webkit-line-clamp: initial !important;
    max-height: none !important;
}

.kb-hero-teaser__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;

    /* Default Primary aus dem Theme */
    --kb-accent: #810D01;
    --kb-accent-rgb: 129 13 1;

    /*
      Optionaler Film-Akzent (kommt nur noch, wenn PHP ihn als gültig gesetzt hat):
      - --kb-film-accent: #RRGGBB
      - --kb-film-accent-rgb: "R G B"
    */
    --kb-active-accent: var(--kb-film-accent, var(--kb-accent));
    --kb-active-accent-rgb: var(--kb-film-accent-rgb, var(--kb-accent-rgb));
}

.kb-hero-teaser__btn {
    appearance: none;
    border: 0;
    text-decoration: none;
    cursor: pointer;

    /* Variante B: globaler Radius aus theme.json (mit Fallback) */
    border-radius: var(--wp--custom--kb--button-radius, 8px);

    padding: 10px 12px;
    font: inherit;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    transition: background-color 160ms ease, filter 160ms ease;
}

.kb-hero-teaser__btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.80);
    outline-offset: 2px;
}

/* PRIMARY: Details & Tickets */
.kb-hero-teaser__btn--primary {
    background: var(--kb-active-accent);
    color: #fff;
}

/* Primary Hover: 70% Opacity (funktioniert auch mit Film-Akzent) */
.kb-hero-teaser__btn--primary:hover {
    background-color: rgba(var(--kb-active-accent-rgb) / 0.70);
}

/* Primary Focus: dezent aber klar */
.kb-hero-teaser__btn--primary:focus-visible {
    box-shadow: 0 0 0 3px rgba(var(--kb-active-accent-rgb) / 0.35);
}

/* SECONDARY: Trailer ansehen */
.kb-hero-teaser__btn--secondary {
    background: rgba(255, 255, 255, 0.30);
    color: #fff;
}

.kb-hero-teaser__btn--secondary:hover {
    background: rgba(255, 255, 255, 0.50);
}

.kb-hero-teaser__btn--secondary:focus-visible {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25);
}

.kb-hero-teaser__btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Indicator UI */
.kb-hero-teaser__ui {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 10px;
    z-index: 3;
    pointer-events: none;
}

.kb-hero-teaser__indicator {
    display: grid;
    justify-items: center;
}

.kb-hero-teaser__dots {
    display: flex;
    gap: 8px;
    pointer-events: auto;
}

.kb-hero-teaser__dot {
    width: 20px; /* inactive */
    height: 3px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
    padding: 0;
    cursor: pointer;
    transition: width 200ms ease, background-color 200ms ease;
}

.kb-hero-teaser__dot.is-active {
    width: 40px; /* active */
    background: rgba(255, 255, 255, 0.9);
}

@media (prefers-reduced-motion: reduce) {
    .kb-hero-teaser__dot {
        transition: none;
    }
}

/* Arrows (only on hover) */
.kb-hero-teaser__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);

    width: 44px;
    height: 44px;

    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;

    display: grid;
    place-items: center;

    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;

    z-index: 4;
}

.kb-hero-teaser__arrow .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
}

.kb-hero-teaser__arrow--prev {
    left: 12px;
}

.kb-hero-teaser__arrow--next {
    right: 12px;
}

.kb-hero-teaser__viewport:hover .kb-hero-teaser__arrow {
    opacity: 1;
    pointer-events: auto;
}

.kb-hero-teaser__arrow:focus-visible {
    opacity: 1;
    pointer-events: auto;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Trailer Modal */
.kb-hero-teaser__modal[hidden] {
    display: none;
}

.kb-hero-teaser__modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.kb-hero-teaser__modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}

.kb-hero-teaser__modal-dialog {
    position: relative;
    max-width: 980px;
    width: min(980px, calc(100% - 32px));
    margin: 5vh auto 0 auto;

    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
}

.kb-hero-teaser__modal-head {
    padding: 14px 16px 10px 16px;
    background: #000;
}

.kb-hero-teaser__modal-title {
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.92);
}

.kb-hero-teaser__modal-video {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
}

.kb-hero-teaser__modal-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.kb-hero-teaser__modal-foot {
    padding: 12px 16px 16px 16px;
    background: #000;
}

.kb-hero-teaser__modal-close-link {
    color: rgba(255, 255, 255, 0.88);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.kb-hero-teaser__modal-close-link:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

/* Responsive: Mobile reduces to title + buttons */
@media (max-width: 767px) {
    .kb-hero-teaser__slide {
        min-height: 240px;
    }

    /* Teasertext IMMER ausblenden auf Mobile (auch short teaser) */
    .kb-hero-teaser__desc,
    .kb-hero-teaser__desc--full {
        display: none !important;
    }

    /* WICHTIG: Meta NICHT ausblenden (war vorher: display:none) */
    .kb-hero-teaser__meta {
        display: block;
    }

    .kb-hero-teaser__arrow {
        display: none;
    }

    .kb-hero-teaser__modal-dialog {
        margin-top: 10vh;
        width: calc(100% - 20px);
    }
}

/* Desktop-only rule for the meta line */
@media (min-width: 1024px) {
    .kb-hero-teaser__meta {
        display: block;
    }
}
