/*---*\
    Tabs Section (Flexible Content)

    Desktop tab strip (.tabs-section__tabs-wrap) is a Slick carousel
    decoupled from FxTabsAccordion panels. Both write panel state
    (`is-active` + `hidden`); active tab uses [aria-selected="true"]
    or .is-active for the underline fill.
\*---*/

.tabs-section__inner {
    max-width: var(--container-max-width);
    margin-left: auto;
    margin-right: auto;
}

.tabs-section__intro {
    text-align: center;
    margin-bottom: var(--space-heading-top);
}

.tabs-section__intro h2 {
    text-transform: uppercase;
}

/* -------------------------------------------------------------------------
   FxTabsAccordion overrides (tab row + mobile accordion)
   ------------------------------------------------------------------------- */

.tabs-section .tab-accordion {
    position: relative;
}

.tabs-section .tab-accordion__tabs {
    display: flex;
    flex-wrap: nowrap;
    justify-content: stretch;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    position: relative;
    z-index: 2;
    top: 0;
}

.tabs-section__tabs-nav {
    position: relative;
}

.tabs-section .tab-accordion__tab {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    padding: 0 0 var(--space-sub-to-heading);
    text-align: center;
    text-transform: uppercase;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: var(--font-size-h4);
    line-height: var(--line-height-heading);
    color: var(--color-inactive);
    background: transparent;
    border: none;
    border-radius: 0;
    padding-bottom: 15px;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: color var(--transition-medium);
}

.tabs-section .tab-accordion__tab .tab-accordion__tab-label-underline {
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
}

.tabs-section .tab-accordion__tab .tab-accordion__tab-label-underline::before,
.tabs-section .tab-accordion__tab .tab-accordion__tab-label-underline::after {
    content: "";
    display: block;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    width: 100%;
    height: 2px;
    border-radius: 10px;
    overflow: hidden;
    background-color: var(--color-accent-green);
    transition: background var(--transition-medium);
}

.tabs-section .tab-accordion__tab .tab-accordion__tab-label-underline::after {
    top: 50%;
    transform: translateY(-50%) scaleX(0);
    transform-origin: right;
    height: 6px;
    background-color: var(--color-primary);
    transition: transform var(--transition-medium);
}

.tabs-section .tab-accordion__tab.is-active {
    color: var(--color-primary);
}

.tabs-section .tab-accordion__tab.is-active .tab-accordion__tab-label-underline::after,
.tabs-section .tab-accordion__tab[aria-selected="true"] .tab-accordion__tab-label-underline::after {
    transform-origin: left;
    transform: translateY(-50%) scaleX(1);
}

.tabs-section .tab-accordion__panels {
    margin: 0;
    padding: 0;
}

.tabs-section .tab-accordion__panel {
    margin: 0;
    padding: 0;
}

.tabs-section .tab-accordion__panel__toggle {
    position: relative;
    list-style-type: none !important;
    width: 100%;
    margin: 0;
    text-align: left;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: var(--font-size-h5);
    line-height: var(--line-height-heading);
    text-transform: uppercase;
    color: var(--color-inactive);
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    padding: 15px 0;
    padding-right: 70px;
    text-decoration: none;
    transition: color var(--transition-medium), background-color var(--transition-medium);
}

.tabs-section .tab-accordion__panel__toggle::after {
    content: '\e924';
    font-family: var(--font-icon) !important;
    position: absolute;
    top: 50%;
    transform: translate(0, -50%) rotate(180deg);
    right: 0;
    width: 25px;
    height: 25px;
    font-weight: normal;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 25px;
    transition: transform var(--transition-medium), color var(--transition-medium);
}

.tabs-section .tab-accordion__panel__toggle.is-active {
    color: var(--color-primary);
    background: transparent;
    border: none;
    border-radius: 0;
}

.tabs-section .tab-accordion__panel__toggle:focus {
    outline: none;
    box-shadow: none;
    border: 0;
}

.tabs-section .tab-accordion__panel__toggle.is-active::after {
    transform: translate(0, -50%) rotate(0deg);
}

.tabs-section .tab-accordion__panel .tab-accordion__panel__toggle {
    border-bottom: 2px solid var(--color-accent-green);
    padding-bottom: var(--space-paragraph);
}

