/*
 * Rivera — Front page
 *
 * Blocks:
 *   .home-page    — the page: spacing between sections. Not .home: WordPress
 *                   puts that class on <body> of the front page, and every
 *                   rule written for the block landed on the whole document
 *   .panel__grid  — the slider track inside a .panel
 *   .offer-card   — an object in the offers slider: photo, price, title
 *
 * .panel, .promo-bar, .social-links and .services are shared with other pages
 * and live in css/sections.css.
 *
 * Sizes are measured off the design: it is 1131px of content wide, this
 * project's content column is 1340, so measured values are scaled by ≈1.18.
 */

/* No background of its own: the ground carries the glow from the header down
 * into the first panel. The insets come from .site-main; the home page ends a
 * little tighter, because the last panel already carries its own bottom. */
@media (max-width: 1023px) {
    .home-page {
        padding-bottom: 48px;
    }
}

@media (max-width: 767px) {
    .home-page {
        padding-bottom: 32px;
    }
}

.home-page__inner {
    display:        flex;
    flex-direction: column;
    gap:            40px;
}

/* A slider track, not a fixed grid: there may be more than three videos or
 * offers, and every card past the third sits off to the right. Three cards
 * per view on desktop, two on a tablet, one and a peek on a phone.
 *
 * It is plain overflow scrolling with snap points, so it swipes on touch,
 * scrolls with a trackpad and works with no script at all; js/main.js only
 * adds the arrows. The 6px of block padding gives a focus ring room, since a
 * scroll container clips everything that sticks out of it. */
.panel__grid {
    /* The containing block for anything absolutely positioned inside the
     * cards — the visually hidden «Ціна:» labels above all. Without it they
     * are placed against the page instead, the ones in off-screen cards land
     * thousands of pixels to the right, and a phone widens the whole page to
     * reach them. */
    position:              relative;
    display:               grid;
    grid-auto-flow:        column;
    grid-auto-columns:     calc((100% - 2 * 48px) / 3);
    gap:                   48px;
    margin:                -6px 0;
    padding:               6px 0;
    list-style:            none;
    overflow-x:            auto;
    overscroll-behavior-x: contain;
    scroll-snap-type:      x mandatory;
    scrollbar-width:       none;
}

.panel__grid::-webkit-scrollbar {
    display: none;
}

.offer-card {
    scroll-snap-align: start;
}

/* ── Offer card ─────────────────────────────────────────────────────────── */
.offer-card {
    display:        flex;
    flex-direction: column;
    min-width:      0;
}

/* The whole card is the link: a photo, a price and a title are one target. */
.offer-card__link {
    display:         flex;
    flex-direction:  column;
    height:          100%;
    color:           var(--color-secondary);
    text-decoration: none;
}

.offer-card__media {
    display:          block;
    overflow:         hidden;
    aspect-ratio:     3 / 2;
    border:           1px solid var(--color-sky);
    background-color: var(--color-navy-deep);
}

.offer-card__link:hover .offer-card__img,
.offer-card__link:focus-visible .offer-card__img {
    transform: scale(1.04);
}

.offer-card__price {
    display:     block;
    margin-top:  24px;
    color:       var(--color-price);
    font-size:   var(--fs-price-card);
    font-weight: 700;
    line-height: 1.2;
}

.offer-card__title {
    display:     block;
    margin-top:  16px;
    font-size:   var(--fs-body);
    line-height: 1.4;
    transition:  color var(--transition);
}

.offer-card__link:hover .offer-card__title,
.offer-card__link:focus-visible .offer-card__title {
    color: var(--color-orange);
}

.offer-card__link:focus-visible {
    outline:        2px solid var(--color-orange);
    outline-offset: 4px;
}

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

/* ── Tablet ─────────────────────────────────────────────────────────────── */
@media (max-width: 1023px) {

    .home-page__inner {
        gap: 28px;
    }

    /* Three 208px video cards on a 768px screen are too small to read, so the
     * tablet shows two and slides to the rest. */
    .panel__grid {
        grid-auto-columns: calc((100% - 24px) / 2);
        gap:               24px;
    }

    .offer-card__price {
        margin-top: 16px;
        font-size:  18px;
    }

    .offer-card__title {
        margin-top: 12px;
        font-size:  16px;
    }
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {

    .home-page__inner {
        gap: 20px;
    }

    /* One card in view with the next one peeking in from the edge — the peek
     * is what tells a visitor there is more to swipe to. The track runs out to
     * the panel's right edge so the peek is not cut off by the panel's own
     * padding. Arrows go: on a phone the swipe is the control, and next to the
     * title they would push it onto a second line. */
    .panel__grid {
        grid-auto-columns: 82%;
        gap:               16px;
        margin-right:      -18px;
        padding-right:     18px;
    }

}
