/**
 * Certified Pre-Owned Watches (CMS pages 11 de / 12 en, identifier "preowned-watches", layout "Page -- Full Width").
 * Loaded only via Magento_Cms/layout/cms_page_view_id_preowned-watches.xml, after the shared kz-brand.css.
 * Same look as the Partnerringe and Atelier pages; the black-and-white photos are this page's own touch.
 *
 * Content is native Page Builder. Styling hooks are the row CSS classes set in Page Builder
 * (full-bleed rows: on the row, contained rows: on its inner element):
 * kz-cpo + kz-cpo-split (text + photo rows: kz-cpo-opener, kz-cpo-closing) | kz-cpo-promise | kz-cpo-band kz-cpo-brands,
 * column class kz-cpo-photo (column background image = photo), text classes kz-cpo-kicker, kz-cpo-lead.
 * Ivory and #111 are row background colours set in Page Builder; gold only for kicker lines and the brand separators.
 * Phones: the photo stays at the top of the screen and the ivory text slides up over it (sticky).
 * Desktop: photo half width with CSS parallax. Both off for reduced motion.
 */

.kz-cpo {
    --kz-muted: #595959; /* secondary text on white and ivory, >= 6.5:1 */
    --kz-gold: #b39b5f;
    line-height: 1.7;

    & p {
        margin: 0 0 1rem;
        color: var(--kz-muted);
    }

    & p:last-child {
        margin-bottom: 0;
    }

    & h2 {
        margin: 0 0 1rem;
        font-size: clamp(1.75rem, 3vw, 2.5rem);
        font-weight: 400;
        line-height: 1.2;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        text-wrap: balance;
    }

    & h3 {
        margin: 0 0 0.75rem;
        font-size: 0.8125rem;
        font-weight: 600;
        letter-spacing: 0.15em;
        text-transform: uppercase;
    }

    & a:not([class*="pagebuilder-button"]) {
        color: #111;
        text-decoration: underline;
        text-underline-offset: 0.25em;
    }

    & [data-content-type="buttons"] {
        margin-top: 1.75rem;
    }
}

/* Small uppercase line above a heading */
.kz-cpo .kz-cpo-kicker p {
    margin-bottom: 1rem;
    color: #111;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.kz-cpo .kz-cpo-lead {
    margin-bottom: 1rem;
}

.kz-cpo .kz-cpo-lead p {
    color: #111;
    font-size: 1.125rem;
    line-height: 1.5;
}

/* ---- Text + photo rows (opener, closing) ---- */
.kz-cpo-split {
    & .kz-cpo-photo {
        order: -1;
        aspect-ratio: 4 / 5;
        background-color: #111;
        background-size: cover;
    }

    & .pagebuilder-column:not(.kz-cpo-photo) {
        padding: 2.5rem var(--kz-edge) 3rem;
    }

    & .kz-cpo-kicker::before {
        content: "";
        display: block;
        width: 3rem;
        height: 1px;
        margin-bottom: 1rem;
        background: var(--kz-gold);
    }
}

/* Photo crops (Page Builder sets "center center" inline, hence !important). The vertical position only on phones:
   on desktop the parallax animation moves it (an !important value would stop the animation). */
.kz-cpo-closing .kz-cpo-photo {
    background-position-x: 30% !important; /* face, tie and watch */
}

@media (max-width: 47.999rem) {
    .kz-cpo-opener .kz-cpo-photo {
        background-position-y: 62% !important; /* wrist and watch */
    }

    .kz-cpo-closing .kz-cpo-photo {
        background-position-y: 35% !important;
    }
}

/* Phones: the photo stays at the top of the screen while the ivory text block slides up over it.
   The header is not sticky on phones (kz-header.css), so top: 0. */
@media (max-width: 47.999rem) and (prefers-reduced-motion: no-preference) {
    .kz-cpo-split {
        & .kz-cpo-photo {
            position: sticky;
            top: 0;
            z-index: 0;
        }

        & .pagebuilder-column:not(.kz-cpo-photo) {
            position: relative;
            z-index: 1;
            background-color: #f6f3ed; /* the row's ivory, so the text block covers the photo */
        }
    }
}

/* ---- Promises: heading, three columns with a thin line on top ---- */
[data-content-type="row"][data-appearance="contained"]:has(> .kz-cpo-promise) {
    margin-block: 0;
    padding-block: 2.5rem;
}

.kz-cpo-promise {
    & .pagebuilder-column-line {
        gap: 2rem;
    }

    & .pagebuilder-column:not(:first-child) {
        padding-top: 1rem;
        border-top: 1px solid #e5e5e5;
    }

    & h2 {
        margin-bottom: 0;
    }
}

/* ---- Brands: dark band, names in one uppercase line with gold dots ---- */
.kz-cpo-band {
    padding: 3rem var(--kz-edge);
    color: #fff;

    & .pagebuilder-column-line {
        gap: 0.25rem;
    }

    & p {
        color: #c9c9c9;
    }

    & .kz-cpo-kicker p {
        color: var(--kz-gold);
    }
}

.kz-cpo-brands ul {
    display: flex;
    flex-wrap: wrap;
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.8125rem;
    line-height: 2;
    letter-spacing: 0.15em;
    text-transform: uppercase;

    & li:not(:last-child)::after {
        content: "·";
        margin-inline: 0.75em;
        color: var(--kz-gold);
    }
}

@media (min-width: 48rem) {
    .kz-cpo .kz-cpo-lead p {
        font-size: 1.375rem;
    }

    /* photo and text side by side, text column at the page edge; the photo fills the row height */
    .kz-cpo-split {
        & .kz-cpo-photo {
            order: 0;
            aspect-ratio: auto;
            min-height: 40rem;
        }

        & .pagebuilder-column:not(.kz-cpo-photo) {
            padding: 4rem 5rem 4rem var(--kz-edge);

            & > * {
                max-width: 32rem;
            }
        }
    }

    /* closing, mirrored: photo left, text right */
    .kz-cpo-closing .pagebuilder-column:not(.kz-cpo-photo) {
        padding: 4rem var(--kz-edge) 4rem 5rem;
    }

    [data-content-type="row"][data-appearance="contained"]:has(> .kz-cpo-promise) {
        padding-block: 4rem;
    }

    .kz-cpo-promise .pagebuilder-column-line {
        gap: 2.5rem;
    }

    .kz-cpo-band {
        padding-block: 4rem;

        & .pagebuilder-column-line {
            gap: 6rem;
        }
    }

    /* Parallax on desktop: the photos move slower than the page (CSS scroll timeline, no script) */
    @media (prefers-reduced-motion: no-preference) {
        @supports (animation-timeline: view()) {
            .kz-cpo-photo {
                animation: kz-cpo-parallax linear both;
                animation-timeline: view();
            }
        }
    }
}

@keyframes kz-cpo-parallax {
    from {
        background-position-y: 25%;
    }

    to {
        background-position-y: 75%;
    }
}
