/* ==========================================================================
   SCROLL FX — Corporacion Club El Meta
   Progreso de lectura, aparicion al hacer scroll, header con estado,
   menu secundario pegajoso, boton "volver arriba" y micro-interacciones.

   Reglas de la casa:
   - Todo es ADITIVO. Si el JS no carga, la pagina se ve exactamente igual
     que antes (nada queda oculto: el ocultamiento vive bajo .sfx-ready,
     clase que solo agrega scroll-fx.js cuando el observer va a correr).
   - Todo se apaga con prefers-reduced-motion: reduce.
   ========================================================================== */

:root{
  --sfx-ease: cubic-bezier(.22,.61,.36,1);
  --sfx-dur: 640ms;
  /* lo calcula scroll-fx.js con la altura real del header */
  --sfx-header-h: 64px;
}

/* --------------------------------------------------------------------------
   1. Barra de progreso de lectura (3px arriba del todo)
   -------------------------------------------------------------------------- */
.sfx-progress{
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 1400;
  pointer-events: none;
  transition: opacity .25s ease;
}
.sfx-progress__bar{
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, #1e40af 0%, #3b82f6 55%, #fbbf24 100%);
  box-shadow: 0 0 12px rgba(59,130,246,.55);
  transition: transform .12s linear;
}
/* Con el menu movil o un modal abierto la barra estorba (y ademas no hay
   scroll que reportar: Bootstrap bloquea el body) */
body.nav-open .sfx-progress,
body.modal-open .sfx-progress{ opacity: 0; }

/* --------------------------------------------------------------------------
   2. Header: gana relieve al separarse del tope
   -------------------------------------------------------------------------- */
.site-header{
  transition: box-shadow .32s ease;
}
body.sfx-scrolled .site-header{
  box-shadow: 0 10px 30px rgba(8,25,70,.30);
}
/* El escudo se compacta un poco al bajar. Se anima el badge circular
   (.brand-logo-wrap) y no .brand-link, que ya usa transform en :hover.
   Al ser transform, no mueve el layout ni cambia la altura del header. */
.site-header .brand-logo-wrap{
  transition: transform .32s var(--sfx-ease);
}
body.sfx-scrolled .site-header .brand-logo-wrap{ transform: scale(.88); }

/* --------------------------------------------------------------------------
   3. Menu secundario pegajoso bajo el header (solo escritorio, donde es
      la navegacion principal; en movil vive dentro del panel deslizable)
   -------------------------------------------------------------------------- */
@media (min-width: 901px){
  .menu-info{
    position: sticky;
    top: var(--sfx-header-h);
    transition: box-shadow .32s ease;
  }
  body.sfx-scrolled .menu-info{
    box-shadow: 0 8px 22px rgba(8,25,70,.24);
  }
}

/* --------------------------------------------------------------------------
   4. Aparicion al hacer scroll
   -------------------------------------------------------------------------- */
.sfx-ready .sfx-reveal{
  opacity: 0;
  transform: translate3d(0, 26px, 0);
  transition:
    opacity var(--sfx-dur) ease,
    transform var(--sfx-dur) var(--sfx-ease);
  transition-delay: var(--sfx-delay, 0ms);
}
.sfx-ready .sfx-reveal.is-visible{
  opacity: 1;
  transform: none;
}

/* El sistema previo `.reveal` (index.html) vive en style.css y ya quedo
   bajo .sfx-ready, asi que comparte esta misma garantia. */

/* --------------------------------------------------------------------------
   5. Boton "volver arriba"
   -------------------------------------------------------------------------- */
.sfx-top{
  position: fixed;
  right: 18px;
  bottom: 20px;
  z-index: 1250;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  color: #fff;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  box-shadow: 0 10px 26px rgba(15,40,110,.38);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(.9);
  transition:
    opacity .28s ease,
    transform .28s var(--sfx-ease),
    visibility .28s,
    box-shadow .2s ease;
}
.sfx-top.is-visible{
  opacity: 1;
  visibility: visible;
  transform: none;
}
.sfx-top:hover,
.sfx-top:focus-visible{
  color: #fff;
  box-shadow: 0 14px 34px rgba(15,40,110,.52);
  transform: translateY(-3px);
}
.sfx-top:active{ transform: translateY(0) scale(.94); }
/* Nunca compite con el menu movil ni con un modal abierto (el detalle de
   salon en /espacios/ usa modales de Bootstrap) */
body.nav-open .sfx-top,
body.modal-open .sfx-top{ opacity: 0 !important; visibility: hidden !important; }

@media (max-width: 575.98px){
  .sfx-top{ right: 14px; bottom: 14px; width: 44px; height: 44px; font-size: 1.05rem; }
}

/* --------------------------------------------------------------------------
   6. Anclas: que el header pegajoso no tape el destino
   -------------------------------------------------------------------------- */
main [id],
section[id],
h1[id], h2[id], h3[id], h4[id]{
  scroll-margin-top: calc(var(--sfx-header-h) + 18px);
}

/* --------------------------------------------------------------------------
   7. Micro-interacciones
   -------------------------------------------------------------------------- */

/* Foco visible coherente en todo el sitio (teclado) */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible{
  outline: 3px solid rgba(59,130,246,.60);
  outline-offset: 2px;
}

/* Seleccion de texto con color de marca */
::selection{ background: rgba(30,64,175,.85); color: #fff; }

/* Respuesta tactil al presionar. Se usa `animation` y la propiedad
   independiente `scale` para no pisar los transition/transform que ya
   tienen los botones del sitio. */
@keyframes sfxPress{
  from{ scale: 1; }
  to  { scale: .965; }
}
.btn.pressed,
button.pressed{
  animation: sfxPress .12s var(--sfx-ease) forwards;
}

/* Barra de scroll discreta con color de marca (escritorio) */
@media (min-width: 992px){
  html{ scrollbar-width: thin; scrollbar-color: #7ba3e8 transparent; }
  ::-webkit-scrollbar{ width: 10px; height: 10px; }
  ::-webkit-scrollbar-track{ background: rgba(15,40,110,.06); }
  ::-webkit-scrollbar-thumb{
    background: linear-gradient(180deg, #3b82f6, #1e40af);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 999px;
  }
  ::-webkit-scrollbar-thumb:hover{
    background: linear-gradient(180deg, #2563eb, #1e3a8a);
    background-clip: padding-box;
  }
}

/* --------------------------------------------------------------------------
   8. Accesibilidad: quien pide menos movimiento no ve nada de esto
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce){
  .sfx-progress__bar{ transition: none; }
  .sfx-ready .sfx-reveal,
  .sfx-ready .reveal{
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  body.sfx-scrolled .site-header .brand-logo-wrap{ transform: none; }
  .sfx-top{ transition: opacity .01ms linear; }
  .sfx-top:hover, .sfx-top:active, .sfx-top:focus-visible{ transform: none; }
  .btn.pressed, button.pressed{ animation: none; }
}
