/* Homepage Styles
   Depends on: components.css */

/* Storefront homepage resets — depends on Storefront markup structure. */
.home.page .site-header {
    margin-bottom: 0;
}

.home #content > .col-full {
    max-width: none;
    padding: 0;
    margin: 0;
}

.dealer-homepage {
    float: none;
    width: 100%;
    margin: 0;
}

.dealer-homepage__main {
    width: 100%;
    margin: 0;
}

.dealer-home-hero {
    position: relative;
    width: 100%;
    margin: 0;
    overflow: hidden;
    background-color: var(--color-white);
}

/* Hero slider shell — scroll-snap track; JS only adds arrows, dots, and
   autoplay on top, so the track stays swipeable without JS. */
.dealer-home-hero__track {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.dealer-home-hero__track::-webkit-scrollbar {
    display: none;
}

.dealer-home-hero__track:focus-visible {
    outline: var(--focus-outline-width) solid var(--color-primary);
    outline-offset: calc(-1 * var(--focus-outline-width));
}

.dealer-home-hero__slide {
    position: relative;
    flex: 0 0 100%;
    min-width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.dealer-home-hero__dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    z-index: 3;
    display: flex;
    gap: 4px;
    transform: translateX(-50%);
}

.dealer-home-hero__dot {
    box-sizing: content-box;
    width: 8px;
    height: 8px;
    padding: 6px;
    background: transparent;
    border: 0;
    appearance: none;
    cursor: pointer;
}

.dealer-home-hero__dot::before {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.25);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
    transition: background-color 0.2s ease;
}

.dealer-home-hero__dot[aria-current="true"]::before {
    background-color: var(--color-primary);
}

/* Banner slide — one flat artwork, fully clickable; texts and the CTA
   button are baked into the image. Two compositions per slide: mobile
   (2:3) up to 480px, desktop (2.5:1) from 481px. The 480/481 split must
   stay in sync with the <source media> in slide-banner.php and the
   preload in inc/home.php. aspect-ratio reserves the hero height before
   the image loads (no CLS); the banner is full-bleed (edge to edge) — it
   scales to the full viewport width at the fixed aspect, so on screens wider
   than the 2000px artwork it upscales (sharp again once @2x masters land). */
.dealer-home-hero__banner {
    display: block;
    background-color: var(--color-white);
}

.dealer-home-hero__banner-frame {
    display: flex;
}

.dealer-home-hero__banner-image {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    aspect-ratio: 480 / 720;
    object-fit: cover;
    border-radius: 0;
}

@media (min-width: 481px) {
    .dealer-home-hero__banner-image {
        aspect-ratio: 2000 / 800;
    }
}

/* Arrows — desktop only; touch users swipe. Revealed by home.js and inset
   16px from the viewport edge (banner is full-bleed). */
.dealer-home-hero__arrow {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background-color: rgba(255, 255, 255, 0.85);
    border: 0;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    color: var(--color-black);
    transform: translateY(-50%);
    cursor: pointer;
    appearance: none;
    transition: background-color 0.2s ease;
}

.dealer-home-hero__arrow:hover {
    background-color: var(--color-white);
}

.dealer-home-hero__arrow svg {
    display: block;
    width: 20px;
    height: 20px;
}

.dealer-home-hero__arrow--prev {
    left: 16px;
}

.dealer-home-hero__arrow--next {
    right: 16px;
}

@media (min-width: 1024px) {
    .dealer-home-hero__arrow:not([hidden]) {
        display: inline-flex;
    }
}

@media (min-width: 768px) {
    .dealer-home-hero__dots {
        bottom: 14px;
        gap: 6px;
    }
}

/* =========================================================================
   Brands Bar — carousel
   ========================================================================= */

.dealer-home-brands {
    --brands-font-size: 12px;
    --brands-font-weight: var(--font-weight-medium);
    --brands-gap: 32px;
    --brands-speed: 60s;
    --brands-height: 40px;
    --brands-color: var(--color-black);

    width: 100%;
    height: var(--brands-height);
    margin-top: 24px;
    overflow: hidden;
    background-color: var(--color-white);
}

.dealer-home-brands__track {
    display: flex;
    height: 100%;
    width: max-content;
    animation: dealer-brands-scroll var(--brands-speed) linear infinite;
}

.dealer-home-brands__set {
    display: flex;
    align-items: center;
    gap: var(--brands-gap);
    padding-right: var(--brands-gap);
}

