/* ═══════════════════════════════════════════════════════════════
   MAX DIMENSIONES TEXAS — mobile.css  v4.0
   Fullscreen-safe · Notch/Dynamic Island aware · Retina-ready
   Touch-optimized · Zero conflicts with style.css / additions.css
   Breakpoints: 1100 / 900 / 768 / 480 / 360
═══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────
   SAFE AREA — env() con fallback universal
───────────────────────────────────────── */
:root {
  --sat: env(safe-area-inset-top,    0px);
  --sar: env(safe-area-inset-right,  0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left,   0px);
}

/* Prevent iOS font zoom on landscape */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ─────────────────────────────────────────
   FLOATING BUTTONS — siempre sobre home bar
───────────────────────────────────────── */
.whatsapp-float {
  bottom: calc(5.5rem + var(--sab));
  right:  calc(1.75rem + var(--sar));
}
#backToTop {
  bottom: calc(1.75rem + var(--sab));
  right:  calc(1.75rem + var(--sar));
}

/* ─────────────────────────────────────────
   NAV — debajo de status bar / notch
───────────────────────────────────────── */
#navbar {
  padding-top: calc(1.4rem + var(--sat));
}
#navbar.scrolled {
  padding-top: calc(0.7rem + var(--sat));
}
.mobile-nav {
  padding-top:    calc(5.5rem + var(--sat));
  padding-bottom: calc(2rem + var(--sab));
}

/* ─────────────────────────────────────────
   RETINA — bordes y svgs nítidos
───────────────────────────────────────── */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .service-card   { border-bottom-width: 0.5px; }
  .portfolio-item { outline: 0.5px solid transparent; }
  .hero-thumb     { border-width: 1px; }
  .map-wrap iframe { filter: grayscale(1) brightness(0.78) contrast(1.12); }
  .service-icon svg,
  .hiw-icon svg,
  .social-btn svg,
  .whatsapp-float svg { will-change: transform; }
}

/* ─────────────────────────────────────────
   TABLET — ≤ 1100px
───────────────────────────────────────── */
@media (max-width: 1100px) {
  .nav-links  { gap: 1.4rem; }
  .btn-quote  { padding: .5rem 1.1rem; font-size: .78rem; }
  .hero-thumb-strip { right: 1.25rem; bottom: 130px; }
  .hero-thumb       { width: 58px; height: 44px; }
  .stats-grid   { gap: .6rem; justify-content: center; }
  .stat-divider { display: none; }
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .service-card[style*="grid-column"] { grid-column: span 1 !important; }
  .portfolio-grid { grid-template-columns: repeat(2, 1fr); }
  .portfolio-item.featured { grid-column: span 2; aspect-ratio: 16/9; }
  .about-grid       { grid-template-columns: 1fr; gap: 3rem; }
  .about-img-wrap   { max-width: 560px; width: 100%; margin: 0 auto; }
  .about-img-main   { width: 100%; }
  .about-img-accent { display: none; }
  .about-content    { text-align: center; }
  .about-list       { align-items: center; }
  .about-list li    { justify-content: center; }
  .about-flags      { justify-content: center; }
  .about-content .section-sub { margin-left: auto; margin-right: auto; }
  .hiw-steps   { flex-wrap: wrap; }
  .hiw-step    { flex: 1 1 calc(50% - 1.5rem); min-width: 200px; }
  .hiw-connector { display: none; }
  .contact-grid { grid-template-columns: 1fr; gap: 3rem; }
  .map-wrap { max-width: 560px; margin: 2rem auto 0; }
}