.tabs-section.bg-white .tab-accordion__panel .tab-accordion__panel__toggle {
    border-color: var(--color-offwhite);
}

.tabs-section .tab-accordion__panel:not(.is-active) .tab-accordion__panel__content {
    display: none;
}

.tabs-section .tab-accordion__panel__content {
    margin: 0;
    padding: var(--content-gap) 0;
    border: none;
    overflow: visible;
}

/* -------------------------------------------------------------------------
   Panel body layout
   ------------------------------------------------------------------------- */

.tabs-section__panel-inner {
    display: block;
    border-radius: var(--border-radius-card);
}

@media (max-width: 1199px) {
    .tabs-section__panel-media {
        margin-bottom: var(--content-gap);
    }
}

@media (max-width: 767px) {
    .tabs-section__panel-media {
        margin-top: var(--content-gap);
        margin-bottom: 0;
    }

    .tabs-section__panel-inner > .row {
        flex-direction: column-reverse;
    }

    /*
     * Override normalize.css `[hidden] { display: none !important }`. On mobile
     * every toggle button (rendered inside the panel) must remain clickable
     * even though FxTabsAccordion sets the `hidden` attribute on inactive
     * panels. Panel CONTENT stays hidden via the
     * .tab-accordion__panel:not(.is-active) ... rule above.
     */
    .tabs-section .tab-accordion__panel[hidden] {
        display: block !important;
    }
}

.tabs-section__panel-media {
    border-radius: var(--border-radius-card);
    overflow: hidden;
    height: 100%;
}

.tabs-section__panel-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Flex gap is the sole vertical rhythm; child margins are stripped below. */
.tabs-section__stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-paragraph);
}

.tabs-section__stack > p {
    margin: 0;
}

.tabs-section__stack > h3 {
    margin: 0;
    text-transform: uppercase;
}

.tabs-section__stack .wysiwyg__subheading,
.tabs-section__stack .sub-heading {
    margin: 0;
}

/* Desktop tab strip (>=768). Slick when .tabs-section--has-slider is set. */