.dealer-home-brands__item {
    flex-shrink: 0;
    font-family: var(--font-family);
    font-size: var(--brands-font-size);
    font-weight: var(--brands-font-weight);
    color: var(--brands-color);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0;
    line-height: 1;
}

.dealer-home-brands__item:hover {
    color: var(--color-primary);
}

@keyframes dealer-brands-scroll {
    to {
        transform: translateX(-50%);
    }
}

/* Static mode — few brands, no animation */
.dealer-home-brands--static {
    height: auto;
    overflow: visible;
}

.dealer-home-brands--static .dealer-home-brands__track {
    animation: none;
    width: 100%;
    justify-content: center;
}

.dealer-home-brands--static .dealer-home-brands__set {
    flex-wrap: wrap;
    justify-content: center;
    padding: 12px var(--padding-mobile);
}

/* Reduced motion — disable animation, show one set */
@media (prefers-reduced-motion: reduce) {
    .dealer-home-brands {
        height: auto;
        overflow: visible;
    }

    .dealer-home-brands__track {
        animation: none;
        width: 100%;
        justify-content: center;
    }

    .dealer-home-brands__set {
        box-sizing: border-box;
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        padding: 12px var(--padding-mobile);
    }

    .dealer-home-brands__set--duplicate {
        display: none;
    }
}

@media (min-width: 768px) {
    .dealer-home-brands {
        --brands-font-size: 20px;
        --brands-gap: 48px;
        --brands-height: 60px;

        margin-top: 32px;
    }

    .dealer-home-brands--static .dealer-home-brands__set {
        padding: 12px var(--padding-tablet);
    }

    @media (prefers-reduced-motion: reduce) {
        .dealer-home-brands__set {
            padding: 12px var(--padding-tablet);
        }
    }
}

@media (min-width: 1024px) {
    .dealer-home-brands {
        --brands-font-size: 20px;
        --brands-gap: 56px;
        --brands-height: 60px;
    }

    .dealer-home-brands--static .dealer-home-brands__set {
        padding: 12px var(--padding-desktop);
    }

    @media (prefers-reduced-motion: reduce) {
        .dealer-home-brands__set {
            padding: 12px var(--padding-desktop);
        }
    }
}

/* =========================================================================
   Advantages - static desktop row, mobile/tablet carousel
   ========================================================================= */

.dealer-home-advantages {
    --advantages-card-width: 150px;
    --advantages-card-height: 150px;
    --advantages-gap: 15px;
    --advantages-font-size: 13px;
    --advantages-line-height: 1.5;

    width: 100%;
    overflow: hidden;
    padding: 40px 0 40px;
    background-color: var(--color-white);
}

.dealer-home-advantages__inner {
    max-width: var(--container-max);
    margin: 0 auto;
}

.dealer-home-advantages__viewport {
    overflow-x: auto;
    scrollbar-width: none;
    scroll-padding-inline: var(--padding-mobile);
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.dealer-home-advantages__viewport::-webkit-scrollbar {
    display: none;
}

.dealer-home-advantages__track {
    display: flex;
    width: max-content;
}

.dealer-home-advantages__set {
    display: flex;
    align-items: center;
    gap: var(--advantages-gap);
    margin: 0;
    padding: 0 var(--advantages-gap) 14px var(--padding-mobile);
    list-style: none;
}

.dealer-home-advantages__item {
    flex: 0 0 auto;
    margin: 0;
    scroll-snap-align: start;
}

.dealer-home-advantages__card {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: var(--advantages-card-width);
    height: var(--advantages-card-height);
    padding: 22px 15px;
    border: 1px solid var(--color-primary);
    border-radius: 20px;
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.18);
    color: var(--color-black);
    font-family: var(--font-family);
    font-size: var(--advantages-font-size);
    font-weight: var(--font-weight-medium);
    line-height: var(--advantages-line-height);
    letter-spacing: 0;
    text-align: center;
}

.dealer-home-advantages__check {
    display: none;
    width: 18px;
    height: 18px;
    margin-bottom: 12px;
    color: var(--color-primary);
}

.dealer-home-advantages__check svg {
    display: block;
    width: 100%;
    height: 100%;
}

.dealer-home-advantages__line {
    display: block;
}

/* Reserve a constant two-line height for the label so every card's
   check+text block is the same height. With the card centering its content,
   that keeps all checks on one line AND the top/bottom gaps equal. One-line
   labels (e.g. "Консьєрж - сервіс") stay vertically centred in the reserved
   space. */
.dealer-home-advantages__text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(var(--advantages-line-height) * 2em);
}