/* ─────────────────────────────────────────
   TABLET INTERMEDIA — ≤ 900px
───────────────────────────────────────── */
@media (max-width: 900px) {
  .nav-links { gap: 1rem; font-size: .88rem; }
  .services-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .portfolio-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

/* ─────────────────────────────────────────
   MOBILE — ≤ 768px
   SIN conflictos: usa !important sólo donde
   style.css/additions.css tienen valores más
   específicos que necesitan ser sobreescritos.
───────────────────────────────────────── */
@media (max-width: 768px) {

  /* ── Global ── */
  .container { padding: 0 1.25rem; }

  /* ── Nav ── */
  .nav-links     { display: none !important; }
  .nav-hamburger { display: flex !important; padding: 10px; margin: -10px; }
  .btn-quote     { display: none !important; }
  .nav-logo img  { height: 36px !important; width: auto; }

  /* ── Hero — svh con fallback ── */
  #hero {
    min-height: 100svh;
    min-height: -webkit-fill-available;
    padding: calc(90px + var(--sat)) 0 calc(60px + var(--sab));
    text-align: center;
  }
  .hero-bg::after {
    background: linear-gradient(
      to bottom,
      rgba(8,8,8,0.93) 0%,
      rgba(8,8,8,0.78) 50%,
      rgba(8,8,8,0.88) 100%
    );
  }
  .hero-content   { max-width: 100%; }
  .hero-eyebrow   { justify-content: center; }
  .hero-title     { font-size: clamp(2.8rem, 11vw, 5.5rem); line-height: 1.05; }
  .hero-desc      { font-size: .95rem; margin-left: auto; margin-right: auto; max-width: 360px; }
  .hero-actions   { flex-direction: column; align-items: center; gap: .85rem; }
  .btn-primary,
  .btn-outline    { width: 100%; max-width: 320px; justify-content: center; }
  .hero-thumb-strip { display: none !important; }
  .hero-scroll-hint { display: none !important; }
  .hero-diagonal    { height: 70px; }

  /* ── Stats ── */
  #stats { padding: 1.25rem 0; }
  .stats-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    text-align: center;
  }
  .stat-item    { padding: .75rem .5rem; }
  .stat-num     { font-size: 2rem; }
  .stat-sep,
  .stat-divider { display: none !important; }

  /* ── How It Works ── */
  .hiw-section { padding: 4rem 0; }
  .hiw-header  { text-align: center; }
  .hiw-steps   { flex-direction: column; gap: 1rem; align-items: center; }
  .hiw-step    { width: 100%; max-width: 420px; text-align: center; }
  .hiw-connector { display: none !important; }

  /* ── Services — 2 columnas con foto ── */
  #services { padding: 4.5rem 0; }
  .services-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .services-header .section-sub { margin-left: auto; margin-right: auto; }
  .services-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .service-card[style*="grid-column"] { grid-column: span 1 !important; }
  .service-card.service-photo {
    min-height: 185px;
    border-radius: 10px;
  }
  .service-card.service-photo .service-name { font-size: .88rem; }
  .service-card.service-photo .service-desc {
    font-size: .75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* ── Portfolio — 2 columnas ── */
  #portfolio { padding: 4.5rem 0; }
  .portfolio-header { text-align: center; }
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .portfolio-item {
    aspect-ratio: 4/3 !important;
    border-radius: 8px;
    overflow: hidden;
  }
  .portfolio-item.featured {
    grid-column: span 2 !important;
    aspect-ratio: 16/9 !important;
  }
  .portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: saturate(.85) brightness(.88);
  }
  /* Touch: overlay siempre visible */
  .portfolio-overlay {
    opacity: 1 !important;
    background: linear-gradient(
      to top,
      rgba(8,8,8,0.88) 0%,
      rgba(8,8,8,0.08) 55%,
      transparent 100%
    ) !important;
  }
  .portfolio-info  { padding: .45rem .55rem; }
  .portfolio-cat   { font-size: .63rem; }
  .portfolio-title { font-size: .8rem; font-weight: 700; }
  .portfolio-desc  { display: none !important; }

  /* Filter buttons — tap targets 44px */
  .filter-btn { padding: .65rem 1.3rem; min-height: 44px; }
  .portfolio-filter { gap: .45rem; flex-wrap: wrap; justify-content: center; }

  /* ── Testimonials ── */
  #testimonials { padding: 4.5rem 0; }
  .testi-card   { padding: 0 .75rem; }
  .testi-text   { font-size: clamp(1.15rem, 5vw, 1.65rem); }
  .testi-controls { padding-left: 0; justify-content: center; }
  .testi-btn    { width: 52px; height: 52px; min-height: 44px; }

  /* ── About ── */
  #about { padding: 4.5rem 0; }
  .about-grid     { grid-template-columns: 1fr; gap: 2.5rem; }
  .about-img-wrap { width: 100%; max-width: 480px; margin: 0 auto; display: block; }
  .about-img-main { width: 100%; display: block; margin: 0 auto; }
  .about-badge    { left: 50%; transform: translateX(-50%); white-space: nowrap; }
  .about-content  { text-align: center; }
  .about-list     { align-items: center; }
  .about-list li  { justify-content: center; }
  .about-flags    { justify-content: center; }

  /* ── CTA ── */
  #cta       { padding: 4rem 0; }
  .cta-title { font-size: clamp(2rem, 9vw, 3.5rem); }

  /* ── Contact ── */
  #contact { padding: 4.5rem 0; }
  .contact-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .contact-detail { flex-direction: row; align-items: flex-start; }
  .map-wrap { margin: 1.5rem auto 0; max-width: 100%; }
  .map-wrap iframe { height: 200px; }
  .form-row   { grid-template-columns: 1fr !important; }
  .form-title { text-align: center; }

  /* ── Footer ── */
  #footer { padding: 2.5rem 0 calc(1.5rem + var(--sab)); }
  .footer-top {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
  }
  .footer-logo     { margin: 0 auto; }
  .footer-logo img { height: 34px !important; width: auto; }
  .footer-links,
  .footer-nav      { justify-content: center; flex-wrap: wrap; gap: 1rem; }
  .footer-social   { justify-content: center; }
  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: .5rem;
  }

  /* ── Floating buttons ── */
  .whatsapp-float {
    bottom: calc(4.5rem + var(--sab));
    right:  calc(1.1rem + var(--sar));
    width: 50px;
    height: 50px;
  }
  .wa-tooltip { display: none !important; }
  #backToTop {
    bottom: calc(1.1rem + var(--sab));
    right:  calc(1.1rem + var(--sar));
    width: 42px;
    height: 42px;
    min-width: 44px;
    min-height: 44px;
  }

  /* ── Mobile call bar ── */
  .mobile-call-bar {
    display: block !important;
    padding-bottom: calc(0.9rem + var(--sab));
  }
  body { padding-bottom: calc(58px + var(--sab)); }
}

