@font-face {
    font-family: "Chelsea Market";
    src: url("../../assets/fonts/hero/ChelseaMarket-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

body:has(.home-hero) {
    overflow-x: hidden;
}

.home-hero {
    --hero-ink: #141416;
    --hero-ghost: #c45a38;
    --hero-orange-1: #ffffff;
    --hero-orange-2: #e85a2b;
    --hero-orange-3: #f58b4e;
    --hero-orange-4: #fdc68a;
    --hero-card-scale: clamp(0.95, 100vw / 1450px, 1.42);
    --hero-next-bg: var(--bs-light, #f8f9fa);

    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: clamp(5.5rem, 12vh, 8rem) 32px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 5;
    overflow: hidden;
    background-color: var(--hero-next-bg);
}

/* Fondo con blur: capa aparte para no afectar texto ni tarjetas */
.home-hero::before {
    content: "";
    position: absolute;
    inset: -32px;
    z-index: 0;
    pointer-events: none;
    background-color: #f2ead6;
    background-image: url("../../assets/img/new_hero/fondo_hero/hero_fondo_3.webp");
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    filter: blur(12px);
    transform: scale(1.06);
}

/* Degradado inferior: transparente arriba → bg-light abajo (sección Nosotros) */
.home-hero::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: min(48%, 28rem);
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        var(--hero-next-bg) 100%
    );
}

.hero-grain {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 6;
    opacity: 0.06;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.1  0 0 0 0 0.1  0 0 0 0 0.1  0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.navbar-hero-overlay {
    background: transparent !important;
    box-shadow: none !important;
    transition: background-color 0.35s ease, box-shadow 0.35s ease;
    /* Estado inicial oculto: evita el flash de "todo visible" antes de que
       hero-banner.js tome el control y reproduzca (o cancele) la animación
       de entrada. Si JS no llega a ejecutarse, ver fallback <noscript>. */
    opacity: 0;
    transform: translateY(-20px);
}

.navbar-hero-overlay.is-ready,
html.site-shell-persistent .navbar-hero-overlay {
    opacity: 1;
    transform: none;
}

.navbar-hero-overlay.navbar-scrolled {
    background: rgba(var(--bs-light-rgb), 0.92) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--bs-box-shadow-sm) !important;
}

/* Menú (desktop) sobre el hero: colores sobre imagen; layout compartido en site-nav.css */
.navbar-hero-overlay .navbar-nav {
    width: fit-content;
    margin-left: auto;
    --nav-divider-opacity: 0.32;
    gap: 0;
}

.navbar-hero-overlay .navbar-nav .nav-item {
    display: flex;
    align-items: center;
}

.navbar-hero-overlay .navbar-nav .nav-item:not(:last-child)::after {
    content: "•";
    margin-inline: 0.28rem;
    font-size: 0.4rem;
    font-weight: 300;
    line-height: 1;
    opacity: var(--nav-divider-opacity);
    color: currentColor;
    pointer-events: none;
    user-select: none;
}

.navbar-hero-overlay.navbar-scrolled .navbar-nav {
    --nav-divider-opacity: 0.22;
}

.navbar-hero-overlay .navbar-nav .nav-link {
    border-radius: 999px;
    color: #fff !important;
    text-shadow: 0 1px 3px rgba(20, 20, 22, 0.45), 0 2px 10px rgba(20, 20, 22, 0.25);
    transition: color 0.25s ease, background-color 0.25s ease, text-shadow 0.25s ease;
}

.navbar-hero-overlay .navbar-nav .nav-link:hover,
.navbar-hero-overlay .navbar-nav .nav-link:focus-visible {
    color: var(--bs-dark) !important;
    background: rgba(255, 255, 255, 0.92);
    text-shadow: none;
}

.navbar-hero-overlay.navbar-scrolled .navbar-nav .nav-link {
    color: var(--bs-dark) !important;
    text-shadow: none;
}

.navbar-hero-overlay.navbar-scrolled .navbar-nav .nav-link:hover,
.navbar-hero-overlay.navbar-scrolled .navbar-nav .nav-link:focus-visible {
    color: #fff !important;
    background: var(--bs-primary);
    text-shadow: none;
}

.home-hero .hero-copy {
    position: relative;
    z-index: 4;
    width: 100%;
    text-align: center;
    margin-top: calc(clamp(3rem, 12vh, 7.5rem) + 40px);
}

.home-hero .small-team {
    font-family: "DM Sans", system-ui, sans-serif;
    font-weight: 700;
    font-size: clamp(28px, 4.2vw, 72px);
    letter-spacing: -0.035em;
    line-height: 1;
    color: var(--hero-ink);
    text-align: center;
    margin: 0;
    z-index: 4;
    position: relative;
    /* drop-shadow (no text-shadow): overflow:hidden de .word cortaba la sombra en cajas */
    filter:
        drop-shadow(0 1px 1px rgba(20, 20, 22, 0.18))
        drop-shadow(0 4px 14px rgba(20, 20, 22, 0.22));
}

.home-hero .small-team__line {
    display: block;
    white-space: nowrap;
}

.home-hero .small-team .word {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
}

.home-hero .small-team .word-space {
    display: inline-block;
}

.home-hero .small-team .word > span {
    display: inline-block;
    transform: translateY(105%);
}

.home-hero .big-results-wrap {
    position: relative;
    width: 100%;
    margin-top: -20px;
    display: flex;
    justify-content: center;
    z-index: 1;
    container-type: inline-size;
    container-name: hero-big;
}

.home-hero .big-results {
    font-family: "DM Sans", system-ui, sans-serif;
    font-style: italic;
    font-weight: 800;
    font-size: clamp(48px, 11.5vw, 170px);
    letter-spacing: -0.09em;
    line-height: 0.85;
    color: #ffffff;
    text-align: center;
    white-space: nowrap;
    user-select: none;
    z-index: 1;
    max-width: 100%;
}

.home-hero .big-results .letter {
    display: inline-block;
    transform-origin: bottom;
    margin-inline: -0.02em;
    color: #ffffff;
    text-shadow:
        0 2px 4px rgba(20, 20, 22, 0.32),
        0 6px 14px rgba(20, 20, 22, 0.22),
        0 12px 28px rgba(20, 20, 22, 0.14);
    /* Mismo estado inicial que gsap.set() en runIntro(): oculto por CSS desde
       el primer paint, para que no aparezca "completo" antes de animarse. */
    opacity: 0;
    transform: translateY(80px);
}

.home-hero .cards-row {
    position: absolute;
    left: 0;
    right: 0;
    top: auto;
    bottom: calc(-90px * var(--hero-card-scale));
    height: calc(320px * var(--hero-card-scale));
    z-index: 3;
    pointer-events: none;
}

.home-hero .cards-row > * {
    pointer-events: auto;
}

.home-hero .hero-card {
    position: absolute;
    border-radius: calc(18px * var(--hero-card-scale));
    overflow: hidden;
    border: none;
    background: linear-gradient(
        180deg,
        var(--hero-orange-1) 0%,
        var(--hero-orange-2) 35%,
        var(--hero-orange-3) 70%,
        var(--hero-orange-4) 100%
    );
    box-shadow: 0 30px 50px -16px rgba(180, 50, 20, 0.5),
        0 14px 26px -8px rgba(140, 40, 10, 0.32),
        0 5px 10px -2px rgba(80, 20, 0, 0.2),
        inset 0 2px 0 rgba(255, 220, 180, 0.45),
        inset 0 -4px 8px rgba(120, 20, 0, 0.4);
    will-change: transform;
    /* Oculta por CSS desde el primer paint (igual que el estado inicial de
       runIntro(): y:-800, scale:0.7, opacity:0). Sin esto, la tarjeta con su
       fondo naranjo aparece completa de inmediato y luego "desaparece" para
       volver a animarse. */
    opacity: 0;
    transform: translateY(-800px) scale(0.7);
}

.home-hero .hero-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        155deg,
        rgba(255, 255, 255, 0.25) 0%,
        transparent 30%,
        transparent 70%,
        rgba(100, 20, 0, 0.25) 100%
    );
    pointer-events: none;
    border-radius: inherit;
    z-index: 2;
}

