/* =====================================================================
   HERO · Carrusel Cover Flow
   ---------------------------------------------------------------------
   Estilos EXCLUSIVOS de la sección Hero de la página principal.
   Todo va prefijado con .hero-cf para no afectar al resto del sitio.

   Ajustes rápidos: ver las variables del bloque .hero-cf de abajo.
   ===================================================================== */

.hero-cf {
    /* --- Geometría de la tarjeta (móvil primero) --- */
    --hero-cf-card: clamp(180px, 54vw, 250px);      /* ancho de la tarjeta central */
    --hero-cf-card-h: calc(var(--hero-cf-card) * 4 / 3);  /* alto = ratio 3:4 (vertical).
                                                       Para banners 16:9 usar  * 9 / 16  */
    --hero-cf-radius: 22px;
    --hero-cf-gap-y: clamp(18px, 2.4vw, 44px);      /* aire vertical alrededor de las tarjetas */

    /* --- Movimiento --- */
    --hero-cf-speed: 600ms;          /* debe coincidir con CONFIG.transition en hero-coverflow.js */
    --hero-cf-ease: cubic-bezier(0.22, 0.61, 0.36, 1);

    /* --- Color --- */
    --hero-cf-accent: #007d00;
    --hero-cf-ink: #16202b;

    position: relative;
    isolation: isolate;
    width: 100%;
    max-width: 100%;
    overflow: hidden;                /* evita cualquier scroll horizontal de la página */
    padding: clamp(18px, 2vw, 30px) 0 clamp(16px, 1.8vw, 26px);
    background:
        radial-gradient(120% 95% at 50% -10%, #ffffff 0%, #f7f9fc 42%, #eef1f6 100%);
}

/* Halo muy sutil detrás de la imagen central */
.hero-cf__glow {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 0;
    width: min(1100px, 120%);
    aspect-ratio: 2 / 1;
    transform: translate(-50%, -50%);
    pointer-events: none;
    background:
        radial-gradient(closest-side, rgba(0, 125, 0, 0.10), rgba(0, 125, 0, 0) 72%),
        radial-gradient(closest-side at 30% 60%, rgba(28, 92, 170, 0.08), rgba(28, 92, 170, 0) 70%);
}

/* ---------- Titulo de la seccion ---------- */

.hero-cf__title {
    position: relative;
    z-index: 2;
    max-width: 90%;
    margin: 0 auto clamp(14px, 1.8vw, 26px);
    color: var(--hero-cf-accent);
    font-size: clamp(19px, 2.6vw, 34px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
    text-wrap: balance;
}

/* ---------- Viewport / Stage (CarouselTrack) ---------- */

.hero-cf__viewport {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.hero-cf__stage {
    position: relative;
    width: 100%;
    height: calc(var(--hero-cf-card-h) + var(--hero-cf-gap-y) * 2);
    margin: 0;
    perspective: 1500px;
    perspective-origin: 50% 50%;
    transform-style: preserve-3d;
    touch-action: pan-y;             /* permite scroll vertical, captura el swipe horizontal */
    /* Difuminado en los bordes: las tarjetas de los extremos se desvanecen
       en lugar de cortarse en seco contra el borde de la pantalla. */
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
    transition: transform var(--hero-cf-speed) var(--hero-cf-ease);
    cursor: grab;
}

.hero-cf__stage.is-dragging {
    transition: none;
    cursor: grabbing;
}

/* ---------- CarouselSlide ---------- */

.hero-cf__slide {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--hero-cf-card);
    height: var(--hero-cf-card-h);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--hero-cf-radius);
    background: #dfe5ec;
    overflow: hidden;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: inherit;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    backface-visibility: hidden;
    will-change: transform, opacity;
    box-shadow:
        0 10px 24px -14px rgba(16, 32, 48, 0.45),
        0 2px 8px -4px rgba(16, 32, 48, 0.25);
    transition:
        transform var(--hero-cf-speed) var(--hero-cf-ease),
        opacity   var(--hero-cf-speed) var(--hero-cf-ease),
        box-shadow var(--hero-cf-speed) var(--hero-cf-ease);
}

.hero-cf__slide.is-active {
    cursor: default;
    box-shadow:
        0 38px 60px -28px rgba(16, 32, 48, 0.55),
        0 12px 26px -12px rgba(16, 32, 48, 0.30);
}

/* Velo que apaga ligeramente las tarjetas laterales */
.hero-cf__slide::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(12, 22, 34, 0.04), rgba(12, 22, 34, 0.16));
    opacity: 1;
    transition: opacity var(--hero-cf-speed) var(--hero-cf-ease);
    pointer-events: none;
}

