/* Tabbed Collections Section */
.tabbed-collections {
    position: relative;
}

.tabbed-collections__title {
    text-align: left;
    margin-bottom: 0;
    font-size: var(--t-card);
}

/* Heading and View all share a row. baseline alignment keeps the link sitting on
   the heading's baseline rather than centred against its full line box. */
.tabbed-collections__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.tabbed-collections__view-all {
    flex: 0 0 auto;
}

/* Only the active tab's link shows; the rest stay in the DOM so switching costs
   nothing. :not(.active) rather than a default of none so that a no-JS render
   still shows the first one. */
.tabbed-collections__view-all-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--fs-small);
    line-height: 1.3;
    color: #15140F;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
}

.tabbed-collections__view-all-link:not(.active) {
    display: none;
}

.tabbed-collections__view-all-arrow {
    display: inline-block;
}

@media screen and (min-width: 960px) {
    .tabbed-collections__header {
        margin-bottom: 10px;
    }
}

/* Tabs Container */
.tabbed-collections__tabs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding: 0;
}

@media (max-width: 959px) {
    .tabbed-collections__tabs {
        padding: 0 5px;
        gap: 4px;
    }
}

@media screen and (min-width: 960px) {
    .tabbed-collections__tabs {
        gap: 8px;
        margin-bottom: 10px;
        padding: 0;
    }
}

/* Individual Tab Button */
.tabbed-collections__tab {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 1);
    color: rgba(0, 0, 0, 1);
    padding: 6px 14px;
    font-size: var(--fs-small);
    line-height: 1.3;
    cursor: pointer;
    border-radius: 999px;
    white-space: nowrap;
    position: relative;
}

/* A rule outside this file pins every tab to a fixed 120px regardless of its label
   (natural widths here are 64px and 84px), so the pill is narrowed by setting the
   width rather than the padding: 120 - 10% = 108, still clear of the longest
   current label.

   !important is needed. That rule lives in a CDN stylesheet whose cssRules are
   CORS-blocked, so it cannot be read and matched directly; measured in the page,
   selectors up to `body .tabbed-collections .tabbed-collections__tabs
   button.tabbed-collections__tab` all still lost, and only !important won. */
.tabbed-collections .tabbed-collections__tab {
    width: 108px !important;
}

.tabbed-collections__tab:hover {
    border-color: rgba(0, 0, 0, 0.3);
    color: rgba(0, 0, 0, 0.9);
}

.tabbed-collections__tabs .active {
    background: rgb(0, 0, 0);
    border-color: rgba(0, 0, 0, 0.9);
    color: #fff;
}

.tabbed-collections__tab:focus-visible {
    outline: 2px solid rgba(0, 0, 0, 0.5);
    outline-offset: 2px;
}

/* Tab Content Container */
.tabbed-collections__content {
    position: relative;
    min-height: 400px;
}

