/* ============================================================
   ciberseguridad-anim.css — Animation layer for ciberseguridad section
   Gate class: js-cy (set on <html> before stylesheets load)
   Scroll-down  → full entrance animation
   Scroll-up    → content snaps visible (no flash)
   onReset fires only when element exits from TOP (bottom <= 0)
   ============================================================ */

/* ── Keyframes ─────────────────────────────────────────────── */
@keyframes cy-rise {
  from { opacity:0; transform:translateY(24px); }
  to   { opacity:1; transform:none; }
}
@keyframes cy-pop {
  from { opacity:0; transform:scale(.9) translateY(14px); }
  to   { opacity:1; transform:none; }
}
@keyframes cy-clip {
  from { clip-path:inset(0 100% 0 0); opacity:0; }
  to   { clip-path:inset(0 0% 0 0);   opacity:1; }
}
@keyframes cy-word {
  from { clip-path:inset(0 0 110% 0); opacity:0; }
  to   { clip-path:inset(0 0 0% 0);   opacity:1; }
}
@keyframes cy-right {
  from { opacity:0; transform:translateX(36px); }
  to   { opacity:1; transform:none; }
}

/* ── Neutralize container .reveal so children animate ─────── */
.js-cy .cyx-head.reveal,      .js-cy .cyx-head.reveal.in,
.js-cy .cyber-top.reveal,     .js-cy .cyber-top.reveal.in,
.js-cy .cyber-flow.reveal,    .js-cy .cyber-flow.reveal.in,
.js-cy .cyber-grid.reveal,    .js-cy .cyber-grid.reveal.in,
.js-cy .cyx-svc-grid.reveal,  .js-cy .cyx-svc-grid.reveal.in,
.js-cy .cyx-stats.reveal,     .js-cy .cyx-stats.reveal.in,
.js-cy .cyx-grid.reveal,      .js-cy .cyx-grid.reveal.in,
.js-cy .hk-points.reveal,     .js-cy .hk-points.reveal.in,
.js-cy .hk-diff.reveal,       .js-cy .hk-diff.reveal.in,
.js-cy .cyx-logos.reveal,     .js-cy .cyx-logos.reveal.in,
.js-cy .cyx-cta.reveal,       .js-cy .cyx-cta.reveal.in {
  opacity:1; transform:none; transition:none;
}

/* ── CSS gate — hidden initial states ───────────────────────── */

/* Hero */
.js-cy .hero h1 .gw          { display:inline-block; opacity:0; }
.js-cy .hero .hero-sub       { opacity:0; }
.js-cy .hero-meta            { opacity:0; }

/* Section heads */
.js-cy .cyx-head .marker     { opacity:0; }
.js-cy .cyx-head h2          { opacity:0; }
.js-cy .cyx-head .lead       { opacity:0; }

/* Standalone paragraphs */
.js-cy .hk-p                 { opacity:0; }

/* AENOR cert */
.js-cy .cyx-cert             { opacity:0; }

/* NIST flow steps */
.js-cy .cyber-step           { opacity:0; }

/* Service columns */
.js-cy .cyber-col            { opacity:0; }

/* Service cards */
.js-cy .cyx-svc-card         { opacity:0; }

/* Stats */
.js-cy .cyx-stat             { opacity:0; }

/* Benefit / feature cards */
.js-cy .cyx-card             { opacity:0; }

/* Check points */
.js-cy .hk-point             { opacity:0; }

/* Differentiators */
.js-cy .hk-diff-item         { opacity:0; }

/* Partner logos */
.js-cy .cyx-logo             { opacity:0; }

/* CTA section */
.js-cy .cyx-cta h2           { opacity:0; }
.js-cy .cyx-cta > p          { opacity:0; }
.js-cy .cyx-cta .btn         { opacity:0; }

/* ── Animated states (cy-in) ────────────────────────────────── */

/* Hero: h1 gets cy-in → all .gw children play cy-word */
.js-cy .hero h1.cy-in .gw         { animation:cy-word  0.52s cubic-bezier(.2,0,0,1) forwards; }
.js-cy .hero .hero-sub.cy-in      { animation:cy-rise  0.60s cubic-bezier(.2,0,0,1) forwards; }
.js-cy .hero-meta.cy-in           { animation:cy-rise  0.55s cubic-bezier(.2,0,0,1) forwards; }

/* Section heads */
.js-cy .cyx-head .marker.cy-in    { animation:cy-clip  0.48s cubic-bezier(.2,0,0,1) forwards; }
.js-cy .cyx-head h2.cy-in         { animation:cy-rise  0.65s cubic-bezier(.2,0,0,1) forwards; }
.js-cy .cyx-head .lead.cy-in      { animation:cy-rise  0.62s cubic-bezier(.2,0,0,1) forwards; }

/* Standalone paragraphs */
.js-cy .hk-p.cy-in                { animation:cy-rise  0.60s cubic-bezier(.2,0,0,1) forwards; }

/* AENOR cert */
.js-cy .cyx-cert.cy-in            { animation:cy-right 0.62s cubic-bezier(.2,0,0,1) forwards; }

/* Flow steps & columns */
.js-cy .cyber-step.cy-in          { animation:cy-rise  0.52s cubic-bezier(.2,0,0,1) forwards; }
.js-cy .cyber-col.cy-in           { animation:cy-rise  0.60s cubic-bezier(.2,0,0,1) forwards; }

