/**
 * Digi Hero Slider — Stylesheet
 *
 * Prinsip desain:
 * - Track pakai position: relative + fixed height → ukuran TIDAK berubah antar slide
 * - Setiap slide pakai position: absolute + opacity fade → transisi halus tanpa layout shift
 * - object-fit: cover pada img → gambar mengisi area tanpa distorsi
 * - Semua unit responsif menggunakan % / vw sehingga tampilan desktop ≡ mobile
 *
 * @package DigiHeroSlider
 * @version 1.3.1
 */

/* ─────────────────────────────────────────────────
   1. WRAPPER UTAMA
───────────────────────────────────────────────── */

.digi-hero-slider {
        position: relative;
        width: 100%;
        overflow: hidden; /* Sembunyikan overflow dari slide yang sedang fade */
        display: block;
        line-height: 0; /* Hilangkan gap dari inline-block image */
}

/* ─────────────────────────────────────────────────
   2. TRACK — Kotak tetap yang menampung semua slide
   KUNCI: height diset via Elementor control, tidak berubah.
───────────────────────────────────────────────── */

.digi-hero-slider__track {
        position: relative;
        width: 100%;
        height: 600px; /* Fallback — override via Elementor responsive control */
}

/* ─────────────────────────────────────────────────
   3. SLIDE — Setiap slide ditumpuk via position absolute
   Fade in/out dikontrol lewat opacity + JS class .is-active
───────────────────────────────────────────────── */

.digi-hero-slider__slide {
        position: absolute;
        inset: 0; /* top:0 right:0 bottom:0 left:0 */
        width: 100%;
        height: 100%;
        opacity: 0;
        /* Transisi fade — duration dikontrol JS melalui CSS variable */
        transition: opacity var(--digi-fade-speed, 800ms) ease-in-out;
        pointer-events: none; /* Slide tidak aktif tidak bisa diklik */
        z-index: 1;
}

/* Slide aktif: tampil penuh */
.digi-hero-slider__slide.is-active {
        opacity: 1;
        pointer-events: auto;
        z-index: 2;
}

/* ─────────────────────────────────────────────────
   3.1 SLIDE DENGAN LINK — Style untuk slide yang clickable
───────────────────────────────────────────────── */

/* Slide yang memiliki link akan menunjukkan cursor pointer */
.digi-hero-slider__slide.has-link {
        cursor: pointer;
}

/* Hover effect untuk slide dengan link */
.digi-hero-slider__slide.has-link:hover .digi-hero-slider__overlay {
        background-color: rgba(0, 0, 0, 0.25);
        transition: background-color 0.3s ease;
}

/* Efek zoom subtle pada gambar saat hover (untuk slide dengan link) */
.digi-hero-slider__slide.has-link .digi-hero-slider__image img {
        transition: transform 0.5s ease, opacity 0.3s ease;
}

.digi-hero-slider__slide.has-link:hover .digi-hero-slider__image img {
        transform: scale(1.03);
}

/* Indikator visual bahwa slide bisa diklik (ikon di pojok) */
.digi-hero-slider__slide.has-link::after {
        content: '';
        position: absolute;
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        background-color: rgba(255, 255, 255, 0.2);
        border-radius: 50%;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 5;
        opacity: 0;
        transition: opacity 0.3s ease, transform 0.3s ease;
        /* Ikon panah menggunakan pseudo-element */
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17L17 7'/%3E%3Cpath d='M7 7h10v10'/%3E%3C/svg%3E");
        background-size: 20px;
        background-position: center;
        background-repeat: no-repeat;
}

.digi-hero-slider__slide.has-link:hover::after {
        opacity: 1;
        transform: translate(-5px, -5px) scale(1.1);
}

/* ─────────────────────────────────────────────────
   4. GAMBAR — Mengisi area 100% tanpa distorsi
───────────────────────────────────────────────── */

.digi-hero-slider__image {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        line-height: 0;
}

