/* ============================================
   Horizontal Tabbing Component – d-hor-tabs
   Red Theme • Dynamic Tab Count • Mobile-First
   ============================================ */

/* --- Reset & Base --- */
.d-hor-tabs {
    --hor-tab-count: 4;
    /* JS overrides this based on actual tab count */
    --hor-accent: #e41e26;
    --hor-accent-hover: #c91920;
    --hor-dark: #0f0f14;
    --hor-glass: rgba(15, 15, 20, 0.72);

    position: relative;
    width: 100%;
    overflow: hidden;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    line-height: 1.5;
    box-sizing: border-box;
}

.d-hor-tabs *,
.d-hor-tabs *::before,
.d-hor-tabs *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- Container --- */
.d-hor-tabs .container {
    max-width: 1530px;
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;
    position: relative;
}

/* --- Banner Section --- */
.d-hor-tabs .hor-banner {
    position: relative;
    width: 100%;
    min-height: 700px;
    display: flex;
    align-items: center;
    overflow: hidden;
    perspective: 1200px;
}

/* Banner Background Images */
.d-hor-tabs .hor-banner__bg {
    position: absolute;
    inset: -100px;
    /* Oversized to prevent edges showing during 3D tilt/parallax */
    z-index: 0;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.d-hor-tabs .hor-banner__slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.9s cubic-bezier(0.4, 0, 0.2, 1), transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(1.06);
    will-change: opacity, transform;
}

.d-hor-tabs .hor-banner__slide.active {
    opacity: 1;
    transform: scale(1);
}

.d-hor-tabs .hor-banner__slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform-origin: center center;
}

.d-hor-tabs .hor-banner__slide.active img {
    animation: htZoomEffect 20s linear forwards;
}

@keyframes htZoomEffect {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.15);
    }
}

/* Light overlay for content readability */
.d-hor-tabs .hor-banner__slide::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 55%;
    height: 100%;
    background: #fff;
    border-radius: 100%;
    filter: blur(200px);
}

/* --- Banner Content --- */
.d-hor-tabs .hor-banner__content {
    position: relative;
    z-index: 2;
    padding: 80px 0 250px;
    max-width: 40%;
    opacity: 0;
    transform: translateY(30px);
    animation: htFadeInUp 0.8s 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.d-hor-tabs .hor-banner__content.switching {
    animation: htContentSwitch 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

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

@keyframes htContentSwitch {
    0% {
        opacity: 1;
        transform: translateY(0);
    }

    45% {
        opacity: 0;
        transform: translateY(-8px);
    }

    55% {
        opacity: 0;
        transform: translateY(8px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Subtitle with line */
.d-hor-tabs .hor-banner__subtitle {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--hor-accent);
    margin-bottom: 18px;
}

.d-hor-tabs .hor-banner__subtitle::before {
    content: '';
    display: inline-block;
    width: 45px;
    height: 2.5px;
    background: var(--hor-accent);
    border-radius: 2px;
    flex-shrink: 0;
}

/* Heading */
.d-hor-tabs .hor-banner__title {
    font-size: clamp(38px, 5vw, 62px);
    font-weight: 800;
    line-height: 1.08;
    color: #000;
    margin-bottom: 22px;
    letter-spacing: -0.5px;
}

.d-hor-tabs .hor-banner__title span {
    color: var(--hor-accent);
}

/* Description */
.d-hor-tabs .hor-banner__desc {
    font-size: 15.5px;
    line-height: 1.7;
    color: #000;
    margin-bottom: 32px;
    max-width: 100%;
}

.d-hor-tabs .hor-banner__desc strong {
    color: #000;
    font-weight: 700;
}

/* CTA Button */
.d-hor-tabs .hor-banner__cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 34px;
    background: var(--hor-accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 50px;
    border: 2px solid var(--hor-accent);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.d-hor-tabs .hor-banner__cta::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #fff;
    border-radius: 50px;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: -1;
}

.d-hor-tabs .hor-banner__cta:hover {
    color: var(--hor-accent);
    border-color: #fff;
}

.d-hor-tabs .hor-banner__cta:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

.d-hor-tabs .hor-banner__cta svg {
    width: 18px;
    height: 18px;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    flex-shrink: 0;
}

.d-hor-tabs .hor-banner__cta:hover svg {
    transform: translateX(4px);
}

/* --- Tabs Navigation --- */
.d-hor-tabs .hor-tabs {
    position: absolute;
    bottom: 50px;
    left: 0;
    right: 0;
    z-index: 10;
}

/* Dynamic grid: uses --hor-tab-count set by JS */
.d-hor-tabs .hor-tabs__list {
    display: grid;
    grid-template-columns: repeat(var(--hor-tab-count, 4), 1fr);
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Individual Tab */
.d-hor-tabs .hor-tabs__item {
    position: relative;
    padding: 28px 26px;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    background: var(--hor-glass);
    -webkit-backdrop-filter: blur(18px) saturate(1.6);
    backdrop-filter: blur(18px) saturate(1.6);
}

.d-hor-tabs .hor-tabs__item:last-child {
    border-right: none;
}

/* Glassmorphism hover glow */
.d-hor-tabs .hor-tabs__item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(228, 30, 38, 0.06) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.d-hor-tabs .hor-tabs__item:hover::before {
    opacity: 1;
}

/* Active tab */
.d-hor-tabs .hor-tabs__item.active {
    background: var(--hor-accent);
    border-right-color: rgba(255, 255, 255, 0.15);
}

.d-hor-tabs .hor-tabs__item.active::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
    opacity: 1;
}

/* Active indicator line on top */
.d-hor-tabs .hor-tabs__item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--hor-accent);
}

.d-hor-tabs .hor-tabs__item:not(.active):hover::after {
    width: 100%;
    transition: width 0.3s ease;
}

.d-hor-tabs .hor-tabs__item.active::after {
    background: rgba(255, 255, 255, 0.6);
    width: 100%;
    transition: none;
    /* Use a CSS variable set by JS for exact sync, fallback to 6s */
    animation: htProgressBar var(--hor-auto-slide-duration, 6s) linear forwards;
}

.d-hor-tabs:hover .hor-tabs__item.active::after {
    animation-play-state: paused;
}

@keyframes htProgressBar {
    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }
}

/* Tab Icon */
.d-hor-tabs .hor-tabs__icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.d-hor-tabs .hor-tabs__item.active .hor-tabs__icon {
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.1);
}

