/* CLICPERÚ — Optimización mobile global */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html, body {
  overflow-x: clip;
  max-width: 100%;
}

html.menu-open,
body.menu-open {
  overflow: hidden !important;
  height: 100%;
  width: 100%;
  touch-action: none;
}

/* Menú cerrado: no reservar espacio */
.navbar__mobile-menu:not(.is-open) {
  display: none !important;
}

.navbar {
  position: relative;
  z-index: 10001;
}

/* ── Menú mobile: pantalla completa, sin scroll del sitio ── */
.navbar__mobile-menu {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: calc(var(--navbar-height, 60px) + 12px) 20px calc(24px + env(safe-area-inset-bottom, 0px)) !important;
  z-index: 10000 !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--color-white, #fff) !important;
  flex-direction: column !important;
  justify-content: flex-start;
  gap: 0 !important;
  box-sizing: border-box;
}

.navbar__mobile-menu.is-open {
  display: flex !important;
}

/* ── Navbar mobile (estilo referencia: logo + acciones + menú) ── */
@media (max-width: 1024px) {
  :root {
    --navbar-height: 60px;
  }

  .navbar__inner {
    display: flex !important;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 16px !important;
    max-width: 100%;
  }

  .navbar__logo {
    flex: 1 1 auto;
    min-width: 0;
    order: 1;
  }

  .navbar__logo-img {
    height: 32px;
    max-width: min(160px, 42vw);
    object-fit: contain;
    object-position: left center;
  }

  .navbar__menu {
    display: none !important;
  }

  .navbar__actions {
    display: flex !important;
    align-items: center;
    gap: 6px;
    order: 2;
    flex-shrink: 0;
  }

  .navbar__actions .btn-cta {
    display: inline-flex !important;
    padding: 10px 14px;
    font-size: 13px;
    white-space: nowrap;
  }

  .navbar__actions .btn-cta svg {
    width: 14px;
    height: 14px;
  }

  .navbar__phone-btn {
    display: flex !important;
  }

  .navbar__hamburger {
    display: flex !important;
    order: 3;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 380px) {
  .navbar__actions .btn-cta {
    padding: 9px 11px;
    font-size: 12px;
  }

  .navbar__logo-img {
    max-width: 120px;
  }
}

.navbar__phone-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1.5px solid var(--color-border, #e5e7eb);
  color: var(--color-dark, #111827);
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.navbar__phone-btn:hover {
  background: var(--color-light-gray, #f3f4f6);
  border-color: var(--color-primary, #2563eb);
  color: var(--color-primary, #2563eb);
}

/* ── Menú mobile mejorado ── */
.navbar__mobile-menu > a:not(.btn-cta) {
  border-bottom: none !important;
  padding: 14px 4px !important;
  font-size: 17px !important;
  font-weight: 600 !important;
  text-align: right;
}

.navbar__mobile-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
  padding: 14px 4px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  color: var(--color-dark, #111827);
  cursor: pointer;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
}

.navbar__mobile-toggle svg {
  transition: transform 0.2s;
}

.navbar__mobile-toggle.is-open svg {
  transform: rotate(180deg);
}

.navbar__mobile-sub {
  display: none;
  flex-direction: column;
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
}

.navbar__mobile-sub.is-open {
  display: flex;
}

.navbar__mobile-sub a {
  display: block;
  padding: 10px 4px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: var(--color-gray, #6b7280) !important;
  text-align: right !important;
  border-bottom: none !important;
}

.navbar__mobile-sub a:hover {
  color: var(--color-primary, #2563eb) !important;
}

.navbar__mobile-menu .btn-cta {
  margin-top: 24px !important;
  width: 100%;
  justify-content: center;
  padding: 15px 20px !important;
  font-size: 16px !important;
}

.navbar__mobile-menu .navbar__mobile-link--active {
  color: var(--color-primary, #2563eb) !important;
}

/* ── Hero ── */
@media (max-width: 768px) {
  .hero {
    padding: 32px 16px 40px !important;
  }

  .hero__inner {
    gap: 20px !important;
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .hero__badge-wrap,
  .hero__title,
  .hero__desc,
  .hero__buttons,
  .hero__trust {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .hero__title-line1 {
    font-size: clamp(24px, 6.5vw, 34px) !important;
    letter-spacing: -0.6px !important;
    line-height: 1.2 !important;
    white-space: normal !important;
    text-wrap: balance;
  }

  .hero__title-line2 {
    font-size: clamp(32px, 9vw, 48px) !important;
    letter-spacing: -1px !important;
    line-height: 1.08 !important;
    white-space: normal !important;
    text-wrap: balance;
  }

  .hero__desc {
    font-size: 15px !important;
    line-height: 1.65 !important;
    max-width: 100%;
  }

  .hero__badge-pill {
    font-size: 12px;
    padding: 8px 14px;
  }

  .hero__trust-text {
    text-align: center;
  }

  .hero__trust-text strong,
  .hero__trust-text span {
    text-align: center;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .hero__buttons {
    flex-direction: column !important;
    width: 100%;
    gap: 10px !important;
  }

  .hero__btn-primary,
  .hero__btn-secondary {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
  }
}

/* ── Secciones generales ── */
@media (max-width: 768px) {
  /* Servicios index: sin paneles fantasma */
  .svc-visual,
  .svc-content {
    min-height: 0 !important;
  }

  .svc-panel:not(.is-active),
  .svc-pane:not(.is-active) {
    display: none !important;
  }

  .svc-panel.is-active,
  .svc-pane.is-active {
    position: relative !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .svc-section {
    padding: 48px 16px 40px !important;
  }

  .svc-grid {
    gap: 20px !important;
  }

  /* Clientes visibles sin esperar scroll */
  .clients__header,
  .clients__grid {
    opacity: 1 !important;
    transform: none !important;
  }

  .cases-strip {
    padding: 4px 0 !important;
  }

  .cases-card__img {
    height: 220px !important;
  }

  .testimonial__slider {
    min-height: 200px !important;
  }

  .testimonial__slide:not(.is-active) {
    display: none !important;
  }

  .testimonial__slide.is-active {
    position: relative !important;
    opacity: 1 !important;
    transform: none !important;
  }

  /* Proyectos hero */
  .wk-hero-grid {
    min-height: 0 !important;
    gap: 28px !important;
  }

  .wk-hero-h1 {
    font-size: clamp(32px, 9vw, 48px) !important;
    letter-spacing: -0.8px !important;
  }

  /* Nosotros */
  .ab-hero-grid,
  .tm-section {
    min-height: 0 !important;
  }

  .clients {
    padding: 56px 16px 48px !important;
  }

  .clients__title {
    font-size: clamp(26px, 7vw, 40px) !important;
    letter-spacing: -1px !important;
  }

  .clients__grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .clients__logo-item {
    min-height: 72px;
    padding: 16px 12px;
  }

  .clients__pills {
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  .clients__pill {
    width: 100%;
    justify-content: center;
  }

  .svc-title {
    font-size: clamp(26px, 7vw, 36px) !important;
  }

  .svc-tabs {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .svc-tabs::-webkit-scrollbar {
    display: none;
  }

  .svc-tab {
    flex-shrink: 0;
  }

  .testimonial {
    padding: 56px 16px !important;
  }

  .testimonial__quote {
    font-size: clamp(18px, 5vw, 24px) !important;
  }

  .cta-final {
    padding: 56px 20px !important;
  }

  .cta-final__title {
    font-size: clamp(28px, 8vw, 40px) !important;
  }

  .footer__top {
    padding: 48px 20px 32px !important;
  }

  .footer__inner {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }

  .footer__col--brand {
    max-width: 100%;
  }

  .footer__partners {
    flex-wrap: wrap;
    gap: 8px;
  }

  .footer__bottom-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 20px !important;
  }

  .ig-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px;
    padding: 20px 16px 12px !important;
  }

  .ig-grid,
  .ig-grid.cp-fb-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    max-width: none !important;
    width: 100%;
  }

  .ig-inner {
    padding: 0 16px !important;
  }
}

@media (max-width: 480px) {
  .cases-card {
    width: 240px !important;
  }

  .cases-card__num {
    font-size: 22px !important;
  }
}

/* ── Proyectos / contacto / nosotros ── */
@media (max-width: 768px) {
  #wk-main-grid,
  .wk-grid,
  .wk-main-grid {
    grid-template-columns: 1fr !important;
  }

  .wk-tabs,
  .wk-tab-row {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
  }

  .ct-hero-grid {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }

  .ct-hero-left,
  .ct-form-col {
    width: 100%;
    max-width: 100%;
  }

  .ct-h1 {
    font-size: clamp(32px, 9vw, 48px) !important;
  }

  .ct-reach-cards {
    grid-template-columns: 1fr !important;
  }

  .ct-follow-row {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .ct-building-wrap {
    aspect-ratio: 16 / 10 !important;
  }
}

/* ── Páginas de servicio (wp-*) ── */
@media (max-width: 768px) {
  .wp-hero-grid,
  .wp-pair-grid,
  .wp-build-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  .wp-hero-title,
  .wp-h2 {
    white-space: normal !important;
    text-wrap: balance;
  }

  .wp-hero-title {
    font-size: clamp(28px, 8vw, 42px) !important;
    line-height: 1.08 !important;
  }

  .wp-brands-strip {
    overflow: hidden;
  }

  .wp-hero,
  .wp-section {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

/* ── Formularios: evitar zoom iOS ── */
@media (max-width: 768px) {
  input, select, textarea, .ct-input, .ct-textarea {
    font-size: 16px !important;
  }
}

/* ── WhatsApp flotante + safe area ── */
@media (max-width: 768px) {
  .cp-wa-float {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    right: calc(14px + env(safe-area-inset-right, 0px)) !important;
  }
}

/* ── Utilidades ── */
@media (max-width: 768px) {
  img, video, svg, iframe {
    max-width: 100%;
    height: auto;
  }

  [class*="__inner"],
  [class*="__wrap"] {
    box-sizing: border-box;
  }
}
