/* =====================================================
   FDP-KACHELN
   FDP Anhalt-Bitterfeld

   Desktop: versetztes Raster (Anzahl → Spalten)
   Handy:   Wisch-Slider mit Fortschritt und Hand-Hinweis
===================================================== */

.fdp-tiles {
    --fdp-tiles-gap: 20px;
    --fdp-tiles-stagger: 48px;

    width: 100%;
    margin: 42px 0;
}

.fdp-tiles:first-child {
    margin-top: 0;
}

.fdp-tiles:last-child {
    margin-bottom: 0;
}

.fdp-tiles__notice {
    padding: 14px 16px;
    border: 2px dashed rgba(3, 45, 103, 0.25);
    border-radius: 9px;
    color: var(--fdp-blue);
    font-weight: 700;
}


/* =====================================================
   KACHEL
===================================================== */

.fdp-tiles__card {
    position: relative;

    display: block;
    overflow: hidden;

    aspect-ratio: 4 / 5;

    border-radius: 22px;

    background: #dfe3e7;
    color: var(--fdp-white);

    text-decoration: none;

    isolation: isolate;

    box-shadow:
        0 10px 30px
        rgba(3, 45, 103, 0.10);

    transition:
        box-shadow var(--transition),
        transform var(--transition);
}

.fdp-tiles__image {
    position: absolute;
    z-index: -2;
    inset: 0;

    display: block;
    width: 100%;
    height: 100%;
    max-width: none;

    object-fit: cover;

    transition: transform 500ms ease;
}

.fdp-tiles__overlay {
    position: absolute;
    z-index: -1;
    inset: 0;

    background:
        linear-gradient(
            to top,
            rgba(0, 24, 56, 0.78) 0%,
            rgba(0, 24, 56, 0.38) 38%,
            rgba(0, 24, 56, 0.04) 68%,
            transparent 100%
        );
}

.fdp-tiles__content {
    position: absolute;
    right: 22px;
    bottom: 22px;
    left: 22px;

    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.fdp-tiles__card-title {
    display: block;

    color: var(--fdp-white);

    font-family: var(--fdp-font);
    font-size: clamp(1.3rem, 1.9vw, 1.65rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;

    hyphens: auto;
    -webkit-hyphens: auto;
    overflow-wrap: break-word;
}

.fdp-tiles__more {
    display: inline-flex;
    align-items: center;
    gap: 9px;

    color: var(--fdp-white);

    font-family: var(--fdp-font);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
}

.fdp-tiles__more-icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: var(--fdp-cyan);

    transition: transform var(--transition);
}

.fdp-tiles__more-icon svg {
    width: 14px;
    height: 14px;

    fill: none;
    stroke: var(--fdp-white);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.6;
}

.fdp-tiles__card:focus-visible {
    outline: 3px solid var(--fdp-cyan);
    outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {

    .fdp-tiles__card:hover {
        box-shadow:
            0 16px 40px
            rgba(3, 45, 103, 0.18);
    }

    .fdp-tiles__card:hover .fdp-tiles__image {
        transform: scale(1.04);
    }

    .fdp-tiles__card:hover .fdp-tiles__more-icon {
        transform: translateX(3px);
    }
}


/* =====================================================
   HANDY: WISCH-SLIDER
===================================================== */

.fdp-tiles__grid {
    display: flex;
    gap: 14px;

    overflow-x: auto;
    overscroll-behavior-x: contain;

    scroll-snap-type: x mandatory;
    scrollbar-width: none;

    -webkit-overflow-scrolling: touch;
}

.fdp-tiles__grid::-webkit-scrollbar {
    display: none;
}

.fdp-tiles__card {
    flex: 0 0 82%;

    scroll-snap-align: start;
}

.fdp-tiles--count-1 .fdp-tiles__card {
    flex-basis: 100%;
}


/* Fortschritt + Hand */

.fdp-tiles__nav {
    position: relative;

    display: flex;
    height: 34px;
    align-items: center;
    justify-content: center;

    margin-top: 14px;
}

.fdp-tiles__progress {
    position: relative;

    display: block;
    width: 64px;
    height: 4px;
    overflow: hidden;

    border-radius: 999px;

    background: rgba(3, 45, 103, 0.14);
}

.fdp-tiles__progress-thumb {
    position: absolute;
    top: 0;
    left: 0;

    display: block;
    width: 40%;
    height: 100%;

    border-radius: inherit;

    background: var(--fdp-blue);

    transition: transform 120ms linear;
}

.fdp-tiles__hint {
    position: absolute;
    top: 50%;
    right: 4px;

    display: block;
    width: 30px;
    height: 30px;

    color: var(--fdp-blue);

    transform: translateY(-50%);

    transition: opacity 300ms ease;

    animation: fdp-tiles-swipe 1.6s ease-in-out 0.8s 3;
}

.fdp-tiles__hint svg {
    display: block;
    width: 100%;
    height: 100%;

    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.6;
}

.fdp-tiles__hint.is-hidden {
    opacity: 0;
}

@keyframes fdp-tiles-swipe {

    0%,
    100% {
        transform: translate(0, -50%) rotate(0deg);
    }

    50% {
        transform: translate(-22px, -50%) rotate(-12deg);
    }
}

@media (prefers-reduced-motion: reduce) {

    .fdp-tiles__hint {
        animation: none;
    }

    .fdp-tiles__image,
    .fdp-tiles__card {
        transition: none;
    }
}


/* =====================================================
   AB TABLET: VERSETZTES RASTER
===================================================== */

@media (min-width: 768px) {

    .fdp-tiles__grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--fdp-tiles-gap);

        overflow: visible;

        scroll-snap-type: none;
    }

    .fdp-tiles__card {
        flex: none;
    }

    .fdp-tiles__nav {
        display: none;
    }


    /* 1 Kachel: breit */

    .fdp-tiles--cols-1 .fdp-tiles__grid {
        grid-template-columns: 1fr;
    }

    .fdp-tiles--cols-1 .fdp-tiles__card {
        aspect-ratio: 16 / 8;
    }


    /* 2 oder 4 Kacheln: zwei Spalten, rechte Spalte tiefer */

    .fdp-tiles--cols-2 .fdp-tiles__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-bottom: var(--fdp-tiles-stagger);
    }

    .fdp-tiles--cols-2 .fdp-tiles__card {
        aspect-ratio: 1 / 1;
    }

    .fdp-tiles--cols-2 .fdp-tiles__card:nth-child(2n) {
        margin-top: var(--fdp-tiles-stagger);
        margin-bottom: calc(-1 * var(--fdp-tiles-stagger));
    }


    /* 3, 5, 6 … Kacheln: drei Spalten, Mitte höher */

    .fdp-tiles--cols-3 .fdp-tiles__grid {
        padding-top: var(--fdp-tiles-stagger);
    }

    .fdp-tiles--cols-3 .fdp-tiles__card:nth-child(3n + 2) {
        margin-top: calc(-1 * var(--fdp-tiles-stagger));
        margin-bottom: var(--fdp-tiles-stagger);
    }


    .fdp-tiles__content {
        right: 20px;
        bottom: 20px;
        left: 20px;
    }
}

@media (min-width: 1050px) {

    .fdp-tiles {
        --fdp-tiles-gap: 22px;
    }

    .fdp-tiles--cols-2 .fdp-tiles__card-title,
    .fdp-tiles--cols-1 .fdp-tiles__card-title {
        font-size: clamp(1.6rem, 2.2vw, 2.1rem);
    }
}
