/* ═══════════════════════════════════════════════
   Búho Digital Landing V5.1 — frame-engine.css
   Tipografía: Manrope
   ═══════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800;900&display=swap');

:root {
    --buho-blue:     #008cff;
    --buho-cyan:     #42C7FF;
    --buho-dark:     #000a1a;
    --buho-glass:    rgba(0, 12, 30, 0.86);
    --buho-glow:     rgba(0, 140, 255, 0.25);
    --buho-muted:    rgba(255,255,255,0.70);
    --tl-active:     #42C7FF;
    --tl-inactive:   #64748B;
    --header-h:      120px;
}

#buho-landing-root {
    position: relative;
    font-family: 'Manrope', -apple-system, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ════════════════════════
   PRELOADER
════════════════════════ */
#buho-preloader {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0; bottom: 0;
    z-index: 999;
    background: var(--buho-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.7s ease, visibility 0.7s ease;
}
#buho-preloader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
#buho-preloader-inner { text-align: center; width: 260px; }
#buho-preloader-logo {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    color: var(--buho-cyan);
    margin-bottom: 30px;
    text-transform: uppercase;
}
#buho-preloader-bar-wrap {
    width: 100%; height: 2px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px; overflow: hidden; margin-bottom: 12px;
}
#buho-preloader-bar {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--buho-blue), var(--buho-cyan));
    border-radius: 2px;
    transition: width 0.15s linear;
    box-shadow: 0 0 8px var(--buho-cyan);
}
#buho-preloader-label {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.06em;
}

/* ════════════════════════
   SCROLL CONTAINER — 250 frames × 2vh = 500vh
════════════════════════ */
#buho-scroll-container {
    position: relative;
    height: 500vh;
}

/* El frame de video: sticky, siempre visible, cambia de imagen con scroll.
   Esto es lo ÚNICO que sigue controlado por JS — el resto es CSS puro. */
#buho-frame-wrapper {
    position: sticky;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--buho-dark);
    margin-left: calc(50% - 50vw);
    z-index: 1;
}
#buho-frame {
    width: 100%;
    height: 100%;
    display: block;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* ════════════════════════
   CARDS LAYER — posiciones FIJAS, sin sticky, sin toggle
════════════════════════ */
/* Layer FIJO al viewport — no se mueve con el scroll del documento.
   Todo el movimiento visual de las cards viene exclusivamente del
   transform que calcula JS en cada frame, función continua y reversible. */
#buho-cards-layer {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--header-h));
    pointer-events: none;
    z-index: 200;
}
/* Al pasar el final del scroll-container (entrando al footer),
   este layer fixed deja de renderizarse — si no, al ser "fixed"
   se queda pegado tapando el footer para siempre. */
#buho-cards-layer.is-past-end {
    display: none;
}

/* TODAS las cards ocupan exactamente la misma posición — centradas
   en el viewport completo, sin desplazamiento ni offset. Solo se
   diferencian por su rango de frames visible (data-frame-start/end).
   Aparecen/desaparecen con un fundido corto: pura ilusión óptica,
   nada se mueve, nada se calcula por distancia. */
.buho-fixed-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    /* Sin pointer-events ni opacity por defecto acá — el JS los
       escribe directamente (inline style) cada frame, calculados
       con interpolación lineal exacta según data-fade-in/out-*.
       Sin transition: el valor ya viene suavizado por la propia
       rampa lineal, agregar CSS easing encima generaría desfasaje. */
}

/* La opacidad/posición global de toda la card (incluye giant-text,
   glass-card, microdatos) ya está controlada por la card padre vía
   --buho-offset y --buho-opacity. Los hijos no necesitan transición
   propia — heredan visualmente del padre de forma continua y exacta. */

