/* ==========================================================================
   CAPA DE ANIMACIONES (estilo Awwwards)
   Archivo independiente: no cambia layout ni colores. Solo movimiento.
   Todas las clases van con prefijo "aw-" y se asignan desde animations.js,
   asi que sin JavaScript la web se ve exactamente igual que antes.
   ========================================================================== */

:root {
    --aw-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --aw-ease-io: cubic-bezier(0.76, 0, 0.24, 1);
    --aw-orange: #ff8c42;
    --aw-dark: #1a1a1a;
}

/* --------------------------------------------------------------------------
   1. PRELOADER
   -------------------------------------------------------------------------- */
.aw-preloader {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: var(--aw-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 22px;
    color: #fff;
    transition: clip-path 0.9s var(--aw-ease-io);
    clip-path: inset(0 0 0 0);
}

.aw-preloader.is-done {
    clip-path: inset(0 0 100% 0);
    pointer-events: none;
}

.aw-preloader-brand {
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: clamp(0.95rem, 3.2vw, 2.4rem);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 92vw;
    gap: 0.22em;
    overflow: hidden;
    line-height: 1.2;
}

.aw-preloader-brand span {
    display: inline-block;
    transform: translateY(110%);
    animation: aw-rise 0.9s var(--aw-ease) forwards;
}

.aw-preloader-brand span.is-orange {
    color: var(--aw-orange);
}

.aw-preloader-line {
    width: min(260px, 60vw);
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
    position: relative;
    overflow: hidden;
}

.aw-preloader-line::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--aw-orange);
    transform-origin: left;
    transform: scaleX(0);
    animation: aw-load 1.1s var(--aw-ease-io) 0.15s forwards;
}

.aw-preloader.is-done .aw-preloader-brand,
.aw-preloader.is-done .aw-preloader-line {
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.4s ease, transform 0.5s var(--aw-ease-io);
}

@keyframes aw-rise {
    to { transform: translateY(0); }
}

@keyframes aw-fade {
    to { opacity: 1; }
}

@keyframes aw-load {
    to { transform: scaleX(1); }
}

/* Mientras carga: bloquea scroll */
html.aw-loading,
html.aw-loading body {
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   2. ENTRADA DEL NAV (se anima el <nav>, no el header, porque header ya usa
      transform para ocultarse al hacer scroll)
   -------------------------------------------------------------------------- */
html.aw-js nav {
    opacity: 0;
    transform: translateY(-24px);
}

html.aw-ready nav {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s var(--aw-ease) 0.1s, transform 0.9s var(--aw-ease) 0.1s;
}

/* --------------------------------------------------------------------------
   3. TEXTO DEL MENU: efecto de intercambio vertical al pasar el cursor
   -------------------------------------------------------------------------- */
.nav-link-text.aw-swap {
    position: relative;
    overflow: hidden;
    display: inline-block;
    line-height: 1.35;
}

.nav-link-text.aw-swap .aw-nt {
    display: block;
    transition: transform 0.45s var(--aw-ease);
}

.nav-link-text.aw-swap::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 100%;
    width: 100%;
    display: block;
    transition: transform 0.45s var(--aw-ease);
}

.nav-link:hover .nav-link-text.aw-swap .aw-nt,
.nav-link:hover .nav-link-text.aw-swap::after {
    transform: translateY(-100%);
}

/* --------------------------------------------------------------------------
   4. REVEAL GENERICO AL HACER SCROLL
   El estado "oculto" solo aplica a elementos marcados por JS.
   La transicion solo vive mientras entra; luego (aw-done) el elemento
   recupera sus transiciones propias (hover, etc.).
   -------------------------------------------------------------------------- */
.aw-reveal:not(.is-inview) {
    opacity: 0;
    transform: translateY(36px);
}

.aw-reveal.is-inview:not(.aw-done) {
    transition:
        opacity 1s var(--aw-ease),
        transform 1s var(--aw-ease);
    transition-delay: calc(var(--aw-i, 0) * 90ms);
}

/* Variante: desde la izquierda / derecha */
.aw-reveal.aw-from-left:not(.is-inview) { transform: translateX(-40px); }
.aw-reveal.aw-from-right:not(.is-inview) { transform: translateX(40px); }