.hero-cf__slide.is-active::after {
    opacity: 0;
}

.hero-cf__slide.is-hidden {
    pointer-events: none;
}

.hero-cf__slide:focus {
    outline: none;
}

.hero-cf__slide:focus-visible {
    outline: 3px solid var(--hero-cf-accent);
    outline-offset: 4px;
}

.hero-cf__img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: inherit;
    user-select: none;
    -webkit-user-drag: none;
}

/* ---------- Pie de la tarjeta (descripcion visible) ---------- */

.hero-cf__caption {
    position: absolute;
    z-index: 2;
    right: 0;
    bottom: 0;
    left: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;            /* maximo 3 lineas */
    overflow: hidden;
    padding: clamp(30px, 7%, 56px) clamp(10px, 5%, 18px) clamp(10px, 4.5%, 16px);
    background: linear-gradient(180deg,
        rgba(9, 17, 27, 0) 0%,
        rgba(9, 17, 27, 0.55) 45%,
        rgba(9, 17, 27, 0.88) 100%);
    color: #fff;
    font-size: clamp(11px, 4.1cqw, 16px);
    font-weight: 600;
    line-height: 1.32;
    letter-spacing: 0.1px;
    text-align: center;
    text-wrap: balance;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

/* El texto escala con el ancho de la tarjeta (container query units). */
.hero-cf__slide {
    container-type: inline-size;
}

/* Sin soporte de container queries: tamano fijo por breakpoint. */
@supports not (font-size: 1cqw) {
    .hero-cf__caption { font-size: 11px; }
    @media (min-width: 768px)  { .hero-cf__caption { font-size: 12px; } }
    @media (min-width: 1200px) { .hero-cf__caption { font-size: 14px; } }
}

/* ---------- PreviousButton / NextButton ---------- */

.hero-cf__nav {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(38px, 4.2vw, 52px);
    height: clamp(38px, 4.2vw, 52px);
    padding: 0;
    transform: translateY(-50%);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    color: var(--hero-cf-ink);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 22px -10px rgba(16, 32, 48, 0.45);
    cursor: pointer;
    transition: background 220ms ease, transform 220ms ease, box-shadow 220ms ease;
}

.hero-cf__nav--prev { left: clamp(8px, 2.5vw, 42px); }
.hero-cf__nav--next { right: clamp(8px, 2.5vw, 42px); }

.hero-cf__nav svg {
    width: 42%;
    height: 42%;
    display: block;
}

.hero-cf__nav:hover {
    background: rgba(255, 255, 255, 0.92);
    transform: translateY(-50%) scale(1.06);
    box-shadow: 0 12px 28px -10px rgba(16, 32, 48, 0.5);
}

.hero-cf__nav:active {
    transform: translateY(-50%) scale(0.96);
}

.hero-cf__nav:focus {
    outline: none;
}

.hero-cf__nav:focus-visible {
    outline: 3px solid var(--hero-cf-accent);
    outline-offset: 3px;
    background: rgba(255, 255, 255, 0.95);
}

/* ---------- Indicators ---------- */

.hero-cf__dots {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin: clamp(14px, 2vw, 26px) 0 0;
    padding: 0;
    list-style: none;
}

.hero-cf__dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 99px;
    background: rgba(22, 32, 43, 0.22);
    cursor: pointer;
    transition: width 300ms var(--hero-cf-ease), background 300ms ease;
}

.hero-cf__dot:hover { background: rgba(22, 32, 43, 0.42); }

.hero-cf__dot[aria-current="true"] {
    width: 26px;
    background: var(--hero-cf-accent);
}

.hero-cf__dot:focus { outline: none; }

.hero-cf__dot:focus-visible {
    outline: 3px solid var(--hero-cf-accent);
    outline-offset: 4px;
}

/* ---------- Utilidad ---------- */

.hero-cf__sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* ---------- Responsive ---------- */

@media (min-width: 768px) {
    .hero-cf {
        --hero-cf-card: clamp(240px, 31vw, 300px);
        --hero-cf-radius: 24px;
    }
}

@media (min-width: 1200px) {
    .hero-cf {
        --hero-cf-card: clamp(300px, 24vw, 370px);
        --hero-cf-radius: 26px;
    }
}

/* ---------- Accesibilidad: movimiento reducido ---------- */

@media (prefers-reduced-motion: reduce) {
    .hero-cf__stage,
    .hero-cf__slide,
    .hero-cf__slide::after,
    .hero-cf__nav,
    .hero-cf__dot {
        transition-duration: 1ms !important;
    }
}