.digi-hero-slider__image img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;        /* Ubah via Elementor control */
        object-position: center;  /* Ubah via Elementor control */
        margin: 0;
        padding: 0;
        border: 0;
}

/* ─────────────────────────────────────────────────
   5. OVERLAY — Lapisan warna di atas gambar
───────────────────────────────────────────────── */

.digi-hero-slider__overlay {
        position: absolute;
        inset: 0;
        background-color: rgba(0, 0, 0, 0.3); /* Ubah via Elementor control */
        z-index: 3;
        transition: background-color 0.3s ease;
}

/* ─────────────────────────────────────────────────
   6. VIDEO PLAY BUTTON
───────────────────────────────────────────────── */

.digi-hero-slider__play-btn-wrapper {
        position: absolute;
        inset: 0;
        z-index: 5;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 16px;
        pointer-events: none; /* Biarkan event klik tembus ke wrapper luar, dikontrol oleh JS wrapper (slide link / btn) */
}

.digi-video-play-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 90px;  /* Default override via Elementor control */
        height: 90px; /* Default override via Elementor control */
        background-color: rgba(220, 38, 38, 0.9); /* YouTube red — override via Elementor */
        color: #ffffff;
        border: none;
        border-radius: 50%;
        cursor: pointer;
        pointer-events: auto; /* Bisa diklik */
        transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.3s ease, box-shadow 0.3s ease;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        padding: 0;
        box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 0 0 8px rgba(220, 38, 38, 0.15); /* Halo effect */
}

.digi-video-play-btn svg {
        width: 44px;   /* Default triangle size — override via Elementor control */
        height: 44px;
        fill: currentColor;
        margin-left: 5px; /* Optically center the triangle (push slightly right) */
        flex-shrink: 0;
}

.digi-video-play-btn:hover {
        transform: scale(1.12);
        background-color: #dc2626;
        box-shadow: 0 16px 40px rgba(0,0,0,0.45), 0 0 0 12px rgba(220, 38, 38, 0.1);
}

.digi-video-play-text {
        color: #ffffff;
        font-size: 16px;
        font-weight: 600;
        text-shadow: 0 2px 4px rgba(0,0,0,0.5);
        pointer-events: none;
}

/* ── Play Button Style Variants ─────────────────── */
.digi-play-style-01 .digi-video-play-btn {
        /* Default solid red */
}

.digi-play-style-02 .digi-video-play-btn {
        background-color: rgba(255, 255, 255, 0.2);
        border: 2px solid #ffffff;
        color: #ffffff;
        box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}
.digi-play-style-02 .digi-video-play-btn:hover {
        background-color: #ffffff;
        color: #111111;
}

