/* ==========================================
   PRODUCT PAGE — RELATED PRODUCTS RAIL

   Horizontal track on every breakpoint (cards keep their own intrinsic
   sizing via container queries in product-card.css), so the section reads
   the same on a phone and on an ultrawide monitor.

   Uses the shared .product-card component, so interior styling is inherited
   and only the rail itself is defined here.
   ========================================== */

.related-products {
    box-sizing: border-box;
    width: min(100% - 2rem, 1520px);
    margin: clamp(2.5rem, 6vw, 4.5rem) auto clamp(2rem, 4vw, 3rem);
}

/* ---------- Heading ---------- */
.related-products-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: clamp(1rem, 2.5vw, 1.75rem);
}

.related-products-eyebrow {
    margin: 0;
    color: #a91f25;
    font-size: clamp(0.68rem, 0.64rem + 0.2vw, 0.78rem);
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.related-products-heading h2 {
    margin: 0.2rem 0 0;
    font-size: clamp(1.3rem, 1rem + 1.5vw, 2.1rem);
    line-height: 1.15;
}

/* ---------- Controls ---------- */
.related-products-controls {
    display: flex;
    flex: 0 0 auto;
    gap: 0.45rem;
}

.related-products-controls button {
    display: grid;
    width: 2.35rem;
    height: 2.35rem;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(29, 54, 134, 0.18);
    border-radius: 50%;
    color: #162248;
    background: rgba(255, 255, 255, 0.58);
    box-shadow: 0 4px 14px rgba(34, 53, 45, 0.06);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition:
        background 160ms ease,
        color 160ms ease,
        transform 160ms ease;
}

.related-products-controls button:hover {
    color: #fff;
    background: #1d3686;
    transform: translateY(-1px);
}

.related-products-controls button:focus-visible {
    outline: 2px solid rgba(29, 54, 134, 0.65);
    outline-offset: 3px;
}

/* ---------- Rail ---------- */
.related-products-track {
    display: flex;
    gap: clamp(0.85rem, 1.6vw, 1.5rem);
    padding: 0.35rem 0.25rem 0.9rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.related-products-track::-webkit-scrollbar {
    display: none;
}

.related-products-item {
    flex: 0 0 auto;
    /* Fixed basis keeps the rail scrolling rather than squashing cards. */
    width: min(72vw, 18rem);
    scroll-snap-align: start;
}

/* ==========================================
   TABLET (>= 640px): ~2.2 cards in view
   ========================================== */
@media (min-width: 640px) {
    .related-products {
        width: min(100% - 2.5rem, 1520px);
    }

    .related-products-item {
        width: min(44vw, 19rem);
    }
}

/* ==========================================
   DESKTOP (>= 1024px): ~4 cards in view
   ========================================== */
@media (min-width: 1024px) {
    .related-products-item {
        width: min(23vw, 19.5rem);
    }
}

/* ==========================================
   SMALL PHONES (<= 400px)
   ========================================== */
@media (max-width: 400px) {
    .related-products {
        width: min(100% - 1.25rem, 1520px);
    }

    .related-products-item {
        width: min(78vw, 16rem);
    }

    .related-products-controls button {
        width: 2rem;
        height: 2rem;
        font-size: 1.25rem;
    }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    .related-products-track {
        scroll-behavior: auto;
    }

    .related-products-controls button {
        transition: none;
    }

    .related-products-controls button:hover {
        transform: none;
    }
}
