/* ==========================================================================
   ADAPTABILIDAD RESPONSIVE AVANZADA (MOBILE & TABLET FIRST)
   Optimizado para la mayoría de usuarios que acceden desde Smartphones
   ========================================================================== */

/* --------------------------------------------------------------------------
   BARRA DE ACCIÓN FIJA INFERIOR PARA MÓVILES (ULTRA-ERGONÓMICA)
   -------------------------------------------------------------------------- */
.mobile-sticky-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-fixed);
  background-color: rgba(9, 13, 22, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.6);
  padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
}

.mobile-sticky-bar__grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1.3fr;
  gap: 0.5rem;
  align-items: center;
  max-width: 540px;
  margin: 0 auto;
}

.mobile-sticky-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.35rem;
  border-radius: var(--radius-md);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  color: #ffffff;
  gap: 3px;
  text-decoration: none;
  min-height: 48px;
  /* Tamaño táctil mínimo recomendado */
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.mobile-sticky-btn:active {
  transform: scale(0.96);
}

.mobile-sticky-btn svg {
  width: 20px;
  height: 20px;
}

.mobile-sticky-btn--call {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
}

.mobile-sticky-btn--whatsapp {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
}

.mobile-sticky-btn--quote {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0b0f19;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

/* --------------------------------------------------------------------------
   OVERLAY DE TELÓN DE FONDO PARA EL MENÚ MÓVIL
   -------------------------------------------------------------------------- */
.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: calc(var(--z-drawer) - 1);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.mobile-nav-backdrop.is-active {
  opacity: 1;
  visibility: visible;
}

/* ==========================================================================
   BREAKPOINTS Y MEDIA QUERIES
   ========================================================================== */

/* Laptops y Pantallas Medianas (<= 1100px) */
@media (max-width: 1100px) {
  .site-nav__list {
    gap: var(--space-3);
  }

  .site-nav__link {
    font-size: 0.85rem;
    padding: 0.4rem 0.4rem;
  }

  .targets-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .process-steps {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablets y Dispositivos Medianos (<= 960px) */
@media (max-width: 960px) {
  .top-bar {
    padding: 0.35rem 0;
  }

  .top-bar__contacts .top-bar__link:first-child {
    display: none;
    /* Ahorrar espacio en barra superior en tablet */
  }

  .mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Menú desplegable tipo Drawer Lateral en Móvil/Tablet (Completamente oculto e inerte hasta que se pulsa) */
  .site-nav {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: min(80vw, 300px);
    height: 100vh;
    height: 100dvh;
    background-color: #0b1120;
    border-left: 1px solid rgba(56, 189, 248, 0.25);
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-6) var(--space-5) var(--space-10);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: var(--z-drawer);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.7);
  }

  .site-nav.is-open {
    display: flex;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .site-nav__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
  }

  .site-nav__close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    padding: 6px;
    border-radius: var(--radius-sm);
    line-height: 0;
    cursor: pointer;
  }

  .site-nav__close svg {
    width: 24px;
    height: 24px;
  }

  .site-nav__list {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: var(--space-2);
  }

  .site-nav__link {
    font-size: 1.05rem;
    font-weight: 700;
    color: #e2e8f0;
    padding: 0.75rem var(--space-3);
    border-radius: var(--radius-md);
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .site-nav__link:hover {
    background-color: var(--color-primary-subtle);
    color: var(--color-primary-light);
    border-color: rgba(56, 189, 248, 0.3);
  }

  /* Hero en una columna */
  .hero {
    padding-top: var(--space-8);
    padding-bottom: var(--space-12);
  }

  .hero__grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .hero__image-card img {
    height: 380px;
  }

  .hero__floating-card {
    position: static;
    margin-top: var(--space-4);
  }

  /* Membrana en una columna */
  .membrane-grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .membrane-visual img {
    height: 380px;
  }

  /* Galería */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Por qué elegirnos */
  .why-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  /* Contacto */
  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .trust-modular-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .process-cta-banner {
    flex-direction: column;
    text-align: center;
    padding: var(--space-6);
  }
}

/* Teléfonos y Dispositivos Móviles (<= 640px) */
@media (max-width: 640px) {
  body {
    padding-bottom: 0;
  }

  .mobile-sticky-bar {
    display: none !important;
  }

  /* Botón circular flotante reposicionado */
  .floating-whatsapp {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 50px;
    height: 50px;
  }

  .floating-whatsapp svg {
    width: 26px;
    height: 26px;
  }

  /* Secciones ultracompactas y minimalistas en móvil */
  .section {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .section-header {
    margin-bottom: 1.25rem;
  }

  .section-tag {
    font-size: 0.68rem;
    padding: 0.2rem 0.55rem;
    margin-bottom: 0.35rem;
  }

  .section-title {
    font-size: 1.45rem;
    line-height: 1.25;
    margin-bottom: 0.35rem;
  }

  .section-description {
    font-size: 0.85rem;
    line-height: 1.4;
  }

  .site-header__container {
    height: 68px;
  }

  .brand-logo__icon {
    width: 38px;
    height: 38px;
  }

  .brand-logo__icon svg {
    width: 20px;
    height: 20px;
  }

  .brand-logo__name {
    font-size: 0.95rem;
  }

  .brand-logo__tagline {
    font-size: 0.65rem;
  }

  .hero {
    padding-top: var(--space-6);
    padding-bottom: var(--space-8);
  }

  .hero__title {
    font-size: 1.75rem;
    line-height: 1.2;
    margin-bottom: var(--space-3);
  }

  .hero__subtitle {
    font-size: 0.92rem;
    line-height: 1.45;
    margin-bottom: var(--space-5);
  }

  .hero__image-card img {
    height: 220px;
    object-fit: cover;
  }

  .hero__cta-group {
    flex-direction: column;
    width: 100%;
    gap: var(--space-3);
  }

  .hero__cta-group .btn {
    width: 100%;
    padding: 0.85rem 1.15rem;
    font-size: 0.92rem;
  }

  .hero__trust-list {
    flex-direction: column;
    gap: var(--space-2);
  }

  /* NUESTROS SERVICIOS: Minimalista, 2 columnas compactas y sin scroll infinito */
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }

  .service-card {
    padding: 0.85rem 0.75rem;
    border-radius: var(--radius-md);
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
  }

  .service-card:active {
    transform: scale(0.98);
    border-color: var(--color-primary-light);
  }

  .service-card__icon {
    width: 32px;
    height: 32px;
    margin-bottom: 0.45rem;
  }

  .service-card__icon svg {
    width: 18px;
    height: 18px;
  }

  .service-card__title {
    font-size: 0.86rem;
    line-height: 1.25;
    margin-bottom: 0.3rem;
  }

  .service-card__desc {
    font-size: 0.74rem;
    line-height: 1.35;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0;
  }

  /* Ocultamos listas de características y botones repetitivos en cada tarjeta móvil */
  .service-card__features,
  .service-card__action {
    display: none !important;
  }

  .services-mobile-cta {
    display: block;
    margin-top: 0.85rem;
  }

  /* CUBIERTAS E INMUEBLES: Carrusel deslizante horizontal táctil */
  .targets-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 0.85rem;
    padding: 0.25rem 0.25rem 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    scrollbar-width: none;
    touch-action: pan-x pan-y;
  }

  .targets-grid::-webkit-scrollbar {
    display: none;
  }

  .target-card {
    flex: 0 0 78%;
    min-width: 240px;
    max-width: 280px;
    scroll-snap-align: start;
    border-radius: var(--radius-lg);
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
  }

  .target-card__image {
    height: 125px;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
    overflow: hidden;
  }

  .target-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .target-card__badge {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    top: 8px;
    left: 8px;
  }

  .target-card__body {
    padding: 0.85rem 0.75rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
  }

  .target-card__title {
    font-size: 0.88rem;
    margin-bottom: 0.25rem;
  }

  .target-card__desc {
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.5rem;
  }

  .target-card__cta {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-primary-light);
    margin-top: auto;
  }

  /* POR QUÉ ELEGIRNOS: Compacto y ligero */
  .why-compact-grid {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .why-compact-card {
    padding: 0.75rem 0.85rem;
    gap: 0.75rem;
    border-radius: var(--radius-md);
  }

  .why-compact-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }

  .why-compact-icon svg {
    width: 18px;
    height: 18px;
  }

  .why-compact-title {
    font-size: 0.88rem;
    margin-bottom: 0.15rem;
  }

  .why-compact-desc {
    font-size: 0.75rem;
    line-height: 1.35;
  }

  /* GALERÍA EN MÓVIL */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .gallery-card {
    border-radius: var(--radius-sm);
  }

  .gallery-card img {
    height: 110px;
    object-fit: cover;
  }

  .gallery-card__content {
    padding: 0.5rem;
  }

  .gallery-card__title {
    font-size: 0.78rem;
  }

  .gallery-card__category {
    font-size: 0.68rem;
  }

  .before-after-box {
    height: 260px;
    border-radius: var(--radius-lg);
  }

  .before-after__label {
    font-size: 0.68rem;
    padding: 0.22rem 0.55rem;
    top: 8px;
    max-width: 105px;
  }

  .before-after__label--before {
    right: 8px;
  }

  .before-after__label--after {
    left: 8px;
  }

  .before-after__handle {
    width: 38px;
    height: 38px;
  }

  .before-after__after-layer img {
    min-width: 0;
  }

  /* FORMULARIO Y CONTACTO EN MÓVIL (Perfectamente encuadrado al 100%) */
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .contact-form-box {
    padding: 1.1rem 0.85rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .contact-info-card {
    padding: 1.1rem 0.85rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .contact-direct-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0;
  }

  .contact-direct-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .contact-direct-icon svg {
    width: 20px;
    height: 20px;
    display: block;
    flex-shrink: 0;
  }

  .contact-direct-label {
    font-size: 0.72rem;
  }

  .contact-direct-value {
    font-size: 0.92rem;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  #budgetForm {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .form-row {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .form-group {
    margin-bottom: 0.75rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .form-label {
    font-size: 0.82rem;
    margin-bottom: 0.25rem;
  }

  .form-input,
  .form-select,
  .form-textarea {
    padding: 0.75rem 0.85rem;
    font-size: 16px;
    /* Evita zoom molesto automático en Safari iPhone */
    border-radius: var(--radius-sm);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .form-textarea {
    min-height: 85px;
    box-sizing: border-box;
  }

  .file-upload-box {
    padding: 0.85rem 0.65rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .file-upload-box__icon {
    width: 28px;
    height: 28px;
    margin-bottom: 0.25rem;
  }

  .file-upload-box__text {
    font-size: 0.82rem;
  }

  .file-upload-box__hint {
    font-size: 0.7rem;
  }

  .contact-form-box .btn {
    width: 100%;
    max-width: 100%;
    padding: 0.85rem 0.65rem;
    font-size: 0.88rem;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
    box-sizing: border-box;
  }

  /* FOOTER SIMPLE EN MÓVIL */
  .footer-simple {
    flex-direction: column;
    gap: 0.65rem;
    text-align: center;
  }
}