.home-hero .hero-card img,
.home-hero .hero-card__slide {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.home-hero .hero-card__carousel {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.home-hero .hero-card__slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.65s ease;
    will-change: opacity;
}

.home-hero .hero-card__slide.is-active {
    opacity: 1;
}

.home-hero .hero-card--nav {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    pointer-events: auto;
}

.home-hero .hero-cards-desktop .hero-card:not(.hero-card--nav) {
    pointer-events: none;
}

.home-hero .hero-card--nav:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.home-hero .hero-card__label {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 4;
    padding: 0.55rem 0.45rem 0.6rem;
    font-family: "Chelsea Market", "Roboto Condensed", system-ui, sans-serif;
    font-size: clamp(0.68rem, 1.1vw, 0.82rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    color: #fff;
    text-shadow: 0 1px 3px rgba(20, 20, 22, 0.55);
    pointer-events: none;
    transform-origin: center top;
}

@media (min-width: 751px) {
    .home-hero .hero-card__label {
        font-size: clamp(1.05rem, 1.9vw, 1.42rem);
        letter-spacing: 0.03em;
        line-height: 1.05;
        padding: 0.78rem 0.5rem 0.95rem;
        text-shadow:
            0 1px 0 rgba(0, 0, 0, 0.55),
            0 2px 0 rgba(0, 0, 0, 0.32),
            0 3px 2px rgba(0, 0, 0, 0.28),
            0 6px 14px rgba(0, 0, 0, 0.5);
    }

    .home-hero .hero-card-4 .hero-card__label--top {
        font-size: clamp(1.22rem, 2.2vw, 1.7rem);
        padding-top: 0.85rem;
    }

    .home-hero .hero-card-6 .hero-card__label--top {
        font-size: clamp(0.82rem, 1.35vw, 1.08rem);
        letter-spacing: 0.015em;
        white-space: nowrap;
    }

    .home-hero .hero-cards-desktop .hero-card {
        transition: box-shadow 0.4s ease;
    }

    .home-hero .hero-cards-desktop .hero-card.is-nav-hover {
        box-shadow:
            0 28px 48px -10px rgba(12, 6, 2, 0.62),
            0 16px 28px -8px rgba(80, 20, 0, 0.42),
            0 0 0 1px rgba(255, 236, 210, 0.22),
            inset 0 2px 0 rgba(255, 220, 180, 0.5),
            inset 0 -4px 8px rgba(120, 20, 0, 0.4);
    }
}

.home-hero .hero-card__label--top {
    top: 0;
    bottom: auto;
    background: linear-gradient(
        to bottom,
        rgba(20, 20, 22, 0.78) 0%,
        rgba(20, 20, 22, 0.34) 58%,
        transparent 100%
    );
}

.home-hero .hero-card__label--sm {
    font-size: 0.58rem;
    letter-spacing: 0.1em;
    padding: 0.38rem 0.28rem 0.42rem;
}

.home-hero .hero-card--nav::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(to bottom, rgba(20, 20, 22, 0.28) 0%, transparent 38%, transparent 100%);
    opacity: 0.9;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.home-hero .hero-card--nav:hover::after,
.home-hero .hero-card--nav:focus-visible::after {
    opacity: 1;
}

.home-hero .hero-card-1 { width: calc(160px * var(--hero-card-scale)); height: calc(220px * var(--hero-card-scale)); left: 8%;  top: calc(50px * var(--hero-card-scale)); z-index: 2; }
.home-hero .hero-card-2 { width: calc(200px * var(--hero-card-scale)); height: calc(270px * var(--hero-card-scale)); left: 18%; top: calc(20px * var(--hero-card-scale)); z-index: 4; }
.home-hero .hero-card-3 { width: calc(150px * var(--hero-card-scale)); height: calc(200px * var(--hero-card-scale)); left: 32%; top: calc(70px * var(--hero-card-scale)); z-index: 3; }
.home-hero .hero-card-4 { width: calc(230px * var(--hero-card-scale)); height: calc(310px * var(--hero-card-scale)); left: 42%; top: 0; z-index: 5; }
.home-hero .hero-card-5 { width: calc(160px * var(--hero-card-scale)); height: calc(215px * var(--hero-card-scale)); left: 57%; top: calc(55px * var(--hero-card-scale)); z-index: 3; }
.home-hero .hero-card-6 { width: calc(175px * var(--hero-card-scale)); height: calc(240px * var(--hero-card-scale)); left: 69%; top: calc(30px * var(--hero-card-scale)); z-index: 4; }
.home-hero .hero-card-7 { width: calc(130px * var(--hero-card-scale)); height: calc(175px * var(--hero-card-scale)); left: 81%; top: calc(50px * var(--hero-card-scale)); z-index: 2; }

.home-hero .hero-anchor {
    margin-top: auto;
    width: 100%;
    flex-shrink: 0;
    pointer-events: none;
    height: calc(180px * var(--hero-card-scale));
}

/* Bloque de tarjetas móviles: reutiliza el estilo del sidebar (.mobile-sidebar__card).
   Oculto en desktop; el .cards-row con efecto GSAP se usa solo en desktop. */
.hero-mobile-cards {
    display: none;
}

@media (max-width: 750px) {
    .home-hero {
        min-height: clamp(300px, 42svh, 360px);
        padding: 5rem 1rem 0;
        justify-content: flex-start;
    }

    .home-hero .hero-copy {
        margin-top: clamp(1.5rem, 7vh, 3rem);
    }

    .home-hero .small-team {
        font-size: clamp(15px, 4.6vw, 22px);
        white-space: normal;
    }

    .home-hero .small-team__line {
        white-space: normal;
    }

    .home-hero .big-results-wrap {
        margin-top: 1rem;
        max-width: 100%;
    }

    .home-hero .big-results {
        /* Escala al ancho del contenedor (11 glifos + itálica) para no desbordar */
        font-size: min(82px, calc(100cqi / 6.9));
        letter-spacing: -0.12em;
        color: #ffffff;
        max-width: 100%;
    }

    .home-hero .big-results .letter {
        margin-inline: -0.045em;
    }

    /* Desactivar por completo las tarjetas de desktop (no gastar recursos GSAP) */
    .home-hero .hero-cards-desktop {
        display: none !important;
    }

    /* Mostrar el bloque móvil tipo sidebar, anclado al fondo y cortado abajo */
    .home-hero .hero-mobile-cards {
        display: block;
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 118px;
        overflow: hidden;
        pointer-events: none;
        z-index: 3;
    }

    .home-hero .hero-mobile-cards__row {
        position: absolute;
        left: 50%;
        bottom: -80px;
        width: 100%;
        max-width: 360px;
        height: 180px;
        transform: translateX(-50%);
    }

    .home-hero .hero-anchor {
        height: 0;
    }
}

@media (max-width: 479px) {
    .home-hero {
        min-height: clamp(280px, 40svh, 340px);
        padding: 4.75rem 0.75rem 0;
    }

    .home-hero .small-team {
        font-size: clamp(14px, 4.4vw, 18px);
    }

    .home-hero .big-results {
        font-size: min(60px, calc(100cqi / 6.9));
        letter-spacing: -0.13em;
    }

    .home-hero .big-results .letter {
        margin-inline: -0.05em;
    }
}

/* Animación de entrada: las tarjetas ascienden desde abajo del hero */
@media (max-width: 750px) {
    .home-hero .hero-mobile-cards .mobile-sidebar__card {
        opacity: 0;
        transform: translateY(120px) rotate(var(--sidebar-card-rot, 0deg));
        animation: heroCardRise 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }

    .home-hero .hero-mobile-cards .sidebar-card-1 { animation-delay: 0.15s; }
    .home-hero .hero-mobile-cards .sidebar-card-2 { animation-delay: 0.28s; }
    .home-hero .hero-mobile-cards .sidebar-card-3 { animation-delay: 0.41s; }
    .home-hero .hero-mobile-cards .sidebar-card-4 { animation-delay: 0.34s; }
    .home-hero .hero-mobile-cards .sidebar-card-5 { animation-delay: 0.22s; }

    /* Esta animación corre por CSS puro (sin esperar a JS), pero mientras
       html.site-fonts-pending el body sigue con visibility:hidden (ver
       site-fonts-ready.js): sin esto, el reloj de la animación avanza igual
       aunque no se vea, y según cuánto tarden fuentes/íconos en cada
       máquina/red podía terminar (o casi) antes de que la página se
       revelara, mostrando las tarjetas ya quietas en vez de subiendo. */
    html.site-fonts-pending .home-hero .hero-mobile-cards .mobile-sidebar__card {
        animation-play-state: paused;
    }
}

@keyframes heroCardRise {
    from {
        opacity: 0;
        transform: translateY(120px) rotate(var(--sidebar-card-rot, 0deg));
    }
    to {
        opacity: 1;
        transform: translateY(0) rotate(var(--sidebar-card-rot, 0deg));
    }
}

@media (prefers-reduced-motion: reduce) {
    html:not(.site-motion-user-on) .home-hero .small-team .word > span,
    html:not(.site-motion-user-on) .home-hero .big-results .letter,
    html:not(.site-motion-user-on) .home-hero .hero-card,
    html:not(.site-motion-user-on) .navbar-hero-overlay {
        transform: none !important;
        opacity: 1 !important;
    }

    html:not(.site-motion-user-on) .home-hero .hero-mobile-cards .mobile-sidebar__card {
        animation: none !important;
        opacity: 1 !important;
        transform: rotate(var(--sidebar-card-rot, 0deg)) !important;
    }
}
