/* ═══════════════════════════════════════════════════════
   QUANDIA — Mobile Responsive Overrides
   mobile.css  (loaded after components.css)
═══════════════════════════════════════════════════════ */

/* ─── Global overflow fix ─── */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}
* { box-sizing: border-box; }

/* ═══════════════════════════════
   BREAKPOINT: ≤ 768px (Mobile)
═══════════════════════════════ */
@media (max-width: 768px) {

  /* ── Navbar ── */
  .navbar { padding: 0 16px; height: 64px; }
  .navbar-inner { gap: 12px; }
  .navbar-logo img { height: 28px; }
  .navbar-actions .lang-toggle { display: none; }
  .hamburger { display: flex; }
  /* Hide desktop "Contactar" CTA in navbar on mobile — lives in mobile menu */
  .navbar-actions > a.btn { display: none !important; }

  /* ── Hero buttons full-width ── */
  .hero-actions { flex-direction: column; gap: 12px; width: 100%; }
  .hero-actions .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
    padding: 16px 20px;
  }
  .mobile-menu {
    padding: 24px 16px 32px;
    gap: 6px;
    justify-content: flex-start;
    overflow-y: auto;
  }
  .mobile-menu a {
    padding: 14px 18px;
    font-size: 1rem;
  }
  .mobile-menu-footer {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .mobile-lang-row {
    display: flex;
    gap: 8px;
  }
  .mobile-lang-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: #64748B;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
  }
  .mobile-lang-btn.active {
    background: linear-gradient(135deg,#6C63FF,#A855F7);
    color: white;
    border-color: transparent;
  }

  /* ── Loading screen ── */
  .loader-logo img { height: 36px; }

  /* ── Hero ── */
  .hero { min-height: 100svh; padding-top: 80px; }
  .hero-content { padding: 24px 0 60px; }
  .hero-title { font-size: 2rem; line-height: 1.12; margin-bottom: 1rem; }
  .hero-subtitle { font-size: 0.95rem; margin-bottom: 2rem; }
  .hero-actions { flex-direction: column; gap: 12px; }
  .hero-actions .btn { width: 100%; justify-content: center; text-align: center; }
  .hero-scroll { display: none; }

  /* ── Stats bar ── */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 24px !important;
  }
  .stat-number { font-size: 2.2rem; }
  .stat-label { font-size: 0.78rem; }

  /* ── Section spacing ── */
  .section { padding: 56px 0; }
  .section-sm { padding: 48px 0; }
  .section-title { font-size: 1.75rem; }
  .section-subtitle { font-size: 0.95rem; }

  /* ── Grids → single column ── */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* ── Values grid (nosotros) → 2 columns on mobile ── */
  .values-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ── About section ── */
  .about-split { flex-direction: column; }

  /* ── Cards ── */
  .card { border-radius: 16px; }
  .value-card { padding: 28px 20px; }
  .solution-card { padding: 24px 20px; }

  /* ── Team flip cards ── */
  .team-card { height: auto; min-height: 380px; }
  .team-card-inner { transform-style: flat; }
  /* Disable flip on mobile — show info directly below photo */
  .team-card:hover .team-card-inner { transform: none; }
  .team-card-front { position: relative; backface-visibility: visible; -webkit-backface-visibility: visible; }
  .team-card-back {
    position: relative;
    backface-visibility: visible;
    -webkit-backface-visibility: visible;
    transform: none !important;
    border-radius: 0 0 16px 16px;
    margin-top: -8px;
    padding: 20px 20px 24px;
  }
  .team-card-front img { height: 220px; }
  .team-card-front-info { display: none; } /* hide duplicate info, back is always visible */

  /* ── Timeline ── */
  .timeline { padding-left: 28px; }
  .timeline-item::before { left: -24px; width: 12px; height: 12px; }

  /* ── Testimonials ── */
  .testimonial-item { padding: 24px 16px; }
  .testimonial-quote { font-size: 0.95rem; }
  .testimonial-quote::before { font-size: 3.5rem; top: 16px; left: -6px; }

  /* ── Page hero (inner pages) ── */
  .page-hero { padding: 110px 0 48px; }
  .page-hero h1 { font-size: 1.8rem; }
  .page-hero p { font-size: 0.92rem; }

  /* ── Footer ── */
  footer { padding: 48px 0 24px; }
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  .footer-desc { max-width: 100%; }
  .footer-bottom { flex-direction: column; text-align: center; gap: 12px; }
  .footer-copy { font-size: 0.78rem; }

  /* ── Contact form grid ── */
  #contact-form .grid-2 {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  /* ── Scroll to top button ── */
  #scroll-top { bottom: 20px; right: 16px; width: 40px; height: 40px; }

  /* ── Nosotros values 5-column → 2-col ── */
  .section .grid-4[style*="grid-template-columns:repeat(5"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ── Technology architecture layers ── */
  .tech-layer-items { flex-wrap: wrap; gap: 8px; }

  /* ── Cases metrics row ── */
  .cases-metrics { flex-wrap: wrap; gap: 10px; }
  .cases-metrics > div { min-width: calc(50% - 8px); flex: 1; }

  /* ── Blog featured post ── */
  .featured-post-grid {
    grid-template-columns: 1fr !important;
  }
  .featured-post-grid > div:first-child { height: 200px; }

  /* ── Blog grid ── */
  #blog-grid { grid-template-columns: 1fr !important; }

  /* ── Stats bar: 2×2 grid on mobile ── */
  .stats-grid,
  [style*="grid-template-columns:repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px !important;
  }

  /* ── Nosotros values 5-col override ── */
  [style*="grid-template-columns:repeat(5,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }

  /* ── Inline grid-2 with large gap ── */
  [style*="gap:64px"], [style*="gap:80px"] {
    gap: 32px !important;
  }
  [style*="gap:48px"] {
    gap: 24px !important;
  }

  /* ── Buttons ── */
  .btn-lg { padding: 14px 24px; font-size: 0.9rem; }

  /* ── Tabs ── */
  .tabs { gap: 6px; }
  .tab-btn { padding: 8px 16px; font-size: 0.8rem; }

  /* ── Lang toggle in mobile menu ── */
  .mobile-menu .lang-toggle {
    display: flex;
    margin-top: 16px;
    border-radius: 12px;
    padding: 4px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
  }
  .mobile-menu .lang-btn { flex: 1; text-align: center; padding: 8px; }
}

/* ═══════════════════════════════
   BREAKPOINT: ≤ 480px (Small phones)
═══════════════════════════════ */
@media (max-width: 480px) {
  .container { padding: 0 14px; }
  .hero-title { font-size: 1.75rem; }
  .section-title { font-size: 1.5rem; }
  .stat-number { font-size: 1.9rem; }

  .team-card-front img { height: 180px; }

  /* Force all grids to single column */
  [style*="grid-template-columns:repeat(2"] {
    grid-template-columns: 1fr !important;
  }

  /* Solutions page order fix */
  [style*="order:2"] { order: unset !important; }
  [style*="order:1"] { order: unset !important; }

  .testimonial-item { padding: 20px 12px; }
  .footer-grid { gap: 24px !important; }
}

/* ═══════════════════════════════
   BREAKPOINT: 768px–1024px (Tablet)
═══════════════════════════════ */
@media (min-width: 769px) and (max-width: 1024px) {
  .navbar-nav { gap: 2px; }
  .navbar-nav a { padding: 8px 10px; font-size: 0.8rem; }
  .navbar-actions > a.btn { padding: 10px 18px; font-size: 0.8rem; }

  .hero-title { font-size: 3rem; }
  .grid-4 { grid-template-columns: repeat(2, 1fr) !important; }

  [style*="grid-template-columns:repeat(5,1fr)"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }

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

  .team-card { height: 380px; }
}
