/* ================== Base ================== */
:root {
    --carousel-cycle: 15s;
    --fade-duration: 1s;
    /* Las imágenes vienen desde Blade:
       --img-base, --img-2, --img-3  */
}

body {
    background-color: #f8f9fa;
    margin: 0;
}

/* ================== Header / Carrusel ================== */
.header {
    position: relative;
    height: 60vh;
    min-height: 420px;
    color: #fff;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Imagen de fondo base */
.header::before {
    content: "";
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-image:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.25) 100%),
        var(--img-base);
    z-index: -2;
}

/* Capa animada (se superpone y cambia entre imagen 2 e imagen 3) */
.header::after {
    content: "";
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-image:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.25) 100%),
        var(--img-2);
    /* arranca como imagen 2 */
    z-index: -1;
    opacity: 0;
    /* fadeCycle controla la opacidad; changeImage cambia la imagen cuando está oculto */
    animation:
        fadeCycle var(--carousel-cycle) linear infinite both,
        changeImage var(--carousel-cycle) steps(1, end) infinite both;
}

/* ================== Tipografía interna ================== */
.header h1 {
    font-size: clamp(2.2rem, 6vw, 4.5rem);
    line-height: 1;
    margin: 0 0 20px 0;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 1px;
    display: inline-block;
    padding: 0.25em 0.6em;
    color: #fff;
    background: linear-gradient(90deg, #2979ff 0%, #55b6ff 100%);
    border-radius: 50px;
    opacity: 0.7;
}

.breadcrumb-nav {
    font-size: 1.1rem;
    color: #dee2e6;
}

.breadcrumb-nav a {
    color: #dee2e6;
    text-decoration: none;
}

.breadcrumb-nav a:hover {
    text-decoration: underline;
}

.breadcrumb-nav span {
    color: #dee2e6;
}

/* ================== Animaciones sincronizadas ================== */
@keyframes fadeCycle {
    0%, 30% { opacity: 0; }
    33.333% { opacity: 1; }
    63.333% { opacity: 1; }
    66.666% { opacity: 0; }
    70%     { opacity: 1; }
    96.666% { opacity: 1; }
    100%    { opacity: 0; }
}

/* La imagen SOLO cambia mientras la capa está oculta (en 66.666%) */
@keyframes changeImage {
    0%, 66.665% {
        background-image:
            linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.25) 100%),
            var(--img-2);
    }
    66.666%, 100% {
        background-image:
            linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.25) 100%),
            var(--img-3);
    }
}

/* ================== Precarga de imágenes ================== */
.header {
    background:
        var(--img-base) no-repeat -9999px -9999px,
        var(--img-2)    no-repeat -9999px -9999px,
        var(--img-3)    no-repeat -9999px -9999px;
}

/* ================== Accesibilidad: reduced motion ================== */
@media (prefers-reduced-motion: reduce) {
    .header::after {
        animation: none;
        opacity: 0;
    }
}

/* ================== Responsive ================== */
@media (max-width: 768px) {
    :root {
        --carousel-cycle: 12s;
        --fade-duration: 0.8s;
    }

    .header {
        height: 50vh;
        min-height: 350px;
    }
}

body {
    height: 100%;
}

/* iOS/Safari antiguo fallback */
@supports not (height: 100dvh) {
    html {
        height: -webkit-fill-available;
    }

    body {
        min-height: -webkit-fill-available;
    }

    .header {
        height: -webkit-fill-available !important;
    }
}

/* Navegadores modernos: usa la visual viewport */
@supports (height: 100dvh) {
    .header {
        height: 100dvh !important;
    }
}

/* En móvil NO restes la navbar si esta es fixed/superpuesta */
@media (max-width: 992px) {
    :root {
        --nav-height: 0px;
    }

    /* evita la resta en móvil */
    .header {
        height: 100svh !important;
    }
}
