/*
 * Tekst i zdjęcia - blok acf/acf-block-text-media.
 *
 * Kazdy wiersz to dwie kolumny: tekst i media. Strony zmieniaja sie naprzemiennie,
 * a przy tekscie po prawej cala kolumna jest wyrownana do prawej - stad klasy
 * .is-text-left / .is-text-right na wierszu.
 *
 * Kolaz dwoch zdjec stoi na proporcji calego bloku mediow (aspect-ratio) i procentach,
 * a nie na marginesach. Dzieki temu kompozycja skaluje sie identycznie na kazdej
 * szerokosci i nie trzeba jej poprawiac na kolejnych breakpointach.
 */

.text-media {
    padding: 90px 20px;
}

.text-media .text-media-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 90px;
    row-gap: 40px;
    align-items: center;
}

.text-media .text-media-row + .text-media-row {
    margin-top: 90px;
}

/* Tekst po prawej: kolumny zamieniaja sie miejscami, tekst laduje przy krawedzi. */

.text-media .text-media-row.is-text-right .text-media-text {
    order: 2;
    text-align: right;
}

.text-media .text-media-row.is-text-right .text-media-media {
    order: 1;
}

/* Wyrownanie kolumn w pionie - ustawienie calego bloku. */

.text-media.is-align-gora .text-media-row {
    align-items: start;
}

/* KOLUMNA TEKSTU */