@media (min-width: 768px) {
    .tabs-section__tabs-wrap {
        position: relative;
    }

    .js-tabs-section-tabs-slider .slick-track {
        display: flex !important;
    }

    .tabs-section__tabs-shell {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 0;
        width: 100%;
        max-width: 100%;
        position: relative;
    }

    .tabs-section__tabs-viewport {
        flex: 1 1 auto;
        min-width: 0;
        position: relative;
    }

    .tabs-section__tabs-track {
        display: flex;
        flex-wrap: nowrap;
        justify-content: center;
        width: 100%;
        margin: 0;
        padding: 0;
        list-style: none;
        position: relative;
        z-index: 2;
    }

    /*
     * Non-slider tracks distribute tabs equally across the full row
     * (matching staging behavior). Each slide gets an equal flex share
     * and the tab button fills its slide so the per-tab underline runs
     * the full slide width.
     */
    .tabs-section:not(.tabs-section--has-slider) .tabs-section__tabs-track {
        gap: 0;
    }

    .tabs-section__tabs-slide {
        flex: 0 0 auto;
        min-width: 0;
        display: flex;
    }

    .tabs-section:not(.tabs-section--has-slider) .tabs-section__tabs-slide {
        flex: 1 1 0;
    }

    /*
     * Long labels: equal-width slides can't fit unbounded nowrap text,
     * so non-slider tabs allow wrapping. Bottom-align the label so
     * single-line and wrapped tabs share the same baseline (just above
     * the underline), and align-items keeps the centered text layout.
     * The absolutely-positioned underline span is unaffected by flex.
     */
    .tabs-section:not(.tabs-section--has-slider) .tabs-section__tabs-slide .tab-accordion__tab {
        width: 100%;
        white-space: normal;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        align-items: center;
    }

    /*
     * Continuous baseline across the tab row. Applied to every track
     * (slider and non-slider) so that 2- and 3-tab blocks still show
     * the full-width green line that runs behind/between the tab
     * underlines, not just slider-enabled (4+/5+ tab) blocks.
     */
    .tabs-section__tabs-track::before {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: 2px;
        height: 2px;
        background: var(--color-accent-green);
        z-index: 0;
        pointer-events: none;
    }

    /* Slick's float/width math requires a block-level track. */
    .tabs-section--has-slider .tabs-section__tabs-track.slick-initialized {
        display: block;
    }

    .tabs-section--has-slider .tabs-section__tabs-track .slick-list {
        width: 100%;
    }

    .tabs-section--has-slider .tabs-section__tabs-track .slick-slide {
        height: auto;
        vertical-align: top;
        padding: 0;
        margin: 0 75px 0 0;
    }

    .tabs-section--has-slider .tabs-section__tabs-track .slick-slide > div {
        height: 100%;
    }

    .tabs-section--has-slider .tabs-section__tabs-track .tabs-section__tabs-slide {
        flex: 0 0 auto;
        min-width: 0;
        display: flex !important;
        height: 100%;
    }

    /* Mask works on any section background, no per-bg-* override needed. */
    .tabs-section--has-slider .tabs-section__tabs-viewport {
        -webkit-mask-image: linear-gradient(
            to right,
            rgba(0, 0, 0, 0) 0,
            #000 2.5rem,
            #000 calc(100% - 2.5rem),
            rgba(0, 0, 0, 0) 100%
        );
        mask-image: linear-gradient(
            to right,
            rgba(0, 0, 0, 0) 0,
            #000 2.5rem,
            #000 calc(100% - 2.5rem),
            rgba(0, 0, 0, 0) 100%
        );
    }

    .tabs-section .tabs-section__tabs-slide .tab-accordion__tab {
        line-height: var(--line-height-heading);
        white-space: nowrap;
    }

    .tabs-section__tabs-arrow {
        appearance: none;
        -webkit-appearance: none;
        flex-shrink: 0;
        position: relative;
        left: auto;
        right: auto;
        transform: none;
        width: 30px;
        height: 30px;
        margin: 0 12px;
        border-radius: 50%;
        background-color: var(--color-primary);
        color: var(--color-white);
        border: 0;
        padding: 0;
        cursor: pointer;
        display: none;
        align-items: center;
        justify-content: center;
        font-family: 'be-icon', var(--font-icon) !important;
        font-size: 0;
        line-height: 0;
        transition:
            background-color var(--transition-fast),
            color var(--transition-fast),
            opacity var(--transition-fast);
        z-index: 4;
    }

    .tabs-section--has-slider .tabs-section__tabs-arrow {
        display: inline-flex;
    }

    .tabs-section__tabs-arrow.slick-prev::before,
    .tabs-section__tabs-arrow.slick-next::before {
        opacity: 1;
        color: currentColor;
        font-size: 12px;
        line-height: 1;
    }

    .tabs-section__tabs-arrow:hover {
        background-color: var(--color-primary-hover);
    }

    .tabs-section .tab-accordion__panel__content {
        padding: var(--content-gap) 0 0;
        border: none;
        border-radius: 0;
    }

    .tabs-section .tab-accordion__tab {
        font-size: 24px;
    }
}

@media (min-width: 1200px) {
    .tabs-section .tabs-section__tabs-slide .tab-accordion__tab {
        padding-left: 12px;
        padding-right: 12px;
    }

    .tabs-section .tab-accordion__tab:hover,
    .tabs-section .tab-accordion__panel__toggle:hover {
        color: var(--color-primary);
    }

    .tabs-section__panel-copy--with-media {
        padding-left: 43px;
    }

    .tabs-section__tabs-arrow {
        width: 40px;
        height: 40px;
    }

    .tabs-section__tabs-arrow.slick-prev::before,
    .tabs-section__tabs-arrow.slick-next::before {
        font-size: 20px;
    }
}

@media (min-width: 1440px) {
    .tabs-section .tab-accordion__tab {
        font-size: var(--font-size-h5);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tabs-section .tab-accordion__toggle-icon {
        transition-duration: 0.01ms;
    }

    .tabs-section .tab-accordion__tab .tab-accordion__tab-label-underline::before,
    .tabs-section .tab-accordion__tab .tab-accordion__tab-label-underline::after,
    .tabs-section__tabs-arrow {
        transition-duration: 0.01ms;
    }
}
