/* ============================================================================
   home-responsive.css  —  Premium responsive layer for home.html
   Loaded AFTER the inline <style>, so these rules override where needed.
   Mobile-first additions, plus large-desktop scaling and edge-case polish.
   ============================================================================ */

/* ---------- 0. Global hardening ---------- */
html, body { max-width: 100%; overflow-x: hidden; }
body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* iOS dynamic viewport: prevent hero clipping behind URL bar */
@supports (height: 100dvh) {
  .modal { min-height: 100dvh; }
}

/* Safe-area for iPhone notch / Android gestures */
@supports (padding: max(0px)) {
  .nav .container,
  .footer .container,
  .hero .container,
  .section .container {
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
  }
  .sticky-cta {
    right: max(18px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
  }
}

/* Better focus ring for keyboard users (no visual change for mouse users) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.prod-filter:focus-visible,
.menu-toggle:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Block long-press text selection on interactive cards */
.prod-card, .svc-card, .why-card, .badge-card, .vmv-card, .exp-panel, .tl-card,
.flow-step, .marquee-item, .hero-stat, .about-stat, .counter, .info-item {
  -webkit-tap-highlight-color: transparent;
}

/* Smooth-scroll respect for reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .bg-orb, .marquee-track, .map-scan, .hv-scan,
  .prod-card .prod-scan, .preloader .pre-logo,
  .preloader .pre-ring { animation: none !important; }
}

/* Touch devices: kill cursor-glow + heavy hover effects */
@media (hover: none) and (pointer: coarse) {
  .cursor-glow { display: none !important; }
  .prod-card:hover,
  .svc-card:hover,
  .why-card:hover,
  .badge-card:hover,
  .exp-panel:hover,
  .vmv-card:hover { transform: none; }
}

/* ---------- 1. Large desktops 1440px+ ---------- */
@media (min-width: 1440px) {
  .container { max-width: 1320px; padding: 0 32px; }
  .section { padding: 88px 0; }
  .hero { padding: 130px 0 70px; }
  .hero h1 { font-size: clamp(2.6rem, 4.6vw, 4.4rem); }
  .hero p.lead { font-size: 1.05rem; max-width: 580px; }
  .hero-stat .num { font-size: 1.8rem; }
  .prod-grid, .svc-grid { gap: 22px; }
  .prod-body { padding: 18px 20px 20px; }
}

/* ---------- 2. Ultra-wide 1920px+ ---------- */
@media (min-width: 1920px) {
  .container { max-width: 1480px; }
  body { font-size: 16px; }
  .hero h1 { font-size: clamp(3rem, 4.2vw, 5rem); }
  .hero p.lead { max-width: 640px; }
  .section { padding: 110px 0; }
  .hero-visual { max-width: 520px; }
  .prod-grid { grid-template-columns: repeat(3, 1fr); gap: 26px; }
  .why-grid { gap: 16px; }
  .footer { padding: 88px 0 28px; }
}

/* ---------- 3. Mid laptops / small desktops 1200-1439px ---------- */
@media (min-width: 1200px) and (max-width: 1439.98px) {
  .container { max-width: 1180px; }
  .hero-content { gap: 30px; }
}

/* ---------- 4. Tablet landscape 992-1199px ---------- */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .container { max-width: 100%; padding: 0 28px; }
  .nav-links { gap: 22px; }
  .nav-links a { font-size: .8rem; }
  .hero h1 { font-size: clamp(1.95rem, 3.6vw, 3rem); }
  .hero-content { grid-template-columns: 1.1fr .9fr; gap: 28px; }
  .hero-visual { max-width: 380px; }
  .prod-grid, .svc-grid, .why-grid { gap: 14px; }
  .why-grid { grid-template-columns: repeat(5, 1fr); }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1.1fr; gap: 26px; }
}

/* ---------- 5. Tablet portrait 768-991px (improve over 992px breakpoint) ---------- */
@media (min-width: 768px) and (max-width: 991.98px) {
  .section { padding: 56px 0; }
  .hero { padding: 110px 0 50px; }
  .hero h1 { font-size: clamp(2rem, 4.2vw, 2.8rem); }
  .hero p.lead { font-size: .94rem; max-width: 100%; }
  .hero-content { gap: 36px; }
  .hero-visual { max-width: 380px; }
  .hero-stats { grid-template-columns: repeat(4, 1fr); }

  /* Keep 2-col layouts where they fit */
  .prod-grid, .svc-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .why-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .vmv-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .exp-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .badges { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .counter-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; gap: 26px; }
  .footer-grid .footer-col:last-child { grid-column: 1 / -1; }
  .footer-stripe { padding: 14px 16px; }
  .footer-stripe .fs-text { font-size: .88rem; }

  /* Map / AI stage on tablet */
  .ai-stage { grid-template-columns: 1fr 1fr; gap: 16px; }
  .contact-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .info-list { grid-template-columns: 1fr 1fr; }

  /* Hero stats: smaller text on tablet portrait */
  .hero-stat .num { font-size: 1.3rem; }
}

