/* =========================================================================
 * Dealer Clean page (/clean/) — layout only.
 *
 * Loaded only on the clean page via dealer_clean_enqueue_assets().
 * The Telegram CTA uses the shared .btn-telegram variant from components.css;
 * this file only owns the page layout. No page JS.
 *
 * Source of truth: docs/systems/CLEAN-SYSTEM.md
 * ========================================================================= */

/* Strip Storefront's default article chrome (default page header removed in PHP). */
.dealer-clean-page article.page {
    border: 0;
    padding: 0;
}

.dealer-clean-page .entry-content {
    margin: 0;
}

/* -------------------------------------------------------------------------
 * Page shell — single centered column with section rhythm.
 * ------------------------------------------------------------------------- */

.dealer-clean {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding-block: 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.dealer-clean__heading {
    margin: 0 0 20px;
    color: var(--color-black);
    font-family: var(--font-family);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
}

/* -------------------------------------------------------------------------
 * Brand logo (page header).
 * ------------------------------------------------------------------------- */

.dealer-clean__brand {
    display: flex;
    justify-content: center;
}

.dealer-clean__logo {
    display: block;
    width: 170px;
    height: auto;
}

/* -------------------------------------------------------------------------
 * Before/after gallery — interactive comparison sliders.
 *
 * Each slot stacks the "до" photo (clipped, on top) over the "після" photo
 * (full, base); a draggable divider reveals the transition. Photos come from
 * the dealer_clean_before_after_images filter.
 *
 * Layout: mobile/tablet = horizontal scroll-snap carousel (one slide per view);
 * desktop (>=1024px) = static three-up grid. JS (clean.js) drives the divider.
 * ------------------------------------------------------------------------- */

.dealer-clean__gallery {
    width: 100%;
}

/* Carousel viewport — native horizontal scroll-snap on mobile/tablet. */
.dealer-clean__gallery-viewport {
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.dealer-clean__gallery-viewport::-webkit-scrollbar {
    display: none;
}

.dealer-clean__gallery-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 16px;
}

.dealer-clean__gallery-item {
    flex: 0 0 100%;
    max-width: 100%;
    margin: 0;
    scroll-snap-align: center;
}

/* --- Comparison slider ------------------------------------------------- */

.dealer-clean__ba {
    --ba-pos: 50;

    position: relative;
    width: 100%;
    aspect-ratio: 7 / 11;
    overflow: hidden;
    background: #e0e0e0;
    -webkit-user-select: none;
    user-select: none;
}

.dealer-clean__ba-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    pointer-events: none;
}

/* "Після" — full base layer. */
.dealer-clean__ba-img--after {
    z-index: 1;
}

/* "До" — clipped layer on top; reveals the base to the right of the divider. */
.dealer-clean__ba-img--before {
    z-index: 2;
    clip-path: inset(0 calc((100 - var(--ba-pos)) * 1%) 0 0);
}

/* Keyboard control — invisible, focusable; pointer handled by the handle. */
.dealer-clean__ba-range {
    position: absolute;
    inset: 0;
    z-index: 3;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
}

/* Visible draggable divider. Wider transparent grab zone, thin visible line. */
.dealer-clean__ba-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(var(--ba-pos) * 1%);
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    transform: translateX(-50%);
    cursor: ew-resize;
    touch-action: none;
}

.dealer-clean__ba-handle::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: var(--color-white);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.dealer-clean__ba-grip {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-white);
    color: var(--color-black);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.dealer-clean__ba:focus-within .dealer-clean__ba-handle::before {
    box-shadow: 0 0 0 2px var(--color-primary);
}

/* --- Carousel pagination dots (mobile/tablet) -------------------------- */
/* Same look as the single-product gallery dots; synced to scroll in clean.js.
 * Hidden on the desktop three-up grid (see the >=1024px block). */

.dealer-clean__gallery-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.dealer-clean__gallery-dot-button {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.dealer-clean__gallery-dot.is-active .dealer-clean__gallery-dot-button {
    background: var(--color-black);
}

/* -------------------------------------------------------------------------
 * Services + reasons — stacked on mobile/tablet, two columns on desktop.
 * ------------------------------------------------------------------------- */

.dealer-clean__cols {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
}

/* Services list: centered inline-wrap on small screens; the desktop rule
 * below switches it to a left-aligned vertical list. Bullets via ::before so
 * the layout works in both directions; underline applies to text only. */
.dealer-clean__services-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 20px;
}

.dealer-clean__services-list li {
    flex: 0 0 auto;
    color: var(--color-black);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.dealer-clean__services-list li::before {
    content: "\2022";
    display: inline-block;
    margin-right: 8px;
    text-decoration: none;
}

/* Reasons: bordered chips. One column on mobile, two columns (3 + 2) on
 * tablet and up via column-first auto-flow. */
.dealer-clean__why-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.dealer-clean__chip {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 20px 20px;
    border: 1px solid var(--color-primary);
    border-radius: 8px;
    background: var(--color-white);
    box-shadow: 0 4px 4px rgba(0, 0, 0, 0.10);
    color: var(--color-black);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    text-align: center;
}

/* Mobile (row-flow grid): the lone 5th chip fills the full row. */
.dealer-clean__chip:nth-child(5) {
    grid-column: 1 / -1;
}

/* -------------------------------------------------------------------------
 * Item categories — icon + label.
 * Mobile: 2×2 grid. Tablet and up: single wrapping row.
 * ------------------------------------------------------------------------- */

.dealer-clean__categories {
    width: 100%;
}

.dealer-clean__categories-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    justify-items: center;
    gap: 24px 16px;
}

