/* ==========================================================================
   Krats Tech — capa de movimiento y componentes premium
   - Todo lo que anima vive dentro de @media (prefers-reduced-motion: no-preference).
   - Sin JS (o con movimiento reducido) el contenido se ve completo: nada queda oculto.
   - Solo se animan transform, opacity, filter y background-position (GPU, sin reflow).
   - Ver .claude/skills/animaciones-premium/SKILL.md antes de añadir efectos.
   ========================================================================== */

:root {
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --grad-brand: linear-gradient(110deg, #ffffff 0%, #9be7ff 30%, #00bfff 55%, #ffb454 85%, #ffffff 100%);
    --glass: rgba(18, 22, 35, 0.62);
    --glass-border: rgba(155, 231, 255, 0.14);
}

/* ---------- Transiciones entre páginas (View Transitions entre documentos) ---------- */
@view-transition { navigation: auto; }
.topbar { view-transition-name: topbar; }
h1.hero__title { view-transition-name: page-title; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.45s; animation-timing-function: var(--ease-out-expo); }
::view-transition-old(root) { animation-name: vt-out; }
::view-transition-new(root) { animation-name: vt-in; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-10px) scale(0.99); filter: blur(4px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px) scale(1.01); filter: blur(4px); } }

/* ---------- Fondo aurora ---------- */
.site-bg__aurora {
    position: absolute;
    inset: -30% -10% auto -10%;
    height: 90vh;
    background:
        radial-gradient(40% 50% at 20% 30%, rgba(0, 191, 255, 0.16), transparent 70%),
        radial-gradient(35% 45% at 80% 20%, rgba(255, 180, 84, 0.10), transparent 70%),
        radial-gradient(30% 40% at 55% 60%, rgba(74, 222, 128, 0.07), transparent 70%);
    filter: blur(40px) saturate(120%);
    opacity: 0.9;
}

/* ---------- Brillo que sigue al cursor (solo punteros finos) ---------- */
.cursor-glow {
    position: fixed;
    left: 0;
    top: 0;
    width: 420px;
    height: 420px;
    margin: -210px 0 0 -210px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 191, 255, 0.10), transparent 65%);
    pointer-events: none;
    z-index: -1;
    opacity: 0;
    transform: translate3d(var(--cx, -999px), var(--cy, -999px), 0);
    transition: opacity 0.4s ease;
}
.has-pointer .cursor-glow { opacity: 1; }

/* ---------- Título con degradado vivo ---------- */
.hero__title,
.section__title {
    background: var(--grad-brand);
    background-size: 220% 100%;
    background-position: 0% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
    .hero__title, .section__title { color: var(--text-primary); background: none; }
}

/* ---------- Texto dividido por palabras (data-split) ---------- */
.split-word {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
    padding-bottom: 0.08em;
    margin-bottom: -0.08em;
}
.split-word__inner { display: inline-block; }
/* Cada palabra lleva el degradado (el padre ya no tiene texto propio). */
[data-split].is-split .split-word__inner {
    background: var(--grad-brand);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---------- Marquesina de países ---------- */
.markets {
    padding: 8px 0 28px;
    overflow: hidden;
}
.markets__title {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 14px;
}
.marquee {
    display: flex;
    gap: 0;
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee__track {
    display: flex;
    flex-shrink: 0;
    gap: 14px;
    margin: 0;
    padding: 0 7px;
    list-style: none;
}
.marquee__track li {
    white-space: nowrap;
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--glass);
    color: var(--text-muted);
    font-family: var(--font-display);
    font-size: 0.95rem;
}

/* ---------- Teaser de supermercados (home) ---------- */
.super-teaser { padding-top: 24px; }
.super-teaser__card {
    position: relative;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 32px;
    align-items: center;
    padding: clamp(24px, 4vw, 44px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    background:
        radial-gradient(120% 120% at 100% 0%, rgba(0, 191, 255, 0.12), transparent 55%),
        linear-gradient(145deg, rgba(23, 28, 44, 0.94), rgba(18, 22, 35, 0.96));
    overflow: hidden;
    isolation: isolate;
}
.super-teaser__card:hover { border-color: rgba(0, 191, 255, 0.5); }
.super-teaser__copy p:not(.eyebrow) { max-width: 52ch; }
.super-teaser__visual {
    border-radius: var(--radius-md);
    overflow: hidden;
    max-height: 340px;
    box-shadow: var(--shadow-raised);
}
.super-teaser__visual img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}
.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}
.chip-list li {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    color: var(--text-primary);
    background: var(--accent-indigo-soft);
    border: 1px solid rgba(0, 191, 255, 0.25);
}

