/*
 * product-tab-rail.css
 * Visual layer of the Tabbed Product Carousel (components/product-tab-rail).
 * Behaviour lives in product-tab-rail.js. Colours follow the site theme
 * variables already defined in common.css.
 */

.pt-rail-section {
    padding-top: var(--home-gap, 56px);
    padding-bottom: var(--home-gap, 56px);
}

/* ---------------------------------------------------------------
   Pill row
--------------------------------------------------------------- */
.pt-rail-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 28px;
}

.pt-pill {
    border: 1px solid var(--hh-green, #1d5c38);
    background: transparent;
    color: var(--hh-green, #1d5c38);
    border-radius: 10px;
    padding: 10px 26px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.pt-pill:hover {
    background: rgba(29, 92, 56, 0.08);
}

.pt-pill--active,
.pt-pill--active:hover {
    background: var(--hh-green, #1d5c38);
    color: #fff;
}

/* ---------------------------------------------------------------
   Rail: horizontal scroll-snap with peeking next card
--------------------------------------------------------------- */
.pt-rail-viewport {
    position: relative;
    /* Track padding, shared with the arrows so they centre on the CARD
       row and not on the whole viewport (which includes the bottom
       padding that leaves room for the card shadow). */
    --pt-track-top: 6px;
    --pt-track-bottom: 18px;
    --pt-track-side: 2px;
    --pt-arrow-size: 44px;
}

.pt-rail-track {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    /* Hide the bar itself, keep scrolling possible */
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: var(--pt-track-top) var(--pt-track-side) var(--pt-track-bottom);
}

.pt-rail-track::-webkit-scrollbar {
    display: none;
}

.pt-rail-item {
    flex: 0 0 auto;
    width: 232px;
    scroll-snap-align: start;
}

/* Cards inside the rail keep their own component styling; the wrapper
   only fixes the width and stops flex children stretching. */
.pt-rail-item .product-card {
    width: 100%;
    height: 100%;
}

@media (min-width: 576px) {
    .pt-rail-item { width: 248px; }
}

@media (min-width: 992px) {
    .pt-rail-item { width: 262px; }
}

/* ---------------------------------------------------------------
   Panel switch: instant swap with a soft fade
--------------------------------------------------------------- */
.pt-panel {
    animation: pt-fade-in 0.25s ease;
}

.pt-panel[hidden] {
    display: none;
}

@keyframes pt-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .pt-panel { animation: none; }
    .pt-rail-track { scroll-behavior: auto; }
}

/* ---------------------------------------------------------------
   Arrow buttons: circle, theme colour, hover only when scrollable
--------------------------------------------------------------- */
.pt-arrow {
    position: absolute;
    /* Vertical middle of the cards: half way between the padded top
       and bottom of the track. */
    top: calc(50% + (var(--pt-track-top) - var(--pt-track-bottom)) / 2);
    transform: translateY(-50%);
    width: var(--pt-arrow-size);
    height: var(--pt-arrow-size);
    box-sizing: border-box;
    border-radius: 50%;
    /* White ring so the circle reads cleanly sitting on the card edge */
    border: 3px solid #fff;
    background: var(--hh-green, #1d5c38);
    color: #fff;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    z-index: 2;
    transition: opacity 0.15s ease;
}

.pt-arrow:hover {
    filter: brightness(1.1);
}

/* The class display:flex above beats the [hidden] attribute, so the
   prev arrow showed on the first page. Make hidden win. */
.pt-arrow[hidden] { display: none; }

/* Centre of each circle sits ON the card border: half the circle
   outside, half inside. Prev lines up with the first card's left edge
   (after the track side padding); next sits on the viewport's right
   edge where the peeking card is cut. */
.pt-arrow--prev { left: calc(var(--pt-track-side) - var(--pt-arrow-size) / 2); }
.pt-arrow--next { right: calc(var(--pt-arrow-size) / -2); }

/* Touch devices swipe natively, arrows are pointer-only comfort */
@media (hover: none) {
    .pt-arrow { display: none; }
}

/* Hide arrows on the smallest screens where one card fills the view */
@media (max-width: 575px) {
    .pt-arrow { display: none; }
}