.text-media .text-media-eyebrow {
    margin: 0 0 24px 0;
    font-family: "Figtree-Medium", sans-serif;
    font-size: 1.5rem;
    line-height: 1.4;
    color: var(--main-color-1, #122056);
}

/* Krotka kreska pod nadtytulem - przy tekscie do prawej przeskakuje na druga strone. */
.text-media .text-media-eyebrow::after {
    content: "";
    display: block;
    width: 52px;
    height: 2px;
    margin-top: 10px;
    background-color: var(--main-color-2, #c12030);
}

.text-media .text-media-row.is-text-right .text-media-eyebrow::after {
    margin-left: auto;
}

.text-media .text-media-title {
    margin: 0 0 26px 0;
    font-family: "Figtree-Medium", sans-serif;
    font-size: clamp(2.6rem, 2.8vw, 3.4rem);
    line-height: 1.35;
    font-weight: 500;
    color: var(--main-color-1, #122056);
}

.text-media .text-media-desc {
    font-size: 1.6rem;
    line-height: 1.8;
    color: #5c6784;
}

/*
 * Motyw zeruje marginesy akapitow globalnie (`figure, p, pre { margin: 0 }`) i narzuca
 * `p { font-size: 1.6rem; line-height: 2.8rem }`. Bez tego bloku kolejne akapity z
 * edytora sklejalyby sie w jedna plame - stad jawne odstepy i typografia na potomkach.
 */
.text-media .text-media-desc p,
.text-media .text-media-desc ul,
.text-media .text-media-desc ol {
    margin: 0 0 16px 0;
    font-size: 1.6rem;
    line-height: 1.8;
    color: inherit;
}

.text-media .text-media-desc > *:first-child {
    margin-top: 0;
}

.text-media .text-media-desc > *:last-child {
    margin-bottom: 0;
}

.text-media .text-media-link {
    display: inline-block;
    margin-top: 26px;
    font-family: "Figtree-Medium", sans-serif;
    font-size: 1.6rem;
    color: var(--main-color-2, #c12030);
    text-decoration: none;
    border-bottom: 1px solid currentColor;
    padding-bottom: 3px;
    transition: opacity 0.3s ease-in-out;
}

.text-media .text-media-link:hover {
    opacity: 0.7;
}

/* KOLUMNA MEDIOW */

.text-media .text-media-img {
    position: relative;
    margin: 0;
    overflow: hidden;
    background-color: #eef0f7;
}

/*
 * Kadr trzyma aspect-ratio, a zawartosc jest w nim rozpieta na inset: 0. Wysokosc
 * procentowa liczona wzgledem pudelka z aspect-ratio bywa zawodna, offsety - nie.
 */
.text-media .text-media-img img,
.text-media .text-media-img .text-media-placeholder {
    position: absolute;
    inset: 0;
}

.text-media .text-media-img img {
    display: block;
    object-fit: cover;
}

/* Jedno zdjecie - zwykly kadr poziomy. */
.text-media .text-media-media.has-one .text-media-img {
    aspect-ratio: 1.5 / 1;
}

/*
 * Kolaz: caly blok ma stala proporcje, a oba kadry sa w nim ustawione procentowo.
 * Wieksze zdjecie u gory, mniejsze - pionowe - nachodzi na nie od dolu.
 */
.text-media .text-media-media.has-two {
    position: relative;
    aspect-ratio: 1 / 0.95;
}

.text-media .text-media-media.has-two .text-media-img {
    position: absolute;
}

.text-media .text-media-media.has-two .text-media-img-1 {
    left: 0;
    top: 0;
    width: 60%;
    height: 57%;
}

.text-media .text-media-media.has-two .text-media-img-2 {
    right: 0;
    top: 33%;
    width: 50%;
    height: 67%;
}

/*
 * Gdy media stoja po prawej stronie wiersza, kolaz jest odbity - ciezar kompozycji
 * idzie na zewnatrz, w strone krawedzi strony, a nie w tekst.
 */
.text-media .text-media-row.is-text-left .text-media-media.has-two .text-media-img-1 {
    left: auto;
    right: 0;
}

.text-media .text-media-row.is-text-left .text-media-media.has-two .text-media-img-2 {
    right: auto;
    left: 0;
}

/* PLACEHOLDER */

.text-media .text-media-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: #eef0f7;
    border: 1px dashed #bcc4dc;
    color: #8b95b3;
    font-size: 1.3rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.text-media .text-media-placeholder svg {
    width: 34px;
    height: 34px;
}

/* RESPONSYWNOSC */

@media (max-width: 1024px) {
    .text-media {
        padding: 60px 20px;
    }

    .text-media .text-media-row {
        grid-template-columns: 1fr;
        row-gap: 36px;
    }

    /*
     * W jednej kolumnie zamiana stron traci sens, a tekst do prawej czyta sie gorzej -
     * wszystkie wiersze wracaja do ukladu tekst nad zdjeciami, wyrownanego do lewej.
     */
    .text-media .text-media-row.is-text-right .text-media-text {
        order: 1;
        text-align: left;
    }

    .text-media .text-media-row.is-text-right .text-media-media {
        order: 2;
    }

    .text-media .text-media-row.is-text-right .text-media-eyebrow::after {
        margin-left: 0;
    }

    .text-media .text-media-row + .text-media-row {
        margin-top: 60px;
    }
}

@media (max-width: 640px) {
    .text-media {
        padding: 45px 20px;
    }

    .text-media .text-media-eyebrow {
        margin-bottom: 18px;
    }

    .text-media .text-media-title {
        margin-bottom: 18px;
    }

    .text-media .text-media-desc {
        font-size: 1.5rem;
        line-height: 1.7;
    }

    .text-media .text-media-placeholder svg {
        width: 26px;
        height: 26px;
    }

    .text-media .text-media-placeholder span {
        font-size: 1.1rem;
    }
}

/* TRYB CIEMNY */

.dark .text-media .text-media-eyebrow,
.dark .text-media .text-media-title {
    color: #fff;
}

/* `.dark p` z motywu ma wyzsza specyficznosc niz dziedziczenie - stad potomkowie wprost. */
.dark .text-media .text-media-desc,
.dark .text-media .text-media-desc p,
.dark .text-media .text-media-desc li {
    color: #c3c8d8;
}

.dark .text-media .text-media-img,
.dark .text-media .text-media-placeholder {
    background-color: rgba(238, 239, 253, 0.08);
}

.dark .text-media .text-media-placeholder {
    border-color: rgba(255, 255, 255, 0.25);
    color: #9aa3bd;
}