/* ---------- Página pilar de supermercados ---------- */
.super-hero .hero__title { max-width: 20ch; }
.super-hero .hero__subtitle { max-width: 70ch; }
.stat-band {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 40px 0 0;
}
.stat-band__item {
    display: flex;
    flex-direction: column-reverse;
    gap: 4px;
    padding: 18px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: var(--glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.stat-band__value {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 700;
    line-height: 1;
    color: var(--accent-indigo);
    font-variant-numeric: tabular-nums;
}
.stat-band__label { color: var(--text-muted); font-size: 0.9rem; }

.bento {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 36px;
}
.bento__card {
    position: relative;
    padding: 26px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: linear-gradient(145deg, rgba(23, 28, 44, 0.94), rgba(18, 22, 35, 0.96));
    overflow: hidden;
    isolation: isolate;
}
.bento__card--wide { grid-column: span 2; }
.bento__card h3 { font-size: 1.2rem; }
.bento__card p:last-child { margin-bottom: 0; }
.bento__icon {
    display: inline-flex;
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--accent-indigo-soft);
    color: var(--accent-indigo);
    margin-bottom: 16px;
}
.bento__icon svg { width: 24px; height: 24px; }
.bento__brand {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-amber);
    margin-bottom: 6px;
}

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(28px, 5vw, 64px);
    align-items: center;
}
.split--reverse > :first-child { order: 2; }
.case-figure {
    margin: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-raised);
}
.case-figure img { display: block; width: 100%; height: auto; }

/* Órbita de integraciones */
.orbit {
    position: relative;
    width: min(100%, 420px);
    aspect-ratio: 1;
    margin-inline: auto;
    container-type: inline-size;
}
.orbit__core {
    position: absolute;
    inset: 36%;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 191, 255, 0.35), rgba(0, 191, 255, 0.05) 70%);
    border: 1px solid rgba(0, 191, 255, 0.5);
    box-shadow: 0 0 60px -10px rgba(0, 191, 255, 0.7);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.4rem;
}
.orbit__ring {
    position: absolute;
    inset: 4%;
    border-radius: 50%;
    border: 1px dashed rgba(155, 231, 255, 0.22);
}
.orbit__node {
    --angle: calc(360deg / var(--n) * var(--i));
    position: absolute;
    left: 50%;
    top: 50%;
    transform: rotate(var(--angle)) translate(calc(min(420px, 100vw - 48px) * 0.44)) rotate(calc(-1 * var(--angle)));
    translate: -50% -50%;
}
@supports (width: 1cqi) {
    .orbit__node { transform: rotate(var(--angle)) translate(44cqi) rotate(calc(-1 * var(--angle))); }
}
.orbit__node > span {
    display: inline-block;
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-family: var(--font-mono);
    background: var(--bg-elevated-2);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

/* FAQ en acordeón */
.faq-list { display: grid; gap: 12px; margin-top: 20px; }
.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(18, 22, 35, 0.7);
    padding: 0 20px;
    transition: border-color 0.25s ease, background 0.25s ease;
}
.faq-item[open] { border-color: rgba(0, 191, 255, 0.45); background: rgba(18, 22, 35, 0.95); }
.faq-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 0;
    cursor: pointer;
    list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary h3 { margin: 0; font-size: 1.05rem; }
.faq-item summary::after {
    content: "+";
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 1.3rem;
    color: var(--accent-indigo);
    transition: transform 0.3s var(--ease-spring);
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding-bottom: 18px; margin: 0; }

/* Enlaces relacionados en las fichas de servicio */
.related-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid var(--border-soft);
}
.related-links__item {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.88rem;
    color: var(--text-muted);
    transition: border-color 0.2s ease, color 0.2s ease;
}
.related-links__item:hover { border-color: var(--accent-indigo); color: var(--text-primary); }
.related-links__item--featured { border-color: rgba(0, 191, 255, 0.5); color: var(--text-primary); }

.service-card--featured { border-color: rgba(255, 180, 84, 0.45); }
.service-card--featured .card-shot { object-fit: cover; object-position: top; }

.footer__markets { font-size: 0.88rem; color: var(--text-faint); }

/* ---------- Spotlight (data-spotlight): luz que sigue al cursor dentro de la tarjeta ---------- */
[data-spotlight] { --mx: 50%; --my: 50%; }
[data-spotlight] > * { position: relative; z-index: 1; }
.has-pointer [data-spotlight]::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    background: radial-gradient(380px circle at var(--mx) var(--my), rgba(0, 191, 255, 0.14), transparent 45%);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}
.has-pointer [data-spotlight]:hover::after { opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .super-teaser__card, .split { grid-template-columns: 1fr; }
    .split--reverse > :first-child { order: 0; }
    .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .bento { grid-template-columns: 1fr; }
    .bento__card--wide { grid-column: auto; }
    .orbit__node > span { font-size: 0.68rem; padding: 4px 8px; }
}

