/* =================================================================
   Custom Features Section — cfs.css  v1.1
   Fixed: height issue, stacking, transitions, responsive
   ================================================================= */

/* ── Wrapper ── */
.cfs-wrap {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* ── Section Header ── */
.cfs-header {
    margin-bottom: 64px;
}
.cfs-eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #4F46E5;
    background: rgba(79,70,229,.1);
    padding: 5px 14px;
    border-radius: 999px;
    margin-bottom: 14px;
}
.cfs-header-title {
    font-size: clamp(26px,3.5vw,42px);
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 12px;
    line-height: 1.15;
}
.cfs-header-sub {
    font-size: 17px;
    color: #64748b;
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ── Progress Bar ── */
.cfs-progress-wrap {
    width: 100%;
    height: 3px;
    background: #e2e8f0;
    border-radius: 2px;
    margin-bottom: 40px;
    overflow: hidden;
}
.cfs-progress-bar {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: width .25s ease;
}

/* ── Desktop Row ── */
.cfs-row {
    display: flex;
    align-items: flex-start;
    gap: 80px;
    position: relative;
}
.cfs-reverse {
    flex-direction: row-reverse;
}

/* ── Content Column ── */
.cfs-content-col {
    width: 45%;
    flex-shrink: 0;
}

/* ── Media Column ── */
.cfs-media-col {
    flex: 1;
    min-width: 0;
}
.cfs-sticky {
    position: sticky;
    top: 100px;
}

/* ================================================================
   MEDIA FRAME — THE KEY FIX
   We use a padding-bottom trick to give the frame its height
   instead of aspect-ratio (which doesn't work on position:relative
   containers with absolute children in all browsers/themes).
   ================================================================ */
.cfs-media-frame {
    position: relative;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: #f1f5f9;
    /* Default 16:9 */
    padding-bottom: 56.25%;
    height: 0;
}

/* Aspect ratio overrides via data-attribute */
.cfs-media-frame[data-aspect="16/9"]  { padding-bottom: 56.25%; }
.cfs-media-frame[data-aspect="4/3"]   { padding-bottom: 75%; }
.cfs-media-frame[data-aspect="3/2"]   { padding-bottom: 66.67%; }
.cfs-media-frame[data-aspect="1/1"]   { padding-bottom: 100%; }
.cfs-media-frame[data-aspect="9/16"]  { padding-bottom: 177.78%; }
.cfs-media-frame[data-aspect="auto"]  { padding-bottom: 0; height: auto; min-height: 320px; }

/* ── Media Items — ALL absolutely positioned inside the frame ── */
.cfs-media-item {
    position: absolute;
    inset: 0;           /* top:0 right:0 bottom:0 left:0 */
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: inherit;

    /* Hidden by default */
    opacity: 0;
    pointer-events: none;
    will-change: opacity, transform;

    /* Default fade transition — overridden by variant classes below */
    transition: opacity 550ms ease;
}

/* Active state */
.cfs-media-item.cfs-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

.cfs-media-item img,
.cfs-media-item video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cfs-iframe-wrap {
    width: 100%;
    height: 100%;
}
.cfs-iframe-wrap iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.cfs-caption {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 8px 14px;
    background: rgba(0,0,0,.45);
    color: #e2e8f0;
    font-size: 12px;
    text-align: center;
    z-index: 5;
}

.cfs-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #94a3b8;
    font-size: 13px;
}

/* ================================================================
   TRANSITION VARIANTS
   Applied by JS as cfs-t-{name} on .cfs-media-frame
   Each variant overrides the transition + inactive transform
   ================================================================ */

/* FADE */
.cfs-t-fade .cfs-media-item {
    transition-property: opacity;
    transform: none !important;
}

/* SLIDE UP — inactive slides sit 28px below */
.cfs-t-slide-up .cfs-media-item {
    transition-property: opacity, transform;
    transform: translateY(28px);
}
.cfs-t-slide-up .cfs-media-item.cfs-active {
    transform: translateY(0) !important;
}

/* SLIDE DOWN — inactive slides sit 28px above */
.cfs-t-slide-down .cfs-media-item {
    transition-property: opacity, transform;
    transform: translateY(-28px);
}
.cfs-t-slide-down .cfs-media-item.cfs-active {
    transform: translateY(0) !important;
}

/* ZOOM IN — inactive slides smaller */
.cfs-t-zoom-in .cfs-media-item {
    transition-property: opacity, transform;
    transform: scale(.88);
}
.cfs-t-zoom-in .cfs-media-item.cfs-active {
    transform: scale(1) !important;
}

/* ZOOM OUT — inactive slides larger */
.cfs-t-zoom-out .cfs-media-item {
    transition-property: opacity, transform;
    transform: scale(1.12);
}
.cfs-t-zoom-out .cfs-media-item.cfs-active {
    transform: scale(1) !important;
}

/* FLIP */
.cfs-t-flip .cfs-media-item {
    transition-property: opacity, transform;
    transform: perspective(700px) rotateY(20deg);
}
.cfs-t-flip .cfs-media-item.cfs-active {
    transform: perspective(700px) rotateY(0deg) !important;
}

/* BLUR FADE */
.cfs-t-blur .cfs-media-item {
    transition-property: opacity, filter, transform;
    filter: blur(10px);
    transform: scale(1.04);
}
.cfs-t-blur .cfs-media-item.cfs-active {
    filter: blur(0) !important;
    transform: scale(1) !important;
}