.d-hor-tabs .hor-tabs__item:hover .hor-tabs__icon {
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.d-hor-tabs .hor-tabs__icon svg {
    width: 24px;
    height: 24px;
    color: #fff;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.d-hor-tabs .hor-tabs__item.active .hor-tabs__icon svg,
.d-hor-tabs .hor-tabs__item:hover .hor-tabs__icon svg {
    opacity: 1;
}

/* Tab Text */
.d-hor-tabs .hor-tabs__text {
    flex: 1;
    min-width: 0;
}

.d-hor-tabs .hor-tabs__title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #fff;
    margin-bottom: 8px;
    line-height: 1.3;
}

.d-hor-tabs .hor-tabs__desc {
    font-size: 13px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.68);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.d-hor-tabs .hor-tabs__item.active .hor-tabs__desc {
    color: rgba(255, 255, 255, 0.88);
}

/* Tab Arrow */
.d-hor-tabs .hor-tabs__arrow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: flex-end;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    margin-left: auto;
}

.d-hor-tabs .hor-tabs__arrow svg {
    width: 16px;
    height: 16px;
    color: #fff;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.d-hor-tabs .hor-tabs__item:hover .hor-tabs__arrow {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

.d-hor-tabs .hor-tabs__item.active .hor-tabs__arrow {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
}

.d-hor-tabs .hor-tabs__item:hover .hor-tabs__arrow svg,
.d-hor-tabs .hor-tabs__item.active .hor-tabs__arrow svg {
    transform: translateX(3px);
}

/* --- Scroll Arrow Buttons (Global) --- */
.d-hor-tabs .hor-tabs .container {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.d-hor-tabs .hor-tabs__list {
    flex: 1;
    min-width: 0;
}

.d-hor-tabs .hor-tabs__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    border: none;
    cursor: pointer;
    z-index: 5;
    transition: all 0.3s ease;
    background: rgba(15, 15, 20, 0.85);
    -webkit-backdrop-filter: blur(18px) saturate(1.6);
    backdrop-filter: blur(18px) saturate(1.6);
    color: #fff;
    flex-shrink: 0;
}

.d-hor-tabs .hor-tabs__nav:hover {
    background: var(--hor-accent);
}

.d-hor-tabs .hor-tabs__nav:disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.d-hor-tabs .hor-tabs__nav svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* =============================================
   RESPONSIVE
   ============================================= */

/* Large tablets / small desktops */
@media (max-width: 1199px) {
    .d-hor-tabs .hor-banner {
        min-height: 560px;
    }

    .d-hor-tabs .hor-banner__content {
        padding: 60px 0 230px;
    }

    .d-hor-tabs .hor-tabs__item {
        padding: 22px 20px;
    }

    .d-hor-tabs .hor-tabs__icon {
        width: 46px;
        height: 46px;
    }

    .d-hor-tabs .hor-tabs__title {
        font-size: 13px;
    }

    .d-hor-tabs .hor-tabs__desc {
        font-size: 12px;
    }
}

/* Tablets – horizontal scroll layout */
@media (max-width: 991px) {
    .d-hor-tabs .hor-banner {
        min-height: 620px;
    }

    .d-hor-tabs .hor-banner__content {
        padding: 50px 0 200px;
        max-width: 420px;
    }

    .d-hor-tabs .hor-banner__title {
        font-size: 36px;
    }

    /* Horizontal scrollable tabs with arrows */
    .d-hor-tabs .hor-tabs .container {
        padding: 0;
        max-width: 100%;
    }

    /* Scrollable tab list wrapper */
    .d-hor-tabs .hor-tabs__list {
        display: flex !important;
        grid-template-columns: unset;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
        flex: 1;
        min-width: 0;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .d-hor-tabs .hor-tabs__list::-webkit-scrollbar {
        display: none;
    }

    .d-hor-tabs .hor-tabs__item {
        min-width: 280px;
        flex-shrink: 0;
        border-bottom: none;
        scroll-snap-align: start;
    }
}

/* Mobile – content & slider optimisation */
@media (max-width: 767px) {
    .d-hor-tabs .hor-banner {
        min-height: auto;
        flex-direction: column;
        align-items: stretch;
    }

    /* Full-coverage white blur for content readability */
    .d-hor-tabs .hor-banner__slide::after {
        width: 100%;
        height: 100%;
        background: rgba(255, 255, 255, 0.85);
        border-radius: 0;
        filter: blur(0);
        top: 0;
        left: 0;
    }

    .d-hor-tabs .hor-banner__content {
        padding: 40px 0 30px;
        max-width: 100%;
    }

    .d-hor-tabs .hor-banner__title {
        font-size: 28px;
        margin-bottom: 14px;
    }

    .d-hor-tabs .hor-banner__subtitle {
        font-size: 11px;
        letter-spacing: 2px;
        margin-bottom: 12px;
    }

    .d-hor-tabs .hor-banner__subtitle::before {
        width: 30px;
    }

    .d-hor-tabs .hor-banner__desc {
        font-size: 13.5px;
        line-height: 1.6;
        margin-bottom: 22px;
    }

    .d-hor-tabs .hor-banner__cta {
        padding: 12px 26px;
        font-size: 12px;
        letter-spacing: 1.5px;
    }

    /* Tabs – move to bottom, relative flow (not absolute) */
    .d-hor-tabs .hor-tabs {
        position: relative;
        bottom: auto;
    }

    /* Full-width tab cards: each card fills viewport minus the two arrow buttons */
    .d-hor-tabs .hor-tabs__item {
        min-width: calc(100vw - 72px);
        max-width: calc(100vw - 72px);
        width: calc(100vw - 72px);
        flex: 0 0 calc(100vw - 72px);
        padding: 18px 16px;
        gap: 12px;
        white-space: normal;
        word-wrap: break-word;
        word-break: break-word;
        overflow: hidden;
        scroll-snap-align: start;
        flex-wrap: nowrap;
    }

    .d-hor-tabs .hor-tabs__text {
        flex: 1;
        min-width: 0;
        max-width: calc(100% - 96px);
        overflow: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .d-hor-tabs .hor-tabs__icon {
        width: 40px;
        height: 40px;
    }

    .d-hor-tabs .hor-tabs__icon svg {
        width: 20px;
        height: 20px;
    }

    .d-hor-tabs .hor-tabs__title {
        font-size: 13px;
        letter-spacing: 1px;
        margin-bottom: 5px;
        white-space: normal !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .d-hor-tabs .hor-tabs__desc {
        font-size: 12px;
        display: block !important;
        -webkit-line-clamp: unset !important;
        -webkit-box-orient: unset !important;
        white-space: normal !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        overflow: visible;
    }

    .d-hor-tabs .hor-tabs__arrow {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
        align-self: center;
    }

    .d-hor-tabs .hor-tabs__arrow svg {
        width: 14px;
        height: 14px;
    }

    .d-hor-tabs .hor-tabs__nav {
        width: 36px;
        min-width: 36px;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .d-hor-tabs .hor-banner__content {
        padding: 30px 0 24px;
    }

    .d-hor-tabs .hor-banner__title {
        font-size: 24px;
    }

    .d-hor-tabs .hor-banner__desc {
        font-size: 13px;
    }

    .d-hor-tabs .hor-tabs__item {
        min-width: calc(100vw - 64px);
        width: calc(100vw - 64px);
        flex: 0 0 calc(100vw - 64px);
        padding: 14px 14px;
    }

    .d-hor-tabs .hor-tabs__nav {
        width: 32px;
        min-width: 32px;
    }
}