/* ==========================================================================
   MOVIMIENTO — solo si el usuario no pidió reducirlo
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {

    .site-bg__aurora { animation: aurora 22s ease-in-out infinite alternate; }
    @keyframes aurora {
        0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
        50% { transform: translate3d(4%, 3%, 0) rotate(6deg) scale(1.08); }
        100% { transform: translate3d(-3%, 5%, 0) rotate(-4deg) scale(1.02); }
    }

    .hero__title,
    .section__title,
    [data-split].is-split .split-word__inner { animation: shimmer 9s ease-in-out infinite alternate; }
    @keyframes shimmer { to { background-position: 100% 50%; } }

    /* Revelado al hacer scroll. Solo se oculta si el JS está activo (.js) y aún no se ha visto. */
    .js [data-reveal]:not(.is-visible) {
        opacity: 0;
        transform: translate3d(0, 28px, 0) scale(0.985);
        filter: blur(6px);
    }
    .js [data-reveal] {
        transition:
            opacity 0.9s var(--ease-out-expo),
            transform 0.9s var(--ease-out-expo),
            filter 0.9s var(--ease-out-expo),
            border-color 0.25s ease,
            box-shadow 0.25s ease;
        transition-delay: calc(var(--stagger, 0) * 90ms);
    }

    /* Palabras del título: suben desde una máscara. El texto sigue siendo visible para el LCP. */
    .js [data-split].is-split .split-word__inner {
        transform: translate3d(0, 105%, 0) rotate(4deg);
        transition: transform 0.95s var(--ease-out-expo);
        transition-delay: calc(var(--w, 0) * 55ms);
    }
    .js [data-split].is-split.is-visible .split-word__inner { transform: none; }

    /* Inclinación 3D (data-tilt): el JS solo escribe --rx/--ry. */
    [data-tilt] {
        --rx: 0deg;
        --ry: 0deg;
        --lift: 0px;
        transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)) translate3d(0, var(--lift), 0);
        transform-style: preserve-3d;
        will-change: transform;
    }
    .js [data-tilt][data-reveal]:not(.is-visible) {
        transform: perspective(900px) translate3d(0, 28px, 0) scale(0.985);
    }
    [data-tilt]:hover { --lift: -6px; }
    .service-card[data-tilt]:hover { transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)) translate3d(0, var(--lift), 0); }
    [data-tilt].is-tilting { transition-duration: 0.12s, 0.12s, 0.9s, 0.25s, 0.25s; }

    /* Botones magnéticos + destello */
    [data-magnetic] {
        transform: translate3d(var(--tx, 0), var(--ty, 0), 0);
        transition: transform 0.35s var(--ease-spring), background 0.2s ease, box-shadow 0.2s ease;
    }
    .btn--primary::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
        transform: translateX(-120%);
        transition: transform 0.8s var(--ease-out-expo);
        pointer-events: none;
    }
    .btn--primary:hover::after { transform: translateX(120%); }

    /* Marquesina infinita */
    .marquee__track { animation: marquee 38s linear infinite; }
    .marquee:hover .marquee__track { animation-play-state: paused; }
    @keyframes marquee { to { transform: translateX(-100%); } }

    /* Órbita */
    .orbit__ring { animation: spin 48s linear infinite; }
    .orbit__node > span { animation: spin 48s linear infinite reverse; }
    .orbit__core { animation: pulse 3.2s ease-in-out infinite; }
    @keyframes spin { to { transform: rotate(360deg); } }
    @keyframes pulse {
        0%, 100% { box-shadow: 0 0 50px -12px rgba(0, 191, 255, 0.6); }
        50% { box-shadow: 0 0 80px -6px rgba(0, 191, 255, 0.95); }
    }

    /* Flotación suave del mock de la home */
    .hero__stage[data-parallax] { transform: translate3d(0, var(--py, 0), 0); transition: transform 0.2s linear; }

    /* Barra de progreso con degradado */
    .scroll-progress { background: linear-gradient(90deg, #00bfff, #ffb454); }

    /* Animaciones ligadas al scroll nativas (Chrome/Edge): la imagen del caso hace zoom suave. */
    @supports (animation-timeline: view()) {
        .case-figure img, .super-teaser__visual img {
            animation: zoom-in-view linear both;
            animation-timeline: view();
            animation-range: entry 0% cover 60%;
        }
        @keyframes zoom-in-view { from { transform: scale(1.12); } to { transform: scale(1); } }
    }
}

/* Las piezas decorativas (órbita, inclinación 3D) nunca generan scroll horizontal.
   clip (no hidden) no crea contenedor de scroll, así position: sticky sigue funcionando. */
main { overflow-x: clip; }
@media (max-width: 600px) {
    @supports (width: 1cqi) {
        .orbit__node { transform: rotate(var(--angle)) translate(38cqi) rotate(calc(-1 * var(--angle))); }
    }
}