/* Individual Tab Panel */
.tabbed-collections__panel {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tabbed-collections__panel.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Empty State */
.tabbed-collections__empty {
    text-align: center;
    padding: 60px 20px;
    color: rgba(0, 0, 0, 0.5);
    font-size: 16px;
}

/* Inherit featured collection styles */
.tabbed-collections .collection__view-all {
    margin-top: 0px;
}

@media screen and (min-width: 960px) {
    .tabbed-collections .collection__view-all {
        margin-top: 10px;
    }
}

.tabbed-collections .collection__view-all a:not(.link) {
    margin-top: 0px;
}

/* Mobile Slider Adjustments */
@media screen and (max-width: 959px) {
    .tabbed-collections .slider--mobile .slider__slide {
        width: calc((100vw - var(--page-padding)) / var(--mobile-cols) - (var(--page-padding) / var(--mobile-cols)));
    }

    .tabbed-collections .grid--peek .slider__slide {
        width: calc((230vw - var(--page-padding)) / (2 * var(--mobile-cols) + 1));
    }

    .tabbed-collections .grid--peek {
        scroll-padding-left: var(--page-padding);
    }

    .tabbed-collections .slider:not(.slider--mobile) {
        flex-wrap: wrap;
    }

    .tabbed-collections .slider--desktop:not(.slider--mobile)+.slider-buttons {
        display: none;
    }

    .tabbed-collections .slider--mobile {
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 0px;
    }

    .tabbed-collections .slider--mobile .slider__slide {
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }
}

/* Desktop Slider Adjustments */
@media screen and (min-width: 960px) {
    .tabbed-collections .slider:not(.slider--desktop) {
        flex-wrap: wrap;
    }

    .tabbed-collections .slider--mobile:not(.slider--desktop)+.slider-buttons {
        display: none;
    }

    .tabbed-collections .slider--desktop {
        scroll-padding-left: var(--page-padding);
    }
}

/* Slider Controls */
.tabbed-collections .control__arrow-button[name="previous"] {
    position: absolute;
    left: 16px;
    top: 40%;
    transform: translateY(-50%) rotate(90deg);
    z-index: 2;
}

.tabbed-collections .control__arrow-button[name="previous"]:hover {
    transform: translateY(-50%) rotate(90deg) scale(1.12);
}

.tabbed-collections .control__arrow-button[name="next"] {
    position: absolute;
    right: 16px;
    top: 40%;
    transform: translateY(-50%) rotate(-90deg);
    z-index: 2;
}

.tabbed-collections .control__arrow-button[name="next"]:hover {
    transform: translateY(-50%) rotate(-90deg) scale(1.12);
}

/* Pagination Dots */
.tabbed-collections .control__dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
}

.tabbed-collections .control__dot {
    display: block;
    padding: 0;
    width: 8px;
    height: 8px;
    margin: 7px;
    border: none;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.1);
    transition: background 0.3s, width 0.3s, height 0.3s;
    cursor: pointer;
}

.tabbed-collections .control__dot:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

.tabbed-collections .control__dot.is-active {
    width: 10px;
    height: 10px;
    background: rgba(0, 0, 0, 0.9);
    cursor: default;
}

/* Pagination Bars */
.tabbed-collections .control__bars {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    gap: 0;
    border-radius: 5px;
    padding-bottom: 0;
}

@media screen and (max-width: 959px) {
    .tabbed-collections .control__bars {
        margin-top: 0px;
    }
}