/* Variante: solo opacidad + blur suave */
.aw-reveal.aw-soft:not(.is-inview) {
    transform: none;
    filter: blur(6px);
}
.aw-reveal.aw-soft.is-inview:not(.aw-done) {
    transition:
        opacity 1.1s var(--aw-ease),
        filter 1.1s var(--aw-ease);
    transition-delay: calc(var(--aw-i, 0) * 90ms);
}

/* --------------------------------------------------------------------------
   5. REVEAL DE IMAGENES: mascara + zoom out
   -------------------------------------------------------------------------- */
.aw-img:not(.is-inview) {
    opacity: 0;
    clip-path: inset(12% 10% 12% 10% round 24px);
    transform: scale(1.1);
}

.aw-img.is-inview:not(.aw-done) {
    transition:
        opacity 0.9s var(--aw-ease),
        clip-path 1.3s var(--aw-ease),
        transform 1.4s var(--aw-ease);
    transition-delay: calc(var(--aw-i, 0) * 90ms);
}

.aw-img.is-inview {
    clip-path: inset(0 0 0 0 round 20px);
}

/* --------------------------------------------------------------------------
   6. TITULOS: palabras que suben desde una mascara
   -------------------------------------------------------------------------- */
.aw-split .aw-w {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
    padding-bottom: 0.14em;
    margin-bottom: -0.14em;
}

.aw-split .aw-wi {
    display: inline-block;
    transform: translateY(115%);
    will-change: transform;
}

.aw-split.is-inview .aw-wi {
    transform: translateY(0);
    transition: transform 0.95s var(--aw-ease);
    transition-delay: calc(var(--aw-i, 0) * 45ms + var(--aw-base, 0ms));
}

/* --------------------------------------------------------------------------
   7. LINEAS Y SEPARADORES QUE SE DIBUJAN
   -------------------------------------------------------------------------- */
.aw-line:not(.is-inview) {
    transform: scaleX(0);
}
.aw-line.is-inview:not(.aw-done) {
    transition: transform 1.2s var(--aw-ease);
}

/* --------------------------------------------------------------------------
   8. TARJETAS DE TRATAMIENTOS (#servicios): tilt 3D + foco de luz
   -------------------------------------------------------------------------- */
#servicios .service-card-bg {
    --tx: 0deg;
    --ty: 0deg;
    --mx: 50%;
    --my: 50%;
    transform-style: preserve-3d;
    overflow: hidden;
}

@media (hover: hover) and (pointer: fine) {
    #servicios .service-card-bg.aw-reveal.aw-done {
        transition: transform 0.35s ease, box-shadow 0.35s ease;
        transform: perspective(1000px) rotateX(var(--tx)) rotateY(var(--ty)) translateY(0);
    }

    #servicios .service-card-bg.aw-reveal.aw-done:hover {
        transform: perspective(1000px) rotateX(var(--tx)) rotateY(var(--ty)) translateY(-10px);
        box-shadow: 0 30px 60px rgba(0, 0, 0, 0.18);
    }
}

#servicios .service-card-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(420px circle at var(--mx) var(--my), rgba(255, 140, 66, 0.14), transparent 65%);
    transition: opacity 0.4s ease;
    z-index: 0;
}

#servicios .service-card-bg:hover::after {
    opacity: 1;
}

#servicios .service-card-bg > * {
    position: relative;
    z-index: 1;
}

/* Imagen de tarjeta: zoom suave al hover */
.service-image {
    overflow: hidden;
    border-radius: 15px;
}

.service-image img {
    transition: transform 0.9s var(--aw-ease), filter 0.9s var(--aw-ease);
    will-change: transform;
}

.service-card:hover .service-image img {
    transform: scale(1.07);
}

/* Tarjetas del hero (fondo naranja): borde que se ilumina */
.services-hero-section .service-card {
    transition: transform 0.5s var(--aw-ease), border-color 0.5s ease, background 0.5s ease, box-shadow 0.5s ease;
}

.services-hero-section .service-card:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 255, 255, 0.55) !important;
    background: rgba(255, 255, 255, 0.16) !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

/* --------------------------------------------------------------------------
   9. BOTONES: hover con brillo que cruza + magnetismo (JS)
   -------------------------------------------------------------------------- */
.aw-magnet {
    will-change: transform;
}

.aw-shine {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.aw-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -80%;
    width: 50%;
    height: 100%;
    background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.35) 50%, transparent 100%);
    transform: skewX(-20deg);
    transition: none;
    pointer-events: none;
    z-index: 1;
}

.aw-shine:hover::before {
    left: 130%;
    transition: left 0.75s var(--aw-ease);
}

