/* =========================================================
   COOPALFA — SPRINT 15
   Cierre responsive, accesibilidad y utilidades flotantes
   Versión: 15.0.0
   ========================================================= */

/* Desplazamiento suave y margen para anclas bajo cabecera fija */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 128px;
}

[id] {
  scroll-margin-top: 128px;
}

/* Foco visible para navegación con teclado */
:where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid rgba(8, 135, 63, 0.38) !important;
  outline-offset: 4px !important;
}

/* Evitar desbordamientos horizontales */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

img,
svg,
video,
iframe {
  max-width: 100%;
}

/* Cabecera estable al desplazarse */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #fff;
}

.site-header.is-scrolled {
  box-shadow: 0 10px 30px rgba(7, 28, 18, 0.10);
}

/* Ajuste moderado del logo y navegación */
.nav-shell {
  min-height: 92px;
}

.brand-logo-fiel img {
  display: block;
  width: clamp(260px, 23vw, 380px);
  height: auto;
}

/* Botón hamburguesa compacto y visible */
.menu-btn {
  gap: 3px !important;
}

.menu-btn span {
  width: 24px !important;
  height: 2.4px !important;
  min-height: 2.4px !important;
}

/* Utilidades flotantes */
.coopalfa-floating-tools {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.coopalfa-float-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  box-sizing: border-box;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(7, 28, 18, 0.18);
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.coopalfa-float-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(7, 28, 18, 0.24);
}

.coopalfa-float-btn svg {
  width: 25px;
  height: 25px;
  display: block;
}

.coopalfa-whatsapp {
  background: #08783f;
  color: #fff;
}

.coopalfa-whatsapp svg {
  fill: currentColor;
}

.coopalfa-backtop {
  background: #fff;
  color: #08783f;
  border: 1px solid rgba(8, 120, 63, 0.22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
}

.coopalfa-backtop.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.coopalfa-backtop svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Mejora del formulario */
.contact-form-premium :where(input, select, textarea) {
  width: 100%;
  box-sizing: border-box;
}

.contact-form-premium button,
.contact-form-premium .btn {
  min-height: 50px;
}

/* Imágenes: evitar saltos de diseño */
.hero-photo img,
.about-photo img,
.gallery img,
.sede-premium__image-wrap img {
  display: block;
  width: 100%;
}

/* Responsive */
@media (max-width: 1024px) {
  html {
    scroll-padding-top: 108px;
  }

  [id] {
    scroll-margin-top: 108px;
  }

  .nav-shell {
    min-height: 82px;
  }

  .brand-logo-fiel img {
    width: clamp(240px, 36vw, 330px);
  }
}

@media (max-width: 768px) {
  html {
    scroll-padding-top: 90px;
  }

  [id] {
    scroll-margin-top: 90px;
  }

  .topbar {
    display: none;
  }

  .nav-shell {
    min-height: 82px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .brand-logo-fiel img {
    width: min(70vw, 310px);
  }

  .nav-actions {
    gap: 8px !important;
  }

  .menu-btn {
    width: 42px !important;
    height: 42px !important;
    flex: 0 0 42px !important;
  }

  .menu-btn span {
    width: 22px !important;
    height: 2.2px !important;
    min-height: 2.2px !important;
  }

  .hero {
    padding-top: 34px;
  }

  .hero-copy h1 {
    overflow-wrap: anywhere;
  }

  .actions {
    align-items: stretch;
  }

  .actions .btn {
    justify-content: center;
    text-align: center;
  }

  .stats,
  .values-grid,
  .about-principles,
  .impact-stats,
  .values-premium__grid,
  .gallery,
  .contact-cards {
    min-width: 0;
  }

  .coopalfa-floating-tools {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .coopalfa-float-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
  }

  .coopalfa-float-btn svg {
    width: 23px;
    height: 23px;
  }
}

@media (max-width: 430px) {
  .brand-logo-fiel img {
    width: min(68vw, 285px);
  }

  .access-btn {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    padding: 0 !important;
  }

  .access-btn .access-text {
    display: none !important;
  }

  .nav-cta {
    display: none !important;
  }

  .hero-copy h1 {
    font-size: clamp(48px, 15vw, 68px);
    line-height: .98;
  }
}

/* Preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
