/* =================================================================
   UP ELEVADORES — Hoja de estilos personalizada
   -----------------------------------------------------------------
   Complementa a Tailwind CSS (CDN) con:
   - Componentes reutilizables (botones, cards, inputs)
   - Animaciones al hacer scroll (reveal)
   - Patrones decorativos de fondo
   - Estilos para lightbox, FAQ acordeón y filtros
   - Scrollbar personalizado
   - Respeto por prefers-reduced-motion (accesibilidad)
   ================================================================= */


/* ---------- 1. BASE / RESETS ---------- */

:root {
  --brand-50:  #e0f4fa;
  --brand-100: #b3e4f2;
  --brand-500: #0083B3;
  --brand-600: #006a94;
  --brand-700: #00547a;
}

* {
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: auto;
  scroll-padding-top: 6rem; /* compensa el navbar fijo al anclar */
}

body {
  overflow-x: hidden;
}

/* Scrollbar personalizado (navegadores modernos) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: #e0f4fa;
}
::-webkit-scrollbar-thumb {
  background: #80d1e8;
  border-radius: 9999px;
  border: 2px solid #e0f4fa;
}
::-webkit-scrollbar-thumb:hover {
  background: #006a94;
}

/* Enlaces accesibles: foco visible */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: 4px;
}


/* ---------- 2. BOTONES (componentes reutilizables) ---------- */

/* Botón primario: gradiente teal-esmeralda con microanimación */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.75rem;
  background-image: linear-gradient(135deg, #006a94 0%, #004d6e 100%);
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffffff;
  box-shadow: 0 10px 25px -10px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
  position: relative;
  overflow: hidden;
}
.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(135deg, #0083B3 0%, #0083B3 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.btn-primary > * {
  position: relative;
  z-index: 1;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.45);
  filter: brightness(1.05);
}
.btn-primary:hover::before {
  opacity: 1;
}
.btn-primary:active {
  transform: translateY(0);
}

/* Botón secundario: borde sobre blanco */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.75rem;
  border: 1.5px solid #80d1e8;
  background-color: #ffffff;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1C1C1C;
  transition: border-color 0.25s ease, color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}
.btn-secondary:hover {
  border-color: var(--brand-500);
  color: var(--brand-700);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -12px rgba(0, 0, 0, 0.4);
}

/* Botón ghost (sobre fondos oscuros) — sólido blanco para máximo contraste */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.75rem;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1C1C1C;
  background-color: rgba(255, 255, 255, 0.95);
  transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}
.btn-ghost:hover {
  background-color: #ffffff;
  border-color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.4);
}


/* ---------- 3. NAVBAR (estado scrolled) ---------- */

/* El navbar empieza con un fondo semitransparente oscuro sobre el hero */
#navbar {
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background-color 0.35s ease, box-shadow 0.35s ease, backdrop-filter 0.35s ease;
}
/* Cuando se hace scroll, se vuelve blanco/blurred con sombra */
#navbar.scrolled {
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 24px -8px rgba(0, 0, 0, 0.12);
}
/* En estado NO scrolled (sobre hero), los enlaces son claros */
#navbar:not(.scrolled) .nav-link {
  color: #80d1e8;
}
#navbar:not(.scrolled) .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}
/* El botón menú móvil también cambia de color */
#navbar:not(.scrolled) #menu-toggle {
  border-color: rgba(255, 255, 255, 0.5);
  background-color: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  backdrop-filter: blur(8px);
}
/* Intercambio de logos según scroll */
#navbar.scrolled .navbar-logo-top {
  display: none;
}
#navbar.scrolled .navbar-logo-scrolled {
  display: block;
}


/* ---------- 4. PATRONES DECORATIVOS ---------- */

/* Patrón de cuadrícula sutil para fondos */
.bg-grid-pattern {
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 50%, transparent 100%);
          mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 50%, transparent 100%);
}


/* ---------- 5. CARDS DE PRODUCTOS ---------- */

.product-card {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 1rem;
  background-color: #e0f4fa;
  cursor: pointer;
  aspect-ratio: 4 / 3;
}
.product-img {
  height: 100%;
  width: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), filter 0.4s ease;
}
.product-card:hover .product-img {
  transform: scale(1.08);
}
.product-caption {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  background-image: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.2) 45%, transparent 75%);
  opacity: 0;
  transition: opacity 0.35s ease;
  padding: 1rem;
}
.product-card:hover .product-caption {
  opacity: 1;
}
.product-caption span {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #ffffff;
  background-color: rgba(0, 0, 0, 0.8);
  padding: 0.35rem 0.75rem;
  border-radius: 0.5rem;
  transform: translateY(8px);
  transition: transform 0.35s ease;
}
.product-card:hover .product-caption span {
  transform: translateY(0);
}