.digi-play-style-03 .digi-video-play-btn {
        background-color: rgba(0, 0, 0, 0.55);
        color: #ffffff;
        box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.digi-play-style-03 .digi-video-play-btn:hover {
        background-color: rgba(0, 0, 0, 0.85);
        color: #ff0000;
}

.digi-play-style-04 .digi-video-play-btn {
        background-color: transparent;
        color: rgba(255, 255, 255, 0.85);
        border: 3px solid rgba(255,255,255,0.7);
        box-shadow: none;
}
.digi-play-style-04 .digi-video-play-btn:hover {
        color: #ffffff;
        border-color: #ffffff;
        background-color: rgba(255,255,255,0.1);
}

/* ── Play Button Animations — Keyframes ─────────── */

/* RIPPLE / WAVE — Gelombang meluas seperti YouTube */
@keyframes digi-ripple {
        0% {
                box-shadow:
                        0 0 0 0   rgba(220, 38, 38, 0.7),
                        0 0 0 0   rgba(220, 38, 38, 0.4),
                        0 8px 32px rgba(0,0,0,0.35), 0 0 0 8px rgba(220,38,38,0.15);
        }
        50% {
                box-shadow:
                        0 0 0 22px rgba(220, 38, 38, 0),
                        0 0 0 44px rgba(220, 38, 38, 0),
                        0 8px 32px rgba(0,0,0,0.35), 0 0 0 8px rgba(220,38,38,0.1);
        }
        100% {
                box-shadow:
                        0 0 0 0   rgba(220, 38, 38, 0),
                        0 0 0 0   rgba(220, 38, 38, 0),
                        0 8px 32px rgba(0,0,0,0.35), 0 0 0 8px rgba(220,38,38,0.15);
        }
}

/* PULSE — Denyut scale naik-turun */
@keyframes digi-pulse {
        0%, 100% { transform: scale(1); }
        50%       { transform: scale(1.12); }
}

/* GLOW — Cahaya berdenyut di sekeliling tombol */
@keyframes digi-glow {
        0%, 100% {
                box-shadow:
                        0 0 16px  4px rgba(220, 38, 38, 0.45),
                        0 8px 32px rgba(0,0,0,0.35);
        }
        50% {
                box-shadow:
                        0 0 40px 14px rgba(220, 38, 38, 0.85),
                        0 0 70px 24px rgba(220, 38, 38, 0.35),
                        0 8px 32px rgba(0,0,0,0.35);
        }
}

/* FLOATING — Melayang naik-turun */
@keyframes digi-floating {
        0%, 100% { transform: translateY(0); }
        50%       { transform: translateY(-12px); }
}

/* ── Apply animation classes ─────────────────────── */

.digi-video-play-btn.digi-anim-ripple {
        animation: digi-ripple 2.2s ease-out infinite;
}

.digi-video-play-btn.digi-anim-pulse {
        animation: digi-pulse 1.6s ease-in-out infinite;
}

.digi-video-play-btn.digi-anim-glow {
        animation: digi-glow 2s ease-in-out infinite;
}

.digi-video-play-btn.digi-anim-floating {
        animation: digi-floating 2.2s ease-in-out infinite;
}

/* Hover mematikan animasi sementara untuk kejelasan interaksi */
.digi-video-play-btn.digi-anim-pulse:hover,
.digi-video-play-btn.digi-anim-floating:hover {
        animation-play-state: paused;
}

/* Reduced motion — disable semua animasi */
@media (prefers-reduced-motion: reduce) {
        .digi-video-play-btn.digi-anim-ripple,
        .digi-video-play-btn.digi-anim-pulse,
        .digi-video-play-btn.digi-anim-glow,
        .digi-video-play-btn.digi-anim-floating {
                animation: none !important;
        }
}

/* ─────────────────────────────────────────────────
   7. KONTEN TEKS & CTA
───────────────────────────────────────────────── */

.digi-hero-slider__content {
        position: absolute;
        inset: 0;
        z-index: 4;
        display: flex;
        flex-direction: column;
        align-items: center;     /* Override via Elementor control */
        justify-content: center; /* Override via Elementor control */
        padding: 40px;
        box-sizing: border-box;
        line-height: initial; /* Reset dari parent */
}

.digi-hero-slider__content-inner {
        display: flex;
        flex-direction: column;
        align-items: inherit;
        gap: 16px;
        max-width: 800px;
        width: 100%;
        text-align: center; /* Default */
}

/* Text-align mapping untuk prefix_class dari Elementor control */
.digi-align-flex-start .digi-hero-slider__content-inner {
        text-align: left;
}
.digi-align-center .digi-hero-slider__content-inner {
        text-align: center;
}
.digi-align-flex-end .digi-hero-slider__content-inner {
        text-align: right;
}

/* Heading slide */
.digi-hero-slider__title {
        margin: 0;
        padding: 0;
        font-size: clamp(28px, 4vw, 56px); /* Fluid: min 28px, max 56px */
        font-weight: 700;
        line-height: 1.15;
        color: #ffffff;
        letter-spacing: -0.02em;
}

/* Subheading slide */
.digi-hero-slider__subtitle {
        margin: 0;
        padding: 0;
        font-size: clamp(15px, 1.6vw, 20px); /* Fluid typography */
        font-weight: 400;
        line-height: 1.6;
        color: rgba(255, 255, 255, 0.85);
}

/* Tombol CTA */
.digi-hero-slider__btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 12px 32px;
        background-color: rgba(255, 255, 255, 0.15);
        color: #ffffff;
        border: 2px solid #ffffff;
        border-radius: 4px;
        font-size: 15px;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-decoration: none;
        cursor: pointer;
        /* Hover transition */
        transition: background-color 0.25s ease, color 0.25s ease, transform 0.2s ease;
        backdrop-filter: blur(4px); /* Efek frosted glass subtle */
        -webkit-backdrop-filter: blur(4px);
        align-self: inherit; /* Ikut perataan dari .content-inner */
        line-height: normal;
        margin-top: 4px;
        z-index: 10; /* Pastikan tombol di atas elemen lain untuk klik */
        position: relative;
}