@media (min-width: 768px) {
    .dealer-home-advantages {
        --advantages-card-width: 180px;
        --advantages-card-height: 180px;
        --advantages-gap: 30px;
        --advantages-font-size: 14px;
        --advantages-line-height: 1.5;

        padding: 44px 0 46px;
    }

    .dealer-home-advantages__viewport {
        scroll-padding-inline: var(--padding-tablet);
    }

    .dealer-home-advantages__set {
        padding: 0 var(--advantages-gap) 14px var(--padding-tablet);
    }

    .dealer-home-advantages__card {
        padding: 28px 14px;
    }

    .dealer-home-advantages__check {
        display: block;
    }
}

@media (min-width: 1024px) {
    .dealer-home-advantages {
        --advantages-card-width: 100%;
        --advantages-card-height: 180px;
        --advantages-gap: 30px;
        --advantages-font-size: 15px;
        --advantages-line-height: 1.5;

        padding: 50px 0;
    }

    .dealer-home-advantages__inner {
        padding: 0 var(--padding-desktop);
    }

    .dealer-home-advantages__viewport {
        overflow: visible;
        scroll-snap-type: none;
    }

    .dealer-home-advantages__track {
        display: block;
        width: 100%;
    }

    .dealer-home-advantages__set {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        width: 100%;
        gap: var(--advantages-gap);
        padding: 0;
    }

    .dealer-home-advantages__card {
        padding: 30px 15px;
    }

    .dealer-home-advantages__check {
        width: 24px;
        height: 24px;
        margin-bottom: 14px;
    }
}

/* =========================================================================
   Novelties block — "Новинки" rows on the homepage.
   Customize visual tuning via the custom properties below.
   ========================================================================= */

.dealer-home-news {
    --news-section-padding-block: 20px;
    --news-title-size: 18px;
    --news-title-weight: var(--font-weight-medium);
    --news-title-margin-bottom: 15px;
    --news-row-gap: 30px;
    --news-row-title-size: 16px;
    --news-row-title-weight: var(--font-weight-medium);
    --news-row-title-margin-bottom: 30px;

    width: 100%;
    padding: var(--news-section-padding-block) 0;
    background-color: var(--color-white);
}

.dealer-home-news__inner {
    max-width: var(--container-max);
    margin: 0 auto;
}

.dealer-home-news .dealer-home-news__title {
    margin: 0 0 var(--news-title-margin-bottom);
    padding: 0 var(--padding-mobile);
    color: var(--color-black);
    font-family: var(--font-family);
    font-size: var(--news-title-size);
    font-weight: var(--news-title-weight);
    line-height: 1.2;
    text-align: center;
}

.dealer-home-news__row + .dealer-home-news__row {
    margin-top: var(--news-row-gap);
}

.dealer-home-news .dealer-home-news__row-title {
    margin: 0 0 var(--news-row-title-margin-bottom);
    padding: 0 var(--padding-mobile);
    color: var(--color-black);
    font-family: var(--font-family);
    font-size: var(--news-row-title-size);
    font-weight: var(--news-row-title-weight);
    line-height: 1.5;
    text-align: center;
}

.dealer-home-news .dealer-home-news__row-link {
    color: inherit;
    text-decoration: none;
}

.dealer-home-news__row-link:hover,
.dealer-home-news__row-link:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.dealer-home-news__product-list {
    --product-list-padding-inline: var(--padding-mobile);
}

@media (min-width: 768px) {
    .dealer-home-news {
        --news-section-padding-block: 40px;
        --news-title-size: 20px;
        --news-title-margin-bottom: 50px;
        --news-row-gap: 30px;
        --news-row-title-size: 18px;
        --news-row-title-margin-bottom: 30px;
    }

    .dealer-home-news__title,
    .dealer-home-news__row-title {
        padding-inline: var(--padding-tablet);
    }

    .dealer-home-news__product-list {
        --product-list-padding-inline: var(--padding-tablet);
    }
}

@media (min-width: 1024px) {
    .dealer-home-news {
        --news-section-padding-block: 50px;
        --news-title-size: 25px;
        --news-title-margin-bottom: 50px;
        --news-row-gap: 50px;
        --news-row-title-size: 20px;
        --news-row-title-margin-bottom: 30px;
    }

    .dealer-home-news__title,
    .dealer-home-news__row-title {
        padding-inline: var(--padding-desktop);
    }

    .dealer-home-news .dealer-home-news__row-title {
        text-align: left;
    }

    /* Desktop: no carousel — static grid of N cards, no horizontal scroll. */
    .dealer-home-news__product-list {
        --product-list-padding-inline: var(--padding-desktop);
    }
}