/* ─────────────────────────────────────────
   SMALL MOBILE — ≤ 480px
───────────────────────────────────────── */
@media (max-width: 480px) {
  .container { padding: 0 1rem; }

  /* Typography */
  .section-title { font-size: clamp(1.9rem, 8vw, 3rem); }
  .hero-title    { font-size: clamp(2.5rem, 11vw, 4.2rem); }

  /* Stats — 2 columnas */
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .stat-num   { font-size: 1.85rem; }

  /* Services — 2 columnas en 480 también */
  .services-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .service-card.service-photo { min-height: 175px; border-radius: 8px; }

  /* Portfolio — 2 columnas */
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
  }
  .portfolio-item { aspect-ratio: 3/2 !important; }

  /* Testimonials */
  .testi-text   { font-size: 1.1rem; }
  .testi-author { flex-direction: column; align-items: flex-start; gap: .5rem; }

  /* CTA */
  .btn-dark { width: 100%; justify-content: center; }

  /* CRÍTICO — evitar zoom automático iOS en focus */
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px !important;
    -webkit-appearance: none;
    border-radius: 0;
  }
  /* Flecha select en iOS */
  .form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
  }

  .footer-copy,
  .footer-credit { font-size: .72rem; }
}

/* ─────────────────────────────────────────
   EXTRA SMALL — ≤ 390px
───────────────────────────────────────── */
@media (max-width: 390px) {
  /* Services y portfolio: 1 columna sólo en teléfonos muy pequeños */
  .services-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  .service-card.service-photo {
    min-height: 200px;
    border-radius: 10px;
  }
  .service-card.service-photo .service-desc {
    -webkit-line-clamp: 3;
  }
  /* Portfolio sigue en 2 cols hasta 360 */
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 5px !important;
  }
}

/* ─────────────────────────────────────────
   ULTRA SMALL — ≤ 360px
───────────────────────────────────────── */
@media (max-width: 360px) {
  .container  { padding: 0 .875rem; }
  .hero-title { font-size: 2.3rem; }
  .btn-primary,
  .btn-outline { font-size: .82rem; padding: .75rem 1.1rem; }
  .stat-num   { font-size: 1.6rem; }
  .nav-logo img { height: 28px !important; width: auto; }
  .whatsapp-float { width: 46px; height: 46px; }
  #backToTop      { width: 40px; height: 40px; }
  .portfolio-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 4px !important; }
}