/* ════════════════════════
   TEXTO GIGANTE
════════════════════════ */
.giant-text {
    position: absolute;
    bottom: 10vh;
    font-size: clamp(3rem, 8vw, 8rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1;
    text-transform: uppercase;
    pointer-events: none;
    user-select: none;
    color: rgba(255,255,255,0.88);
    text-shadow:
        0 0 25px rgba(66,199,255,0.65),
        0 0 70px rgba(66,199,255,0.3),
        0 0 1px rgba(66,199,255,0.95);
}
.giant-right { right: 170px; text-align: right; }
.giant-left  { left: 5vw;   text-align: left;  }

/* ════════════════════════
   GLASS CARD
════════════════════════ */
.glass-card {
    position: relative;
    width: clamp(280px, 28vw, 420px);
    max-height: calc(85vh - var(--header-h));
    overflow-y: auto;
    padding: clamp(22px, 2.2vw, 34px);
    border-radius: 20px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    background: var(--buho-glass);
    border: 1px solid transparent;
    color: #fff;
    scrollbar-width: none;
    isolation: isolate;
}
.glass-card::-webkit-scrollbar { display: none; }

.glass-card::before {
    content: '';
    position: absolute;
    inset: -1.5px;
    border-radius: 21px;
    z-index: -1;
    background: conic-gradient(
        from var(--buho-angle, 0deg),
        transparent 0%, transparent 25%,
        #42C7FF 45%, #008cff 55%,
        transparent 75%, transparent 100%
    );
    animation: buho-spin 4s linear infinite;
    opacity: 0.9;
}
.glass-card::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 19px;
    background: var(--buho-glass);
    backdrop-filter: blur(24px);
    z-index: -1;
}
@property --buho-angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes buho-spin { to { --buho-angle: 360deg; } }
@supports not (background: conic-gradient(from 0deg, red, blue)) {
    .glass-card::before { background: none; border: 1px solid rgba(66,199,255,0.45); }
}

/* Posiciones horizontales — el contenedor padre (.buho-fixed-card) ya
   centra verticalmente con flex; estas solo definen izquierda/derecha */
.card-left  { margin-left: 5vw;  margin-right: auto; }
.card-right { margin-left: auto; margin-right: 170px; }

/* ── Tipografía ── */
.section-tag {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--buho-cyan);
    border: 1px solid rgba(66,199,255,0.35);
    border-radius: 20px;
    padding: 4px 12px;
    margin-bottom: 14px;
}
.glass-card h2 {
    font-size: clamp(1.5rem, 2.5vw, 2.2rem);
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 12px;
    color: #fff;
    letter-spacing: -0.01em;
}
.glass-card p {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.65;
    color: var(--buho-muted);
    margin: 0 0 18px;
}

/* ════════════════════════
   ICON GRID
════════════════════════ */
.icon-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 18px;
}
.icon-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(0,140,255,0.07);
    border: 1px solid rgba(66,199,255,0.18);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,0.78);
    line-height: 1.3;
}
.buho-icon {
    width: 22px; height: 22px;
    flex-shrink: 0;
    fill: none;
    stroke: #42C7FF;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 2px #42C7FF) drop-shadow(0 0 6px rgba(66,199,255,0.6));
    overflow: visible;
}
.buho-icon path, .buho-icon circle, .buho-icon line,
.buho-icon polyline, .buho-icon polygon, .buho-icon rect {
    stroke: #42C7FF !important;
    fill: none !important;
}

/* ════════════════════════
   SOCIAL BADGES
════════════════════════ */
.social-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
    margin-bottom: 16px;
}
.social-badge {
    font-size: 13px;
    font-weight: 600;
    color: var(--buho-cyan);
    border: 1px solid rgba(66,199,255,0.35);
    border-radius: 20px;
    padding: 4px 12px;
    background: rgba(66,199,255,0.07);
}