/* --------------------------------------------------------------------------
   10. CURSOR PERSONALIZADO (solo escritorio con puntero fino)
   -------------------------------------------------------------------------- */
.aw-cursor-dot,
.aw-cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 100001;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.aw-cursor-dot {
    width: 7px;
    height: 7px;
    background: var(--aw-orange);
}

.aw-cursor-ring {
    width: 38px;
    height: 38px;
    border: 1.5px solid rgba(255, 140, 66, 0.9);
    transition: width 0.35s var(--aw-ease), height 0.35s var(--aw-ease), background 0.35s ease, border-color 0.35s ease, opacity 0.3s ease;
}

html.aw-cursor-on .aw-cursor-dot,
html.aw-cursor-on .aw-cursor-ring {
    opacity: 1;
}

html.aw-cursor-on.aw-cursor-hover .aw-cursor-ring {
    width: 64px;
    height: 64px;
    background: rgba(255, 140, 66, 0.12);
    border-color: rgba(255, 140, 66, 0.5);
}

html.aw-cursor-on.aw-cursor-hover .aw-cursor-dot {
    transform: translate(-50%, -50%) scale(0.5);
}

html.aw-cursor-on.aw-cursor-down .aw-cursor-ring {
    width: 26px;
    height: 26px;
}

@media (hover: hover) and (pointer: fine) {
    html.aw-cursor-on,
    html.aw-cursor-on *:not(input):not(textarea):not(select):not(iframe) {
        cursor: none;
    }
}

/* --------------------------------------------------------------------------
   12. GRANO SUTIL (textura de pelicula, muy tenue)
   -------------------------------------------------------------------------- */
.aw-grain {
    position: fixed;
    inset: -50%;
    width: 200%;
    height: 200%;
    z-index: 9000;
    pointer-events: none;
    opacity: 0.045;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    animation: aw-grain 0.8s steps(4) infinite;
    mix-blend-mode: multiply;
}

@keyframes aw-grain {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(-2%, 1%); }
    50%  { transform: translate(1%, -2%); }
    75%  { transform: translate(-1%, -1%); }
    100% { transform: translate(2%, 2%); }
}

/* --------------------------------------------------------------------------
   13. HERO: parallax en wrapper de imagen + flotacion suave
   -------------------------------------------------------------------------- */
.aw-parallax {
    will-change: transform;
}

#inicio .hero-image img.is-inview.aw-done {
    animation: aw-float 7s ease-in-out infinite;
}

@keyframes aw-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

/* Boton flotante de WhatsApp: pulso */
.whatsapp-float::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(37, 211, 102, 0.6);
    animation: aw-pulse 2.2s ease-out infinite;
    pointer-events: none;
}

@keyframes aw-pulse {
    0%   { transform: scale(1); opacity: 0.9; }
    100% { transform: scale(1.7); opacity: 0; }
}

/* --------------------------------------------------------------------------
   14. STAT CARDS: numero que "salta" al revelar
   -------------------------------------------------------------------------- */
.stat-card .stat-number {
    display: inline-block;
    transition: transform 0.4s var(--aw-ease);
}

.stat-card:hover .stat-number {
    transform: translateY(-3px) scale(1.04);
}

/* --------------------------------------------------------------------------
   15. ACCESIBILIDAD: sin animaciones si el usuario lo pide
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .aw-reveal:not(.is-inview),
    .aw-img:not(.is-inview),
    .aw-line:not(.is-inview) {
        opacity: 1;
        transform: none;
        clip-path: none;
        filter: none;
    }
    .aw-split .aw-wi {
        transform: none;
    }
    .aw-grain,
    .aw-cursor-dot,
    .aw-cursor-ring {
        display: none;
    }
    html.aw-cursor-on,
    html.aw-cursor-on * {
        cursor: auto;
    }
    .aw-preloader {
        transition-duration: 0.3s;
    }
    #inicio .hero-image img.is-inview.aw-done,
    .whatsapp-float::before {
        animation: none;
    }
}

/* En movil: sin cursor, sin grano (rendimiento), reveals mas cortos */
@media (max-width: 768px) {
    .aw-grain { display: none; }
    .aw-preloader-brand {
        letter-spacing: 0.12em;
        gap: 0.16em;
    }
    .aw-reveal:not(.is-inview) { transform: translateY(24px); }
    .aw-reveal.is-inview:not(.aw-done) { transition-duration: 0.7s; }
}