/* ─────────────────────────────────────────
   TOUCH DEVICES (hover: none)
   Tap targets WCAG 2.5.5 — 44×44px mín.
───────────────────────────────────────── */
@media (hover: none) {
  .portfolio-overlay { opacity: 1 !important; }
  .portfolio-item img { filter: saturate(.82) brightness(.88); }

  .filter-btn    { padding: .65rem 1.4rem; min-height: 44px; }
  .testi-btn     { width: 52px; height: 52px; }
  .nav-hamburger { padding: 10px; }
  .lang-toggle span  { padding: .6rem .75rem; min-height: 44px; display: inline-flex; align-items: center; }
  .social-btn,
  .social-icon   { width: 44px; height: 44px; }
  .mobile-nav a  { padding: 1rem 0; }
  .btn-submit    { min-height: 52px; }

  /* Quitar transforms de hover que se disparan al tap */
  .service-card:hover  { transform: none !important; }
  .hiw-step:hover      { transform: none !important; }
  .btn-primary:hover,
  .btn-outline:hover,
  .btn-dark:hover      { transform: none !important; box-shadow: none !important; }
  .portfolio-item:hover img { transform: none !important; filter: saturate(.82) brightness(.88) !important; }
  .footer-nav a:hover  { padding-left: 0 !important; }
}

/* ─────────────────────────────────────────
   LANDSCAPE — teléfono horizontal
───────────────────────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
  #hero {
    min-height: auto;
    padding: calc(65px + var(--sat)) 0 2rem;
  }
  .hero-title   { font-size: clamp(1.8rem, 7vw, 3rem); }
  .hero-desc    { display: none; }
  .hero-actions { flex-direction: row; gap: .75rem; }
  .btn-primary,
  .btn-outline  { width: auto; }
  .hero-diagonal { height: 50px; }
  .loader-status,
  #loader .loader-bg-lines { display: none; }
}

/* ─────────────────────────────────────────
   REDUCED MOTION — respeta preferencias OS
───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal         { opacity: 1 !important; transform: none !important; }
  .hero-bg-slide  { transition: none !important; }
  #loader .loader-fill { transition: none !important; }
}

/* ─────────────────────────────────────────
   HIGH CONTRAST (Windows)
───────────────────────────────────────── */
@media (forced-colors: active) {
  .btn-primary,
  .btn-quote,
  .btn-submit  { forced-color-adjust: none; }
  .service-card { border: 1px solid ButtonText; }
}

/* ─────────────────────────────────────────
   SERVICE PHOTO-CARDS — desktop + mobile
   CSS variable --svc-bg se pone inline.
───────────────────────────────────────── */
.service-card.service-photo {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  background-image: var(--svc-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 0 1.25rem 0;
  border: none;
}

/* Overlay degradado — texto siempre legible */
.service-card.service-photo::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.05) 0%,
    rgba(0,0,0,0.52) 52%,
    rgba(0,0,0,0.84) 100%
  );
  z-index: 1;
}

.service-card.service-photo .service-num,
.service-card.service-photo .service-name,
.service-card.service-photo .service-desc {
  position: relative;
  z-index: 2;
  color: #fff;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}
.service-card.service-photo .service-num {
  font-size: .7rem;
  letter-spacing: .12em;
  color: var(--orange, #FF5500);
  margin-bottom: .35rem;
  padding-top: 0;
}
.service-card.service-photo .service-name {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: .4rem;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.service-card.service-photo .service-desc {
  font-size: .82rem;
  line-height: 1.5;
  color: rgba(255,255,255,0.88);
  margin: 0;
}

/* ─────────────────────────────────────────
   WHY US — responsive (agregado)
───────────────────────────────────────── */
@media (max-width: 768px) {
  #why-us { padding: 4rem 0 !important; }
  #why-us .section-title { font-size: clamp(2rem, 9vw, 3.5rem); }
  #why-us > .container > div:last-child {
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
  }
}
@media (max-width: 480px) {
  #why-us > .container > div:last-child {
    grid-template-columns: 1fr !important;
  }
}

/* ─────────────────────────────────────────
   PORTFOLIO ITEM — fix para ítems ocultos
   (position:absolute saca del flujo, pero
   el grid puede colapsar si no se aclara)
───────────────────────────────────────── */
.portfolio-grid {
  position: relative;
}
.portfolio-item.hidden {
  display: none !important;
}

/* ─────────────────────────────────────────
   FORM — mejorar tap targets en móvil
───────────────────────────────────────── */
@media (max-width: 768px) {
  .form-group input,
  .form-group select,
  .form-group textarea {
    min-height: 48px;
    padding: .85rem 1rem;
  }
  .btn-submit {
    width: 100%;
    min-height: 52px;
    font-size: 1rem;
  }
}

/* ─────────────────────────────────────────
   NAV-LOGO — centrado en móvil
───────────────────────────────────────── */
@media (max-width: 768px) {
  #navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .nav-logo {
    flex: 1;
    display: flex;
    align-items: center;
  }
}