/* =========================================================================
   Featured Brands - curated brand cards
   ========================================================================= */

.dealer-home-featured-brands {
    --featured-brands-section-padding-block: 40px;

    /* Edit these six values to tune card size per breakpoint. */
    --featured-brands-card-width-mobile: min(280px, calc(100vw - 70px));
    --featured-brands-card-height-mobile: 420px;
    --featured-brands-card-width-tablet: 420px;
    --featured-brands-card-height-tablet: 570px;
    --featured-brands-card-width-desktop: 100%;
    --featured-brands-card-height-desktop: 470px;

    --featured-brands-card-width: var(--featured-brands-card-width-mobile);
    --featured-brands-card-height: var(--featured-brands-card-height-mobile);
    --featured-brands-card-gap: 20px;
    --featured-brands-card-radius: 10px;
    --featured-brands-name-size: 24px;

    width: 100%;
    padding: var(--featured-brands-section-padding-block) 0;
    overflow: hidden;
    background-color: var(--color-white);
}

.dealer-home-featured-brands__inner {
    max-width: var(--container-max);
    margin: 0 auto;
}

.dealer-home-featured-brands__viewport {
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
    scroll-padding-inline: var(--padding-mobile);
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.dealer-home-featured-brands__viewport::-webkit-scrollbar {
    display: none;
}

.dealer-home-featured-brands__list {
    display: flex;
    gap: var(--featured-brands-card-gap);
    width: max-content;
    margin: 0;
    padding: 0 var(--padding-mobile);
    list-style: none;
}

.dealer-home-featured-brands__item {
    flex: 0 0 auto;
    width: var(--featured-brands-card-width);
    margin: 0;
    scroll-snap-align: start;
}

.dealer-home-featured-brands__card {
    position: relative;
    display: block;
    overflow: hidden;
    width: 100%;
    height: var(--featured-brands-card-height);
    border: 1px solid var(--color-primary);
    border-radius: var(--featured-brands-card-radius);
    box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
    color: var(--color-white);
    text-decoration: none;
    background-color: #E7E7E7;
}

.dealer-home-featured-brands__card:hover,
.dealer-home-featured-brands__card:focus {
    color: var(--color-white);
    text-decoration: none;
}

.dealer-home-featured-brands__image {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    object-fit: cover;
    object-position: center;
}

.dealer-home-featured-brands__name {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 50%;
    display: block;
    width: calc(100% - 32px);
    color: var(--color-white);
    font-family: var(--font-family);
    font-size: var(--featured-brands-name-size);
    font-weight: var(--font-weight-medium);
    line-height: 1.18;
    letter-spacing: 0;
    text-align: center;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

body.dealer-focus-modality-ready.dealer-using-keyboard .dealer-home-featured-brands__card:focus,
.dealer-home-featured-brands__card:focus-visible {
    outline: var(--focus-outline-width) solid var(--color-primary);
    outline-offset: var(--focus-outline-offset);
}

@media (min-width: 768px) {
    .dealer-home-featured-brands {
        --featured-brands-section-padding-block: 52px;
        --featured-brands-card-width: var(--featured-brands-card-width-tablet);
        --featured-brands-card-height: var(--featured-brands-card-height-tablet);
        --featured-brands-card-gap: 20px;
        --featured-brands-name-size: 35px;
    }

    .dealer-home-featured-brands__viewport {
        scroll-padding-inline: var(--padding-tablet);
    }

    .dealer-home-featured-brands__list {
        padding-inline: var(--padding-tablet);
    }
}

@media (min-width: 1024px) {
    .dealer-home-featured-brands {
        --featured-brands-section-padding-block: 58px;
        --featured-brands-card-width: var(--featured-brands-card-width-desktop);
        --featured-brands-card-height: var(--featured-brands-card-height-desktop);
        --featured-brands-card-gap: 30px;
        --featured-brands-name-size: 40px;
    }

    .dealer-home-featured-brands__inner {
        padding: 0 var(--padding-desktop);
    }

    .dealer-home-featured-brands__viewport {
        overflow: visible;
        scroll-snap-type: none;
    }

    .dealer-home-featured-brands__list {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--featured-brands-card-gap);
        width: 100%;
        padding: 0;
    }

    .dealer-home-featured-brands__item {
        width: var(--featured-brands-card-width);
        scroll-snap-align: none;
    }
}
