/* ============================================================================
   GIGGLEZEN — FINAL MOBILE-FIRST OVERRIDE
   Loaded LAST. Strips the expensive cinematic chrome on mobile + tablet so
   the experience is FAST, SCROLLS NATIVELY, and never overflows.
   ============================================================================ */

/* ============================================================================
   1. Universal box model + horizontal-overflow hardening
   ============================================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

img, picture, video, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

iframe {
  max-width: 100%;
  border: 0;
}

/* Stop anything (especially user-pasted blog HTML) from blowing out the viewport */
main, section, article, header, footer, .container, [class*="-wrap"], [class*="-grid"] {
  max-width: 100vw;
  min-width: 0;
}

/* ============================================================================
   2. MOBILE (< 768px) — strip the cinematic chrome, simplify everything
   The custom cursor, mouse-tracking spotlight, decorative grid overlay,
   noise grain, orbs, vignette, and backdrop blur are EXPENSIVE GPU effects.
   On mobile they cost performance + cause the "transparency / black overlay
   flickering" complaint. Hide all decorative-only chrome on mobile.
   ============================================================================ */
@media (max-width: 767px) {

  /* Kill all decorative full-viewport overlays */
  .bg-field .orb,
  .bg-field .grain,
  .bg-field .grid-overlay,
  .bg-field .vignette,
  .bg-field .spotlight,
  .letterbox,
  .cursor,
  .scroll-cue,
  .hero-3d {
    display: none !important;
  }

  /* Restore native cursor for everything on touch */
  body, a, button, input, select, textarea,
  .btn, .cta-pill, .nav-links a, .glass-chip,
  [data-cursor], [data-magnet] {
    cursor: auto !important;
  }
  button, [role="button"], .btn, .cta-pill,
  a[href], input[type="submit"], input[type="button"] {
    cursor: pointer !important;
  }

  /* Solid background instead of layered orbs — much faster + reliable */
  .bg-field {
    background: linear-gradient(180deg, #FBF8F1 0%, #F6F2EA 40%, #F0E9D7 100%) !important;
  }

  /* Drop backdrop-filter on glass elements (expensive on mobile GPUs). */
  .glass,
  .glass-chip,
  .nav,
  .drop-menu,
  .stat-card,
  .show-card,
  .price-card,
  .feature,
  .service .svc-inner,
  .testimonial,
  .t-card,
  .faq,
  .contact-card,
  .news,
  .cookie,
  .admin-panel,
  .mv,
  .lead-card,
  .values {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(255,255,255,.96) !important;
    border: 1px solid rgba(10,6,6,.10) !important;
    box-shadow: 0 6px 20px -10px rgba(10,6,6,.15) !important;
  }

  /* Disable all 3D transforms on cards — pure overhead on mobile */
  .tiltable,
  .service, .price-card, .show-card, .port-tile, .stat-card {
    transform: none !important;
    transform-style: flat !important;
    perspective: none !important;
  }

  /* Disable hover-only effects */
  .service:hover, .price-card:hover, .show-card:hover, .port-tile:hover, .stat-card:hover {
    transform: none !important;
  }

  /* Marquee — still scrolls horizontally but no velocity skew */
  .marquee-track { transform: none !important; }

  /* Kinetic SOFTWARE letters — render as plain text */
  .kch {
    transform: none !important;
    translate: 0 !important;
    color: inherit !important;
    filter: none !important;
    animation: none !important;
    opacity: 1 !important;
  }

  /* Section title word reveal — show all words immediately */
  .section-title .kword,
  .contact-title .kword {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  /* Hero focus-blur — never blur on mobile */
  .bg-field { filter: none !important; }

  /* Strip any "scroll-progress" glow */
  .scroll-progress { box-shadow: none !important; }

  /* ==============  LAYOUT — single column everywhere ============== */

  .container { padding-left: 16px !important; padding-right: 16px !important; }

  .hero {
    padding: 100px 18px 32px !important;
    min-height: auto !important;
  }
  .hero-title {
    font-size: clamp(34px, 11vw, 56px) !important;
    line-height: 1 !important;
    margin: 16px 0 0 !important;
  }
  .line.lead {
    font-size: 11px !important;
    letter-spacing: .12em !important;
    margin-bottom: 6px !important;
  }
  .hero-sub {
    font-size: 15px !important;
    line-height: 1.5 !important;
    margin: 18px auto 24px !important;
    max-width: 100% !important;
  }
  .hero-eyebrow {
    font-size: 11px !important;
    padding: 6px 12px !important;
    gap: 8px !important;
  }
  .hero-eyebrow .sep, .hero-eyebrow .mono { display: none !important; }

  .hero-ctas {
    flex-direction: column;
    gap: 10px !important;
    width: 100%;
  }
  .hero-ctas .btn {
    width: 100%;
    justify-content: center;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-top: 24px !important;
  }
  .hero-stats .stat-card { padding: 14px 12px !important; }
  .hero-stats .num { font-size: 28px !important; }
  .hero-stats .lbl { font-size: 10px !important; }
  .hero-stats .trend, .hero-stats .dots,
  .hero-stats .globe, .hero-stats .bar-mini { display: none !important; }

  .section {
    padding: 56px 16px 8px !important;
    max-width: 100% !important;
  }
  .section-head {
    margin: 0 auto 28px !important;
    max-width: 100% !important;
  }
  .section-title {
    font-size: clamp(26px, 8vw, 42px) !important;
    line-height: 1.1 !important;
  }
  .section-sub {
    font-size: 14.5px !important;
    line-height: 1.55 !important;
  }
  .kicker { font-size: 10px !important; padding: 5px 11px !important; }

  .page-hero {
    padding: 100px 16px 36px !important;
  }
  .page-hero h1 {
    font-size: clamp(32px, 10vw, 50px) !important;
    line-height: 1.05 !important;
  }
  .page-hero .page-sub {
    font-size: 15px !important;
    line-height: 1.5 !important;
  }
  .page-ctas {
    flex-direction: column;
    gap: 10px;
  }
  .page-ctas .btn { width: 100%; justify-content: center; }

  /* GRIDS → single column on mobile */
  .services-grid,
  .showcase-grid,
  .port-grid,
  .pricing-grid,
  .process-rail,
  .feature-grid,
  .about-grid,
  .about-mv,
  .stack-grid,
  .blog-grid,
  .gallery-grid,
  .jobs-grid,
  .footer-inner {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .show-card.big,
  .port-tile.tall-tile {
    grid-column: span 1 !important;
    grid-row: span 1 !important;
    min-height: 280px;
  }
  .stack-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }

  /* Cards — readable inner padding */
  .service .svc-inner,
  .feature,
  .price-card,
  .show-card,
  .phase,
  .stack-grid li,
  .mv,
  .lead-card,
  .values {
    padding: 20px 18px !important;
  }

  /* Process rail — drop the horizontal connector line, vertical layout */
  .process-rail::before { display: none !important; }
  .phase-num { font-size: 38px !important; margin-bottom: 12px !important; }

  /* About page directors — single column */
  .about-grid > * { width: 100% !important; }
  .about-side { position: static !important; top: auto !important; }

  /* Marquee — smaller font, reduce padding */
  .marquee-track { font-size: clamp(18px, 5vw, 24px) !important; gap: 24px !important; }
  .marquee { padding: 16px 0 !important; }

  /* Testimonials carousel — single visible card */
  .t-card { flex-basis: 100% !important; min-width: 100% !important; padding: 22px !important; }
  .t-controls { margin-top: 20px !important; gap: 10px !important; }
  .t-btn { width: 40px !important; height: 40px !important; }

  /* Pricing — full-width primary CTA */
  .pc-amt { font-size: 38px !important; }
  .price-card .btn { width: 100% !important; justify-content: center !important; }
  .pc-flag { top: 10px !important; right: 10px !important; padding: 4px 10px !important; font-size: 9px !important; }

  /* Contact card — single column */
  .contact-card {
    grid-template-columns: 1fr !important;
    padding: 24px 18px !important;
    gap: 20px !important;
  }
  .contact-form {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .contact-form .field-wide,
  .contact-form .btn { grid-column: 1 / -1 !important; }
  .contact-form .btn { width: 100% !important; justify-content: center !important; }
  .field input, .field select, .field textarea {
    font-size: 16px !important; /* prevents iOS zoom */
    padding: 12px 14px !important;
  }

  /* Newsletter footer form */
  .news { flex-direction: column; padding: 6px !important; border-radius: 18px !important; gap: 6px; }
  .news input { width: 100% !important; padding: 12px 14px !important; font-size: 16px !important; }
  .news button { width: 100% !important; min-height: 44px !important; }

  /* CTA strip */
  .cta-strip { padding: 0 16px !important; margin: 40px auto 60px !important; }
  .cta-strip-inner { grid-template-columns: 1fr !important; padding: 28px 22px !important; text-align: center; }
  .cta-strip-inner .btn { width: 100% !important; justify-content: center !important; }
  .cta-strip h2 { font-size: clamp(22px, 6vw, 32px) !important; }

  /* Footer */
  .footer-inner { padding: 50px 18px 24px !important; gap: 28px !important; }
  .f-news .news { margin-top: 12px; }
  .footer-bottom { padding: 18px 18px !important; text-align: center; flex-direction: column; gap: 6px !important; }

  /* FAQ */
  .faq summary { padding: 18px 18px !important; font-size: 15px !important; gap: 12px !important; }
  .faq p { padding: 0 18px 18px !important; font-size: 14px !important; }
  .faq-ic { width: 22px !important; height: 22px !important; }

  /* Service detail breadcrumbs */
  .breadcrumbs { font-size: 10px !important; gap: 6px !important; flex-wrap: wrap; margin-bottom: 16px !important; }

  /* Hide expensive decorative SVG positioned art on cards */
  .show-card .sc-art,
  .stat-card .trend, .stat-card .dots, .stat-card .globe, .stat-card .bar-mini {
    display: none !important;
  }

  /* Cookie consent — bottom sheet, full width */
  .cookie {
    bottom: 8px !important;
    left: 8px !important;
    right: 8px !important;
    transform: none !important;
    width: auto !important;
    max-width: 100% !important;
    flex-direction: column !important;
    border-radius: 16px !important;
    text-align: center !important;
    padding: 16px !important;
    gap: 12px !important;
  }
  .cookie p { font-size: 12.5px !important; margin: 0 !important; }
  .cookie > div { width: 100%; }
  .cookie .btn { flex: 1; }
}

/* ============================================================================
   3. TABLET (768px - 1023px) — reduce to 2 columns, keep most chrome
   ============================================================================ */
@media (min-width: 768px) and (max-width: 1023px) {
  .services-grid,
  .showcase-grid,
  .pricing-grid,
  .feature-grid,
  .port-grid,
  .blog-grid,
  .footer-inner {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .show-card.big,
  .port-tile.tall-tile {
    grid-column: span 2 !important;
  }
  .stack-grid { grid-template-columns: repeat(4, 1fr) !important; }
  .gallery-grid { grid-template-columns: repeat(3, 1fr) !important; }

  .process-rail {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }
  .process-rail::before { display: none !important; }

  .hero-title { font-size: clamp(48px, 8vw, 88px) !important; }
  .section-title { font-size: clamp(34px, 5.5vw, 60px) !important; }

  .contact-card { grid-template-columns: 1fr !important; padding: 36px !important; }
  .about-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
}

/* ============================================================================
   4. DESKTOP (>= 1024px) — keep cinematic, but tame the most expensive bits
   ============================================================================ */
@media (min-width: 1024px) {
  /* Cap orb opacity slightly — they were a bit heavy at default */
  .orb { opacity: .45 !important; }
}

/* ============================================================================
   5. NATIVE SMOOTH SCROLL FALLBACK
   Lenis is disabled on touch+small in motion-cinematic.js.
   Add CSS smooth-scroll for anchor links so it still feels nice.
   ============================================================================ */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ============================================================================
   6. TOUCH DEVICE OVERRIDES (regardless of width)
   Catches tablets that report wide viewports but no hover.
   ============================================================================ */
@media (hover: none) {
  .cursor { display: none !important; }
  body { cursor: auto !important; }

  /* Disable mouse-tracking spotlight */
  .spotlight { display: none !important; }

  /* Disable 3D card tilt regardless of viewport */
  .tiltable, .service, .price-card, .show-card, .port-tile {
    transform: none !important;
    transform-style: flat !important;
  }

  /* Prevent iOS sticky :hover state */
  *:hover { transition-duration: 0s !important; }
}

/* ============================================================================
   7. LEAD-CAPTURE STICKY BAR + EXIT POPUP — restyle for cinematic theme
   These elements live in components/lead-capture.php and were originally
   built for the OLD admin theme (gz-btn classes, gz-magenta/cyan vars).
   In the cinematic theme they rendered as unstyled black boxes.
   ============================================================================ */

/* Sticky bottom CTA on mobile — was a plain black bar. Restyle to cinematic
   red-gold gradient, give it a subtle shadow, and proper safe-area padding
   for iPhones with home indicator. */
.sticky-cta-mobile {
  background: rgba(246, 242, 234, 0.92) !important;
  backdrop-filter: blur(14px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(14px) saturate(140%) !important;
  border-top: 1px solid rgba(10, 6, 6, 0.08) !important;
  box-shadow: 0 -10px 28px -10px rgba(10, 6, 6, 0.18) !important;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
  display: none; /* default hidden; the @media block re-enables on phone */
}
.sticky-cta-mobile a,
.sticky-cta-mobile .gz-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: 100% !important;
  padding: 13px 22px !important;
  border-radius: 999px !important;
  background: linear-gradient(135deg, #C2102B 0%, #B8932D 100%) !important;
  color: #fff !important;
  text-decoration: none !important;
  font-family: var(--font-b, system-ui), system-ui !important;
  font-weight: 600 !important;
  font-size: 15px !important;
  letter-spacing: 0.005em !important;
  min-height: 48px !important;
  box-shadow: 0 10px 26px -8px rgba(194, 16, 43, 0.45) !important;
  border: 0 !important;
}
.sticky-cta-mobile .arrow-icon {
  display: inline-block;
  transition: transform .25s;
}
.sticky-cta-mobile a:active .arrow-icon,
.sticky-cta-mobile a:focus-visible .arrow-icon { transform: translateX(3px); }

@media (max-width: 767px) {
  .sticky-cta-mobile { display: block !important; }
  /* Lift the WhatsApp float above the sticky CTA bar */
  .whatsapp-float { bottom: 76px !important; }
  /* Push the cookie banner above the sticky CTA bar so it doesn't overlap */
  .cookie {
    bottom: 70px !important;
    left: 8px !important;
    right: 8px !important;
    transform: none !important;
    width: auto !important;
    max-width: 100% !important;
  }
  /* Add space at the bottom of pages so content isn't hidden behind the bar */
  body { padding-bottom: 70px !important; }
}

/* Exit popup — re-skin for cinematic theme. Was using gz-cyan / gz-magenta
   tokens that no longer exist. */
.exit-popup {
  position: fixed; inset: 0; z-index: 10000;
}
.exit-popup__overlay {
  background: rgba(10, 6, 6, 0.72) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
}
.exit-popup__content,
.exit-popup__content.glass-card {
  background: #fff !important;
  color: var(--ink, #0A0606) !important;
  border-radius: 18px !important;
  border: 1px solid rgba(10, 6, 6, 0.08) !important;
  box-shadow: 0 30px 80px -20px rgba(10, 6, 6, 0.4) !important;
  padding: 28px 24px !important;
  max-width: 420px !important;
  width: calc(100% - 32px) !important;
}
.exit-popup__icon i { color: var(--red, #C2102B) !important; -webkit-text-fill-color: var(--red, #C2102B) !important; background: none !important; }
.exit-popup__content h3 {
  font-family: var(--font-d, system-ui), system-ui !important;
  color: var(--ink, #0A0606) !important;
  font-size: 22px !important;
  margin: 12px 0 6px !important;
}
.exit-popup__content p {
  color: var(--ink-dim, rgba(10,6,6,.72)) !important;
  font-size: 14.5px !important;
  line-height: 1.5 !important;
}
.exit-popup__content p strong { color: var(--red, #C2102B) !important; }
.exit-popup__form input {
  background: rgba(255,255,255,.92) !important;
  color: var(--ink, #0A0606) !important;
  border: 1px solid rgba(10, 6, 6, 0.12) !important;
  font-size: 16px !important;
}
.exit-popup__form input:focus {
  border-color: var(--red, #C2102B) !important;
  box-shadow: 0 0 0 3px rgba(194, 16, 43, 0.12) !important;
  outline: none !important;
}
.exit-popup__form button,
.exit-popup__form .gz-btn,
.exit-popup__form .gz-btn--primary {
  background: linear-gradient(135deg, var(--red, #C2102B), var(--gold, #B8932D)) !important;
  color: #fff !important;
  border: 0 !important;
  border-radius: 999px !important;
  padding: 12px 22px !important;
  font-weight: 600 !important;
  font-family: var(--font-b, system-ui), system-ui !important;
  font-size: 15px !important;
  min-height: 48px !important;
  width: 100% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  cursor: pointer !important;
}
.exit-popup__close { color: var(--ink-dim, rgba(10,6,6,.72)) !important; }
.exit-popup__close:hover { color: var(--red, #C2102B) !important; }

/* ============================================================================
   8. BUTTON STACKING WINNER — HIGH-SPECIFICITY
   site-extensions.css uses `.page-hero .page-ctas` selector (specificity 0,2,0)
   which beats plain `.page-ctas` (0,1,0). Match the specificity by using a
   selector with body+class. With `!important` on the rule itself we win.
   ============================================================================ */
@media (max-width: 767px) {
  body .page-hero .page-ctas,
  body .hero .hero-ctas,
  body .hero-ctas,
  body .page-ctas {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 360px !important;
    margin: 16px auto 0 !important;
  }
  body .page-hero .page-ctas .btn,
  body .hero .hero-ctas .btn,
  body .hero-ctas .btn,
  body .page-ctas .btn {
    width: 100% !important;
    justify-content: center !important;
    min-height: 48px !important;
    padding: 13px 24px !important;
  }
}

/* ============================================================================
   9. SAFETY NETS
   ============================================================================ */

/* Make sure no element ever produces horizontal overflow */
.hero-inner, .hero-3d, .section-head, .about-grid,
.services-grid, .showcase-grid, .port-grid, .pricing-grid,
.process-rail, .stack-grid, .feature-grid, .blog-grid,
.gallery-grid, .jobs-grid, .marquee-wrap, .contact-card,
.cta-strip-inner, .footer-inner {
  min-width: 0;
}

/* Form controls in dark backgrounds inherit ink color properly */
.field input, .field textarea, .field select {
  color: var(--ink);
  background: rgba(255,255,255,.92);
}

/* Make sure focus rings are visible on all interactive elements */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Touch target safety net */
@media (max-width: 767px) {
  a, button, input[type="submit"], input[type="button"],
  .btn, .cta-pill, .nav-links a, .faq summary, .glass-chip {
    min-height: 44px;
  }
}