.digi-hero-slider__btn:hover,
.digi-hero-slider__btn:focus {
        background-color: #ffffff;
        color: #111111;
        transform: translateY(-2px);
        outline: 2px solid transparent;
}

.digi-hero-slider__btn:focus-visible {
        outline: 3px solid rgba(255, 255, 255, 0.8);
        outline-offset: 3px;
}

/* ─────────────────────────────────────────────────
   7. NAVIGASI — Panah Prev/Next
───────────────────────────────────────────────── */

.digi-hero-slider__arrow {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        background-color: rgba(255, 255, 255, 0.15);
        border: 1.5px solid rgba(255, 255, 255, 0.4);
        border-radius: 50%;
        color: #ffffff;
        cursor: pointer;
        transition: background-color 0.2s ease, transform 0.2s ease;
        padding: 0;
        line-height: 0;
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
}

.digi-hero-slider__arrow svg {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
}

.digi-hero-slider__arrow--prev {
        left: 20px;
}

.digi-hero-slider__arrow--next {
        right: 20px;
}

.digi-hero-slider__arrow:hover {
        background-color: rgba(255, 255, 255, 0.3);
        transform: translateY(-50%) scale(1.08);
}

.digi-hero-slider__arrow:focus-visible {
        outline: 3px solid rgba(255, 255, 255, 0.8);
        outline-offset: 2px;
}

/* ─────────────────────────────────────────────────
   8. NAVIGASI — Dots
───────────────────────────────────────────────── */

.digi-hero-slider__dots {
        position: absolute;
        bottom: 50px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 10;
        display: flex;
        align-items: center;
        gap: 8px;
}

.digi-hero-slider__dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: rgba(255, 255, 255, 0.5);
        border: none;
        padding: 0;
        cursor: pointer;
        transition: background-color 0.3s ease, transform 0.3s ease, width 0.3s ease;
        flex-shrink: 0;
}

/* Dot aktif — melebar jadi pill */
.digi-hero-slider__dot.is-active {
        background-color: #ffffff;
        width: 24px;
        border-radius: 4px;
        transform: none;
}

.digi-hero-slider__dot:hover:not(.is-active) {
        background-color: rgba(255, 255, 255, 0.8);
        transform: scale(1.2);
}

.digi-hero-slider__dot:focus-visible {
        outline: 2px solid #ffffff;
        outline-offset: 2px;
}

/* ─────────────────────────────────────────────────
   9. PROGRESS BAR (Autoplay indicator)
   Bar kecil di bawah slider — animasi via JS class
───────────────────────────────────────────────── */

.digi-hero-slider__progress {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 0%;
        height: 3px;
        background-color: rgba(255, 255, 255, 0.7);
        z-index: 10;
        transition: none; /* Dikontrol JS */
}

