/**
 * Dovi Tab Carousel styles.
 * Brand-neutral defaults keyed to ABS colors; every color is overridable
 * through the widget's Style controls (which set the --dtc-* custom properties).
 */

.dtc {
    /* Box model */
    --dtc-radius: 24px;
    --dtc-media-radius: 12px;
    /* Brand palette (ABS defaults) */
    --dtc-accent: #06454E;
    --dtc-text: #3F4A54;
    --dtc-card: #FFFFFF;
    --dtc-border: #E3E8EC;
    --dtc-pill: #06454E;
    --dtc-pill-text: #FFFFFF;
    --dtc-glow: #BFE9F0;

    max-width: 1120px;
    margin: 0 auto;
}

/* ---- Stage: arrows flanking the featured card ---- */
.dtc-stage {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dtc-panels {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    background: var(--dtc-card);
    border-radius: var(--dtc-radius);
    box-shadow: 0 0 0 1px var(--dtc-border), 0 10px 44px rgba(127, 211, 224, 0.30);
    overflow: hidden;
}

/* Panels overlap so the outgoing one can animate out while the incoming animates
   in (a true crossfade-slide). The active panel is in normal flow so it sets the
   container height; the rest are absolute and hidden. `.dtc-leaving` keeps the
   outgoing panel painted just for the duration of its exit animation. */
.dtc-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 44px;
    padding: 40px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.dtc-panel.is-active {
    position: relative;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 2;
}

.dtc-panel.dtc-leaving {
    visibility: visible;
    z-index: 1;
}

/* ---- Switch animations ----
   NOTE: no `animation-fill-mode` on the ENTER animation — a panel that isn't
   actively animating must fall back to its natural (visible) state, or a deferred
   animation (backgrounded tab) would freeze it at opacity:0 and hide the widget.
   The LEAVE animation uses `forwards` so the outgoing panel holds its hidden end
   state until JS strips the class. */
.dtc[data-anim="slide"] .dtc-panel.is-active.dtc-enter-next {
    animation: dtcEnterNext 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.dtc[data-anim="slide"] .dtc-panel.is-active.dtc-enter-prev {
    animation: dtcEnterPrev 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.dtc[data-anim="slide"] .dtc-panel.dtc-leaving.dtc-leave-next {
    animation: dtcLeaveNext 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.dtc[data-anim="slide"] .dtc-panel.dtc-leaving.dtc-leave-prev {
    animation: dtcLeavePrev 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.dtc[data-anim="fade"] .dtc-panel.is-active.dtc-enter {
    animation: dtcFadeIn 0.5s ease;
}
.dtc[data-anim="fade"] .dtc-panel.dtc-leaving {
    animation: dtcFadeOut 0.5s ease forwards;
}

@keyframes dtcEnterNext {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes dtcEnterPrev {
    from { opacity: 0; transform: translateX(-40px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes dtcLeaveNext {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-40px); }
}
@keyframes dtcLeavePrev {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}
@keyframes dtcFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes dtcFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .dtc-panel {
        animation: none !important;
    }
}

.dtc-media {
    flex: 0 0 42%;
    max-width: 42%;
}

.dtc-media img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--dtc-media-radius);
    object-fit: cover;
}

.dtc-content {
    flex: 1 1 auto;
    min-width: 0;
}

.dtc-icon {
    display: block;
    color: var(--dtc-accent);
    margin-bottom: 16px;
}

.dtc-icon svg,
.dtc-icon img {
    width: 80px;
    height: 80px;
}

/* Recolor monochrome SVG icons to the accent color. These icons carry no
   per-path fill, so set fill on the <svg> itself (paths inherit it); the
   descendant rules cover icons that DO declare stroke/fill. */
.dtc .dtc-icon svg {
    fill: var(--dtc-accent);
    color: var(--dtc-accent);
}

.dtc .dtc-icon svg [stroke]:not([stroke="none"]) {
    stroke: var(--dtc-accent);
}

.dtc .dtc-icon svg [fill]:not([fill="none"]) {
    fill: var(--dtc-accent);
}

.dtc-heading {
    color: var(--dtc-accent);
    font-weight: 800;
    font-size: 34px;
    line-height: 1.15;
    margin: 0 0 16px;
}

.dtc-desc {
    color: var(--dtc-text);
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
}

/* ---- Prev / next arrows ---- */
/* Scoped under .dtc + explicit resets so the theme/kit global <button>
   styles (gold background, borders, shadows) never bleed into these. */
.dtc .dtc-arrow {
    flex: 0 0 auto;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0 10px;
    font-size: 42px;
    line-height: 1;
    color: #9AA6AE;
    cursor: pointer;
    transition: color 0.2s ease;
}

.dtc .dtc-arrow:hover {
    background: transparent;
    color: var(--dtc-accent);
}

/* ---- Pill navigation ---- */
.dtc-tabs {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 28px;
}

.dtc .dtc-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 156px;
    min-height: 90px;
    padding: 16px 12px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--dtc-pill);
    color: var(--dtc-pill-text);
    border: 0;
    border-radius: 12px;
    box-shadow: none;
    cursor: pointer;
    text-align: center;
    white-space: normal;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.dtc .dtc-tab:hover {
    background: var(--dtc-pill);
}

.dtc-tab-icon {
    display: block;
    color: var(--dtc-pill-text);
}

.dtc-tab-icon svg,
.dtc-tab-icon img {
    width: 39px;
    height: 39px;
}

/* Pill icons: force white (paths inherit fill from the <svg>). */
.dtc .dtc-tab-icon svg {
    fill: var(--dtc-pill-text);
    color: var(--dtc-pill-text);
}

.dtc .dtc-tab-icon svg [stroke]:not([stroke="none"]) {
    stroke: var(--dtc-pill-text);
}

.dtc .dtc-tab-icon svg [fill]:not([fill="none"]) {
    fill: var(--dtc-pill-text);
}

/* Fallback if an icon ever renders as <img> instead of inline SVG. */
.dtc .dtc-tab-icon img {
    filter: brightness(0) invert(1);
}

.dtc-tab-label {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: break-word;
    max-width: 100%;
}

.dtc .dtc-tab.is-active {
    box-shadow: 0 0 0 3px var(--dtc-glow), 0 8px 24px rgba(127, 211, 224, 0.55);
    transform: translateY(-2px);
}

.dtc .dtc-tab:focus-visible {
    outline: 2px solid var(--dtc-glow);
    outline-offset: 2px;
}

/* ---- Responsive ---- */

/* Tablet: keep the desktop side-by-side layout (short card), just scaled down.
   Pills flex to stay 5-across, and the image column shrinks + is height-capped so
   the card stays short instead of ballooning. */
@media (min-width: 768px) and (max-width: 1023px) {
    .dtc-panel.is-active {
        gap: 28px;
        padding: 28px;
    }

    .dtc-media {
        flex: 0 0 38%;
        max-width: 38%;
    }

    .dtc-media img {
        max-height: 200px;
        object-fit: cover;
    }

    .dtc-heading {
        font-size: 26px;
        margin-bottom: 10px;
    }

    .dtc-desc {
        font-size: 15px;
    }

    .dtc .dtc-icon svg,
    .dtc .dtc-icon img {
        width: 60px;
        height: 60px;
    }

    /* 5 equal pills across, shrinking to fit the row */
    .dtc .dtc-tab {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        min-height: 78px;
        padding: 12px 8px;
    }

    .dtc-tab-label {
        font-size: 12px;
    }

    .dtc .dtc-tab-icon svg,
    .dtc .dtc-tab-icon img {
        width: 30px;
        height: 30px;
    }
}

/* Phone: single-column card (image over content) + pills 2-up. */
@media (max-width: 767px) {
    .dtc-panel.is-active {
        flex-direction: column;
        gap: 24px;
        padding: 28px;
        text-align: center;
    }

    .dtc-media {
        flex-basis: auto;
        max-width: 100%;
        width: 100%;
    }

    .dtc-icon {
        margin-left: auto;
        margin-right: auto;
    }

    .dtc-heading {
        font-size: 27px;
    }

    .dtc .dtc-tab {
        width: calc(50% - 8px);
    }
}

@media (max-width: 560px) {
    .dtc .dtc-arrow {
        font-size: 30px;
        padding: 0 2px;
    }

    .dtc .dtc-tab {
        width: calc(50% - 6px);
    }
}

/* ---- Stack Cards on Mobile ----
   When enabled, on phones the carousel becomes a simple vertical stack: pills and
   arrows are dropped, every panel is shown at once, and each panel is styled as its
   own card. `!important` beats the base absolute/hidden panel rules, any in-flight
   animation classes, and the JS-set inline min-height on .dtc-panels. */
@media (max-width: 767px) {
    .dtc--stack-mobile .dtc-tabs,
    .dtc--stack-mobile .dtc-arrow {
        display: none;
    }

    .dtc--stack-mobile .dtc-stage {
        display: block;
    }

    .dtc--stack-mobile .dtc-panels {
        overflow: visible;
        background: transparent;
        box-shadow: none;
        border-radius: 0;
        min-height: 0 !important;
    }

    .dtc--stack-mobile .dtc-panel {
        position: relative !important;
        display: flex !important;
        flex-direction: column;
        gap: 20px;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: none !important;
        animation: none !important;
        text-align: center;
        margin-bottom: 20px;
        padding: 28px;
        background: var(--dtc-card);
        border-radius: var(--dtc-radius);
        box-shadow: 0 0 0 1px var(--dtc-border), 0 10px 30px rgba(127, 211, 224, 0.25);
    }

    .dtc--stack-mobile .dtc-panel:last-child {
        margin-bottom: 0;
    }

    .dtc--stack-mobile .dtc-media {
        flex-basis: auto;
        width: 100%;
        max-width: 100%;
    }

    .dtc--stack-mobile .dtc-icon {
        margin-left: auto;
        margin-right: auto;
    }
}