.dealer-clean__category {
    flex: 0 0 auto;
    width: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.dealer-clean__category-img {
    display: block;
    height: 100px;
    width: auto;
}

.dealer-clean__category-label {
    color: var(--color-black);
    font-family: var(--font-family);
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-medium);
    line-height: 1.3;
}

/* -------------------------------------------------------------------------
 * Steps — "how it works": image + caption columns with arrow separators.
 * Single-row flow that scrolls on small screens; centered on desktop.
 * ------------------------------------------------------------------------- */

.dealer-clean__steps {
    width: 100%;
}

.dealer-clean__steps-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    align-items: flex-start;
    flex-wrap: nowrap;
    gap: 20px;
    justify-content: center;
    overflow-x: auto;
}

.dealer-clean__step {
    flex: 0 0 auto;
    width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.dealer-clean__step-img {
    display: block;
    height: 100px;
    width: auto;
}

.dealer-clean__step-caption {
    color: var(--color-black);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
}

.dealer-clean__step-arrow {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    margin-top: 28px;
    color: var(--color-black);
}

.dealer-clean__step-arrow svg {
    width: 20px;
    height: 20px;
}

/* -------------------------------------------------------------------------
 * Actions — Telegram CTA, constrained and centered.
 * ------------------------------------------------------------------------- */

.dealer-clean__actions {
    width: 100%;
    max-width: 360px;
    display: flex;
    justify-content: center;
}

/* Single sizing override on the shared CTA — taller, full-width button per the
 * design. Skin (fill, radius, shadow, font) stays owned by .btn-telegram. */
.dealer-clean__cta {
    width: 100%;
    height: 56px;
}

/* -------------------------------------------------------------------------
 * Tablet and up.
 * ------------------------------------------------------------------------- */

@media (min-width: 768px) {
    
    .content-area{
        margin-bottom:0px;
    }
    .dealer-clean {
        gap: 50px;
    }

    .dealer-clean__logo {
        width: 200px;
    }

    /* Carousel on tablet: fixed-width slides, neighbours peek, snap to centre. */
    .dealer-clean__gallery-viewport {
        scroll-padding-inline: 24px;
    }

    .dealer-clean__gallery-list {
        gap: 24px;
        padding-inline: 24px;
    }

    .dealer-clean__gallery-item {
        flex-basis: 320px;
    }

    .dealer-clean__heading {
        margin: 0 0 30px;
        color: var(--color-black);
        font-family: var(--font-family);
        font-size: 20px;
        font-weight: 700;
        line-height: 1.5;
        text-align: center;
    }

    .dealer-clean__services-list {
        margin: 0;
        padding: 0;
        list-style: none;
        display: flex;
        flex-wrap: wrap;
        justify-content: left;
        gap: 20px;
    }

    /* Reasons: two columns. Explicit placement (not auto-flow) so the lone 3rd
     * chip can span the full last row without depending on column-flow + span
     * quirks. Left column = chips 1,2,3; right column = chips 4,5.
     * Resets the mobile full-row rule on the 5th chip. */
    .dealer-clean__why-list {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, auto);
        gap: 15px 15px;
    }

    .dealer-clean__chip:nth-child(1) {
        grid-area: 1 / 1;
    }

    .dealer-clean__chip:nth-child(2) {
        grid-area: 2 / 1;
    }

    .dealer-clean__chip:nth-child(3) {
        grid-area: 3 / 1 / 4 / 3;
    }

    .dealer-clean__chip:nth-child(4) {
        grid-area: 1 / 2;
    }

    .dealer-clean__chip:nth-child(5) {
        grid-area: 2 / 2;
    }

    /* Categories back to a single wrapping row from tablet up. */
    .dealer-clean__categories-list {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-evenly;
        gap: 24px 32px;
    }

    .dealer-clean__category {
        width: 120px;
    }

    .dealer-clean__category-img {
        height: 100px;
    }

    /* Steps fit in one centered non-scrolling row from tablet up. */
    .dealer-clean__steps-list {
        justify-content: center;
        overflow-x: visible;
        gap: 10px;
    }

    .dealer-clean__step {
        width: 200px;
    }

    .dealer-clean__step-img {
        height: 100px;
    }

    .dealer-clean__step-arrow {
        margin-top: 40px;
    }

    .dealer-clean__step-arrow svg {
        width: 25px;
        height: 25px;
    }
}

/* -------------------------------------------------------------------------
 * Desktop — three-up gallery, services|reasons side by side, vertical services.
 * ------------------------------------------------------------------------- */

@media (min-width: 1024px) {
    /* Desktop: static three-up grid — carousel scroll/snap off. */
    .dealer-clean__gallery-viewport {
        overflow: visible;
        scroll-snap-type: none;
    }

    .dealer-clean__gallery-list {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
        padding-inline: 0;
    }

    .dealer-clean__gallery-item {
        flex: initial;
        max-width: none;
    }

    /* No carousel cue on the static desktop grid. */
    .dealer-clean__gallery-dots {
        display: none;
    }

    .dealer-clean__cols {
        grid-template-columns: 1fr 1fr;
        gap: 48px;
        align-items: start;
    }

    /* Desktop services: left-aligned vertical bullet list. */
    .dealer-clean__services-list {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 14px;
    }
}