/* Cards */
.js-cy .cyx-svc-card.cy-in        { animation:cy-pop   0.50s cubic-bezier(.2,0,0,1) forwards; }
.js-cy .cyx-stat.cy-in            { animation:cy-pop   0.50s cubic-bezier(.2,0,0,1) forwards; }
.js-cy .cyx-card.cy-in            { animation:cy-pop   0.50s cubic-bezier(.2,0,0,1) forwards; }

/* Points & differentiators */
.js-cy .hk-point.cy-in            { animation:cy-rise  0.55s cubic-bezier(.2,0,0,1) forwards; }
.js-cy .hk-diff-item.cy-in        { animation:cy-pop   0.44s cubic-bezier(.2,0,0,1) forwards; }

/* Logos */
.js-cy .cyx-logo.cy-in            { animation:cy-pop   0.42s cubic-bezier(.2,0,0,1) forwards; }

/* CTA */
.js-cy .cyx-cta h2.cy-in          { animation:cy-rise  0.62s cubic-bezier(.2,0,0,1) forwards; }
.js-cy .cyx-cta > p.cy-in         { animation:cy-rise  0.60s cubic-bezier(.2,0,0,1) forwards; }
.js-cy .cyx-cta .btn.cy-in        { animation:cy-pop   0.48s cubic-bezier(.2,0,0,1) forwards; }

/* ── Snap rule — instant visibility on scroll-up ────────────── */
.js-cy .cy-snap,
.js-cy .cy-snap * { animation:none !important; opacity:1 !important; transform:none !important; }

/* ── Form drawer ─────────────────────────────────────────────── */

/* Floating trigger button */
.cy-form-btn {
  position: fixed; bottom: 32px; right: 32px;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 22px;
  background: var(--c3-orange, #FC466B);
  color: #fff; border: none; border-radius: 50px;
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 700;
  letter-spacing: .01em; cursor: pointer; white-space: nowrap;
  box-shadow: 0 8px 28px rgba(252,70,107,.38);
  z-index: 200;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.cy-form-btn:hover {
  transform: scale(1.04) translateY(-2px);
  box-shadow: 0 14px 40px rgba(252,70,107,.5);
}
.cy-form-btn svg { width:15px; height:15px; flex-shrink:0; }

/* Backdrop overlay */
.cy-overlay {
  position: fixed; inset: 0;
  background: rgba(4,9,22,.72);
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
  z-index: 400;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.cy-overlay.cy-open { opacity:1; pointer-events:all; }

/* Drawer panel */
.cy-drawer {
  position: fixed; top: 16px; right: 16px; bottom: 16px;
  width: 440px; max-width: calc(100vw - 32px);
  background: var(--bg-base, #060d1f);
  border: 1px solid rgba(204,231,255,.12);
  border-radius: 20px;
  display: flex; flex-direction: column;
  transform: translateX(calc(100% + 32px));
  transition: transform .34s cubic-bezier(.2,0,0,1);
  z-index: 401;
  overflow: hidden;
}
.cy-drawer.cy-open { transform: translateX(0); }

/* Drawer header */
.cy-drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 28px 28px 22px;
  border-bottom: 1px solid rgba(204,231,255,.08);
  flex-shrink: 0;
}
.cy-drawer-label {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--c3-orange, #FC466B); opacity:.9;
  display: block; margin-bottom: 5px;
}
.cy-drawer-h {
  font-family: var(--font-sans); font-size: 22px; font-weight: 800;
  letter-spacing: -.035em; color: #fff; margin: 0; line-height: 1.1;
}
.cy-drawer-sub {
  font-family: var(--font-body); font-size: 13.5px;
  color: rgba(204,231,255,.55); margin: 6px 0 0; line-height: 1.45;
}
.cy-drawer-close {
  width: 36px; height: 36px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.07); border: none; border-radius: 10px;
  color: rgba(204,231,255,.65); cursor: pointer; font-size: 16px;
  transition: background .15s, color .15s;
}
.cy-drawer-close:hover { background: rgba(255,255,255,.14); color:#fff; }

/* Drawer scrollable body */
.cy-drawer-body {
  flex: 1; overflow-y: auto; padding: 28px 28px 48px;
  scrollbar-width: thin;
  scrollbar-color: rgba(204,231,255,.12) transparent;
}
.cy-drawer-body::-webkit-scrollbar { width:4px; }
.cy-drawer-body::-webkit-scrollbar-track { background: transparent; }
.cy-drawer-body::-webkit-scrollbar-thumb { background: rgba(204,231,255,.15); border-radius:4px; }

/* HubSpot form overrides inside drawer */
.cy-drawer-body .hs-form fieldset { max-width: none !important; }
.cy-drawer-body .hs-form .hs-input,
.cy-drawer-body .hs-form input,
.cy-drawer-body .hs-form textarea,
.cy-drawer-body .hs-form select {
  width: 100% !important; box-sizing: border-box !important;
}

/* Mobile: floating window with gap on all sides */
@media (max-width: 520px) {
  .cy-drawer {
    top: 12px; left: 12px; right: 12px; bottom: 12px;
    width: auto; max-width: none;
    border-radius: 20px;
    border: 1px solid rgba(204,231,255,.14);
    transform: translateY(calc(100% + 24px));
  }
  .cy-drawer.cy-open { transform: translateY(0); }
  .cy-form-btn { bottom: 20px; right: 16px; padding: 12px 18px; font-size: 13px; }
  .cy-drawer-head { padding: 22px 20px 18px; }
  .cy-drawer-body { padding: 20px 20px 40px; }
}