/* ════════════════════════
   CTA BUTTONS
════════════════════════ */
.buho-cta {
    display: inline-block;
    margin-top: 4px;
    padding: 11px 22px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none;
    background: linear-gradient(135deg, var(--buho-blue), var(--buho-cyan));
    color: #fff !important;
    box-shadow: 0 4px 18px rgba(0,140,255,0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.buho-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,140,255,0.6); color: #fff !important; }
.cta-glow { animation: ctaPulse 2.5s ease-in-out infinite; }
@keyframes ctaPulse {
    0%,100% { box-shadow: 0 4px 18px rgba(66,199,255,0.4); }
    50%      { box-shadow: 0 4px 32px rgba(66,199,255,0.85); }
}

/* ════════════════════════
   MICRODATOS
════════════════════════ */
.buho-microdatos {
    position: absolute;
    bottom: 12vh;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.microdatos-bottom-left  { left: 5vw; }
.microdatos-bottom-right { right: 170px; }

.micro-item {
    background: rgba(0,12,30,0.75);
    border: 1px solid rgba(66,199,255,0.28);
    border-radius: 12px;
    padding: 8px 14px;
    backdrop-filter: blur(12px);
    text-align: center;
    min-width: 90px;
}
.micro-value {
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.micro-value.positive { color: var(--buho-cyan); text-shadow: 0 0 10px rgba(66,199,255,0.55); }
.micro-value.negative { color: #ff6b6b;          text-shadow: 0 0 10px rgba(255,107,107,0.45); }
.micro-label {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
    margin-top: 3px;
}

/* ════════════════════════
   NAVEGACIÓN LATERAL
════════════════════════ */
#buho-nav {
    position: fixed;
    right: 0;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    width: 160px;
    z-index: 201;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    padding-right: 28px;
    pointer-events: none;
}
#buho-progress-track {
    position: absolute;
    right: 14px; top: 0;
    width: 1.5px; height: 100%;
    background: rgba(255,255,255,0.08);
}
#buho-progress-fill {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 0%;
    background: var(--tl-active);
    box-shadow: 0 0 8px var(--tl-active);
    transition: height 0.1s linear;
}
#buho-timeline {
    display: flex;
    flex-direction: column;
    gap: 20px;
    pointer-events: auto;
    position: relative;
    z-index: 2;
}
.tl-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-direction: row-reverse;
    cursor: pointer;
    pointer-events: auto;
}
.tl-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    border: 1.5px solid var(--tl-inactive);
    background: transparent;
    flex-shrink: 0;
    transition: border-color 0.3s, background 0.3s, box-shadow 0.3s, transform 0.3s;
}
.tl-item.active .tl-dot {
    background: var(--tl-active);
    border-color: var(--tl-active);
    transform: scale(1.3);
    box-shadow: 0 0 8px var(--tl-active), 0 0 18px rgba(66,199,255,0.35);
}
.tl-label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--tl-inactive);
    white-space: nowrap;
    opacity: 0;
    transform: translateX(8px);
    transition: opacity 0.3s, transform 0.3s, color 0.3s;
}
.tl-item:hover .tl-label,
.tl-item.active .tl-label {
    opacity: 1;
    transform: translateX(0);
    color: var(--tl-active);
}

/* ════════════════════════
   CONTADOR
════════════════════════ */
#buho-frame-counter {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 199;
    text-align: right;
    pointer-events: none;
}
#buho-counter-number {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.45);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-variant-numeric: tabular-nums;
}
#buho-counter-number span { color: var(--tl-active); }
#buho-counter-section {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--tl-active);
    margin-top: 3px;
    opacity: 0.8;
}

/* ════════════════════════
   CTA FINAL
════════════════════════ */
#buho-cta-final {
    position: relative;
    background: linear-gradient(180deg, var(--buho-dark) 0%, #000d22 100%);
    padding: 100px 20px;
    text-align: center;
    z-index: 10;
}
#buho-cta-inner { max-width: 680px; margin: 0 auto; }
#buho-cta-logo {
    width: 72px; height: auto;
    margin-bottom: 30px;
    filter: drop-shadow(0 0 18px rgba(66,199,255,0.5));
}
#buho-cta-final h2 {
    font-size: clamp(1.6rem, 3vw, 2.6rem);
    font-weight: 700;
    line-height: 1.25;
    color: #fff;
    margin: 0 0 16px;
}
#buho-cta-final p {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.7;
    color: var(--buho-muted);
    margin: 0 0 36px;
}
#buho-cta-buttons { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.cta-primary {
    background: linear-gradient(135deg, var(--buho-blue), var(--buho-cyan));
    color: #fff !important;
    padding: 13px 30px;
    box-shadow: 0 6px 22px rgba(0,140,255,0.45);
}
.cta-primary:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,140,255,0.65); }
.cta-secondary {
    background: transparent;
    color: var(--buho-cyan) !important;
    border: 1.5px solid var(--buho-cyan);
    padding: 13px 30px;
    box-shadow: none;
}
.cta-secondary:hover { background: rgba(66,199,255,0.08); transform: translateY(-3px); }


/* ════════════════════════
   SOMOS — texto+CTA arriba centrado, chips cuadrados a los costados
════════════════════════ */
.buho-somos-layout {
    /* Contenedor relativo simple — cada grupo se posiciona independiente */
    position: relative;
    display: block;
}

/* Bloque de texto: centrado horizontalmente, arriba de la notebook */
.somos-text-block {
    position: absolute;
    top: calc(var(--header-h) + 4vh);
    left: 50%;
    transform: translateX(-50%);
    width: clamp(280px, 50vw, 560px);
    text-align: center;
    pointer-events: auto;
}
.somos-text-block .section-tag { margin-bottom: 10px; }
.somos-text-block h1,
.somos-text-block h2 {
    font-size: clamp(1.6rem, 2.6vw, 2.3rem);
    font-weight: 700;
    line-height: 1.25;
    color: #fff;
    margin: 0 0 10px;
}
.somos-text-block p {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.6;
    color: var(--buho-muted);
    margin: 0 0 18px;
}

