/* Barra fina de progreso al abrir cualquier página.
   Es CSS puro y se apaga sola: no depende del JavaScript ni se queda pegada. */
html.esq-barra-pagina::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    z-index: 9999;
    background: var(--color-gold, #C5A55A);
    box-shadow: 0 0 10px rgba(197, 165, 90, 0.5);
    pointer-events: none;
    animation: esq-progreso 2.2s cubic-bezier(0.1, 0.7, 0.3, 1) forwards;
}

@keyframes esq-progreso {
    0% { width: 0; opacity: 1; }
    65% { width: 72%; opacity: 1; }
    95% { width: 100%; opacity: 1; }
    100% { width: 100%; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    html.esq-barra-pagina::before { animation-duration: 0.6s; }
}

/* ==========================================================================
   SKELETON SCREEN — esqueletos de carga para todo el sitio
   Se apoya en js/skeleton.js, que pone y quita la clase .esq-cargando.
   ========================================================================== */

@keyframes esq-aparecer {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes esq-brillo {
    0% { background-position: 150% 0; }
    100% { background-position: -50% 0; }
}

/* Imágenes que todavía no llegan: se pinta un brillo en su propia caja,
   así no hay salto de maquetación porque el hueco ya tiene tamaño. */
img.esq-cargando,
iframe.esq-cargando {
    background-color: #E7E2D8;
    background-image: linear-gradient(100deg,
        rgba(255, 255, 255, 0) 20%,
        rgba(255, 255, 255, 0.75) 42%,
        rgba(255, 255, 255, 0) 64%);
    background-repeat: no-repeat;
    background-size: 220% 100%;
    animation: esq-brillo 1.35s linear infinite;
    color: transparent;
}

/* Contenedores con imagen de fondo (portada del carrusel, banners de libro) */
.esq-fondo {
    position: relative;
    background-color: #232A33;
}

.esq-fondo::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background-image: linear-gradient(100deg,
        rgba(255, 255, 255, 0) 20%,
        rgba(255, 255, 255, 0.26) 45%,
        rgba(255, 255, 255, 0) 70%);
    background-size: 220% 100%;
    animation: esq-brillo 1.5s linear infinite;
    pointer-events: none;
}

/* Huecos que llena el JavaScript: mientras estén vacíos, muestran esqueleto */
.slider-wrapper:not(:has(.hero-slide)),
#heroSliderWrapper:empty {
    min-height: min(78vh, 620px);
    background-color: #232A33;
    background-image: linear-gradient(100deg,
        rgba(255, 255, 255, 0) 20%,
        rgba(255, 255, 255, 0.26) 45%,
        rgba(255, 255, 255, 0) 70%);
    background-size: 220% 100%;
    animation: esq-aparecer 0.01s linear 0.25s both, esq-brillo 1.5s linear infinite;
}

.studies-grid:empty {
    min-height: 260px;
    border-radius: 12px;
    background-color: #EFEBE3;
    background-image: linear-gradient(100deg,
        rgba(255, 255, 255, 0) 20%,
        rgba(255, 255, 255, 0.8) 42%,
        rgba(255, 255, 255, 0) 64%);
    background-size: 220% 100%;
    animation: esq-aparecer 0.01s linear 0.25s both, esq-brillo 1.35s linear infinite;
}

/* Respeta a quien pidió menos movimiento en su sistema */
@media (prefers-reduced-motion: reduce) {
    img.esq-cargando,
    iframe.esq-cargando,
    .esq-fondo::after,
    #heroSliderWrapper:empty,
    .studies-grid:empty {
        animation: none;
    }
}

/* Zona que llena el JavaScript del test (ebpt) */
#quiz-container:empty,
#options-container:empty {
    min-height: 180px;
    border-radius: 14px;
    background-color: rgba(255, 255, 255, 0.06);
    background-image: linear-gradient(100deg,
        rgba(255, 255, 255, 0) 20%,
        rgba(255, 255, 255, 0.16) 45%,
        rgba(255, 255, 255, 0) 70%);
    background-size: 220% 100%;
    animation: esq-brillo 1.4s linear infinite;
}
