/* ==========================================================
   STAI Al Hidayah - Hero Slider
   ========================================================== */
:root {
    --stai-header-h: 125px;   /* tinggi header, sesuaikan jika berubah */
    --stai-green: #13846a;
    --stai-gold: #f1c40f;
    --stai-delay: 5000ms;     /* samakan dengan autoplay delay di JS */
}

.stai-hero {
    position: relative;
    width: 100%;
    height: calc(100dvh - var(--stai-header-h));
    min-height: 480px;
    max-height: 860px;
    background: #0b1f1a;
    overflow: hidden;
    isolation: isolate;
    font-family: 'Open Sans', sans-serif;
}

.stai-hero .swiper,
.stai-hero .swiper-slide {
    width: 100%;
    height: 100%;
}

/* FIX: pemotongan dilakukan di sini, bukan di slide */
.stai-hero .swiper {
    overflow: hidden;
    clip-path: inset(0);
}

/* FIX: slide tidak memotong, supaya overscan 2px menutup celah sub-pixel */
.stai-hero .swiper-slide {
    position: relative;
    display: flex;
    align-items: center;
    overflow: visible;
    background: #0b1f1a;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* ---------- Background ---------- */
/* FIX: lebih lebar 2px di kiri & kanan dari slide */
.stai-bg-wrapper {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -2px;
    right: -2px;
    z-index: 1;
    overflow: hidden;
    background: #0b1f1a;
}

.stai-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transform: scale(1.12);
    transform-origin: center center;
    transition: transform 7s cubic-bezier(.22, .61, .36, 1);
    will-change: transform;
}

.swiper-slide-active .stai-bg {
    transform: scale(1);
}

/* Overlay gradasi (di dalam wrapper, jadi ikut overscan) */
.stai-bg-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(5, 25, 20, .88) 0%, rgba(5, 25, 20, .55) 25%, rgba(5, 25, 20, .10) 100%),
        linear-gradient(0deg, rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, 0) 40%);
    pointer-events: none;
}

/* ---------- Konten ---------- */
.stai-box-content {
    position: relative;
    z-index: 10;
    width: min(680px, 88%);
    margin-left: 8%;
    color: #fff;
}

.stai-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--stai-gold);
}

.stai-eyebrow::before {
    content: '';
    width: 44px;
    height: 3px;
    border-radius: 3px;
    background: var(--stai-gold);
}

.stai-tag-main {
    margin: 0 0 20px;
    font-size: clamp(1.9rem, 4.2vw, 3.6rem);
    font-weight: 800;
    line-height: 1.15;
    text-transform: uppercase;
    letter-spacing: -.01em;
    text-shadow: 0 4px 24px rgba(0, 0, 0, .35);
}

.stai-tag-sub {
    display: inline-block;
    max-width: 560px;
    padding: 18px 24px;
    font-size: clamp(.9rem, 1.2vw, 1.1rem);
    font-weight: 500;
    line-height: 1.6;
    color: #f4f4f4;
    background: rgba(255, 255, 255, .10);
    border: 0px solid rgba(255, 255, 255, .22);
    border-left: 4px solid var(--stai-gold);
    border-radius: 0 14px 14px 0;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

/* Animasi masuk bertahap (hanya saat slide aktif) */
.stai-eyebrow,
.stai-tag-main,
.stai-tag-sub {
    opacity: 0;
    transform: translateY(32px);
}

.swiper-slide-active .stai-eyebrow,
.swiper-slide-active .stai-tag-main,
.swiper-slide-active .stai-tag-sub,
.swiper-slide:first-child .stai-eyebrow,
.swiper-slide:first-child .stai-tag-main,
.swiper-slide:first-child .stai-tag-sub {
    opacity: 1;
    transform: translateY(0);
    transition: opacity .8s ease, transform .8s cubic-bezier(.22, .61, .36, 1);
}

.swiper-slide-active .stai-eyebrow  { transition-delay: .35s; }
.swiper-slide-active .stai-tag-main { transition-delay: .55s; }
.swiper-slide-active .stai-tag-sub  { transition-delay: .80s; }

.swiper-slide:first-child:not(.swiper-slide-active) .stai-eyebrow,
.swiper-slide:first-child:not(.swiper-slide-active) .stai-tag-main,
.swiper-slide:first-child:not(.swiper-slide-active) .stai-tag-sub {
    opacity: 0;
    transform: translateY(32px);
}

/* ---------- Progress bar autoplay ---------- */
.stai-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 15;
    width: 100%;
    height: 6px;
}