/* ---------- 6. Tablet/large phone 640-767px ---------- */
@media (min-width: 640px) and (max-width: 767.98px) {
  .section { padding: 48px 0; }
  .hero { padding: 96px 0 44px; }
  .container { padding: 0 22px; }

  .prod-grid, .svc-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .why-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .vmv-grid { grid-template-columns: 1fr; gap: 14px; }
  .exp-grid { grid-template-columns: 1fr; gap: 14px; }
  .badges { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .badges .badge-card:last-child { grid-column: 1 / -1; }
  .counter-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-grid .footer-brand { grid-column: 1 / -1; }
  .ai-stage, .contact-grid { grid-template-columns: 1fr; gap: 22px; }
  .info-list { grid-template-columns: 1fr 1fr; }

  .hero-stats { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .hero-stat .num { font-size: 1.15rem; }
  .hero-stat .lbl { font-size: .5rem; }
}

/* ---------- 7. Phones 481-639px ---------- */
@media (max-width: 639.98px) {
  .section { padding: 44px 0; }
  .container { padding: 0 18px; }
  .hero { padding: 92px 0 36px; }
  .hero-content { gap: 26px; }
  .hero h1 { font-size: clamp(1.7rem, 7vw, 2.4rem); line-height: 1.1; }
  .hero p.lead { font-size: .9rem; }
  .hero-cta { gap: 10px; }
  .hero-cta .btn { padding: 11px 18px; font-size: .8rem; }
  .hero-meta { font-size: .58rem; letter-spacing: .14em; margin-left: 0; }

  /* Hero visual scales nicely on phones */
  .hero-visual { max-width: 280px; }
  .hv-chip { padding: 6px 10px; font-size: .5rem; }
  .hv-chip svg { width: 12px; height: 12px; }
  .hv-badge { padding: 5px 9px; font-size: .46rem; }

  /* Marquee less aggressive */
  .marquee-track { gap: 18px; padding: 10px 0; animation-duration: 32s; }
  .marquee-item { font-size: .8rem; padding: 7px 14px 7px 10px; }
  .marquee-item .mi-icon { width: 24px; height: 24px; }
  .marquee-item .mi-icon svg { width: 13px; height: 13px; }
  .marquee::before, .marquee::after { width: 60px; }

  /* Section heading scaling */
  .s-head h2 { font-size: clamp(1.4rem, 6vw, 1.85rem); }
  .s-head p { font-size: .82rem; }

  /* Cards padding tighter */
  .prod-body { padding: 12px 14px 14px; }
  .svc-card, .why-card, .badge-card, .vmv-card, .exp-panel, .tl-card { padding: 18px 16px; }
  .exp-panel { padding: 20px 18px 18px; }

  /* Process flow becomes vertical */
  .process { padding: 28px 18px 22px; border-radius: 18px; }
  .flow { grid-template-columns: 1fr; gap: 18px; }
  .flow::before, .flow::after { display: none; }
  .flow-step .num { width: 56px; height: 56px; font-size: .85rem; box-shadow: 0 0 0 4px var(--bg), 0 0 18px rgba(255,122,61,.3); }
  .flow-step p { max-width: 100%; }

  /* Form */
  .form-grid-2 { grid-template-columns: 1fr; gap: 0; }
  .contact-form { padding: 20px 18px 18px; border-radius: 16px; }
  .info-list { grid-template-columns: 1fr; }

  /* Modal */
  .modal { padding: 12px; }
  .modal-card { max-height: 96vh; border-radius: 16px; }
  .modal-hero { padding: 14px 16px 18px; }
  .modal-body { padding: 18px 18px 22px; }
  .modal-card h3 { font-size: 1.05rem; }
  .modal-card .modal-desc { font-size: .76rem; }

  /* Footer */
  .footer { padding: 48px 0 24px; }
  .footer-stripe { flex-direction: column; align-items: stretch; padding: 14px; text-align: center; }
  .footer-stripe .fs-text { justify-content: center; font-size: .85rem; }
  .footer-stripe .fs-cta { justify-content: center; }
  .footer-bottom { font-size: .68rem; gap: 10px; flex-direction: column; text-align: center; }
  .footer-bottom .fb-meta { justify-content: center; }
  .scroll-top { right: 14px; left: auto; bottom: 88px; width: 40px; height: 40px; }

  /* Sticky CTA: smaller on phones */
  .sticky-cta a { width: 46px; height: 46px; font-size: .95rem; }

  /* Nav: tighter */
  .nav { padding: 14px 0; }
  .nav.scrolled { padding: 10px 0; }
  .brand-mark { width: 42px; height: 42px; }
  .brand-text > span { font-size: 1.18rem; letter-spacing: 3px; }
  .brand-text small { font-size: .58rem; letter-spacing: .55em; }
  .menu-toggle { width: 40px; height: 40px; } /* keep ≥40px tap target */
}

/* ---------- 8. Small phones 360-480px ---------- */
@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .about-stats { grid-template-columns: repeat(2, 1fr); }
  .counter-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .badges { grid-template-columns: 1fr; gap: 12px; }
  .badges .badge-card:last-child { grid-column: auto; }
  .why-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .why-grid .why-card:nth-child(5) { grid-column: 1 / -1; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
  .footer-grid .footer-brand { grid-column: auto; }

  /* Buttons full width for thumb reach */
  .hero-cta { flex-direction: column; align-items: stretch; width: 100%; }
  .hero-cta .btn { width: 100%; justify-content: center; }
  .hero-cta .hero-meta { justify-content: center; margin-top: 4px; }

  /* Tagline on hero */
  .hero-eyebrow { font-size: .54rem; letter-spacing: .18em; padding: 5px 12px 5px 10px; }
  .hero-tag { font-size: .82rem; }

  /* Filters wrap nicely */
  .prod-filters { gap: 6px; margin: -20px 0 30px; }
  .prod-filter { padding: 7px 14px; font-size: .62rem; letter-spacing: .12em; }

  /* Timeline indent tighter */
  .tl-item { padding: 12px 14px 12px 38px; }
  .timeline::before { left: 14px; }
  .tl-item .tl-dot { left: 7px !important; }

  /* Logos / brand */
  .brand { gap: 10px; }
  .brand-mark { width: 38px; height: 38px; padding: 5px; }
  .brand-text > span { font-size: 1.05rem; letter-spacing: 2.5px; }
  .brand-text small { font-size: .52rem; letter-spacing: .42em; }

  /* Mobile menu panel: full width */
  .nav-links { width: 88%; padding: 84px 22px 24px; }
  .nav-links a { font-size: .95rem; padding: 10px 0; }

  /* Hero visual */
  .hero-visual { max-width: 240px; }
  .hv-chip.c1, .hv-chip.c3 { transform: translateX(-50%) scale(.85); }
  .hv-chip.c2, .hv-chip.c4 { transform: scale(.85); }
}

/* ---------- 9. Tiny phones ≤360px (iPhone SE 1st gen, old Android) ---------- */
@media (max-width: 360px) {
  .container { padding: 0 14px; }
  .section { padding: 36px 0; }
  .hero { padding: 86px 0 30px; }
  .hero h1 { font-size: 1.55rem; line-height: 1.12; }
  .hero p.lead { font-size: .85rem; line-height: 1.6; }
  .s-head h2 { font-size: 1.35rem; }

  .hero-visual { max-width: 200px; }
  .hv-chip { padding: 5px 8px; font-size: .46rem; gap: 5px; }
  .hv-chip svg { width: 11px; height: 11px; }
  .hv-badge.b1, .hv-badge.b2 { display: none; }

  .hero-stat .num { font-size: 1.05rem; }
  .hero-stat .lbl { font-size: .46rem; letter-spacing: .12em; }

  .marquee-item { font-size: .72rem; padding: 6px 12px 6px 8px; }
  .marquee-item .mi-icon { width: 22px; height: 22px; border-radius: 7px; }
  .marquee-item .mi-icon svg { width: 11px; height: 11px; }

  .prod-filter { padding: 6px 12px; font-size: .58rem; }
  .prod-filter .cnt { font-size: .54rem; padding: 1px 5px; }

  /* Smaller cards & icons */
  .prod-icon { width: 46px; height: 46px; }
  .prod-icon svg { width: 20px; height: 20px; }
  .prod-name { font-size: .92rem; }
  .prod-desc { font-size: .72rem; }

  .svc-card h3, .badge-card h3, .why-card h4 { font-size: .85rem; }
  .badge-icon { width: 50px; height: 50px; }

  .footer { padding: 40px 0 22px; }
  .footer-brand .f-logo { width: 56px; height: 56px; }
  .footer-brand h3 { font-size: 1rem; }
  .footer-tag { font-size: .85rem; }

  .scroll-top { right: 10px; left: auto; bottom: 80px; width: 36px; height: 36px; }
  .sticky-cta { right: 10px; bottom: 10px; gap: 8px; }
  .sticky-cta a { width: 42px; height: 42px; font-size: .9rem; }
}

/* ---------- 10. Landscape phones (short height) ---------- */
@media (max-height: 480px) and (orientation: landscape) {
  .hero { padding: 84px 0 28px; min-height: auto; }
  .hero-content { grid-template-columns: 1.1fr .9fr; gap: 22px; }
  .hero-visual { max-width: 220px; }
  .nav-links { padding-top: 60px; overflow-y: auto; }
}

/* ---------- 11. Tap-target & form polish on touch ---------- */
@media (pointer: coarse) {
  .nav-links a,
  .footer-col a,
  .footer-social a,
  .prod-filter,
  .prod-card,
  .modal-close,
  .form-submit,
  .btn,
  .nav-cta,
  .menu-toggle,
  .scroll-top,
  .sticky-cta a {
    min-height: 44px;
  }
  .menu-toggle { min-width: 44px; }
  .footer-social a { min-width: 44px; }

  /* Prevent iOS zoom on input focus */
  .form-row input,
  .form-row textarea { font-size: 16px; }
}

/* ---------- 12. High-DPI / Retina image polish ---------- */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .brand-mark img,
  .footer-brand .f-logo img,
  .hero-visual .hv-core img,
  .pre-logo img {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* ---------- 13. Dark-mode-aware print fallback ---------- */
@media print {
  .preloader, .cursor-glow, .bg-grid, .bg-noise, .bg-orb,
  .sticky-cta, .scroll-top, .hero-canvas, .particles,
  .marquee, .nav-cta, .menu-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  .nav { position: static; background: #fff; border-bottom: 1px solid #ccc; }
  a { color: #000; text-decoration: underline; }
  .hero { padding: 30px 0; }
  .section { padding: 24px 0; page-break-inside: avoid; }
}

/* ---------- 14. Helpful additions: scroll-reveal stagger on grids ---------- */
.prod-grid > .prod-card,
.svc-grid > .svc-card,
.why-grid > .why-card,
.badges > .badge-card,
.vmv-grid > .vmv-card,
.exp-grid > .exp-panel {
  --stagger: 0;
  animation-delay: calc(var(--stagger) * 70ms);
}

/* Prevent mobile menu body scroll bleed */
body.menu-open { overflow: hidden; touch-action: none; }

/* Mobile nav backdrop */
.nav-backdrop {
  position: fixed; inset: 0; z-index: 99;
  background: rgba(6,8,15,.6);
  backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}
.nav-backdrop.show { opacity: 1; visibility: visible; }
@media (min-width: 992px) { .nav-backdrop { display: none; } }

/* Mobile nav close (X) inside the panel */
.nav-close {
  display: none;
  position: absolute; top: 18px; right: 18px;
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line-2);
  color: #fff; cursor: pointer; font-size: 1rem;
  align-items: center; justify-content: center;
  transition: background .25s ease, transform .25s ease;
}
.nav-close:hover { background: var(--orange); transform: rotate(90deg); }
@media (max-width: 991.98px) {
  .nav-links .nav-close { display: flex; }
}

/* Make sure nav-links list is reachable after CTA hides on mobile */
@media (max-width: 991.98px) {
  .nav-inner { gap: 10px; }
  .menu-toggle { margin-left: auto; }
}

/* Hero: reserve fixed minimum height to avoid CLS */
.hero { min-height: 560px; }
@media (max-width: 767.98px) { .hero { min-height: 520px; } }
@media (max-width: 480px) { .hero { min-height: 480px; } }

/* Improve image performance hints (added via JS, but safe defaults here) */
img { content-visibility: auto; }

/* Desktop nav bar: never scroll, no top padding */
@media (min-width: 900px) {
  .nav-inner .nav-links {
    padding-top: 0 !important;
    overflow-y: visible !important;
  }
}

:root[data-theme="light"] .btn-ghost {
  color: #181c22 !important;
  border-color: var(--line-2);
}
:root[data-theme="light"] .btn-ghost:hover {
  color: var(--blue) !important;
  border-color: var(--blue);
}