/* Ocultar items filtrados (controlado por JS) */
.product-item.hidden-item {
  display: none;
}
.product-item {
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.product-item.filtering {
  opacity: 0;
  transform: scale(0.95);
}


/* ---------- 6. BOTONES DE FILTRO ---------- */

.filter-btn {
  border-radius: 9999px;
  border: 1.5px solid #80d1e8;
  background-color: #ffffff;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #006a94;
  cursor: pointer;
  transition: all 0.25s ease;
}
.filter-btn:hover {
  border-color: var(--brand-500);
  color: var(--brand-700);
}
.filter-btn.active {
  background-image: linear-gradient(135deg, #006a94 0%, #004d6e 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.35);
}


/* ---------- 7. GALERÍA (imagenes con hover) ---------- */

.gallery-img {
  cursor: pointer;
  box-shadow: 0 4px 16px -6px rgba(0, 0, 0, 0.15);
  transition: transform 0.4s ease, box-shadow 0.4s ease, filter 0.4s ease;
}
.gallery-img:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 16px 32px -10px rgba(0, 0, 0, 0.3);
  filter: brightness(1.05);
}


/* ---------- 8. FAQ (acordeón) ---------- */

.faq-item {
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.faq-item:hover {
  border-color: #80d1e8;
}
.faq-item.open {
  border-color: var(--brand-500);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.15);
}
.faq-trigger {
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
}
.faq-icon {
  transition: transform 0.35s ease, background-color 0.25s ease;
}
.faq-item.open .faq-icon {
  transform: rotate(180deg);
  background-color: var(--brand-500);
  color: #ffffff;
}
.faq-content {
  transition: max-height 0.35s ease;
}


/* ---------- 9. FORMULARIO DE CONTACTO ---------- */

.form-input {
  width: 100%;
  border-radius: 0.75rem;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  background-color: rgba(255, 255, 255, 0.05);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #ffffff;
  transition: border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}
.form-input::placeholder {
  color: rgba(77, 184, 217, 0.5);
}
.form-input:focus {
  outline: none;
  border-color: var(--brand-500);
  background-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
}
.form-input.error {
  border-color: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}

/* Spinner de carga del botón submit */
.btn-primary.loading .btn-label {
  opacity: 0.7;
}
.btn-primary.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.25rem;
  height: 1.25rem;
  margin: -0.625rem 0 0 -0.625rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  z-index: 2;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}


/* ---------- 10. ICONOS SOCIALES ---------- */

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.75rem;
  width: 2.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background-color: rgba(255, 255, 255, 0.05);
  color: #80d1e8;
  transition: all 0.25s ease;
}
.social-icon:hover {
  background-image: linear-gradient(135deg, #006a94 0%, #004d6e 100%);
  border-color: transparent;
  color: #ffffff;
  transform: translateY(-3px);
}


/* ---------- 11. ENLACES DEL FOOTER ---------- */

.footer-link {
  color: #4db8d9;
  transition: color 0.2s ease, padding-left 0.2s ease;
  display: inline-block;
}
.footer-link:hover {
  color: #ffffff;
  padding-left: 0.25rem;
}


/* ---------- 12. ANIMACIÓN REVEAL (al hacer scroll) ---------- */

/* Estado inicial: invisible y desplazado */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
/* Estado visible: entra con suavidad */
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
/* Retraso escalonado para grupos */
.reveal:nth-child(2) { transition-delay: 0.08s; }
.reveal:nth-child(3) { transition-delay: 0.16s; }
.reveal:nth-child(4) { transition-delay: 0.24s; }
.reveal:nth-child(5) { transition-delay: 0.32s; }
.reveal:nth-child(6) { transition-delay: 0.40s; }


/* ---------- 13. LIGHTBOX ---------- */

#lightbox.active {
  display: flex !important;
  animation: fadeIn 0.3s ease;
}
#lightbox-img {
  animation: zoomIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}


/* ---------- 14. ESTADO "VOLVER ARRIBA" ---------- */

#back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}


/* ---------- 15. UTILIDADES RESPONSIVE ---------- */

/* En móvil, reducir el padding de secciones para mejor UX */
@media (max-width: 640px) {
  .product-card { border-radius: 0.875rem; }
}


/* ---------- 16. ACCESIBILIDAD: respeta prefers-reduced-motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