/* Grupos de chips: flanqueando la notebook, centrados verticalmente */
.somos-side {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    pointer-events: auto;
}
.somos-left  { left: 6vw; }
.somos-right { right: 6vw; }

/* Chip cuadrado y simétrico — icono arriba, texto abajo */
.somos-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: clamp(96px, 9vw, 130px);
    aspect-ratio: 1 / 1;
    padding: 10px;
    background: rgba(0,140,255,0.07);
    border: 1px solid rgba(66,199,255,0.22);
    border-radius: 16px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    color: rgba(255,255,255,0.85);
    backdrop-filter: blur(10px);
}
.somos-chip .buho-icon { width: 26px; height: 26px; }

/* ════════════════════════
   BOTTOM CHIPS ROW — 4 chips CUADRADOS centrados abajo
════════════════════════ */
.bottom-chips-row {
    position: absolute;
    bottom: 10vh;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
    pointer-events: auto;
    max-width: 90vw;
}

/* Chip cuadrado — mismo criterio que somos-chip, reutilizado en
   Publicidad / Marketing / Web+SEO / Software+IA / Automatizaciones */
.mini-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: clamp(90px, 8vw, 120px);
    aspect-ratio: 1 / 1;
    padding: 10px;
    background: var(--buho-glass);
    border: 1px solid rgba(66,199,255,0.3);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    color: rgba(255,255,255,0.85);
    white-space: normal;
    box-shadow: 0 0 20px rgba(0,140,255,0.15);
}
.mini-chip .buho-icon { width: 22px; height: 22px; }

/* ════════════════════════
   MICRODATOS — variante arriba-derecha
════════════════════════ */
.microdatos-top-right {
    top: 14vh;
    bottom: auto;
    right: 170px;
    left: auto;
}

/* ════════════════════════
   RESPONSIVE — MOBILE + LAPTOPS CHICAS (≤1300px)
   Todo lo que no sea desktop grande usa este layout simplificado,
   probado y sin solapes posibles.
════════════════════════ */
@media (max-width: 1300px) {
    :root { --header-h: 80px; }

    .buho-fixed-card {
        align-items: flex-end;
        padding-bottom: 16px;
    }

    .glass-card {
        width: calc(100vw - 32px);
        margin-left: 16px !important;
        margin-right: 16px !important;
        max-height: 50vh;
    }

    .giant-text {
        font-size: clamp(2rem, 11vw, 3.5rem);
        bottom: auto;
        top: calc(var(--header-h) + 20px);
        left: 0 !important;
        right: 0 !important;
        text-align: center;
    }

    #buho-nav,
    #buho-frame-counter,
    .buho-microdatos { display: none; }

    /* Somos en mobile: texto arriba, chips apilados abajo en fila */
    .somos-text-block {
        top: calc(var(--header-h) + 12px);
        width: calc(100vw - 32px);
    }
    .somos-side {
        top: auto;
        bottom: 4vh;
        transform: none;
        flex-direction: row;
        gap: 8px;
    }
    .somos-left  { left: 50%; transform: translateX(-105%); }
    .somos-right { right: 50%; transform: translateX(105%); }
    /* Cuadrado FORZADO: width+height explícitos (no solo aspect-ratio)
       + overflow:hidden — así el texto largo nunca estira la caja. */
    .somos-chip  {
        width: 80px;
        height: 80px;
        aspect-ratio: auto;
        font-size: 10px;
        gap: 4px;
        padding: 7px;
        overflow: hidden;
    }
    .somos-chip .buho-icon { width: 20px; height: 20px; }

    .bottom-chips-row {
        top: calc(var(--header-h) + 4px);
        left: 50%;
        transform: translateX(-50%);
        /* Una sola fila, sin wrap — elimina cualquier ambigüedad
           de separación entre líneas y permite hacerlos más grandes. */
        flex-wrap: nowrap;
        justify-content: center;
        gap: 6px;
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
    }
    .mini-chip {
        /* 4 chips en una fila dentro de ~100vw-24px, con 3 gaps de 6px */
        width: calc((100vw - 24px - 18px) / 4);
        height: calc((100vw - 24px - 18px) / 4);
        max-width: 92px;
        max-height: 92px;
        aspect-ratio: 1 / 1;
        font-size: 9.5px;
        gap: 4px;
        padding: 6px;
        overflow: hidden;
        flex-shrink: 0;
    }
    .mini-chip .buho-icon { width: 20px; height: 20px; }
}