.digi-hero-slider__progress.is-animating {
        transition: width linear; /* Duration di-set via JS inline style */
}

/* ─────────────────────────────────────────────────
   10. RESPONSIVE — Sesuaikan padding & arrows di mobile
   PENTING: Ukuran TRACK tidak berubah, hanya UI sekitar.
───────────────────────────────────────────────── */

@media screen and (max-width: 767px) {
        .digi-hero-slider__content {
                padding: 24px 20px;
        }

        .digi-hero-slider__arrow {
                width: 38px;
                height: 38px;
        }

        .digi-hero-slider__arrow svg {
                width: 18px;
                height: 18px;
        }

        .digi-hero-slider__arrow--prev {
                left: 12px;
        }

        .digi-hero-slider__arrow--next {
                right: 12px;
        }

        .digi-hero-slider__btn {
                font-size: 14px;
        }

        /* Sembunyikan indikator link di mobile untuk mengurangi clutter */
        .digi-hero-slider__slide.has-link::after {
                width: 32px;
                height: 32px;
                bottom: 15px;
                right: 15px;
                background-size: 16px;
        }
}

/* ─────────────────────────────────────────────────
   11. ACCESSIBILITY — Reduced motion
───────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
        .digi-hero-slider__slide {
                transition: opacity 0.01ms !important;
        }
        .digi-hero-slider__btn,
        .digi-hero-slider__arrow,
        .digi-hero-slider__dot,
        .digi-hero-slider__slide.has-link .digi-hero-slider__image img,
        .digi-hero-slider__slide.has-link::after {
                transition: none !important;
        }
}

/* ─────────────────────────────────────────────────
   12. VIDEO POPUP MODAL
───────────────────────────────────────────────── */

.digi-hero-video-popup {
        position: fixed;
        inset: 0;
        z-index: 999999;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
}

.digi-hero-video-popup.is-open {
        opacity: 1;
        visibility: visible;
}

.digi-hero-video-popup.is-closing {
        opacity: 0;
        visibility: hidden;
}

.digi-hero-video-popup__overlay {
        position: absolute;
        inset: 0;
        background-color: rgba(0, 0, 0, 0.9);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        cursor: pointer;
}

.digi-hero-video-popup__close {
        position: absolute;
        top: 20px;
        right: 20px;
        z-index: 2;
        width: 48px;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: transparent;
        border: none;
        color: #ffffff;
        cursor: pointer;
        opacity: 0.7;
        transition: opacity 0.2s ease, transform 0.2s ease;
        padding: 0;
}

.digi-hero-video-popup__close:hover {
        opacity: 1;
        transform: scale(1.1);
}

.digi-hero-video-popup__close svg {
        width: 32px;
        height: 32px;
}

.digi-hero-video-popup__content {
        position: relative;
        z-index: 1;
        width: 90%;
        max-width: 1100px;
        aspect-ratio: 16 / 9;
        background-color: #000;
        box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
        border-radius: 8px;
        overflow: hidden;
        transform: scale(0.95);
        transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.digi-hero-video-popup.is-open .digi-hero-video-popup__content {
        transform: scale(1);
}

.digi-hero-video-popup__content iframe {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        border: none;
}

@media screen and (max-width: 767px) {
        .digi-hero-video-popup__close {
                top: 10px;
                right: 10px;
                width: 40px;
                height: 40px;
        }
        .digi-hero-video-popup__content {
                width: 100%;
                border-radius: 0;
        }
}

/* ─────────────────────────────────────────────────
   13. PRINT STYLES
───────────────────────────────────────────────── */

@media print {
        .digi-hero-slider__arrow,
        .digi-hero-slider__dots,
        .digi-hero-slider__slide.has-link::after {
                display: none !important;
        }

        .digi-hero-slider__slide {
                opacity: 1 !important;
                position: relative !important;
        }

        .digi-hero-slider__slide:not(:first-child) {
                display: none !important;
        }
}