/* ================================================================
   SLIDE CONTENT BLOCKS
   ================================================================ */
.cfs-slide:not(:last-child) {
    margin-bottom: 160px;
}
.cfs-slide-inner {
    display: flex;
    flex-direction: column;
    gap: 24px;
    /* Do NOT hide by default — only hidden if content anim enabled */
}

/* ── Tag / Badge ── */
.cfs-tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 5px 14px;
    border-radius: 999px;
    width: fit-content;
}

/* ── Icon ── */
.cfs-icon {
    display: inline-flex;
    align-items: center;
    font-size: 32px;
    line-height: 1;
}
.cfs-icon i   { font-size: inherit; }
.cfs-icon svg { width: 1em; height: 1em; }

/* ── Title ── */
.cfs-title {
    font-size: clamp(22px, 2.5vw, 34px);
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    line-height: 1.2;
}

/* ── Description ── */
.cfs-desc {
    font-size: 16px;
    color: #64748b;
    line-height: 1.75;
    margin: 0;
}

/* ── Feature List ── */
.cfs-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cfs-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 15px;
    color: #334155;
    line-height: 1.5;
}
.cfs-list-icon {
    flex-shrink: 0;
    font-size: 13px;
    margin-top: 3px;
    line-height: 1;
}

/* ── Button ── */
.cfs-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    width: fit-content;
    cursor: pointer;
    transition: filter .2s ease, transform .2s ease, box-shadow .2s ease;
}
.cfs-btn:hover {
    filter: brightness(.9);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    text-decoration: none;
}
.cfs-btn svg { transition: transform .2s ease; }
.cfs-btn:hover svg { transform: translateX(4px); }

/* ================================================================
   CONTENT ANIMATION
   .cfs-ca-{name} added to .cfs-slide-inner
   .cfs-ca-in = revealed state
   Default: all slides visible. Anim only applies when JS adds class.
   ================================================================ */
.cfs-slide-inner.cfs-anim-init {
    opacity: 0;
    transition-property: opacity, transform;
}
.cfs-slide-inner.cfs-anim-init.cfs-ca-fade-up   { transform: translateY(22px); }
.cfs-slide-inner.cfs-anim-init.cfs-ca-fade-left  { transform: translateX(22px); }
.cfs-slide-inner.cfs-anim-init.cfs-ca-fade-right { transform: translateX(-22px); }
.cfs-slide-inner.cfs-anim-init.cfs-ca-zoom       { transform: scale(.95); }

.cfs-slide-inner.cfs-anim-in {
    opacity: 1 !important;
    transform: none !important;
}

/* ================================================================
   PROGRESS DOTS
   ================================================================ */
.cfs-dots {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-top: 14px;
}
.cfs-dots-right {
    position: absolute;
    right: -26px;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    margin-top: 0;
}
.cfs-dots-left {
    position: absolute;
    left: -26px;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    margin-top: 0;
}
.cfs-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform .3s ease, width .3s ease, background .3s ease;
    display: block;
}
.cfs-dot-active { transform: scale(1.35); }
.cfs-dots:not(.cfs-dots-right):not(.cfs-dots-left) .cfs-dot-active {
    width: 22px;
    border-radius: 4px;
    transform: none;
}

/* ================================================================
   MOBILE SLIDER
   ================================================================ */
.cfs-mobile-slider { display: none; }
.cfs-mobile-slider.cfs-show { display: block !important; }

.cfs-mob-track-wrap {
    overflow: hidden;
    position: relative;
    width: 100%;
}
.cfs-mob-track {
    display: flex;
    will-change: transform;
    /* transition set by JS */
}
.cfs-mob-slide {
    min-width: 100%;
    box-sizing: border-box;
}
.cfs-mob-media {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    background: #f1f5f9;
}
.cfs-mob-media img,
.cfs-mob-media video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.cfs-mob-content { }
.cfs-mob-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
}
.cfs-mob-prev,
.cfs-mob-next {
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}
.cfs-mob-prev:hover, .cfs-mob-next:hover { background: #e2e8f0; }
.cfs-mob-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}
.cfs-mob-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    padding: 0;
    background: #CBD5E1;
    transition: background .25s, transform .25s, width .25s;
}
.cfs-mob-dot.active {
    transform: scale(1.35);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1024px) {
    .cfs-row { gap: 48px; }
    .cfs-content-col { width: 48% !important; }
}

/* Desktop row hidden on mobile when slider is on */
.cfs-row.cfs-hide-desktop { display: none !important; }

/* Fallback stacking when mobile slider disabled */
@media (max-width: 768px) {
    .cfs-row:not(.cfs-hide-desktop) {
        flex-direction: column !important;
        gap: 0 !important;
    }
    .cfs-row:not(.cfs-hide-desktop) .cfs-content-col,
    .cfs-row:not(.cfs-hide-desktop) .cfs-media-col {
        width: 100% !important;
    }
    .cfs-row:not(.cfs-hide-desktop) .cfs-sticky {
        position: static !important;
        margin-bottom: 28px;
    }
    .cfs-row:not(.cfs-hide-desktop) .cfs-media-col {
        order: -1;
    }
    .cfs-slide:not(:last-child) { margin-bottom: 60px !important; }
    .cfs-dots-right,
    .cfs-dots-left {
        position: static !important;
        transform: none !important;
        flex-direction: row !important;
        margin-top: 12px !important;
        justify-content: center !important;
    }
}