.tabbed-collections .control__bar {
    background: rgba(0, 0, 0, 0.1);
    flex: 1;
    border: none;
    height: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

.tabbed-collections .control__bar::after {
    content: none;
}

.tabbed-collections .control__bar:hover {
    background: rgba(0, 0, 0, 0.2);
}

.tabbed-collections .control__bar.is-active {
    background: rgba(0, 0, 0, 0.9);
    border-radius: 5px;
}

/* Slider Buttons */
.tabbed-collections .slider-buttons {
    margin-top: 20px;
}

@media screen and (min-width: 960px) {
    .tabbed-collections .slider-buttons {
        margin-top: 30px;
    }
}

/* Loading State */
.tabbed-collections__panel.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Responsive Tab Layout */
@media screen and (max-width: 749px) {
    .tabbed-collections__tabs {
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-start;
        scrollbar-width: none;
        -ms-overflow-style: none;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    .tabbed-collections__tabs::-webkit-scrollbar {
        display: none;
    }

    .tabbed-collections__tab {
        flex-shrink: 0;
    }
}

/* Dark mode support (if needed) 
@media (prefers-color-scheme: dark) {
    .tabbed-collections__tab {
        border-color: rgba(255, 255, 255, 0.2);
        color: rgba(255, 255, 255, 0.7);
    }

    .tabbed-collections__tab:hover {
        border-color: rgba(255, 255, 255, 0.4);
        color: rgba(255, 255, 255, 0.9);
    }

    .tabbed-collections__tab.active {
        background: rgba(255, 255, 255, 0.9);
        border-color: rgba(255, 255, 255, 0.9);
        color: #000;
    }
}*/
/* Align the first product image with the heading and the pills. The product grid
   is a horizontal scroll container (overflow-x: auto), and its first slide sat
   10px to the right of the heading: 8px from the grid's own padding-left plus 2px
   from the slide's. A negative margin would drag the scroll viewport itself, so
   the padding is removed instead — and on the first slide only, because that 2px
   is also the inter-card gutter every other card relies on. */
/* Tablet (750-959) follows desktop rather than mobile: the desktop column count
   instead of the 2-up peek slider.

   Peek is switched off here rather than retuned. Its -20px margin / 19px padding
   pair exists to bleed the next card past the page edge, and those numbers are
   what pushed the first image out of line in the first place. With them zeroed
   the track's content box lines up with the page gutter, so the first image sits
   on the heading automatically and N columns divide the width exactly.

   The column count comes from --tc-tablet-cols (the Columns (Tablet) setting,
   default 3), so tablet is tuned independently of desktop - 4 desktop columns
   land at only 188px a card on a 768px screen. Both are plain numbers in a
   calc(), so 1-5 works without a rule per grid-cols-N class. */
@media screen and (min-width: 750px) and (max-width: 959px) {
    .tabbed-collections .product-grid {
        /* Same 3px swatch-ring clearance as the desktop block above, for the same
           reason: with the peek margins zeroed, the scroll container's clip edge
           lands on the content edge and shaves the first selected swatch's outline.
           Phones are unaffected - grid--peek's -20px/19px pair already leaves 15px
           of bleed there. */
        margin-left: -3px !important;
        margin-right: 0 !important;
        padding-left: 3px !important;
        padding-right: 0 !important;
        scroll-padding-left: 0;
    }

    .tabbed-collections .product-grid > .slider__slide {
        width: calc(100% / var(--tc-tablet-cols, 3)) !important;
        padding-left: 0;
    }
}

/* Below 960 (phones and tablets): the same alignment, reached a different way.
   Here the offset is not the grid's padding but the slider-component's own 5px
   padding-left (the .slider-mobile-gutter class), which pushed the track to 10px
   against a heading at 5px. The tablet block above zeroes the grid's own padding,
   so this 5px is the only thing left between the track and the gutter there too. Zeroing just that shifts the whole track into line and leaves the
   grid--peek padding — which sizes the peeking card — untouched. padding-right
   stays, so the track still has its trailing gutter. */
@media screen and (max-width: 959px) {
    .tabbed-collections slider-component.slider-mobile-gutter {
        padding-left: 0;
    }
}

/* Desktop only. On mobile the grid runs in grid--peek mode with its own padding
   that deliberately bleeds the first card toward the screen edge; zeroing it
   there put the first image at -10px against a heading at 5px. */
@media screen and (min-width: 960px) {
    .tabbed-collections .product-grid {
        /* The grid is overflow-x: auto, so it CLIPS at its padding edge. With
           padding-left: 0 that edge sat exactly on the content, and the selected
           colour swatch's 1px outline at outline-offset: 2px - which paints 3px
           outside the chip - was sliced off on the first card only.

           So instead of zeroing the padding, give the scrollport 3px of bleed and
           pull the box 3px further left to pay for it. Content width and every
           alignment are unchanged (the negative margin widens the border box by
           exactly what the padding takes back), the first image still starts on the
           heading, and the ring now has room to draw.

           3px = outline-offset (2) + outline-width (1). --page-padding is the 10px
           the base -10px margin already cancels; reading it keeps the two in step if
           the page gutter ever changes.

           !important because the 8px is itself set with !important elsewhere - an
           inline non-important override was measured losing to it. */
        padding-left: 3px !important;
        margin-left: calc((var(--page-padding, 10px) + 3px) * -1) !important;
    }

    .tabbed-collections .product-grid > .grid__item:first-child {
        padding-left: 0;
    }
}