.stai-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--stai-green), var(--stai-gold));
}

.swiper-slide-active .stai-progress span {
    animation: staiProgress var(--stai-delay) linear forwards;
}

@keyframes staiProgress {
    from { width: 0; }
    to   { width: 100%; }
}

/* ---------- Penghitung halaman (01 / 05) ---------- */
.stai-counter {
    position: absolute;
    right: 5%;
    bottom: 40px;
    z-index: 20;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .12em;
    color: rgba(255, 255, 255, .75);
    text-shadow: 0 2px 10px rgba(0, 0, 0, .4);
}

.stai-counter .stai-current {
    font-size: 1.8rem;
    color: #fff;
}

/* ---------- Pagination ---------- */
.stai-hero .swiper-pagination {
    left: 8%;
    bottom: 44px;
    width: auto;
    text-align: left;
}

.stai-hero .swiper-pagination-bullet {
    width: 28px;
    height: 4px;
    margin: 0 5px 0 0 !important;
    border-radius: 4px;
    background: rgba(255, 255, 255, .45);
    opacity: 1;
    transition: width .3s, background .3s;
}

.stai-hero .swiper-pagination-bullet-active {
    width: 54px;
    background: var(--stai-gold);
}

/* ---------- Tablet & Mobile ---------- */
@media (max-width: 991px) {
    .stai-box-content { margin-left: 6%; }
    .stai-counter { right: 6%; }
}

@media (max-width: 768px) {
    .stai-hero {
        /* 1. Turunkan tinggi agar bentuknya lebar (landscape), bukan tinggi */
        height: 46svh;        /* Sebelumnya 72svh */
        min-height: 270px;    /* Sebelumnya 420px */
        max-height: 360px;    /* Sebelumnya 620px */
    }

    /* 2. Atur posisi fokus & zoom foto di HP agar terlihat lebih lebar */
    .stai-bg {
        object-position: center bottom; /* Fokus ke bagian atas/tengah foto agar kepala tidak terpotong */
        transform: scale(1.04);      /* Kurangi zoom awal (sebelumnya 1.12) agar bidang foto lebih luas */
    }

    .stai-hero .swiper-slide { align-items: flex-end; }

    .stai-bg-wrapper::after {
        background: linear-gradient(0deg, rgba(5, 25, 20, .92) 0%, rgba(5, 25, 20, .45) 25%, rgba(5, 25, 20, .15) 100%);
    }

    /* 3. Rapikan jarak teks karena tinggi container sekarang lebih ringkas */
    .stai-box-content {
        width: 88%;
        margin: 0 6% 48px; /* Sebelumnya 78px */
    }

    .stai-eyebrow { font-size: .65rem; margin-bottom: 6px; }
    .stai-eyebrow::before { width: 24px; }

    .stai-tag-main { font-size: 1.15rem; margin-bottom: 8px; }

    .stai-tag-sub {
        padding: 8px 12px;
        font-size: .75rem;
        line-height: 1.45;
        border-radius: 0 10px 10px 0;
        display: -webkit-box;
        -webkit-line-clamp: 2; /* Batasi 2 baris agar tidak menutupi wajah di foto */
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .stai-counter {
        bottom: 14px; /* Sebelumnya 22px */
        font-size: .72rem;
    }

    .stai-counter .stai-current { font-size: 1.05rem; }

    .stai-hero .swiper-pagination { left: 6%; bottom: 18px; } /* Sebelumnya 30px */
    .stai-hero .swiper-pagination-bullet { width: 16px; }
    .stai-hero .swiper-pagination-bullet-active { width: 32px; }
}

/* Hormati pengguna yang mematikan animasi */
@media (prefers-reduced-motion: reduce) {
    .stai-bg,
    .stai-eyebrow,
    .stai-tag-main,
    .stai-tag-sub { transition: none !important; transform: none !important; }
    .swiper-slide-active .stai-progress span { animation: none; width: 100%; }
}