/*
  GrowBeyond Tech — Advanced Responsive Stylesheet
  =========================================================
  Breakpoints (Mobile-First Guard):
    xs  : 0–374px     (Small Android, older phones)
    sm  : 375–479px   (iPhone SE, standard iOS)
    md  : 480–639px   (Large phones, iPhone Plus)
    lg  : 640–767px   (Small tablets, landscape phones)
    xl  : 768–1023px  (Tablets: iPad, Android tablets)
    2xl : 1024–1279px (Large tablets, small laptops)
    3xl : 1280px+     (Desktops — PRESERVED, no changes)

  RULE: Desktop (1280px+) is UNTOUCHED.
  All rules below only target ≤1279px.
  =========================================================
*/

/* =============================================
   1. iOS/ANDROID GLOBAL FIXES
   ============================================= */

/* iOS rubber-band scroll & safe areas */
html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Prevent ALL horizontal overflow at root */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

/* Clip everything inside body on mobile — kills horizontal scroll gap */
@media (max-width: 1023px) {
  body {
    overflow-x: hidden !important;
    position: relative;
    width: 100%;
  }

  /* Canvas elements from GSAP/animations should never cause scroll */
  canvas {
    max-width: 100% !important;
    overflow: hidden;
  }

  /* Marquee track clips itself — no overflow past container */
  .marquee-container {
    overflow: hidden !important;
    max-width: 100vw;
  }

  /* Home hero — contains the canvas, must clip */
  .home-main-hero,
  .home-hero,
  .hero-cinematic {
    overflow: hidden !important;
    max-width: 100vw;
  }
}

/* iOS tap highlight removal */
* {
  -webkit-tap-highlight-color: transparent;
}

/* Prevent buttons/inputs from being zoomed in iOS */
input, textarea, select, button {
  font-size: 16px; /* iOS requires 16px to prevent auto-zoom */
}

@media (max-width: 767px) {
  input, textarea, select {
    font-size: 16px !important;
  }
}

/* iOS safe area support for notched devices */
@supports (padding: max(0px)) {
  nav#navbar {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }

  .sticky-talk {
    bottom: max(1.25rem, calc(env(safe-area-inset-bottom) + 1.25rem));
    right: max(1.25rem, calc(env(safe-area-inset-right) + 1.25rem));
  }

  /* Mobile nav panel accounts for bottom safe area */
  .nav-links {
    padding-bottom: max(0.6rem, env(safe-area-inset-bottom));
  }
}

/* =============================================
   2. CONTAINER — Responsive Padding Scale
   ============================================= */

@media (max-width: 1279px) {
  .container {
    padding: 0 4%;
  }
}

@media (max-width: 767px) {
  .container {
    padding: 0 1.1rem;
  }
}

@media (max-width: 374px) {
  .container {
    padding: 0 0.875rem;
  }
}

/* =============================================
   3. TYPOGRAPHY — Scale for Mobile
   ============================================= */

@media (max-width: 767px) {
  h1 {
    font-size: clamp(1.75rem, 7vw, 2.6rem);
    letter-spacing: -0.03em;
  }

  h2 {
    font-size: clamp(1.5rem, 6vw, 2.2rem);
    letter-spacing: -0.02em;
    margin-bottom: 1.2rem;
  }

  h3 {
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    margin-bottom: 0.6rem;
  }

  p {
    font-size: 0.97rem;
    line-height: 1.7;
  }
}

@media (max-width: 374px) {
  h1 { font-size: clamp(1.5rem, 8vw, 2rem); }
  h2 { font-size: clamp(1.35rem, 7vw, 1.8rem); }
  h3 { font-size: 1.1rem; }
}

/* =============================================
   4. NAVBAR — Full Mobile/Tablet Fix
   ============================================= */

/* Ensure navbar is always solid and on top */
@media (max-width: 1023px) {
  nav#navbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    transform: none !important;
    z-index: 9999 !important;
    height: var(--navbar-h) !important;
    /* Stronger glass on mobile */
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  }

  .nav-content {
    padding: 0;
    gap: 0;
  }

  /* Hamburger visible */
  .mobile-menu-toggle {
    display: flex !important;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    z-index: 10002;
    padding: 12px;
    border-radius: 8px;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-menu-toggle:active {
    background: rgba(0, 0, 0, 0.05);
  }

  .mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
    display: block;
    transform-origin: center;
  }

  /* X state */
  .mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }

  .mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* ── NAV PANEL ── */
  .nav-links {
    position: fixed !important;
    top: var(--navbar-h) !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: auto !important;
    max-height: calc(100dvh - var(--navbar-h)) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;

    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(24px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(200%) !important;
    border: none !important;
    border-top: 1px solid var(--accent-gray) !important;
    border-radius: 0 !important;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12) !important;

    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    padding: 0.5rem 1rem 1rem !important;

    /* Hidden state */
    opacity: 0 !important;
    transform: translateY(-12px) !important;
    pointer-events: none !important;
    visibility: hidden !important;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s !important;
  }

  .nav-links.active {
    opacity: 1 !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
    visibility: visible !important;
    transition: opacity 0.22s ease, transform 0.22s ease !important;
  }

  /* Nav links inside panel */
  .nav-links > a {
    font-size: 1.05rem !important;
    padding: 0.75rem 0.85rem !important;
    border-radius: 10px !important;
    width: 100% !important;
    display: block !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    transition: background 0.18s ease !important;
  }

  .nav-links > a:last-of-type {
    border-bottom: none !important;
  }

  .nav-links > a:hover,
  .nav-links > a:active {
    background: rgba(0, 102, 204, 0.06) !important;
  }

  /* "Talk to Us" button in nav */
  .nav-links .btn-outline-nav {
    display: block !important;
    text-align: center !important;
    margin-top: 0.5rem !important;
    padding: 0.85rem !important;
    background: var(--accent-blue) !important;
    color: #fff !important;
    border-radius: 10px !important;
    border-top: none !important;
    font-weight: 600 !important;
  }

  /* ── DROPDOWN IN MOBILE NAV ── */
  .nav-dropdown {
    width: 100%;
  }

  .nav-dd-trigger {
    width: 100%;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    font-size: 1.05rem !important;
    padding: 0.75rem 0.85rem !important;
    border-radius: 10px !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    cursor: pointer;
  }

  .nav-dd-trigger:hover,
  .nav-dd-trigger:active {
    background: rgba(0, 102, 204, 0.06) !important;
  }

  .nav-dd-arrow {
    display: inline-block !important;
    font-size: 0.9rem;
    transition: transform 0.25s ease;
  }

  .nav-dropdown.open .nav-dd-arrow {
    transform: rotate(90deg);
  }

  /* Dropdown menu — mobile inline style */
  .nav-dd-menu {
    position: static !important;
    transform: none !important;
    opacity: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    visibility: hidden !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    transition: opacity 0.2s ease, max-height 0.3s ease !important;
  }

  .nav-dropdown.open .nav-dd-menu {
    opacity: 1 !important;
    max-height: 300px !important;
    pointer-events: auto !important;
    visibility: visible !important;
    padding: 0.25rem 0 0.25rem 1rem !important;
    border-left: 2px solid var(--accent-blue) !important;
    margin-left: 0.85rem !important;
    margin-bottom: 0.25rem !important;
  }

  .nav-dd-menu a {
    font-size: 0.97rem !important;
    padding: 0.6rem 0.85rem !important;
    border-radius: 8px !important;
    display: block !important;
    color: var(--text-secondary) !important;
  }

  .nav-dd-menu a:hover {
    color: var(--accent-blue) !important;
    background: rgba(0, 102, 204, 0.05) !important;
  }
}

/* Tablet-specific: Show nav as dropdown panel from right side */
@media (min-width: 640px) and (max-width: 1023px) {
  .nav-links {
    left: auto !important;
    right: 0 !important;
    width: 320px !important;
    border-radius: 0 0 0 20px !important;
    border-top: 1px solid var(--accent-gray) !important;
    border-left: 1px solid var(--accent-gray) !important;
    box-shadow: -8px 8px 40px rgba(0, 0, 0, 0.1) !important;
  }
}

/* =============================================
   5. BODY PADDING-TOP — Match navbar height
   ============================================= */

@media (max-width: 767px) {
  :root {
    --navbar-h: 70px;
  }
}

@media (max-width: 374px) {
  :root {
    --navbar-h: 64px;
  }
}

/* =============================================
   6. HOME HERO — Mobile/iOS/Android Fixes
   ============================================= */

@media (max-width: 767px) {
  .home-hero {
    min-height: calc(100dvh - var(--navbar-h));
  }

  .home-main-hero {
    min-height: calc(100dvh - var(--navbar-h));
    padding: 0;
    overflow: hidden;
    width: 100%;
  }

  .home-hero-content {
    min-height: calc(100dvh - var(--navbar-h));
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    --home-hero-gap: 0.9rem;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
    align-items: center;
  }

  .home-hero-heading {
    margin-top: 0.75rem;
  }

  .home-hero-line-muted {
    font-size: clamp(1.4rem, 5.5vw, 2rem);
  }

  .home-hero-line-strong {
    font-size: clamp(1.75rem, 6.5vw, 2.5rem);
  }

  .home-hero-badge {
    font-size: 0.6rem;
    padding: 0.28rem 0.7rem;
  }

  .home-hero-subline {
    font-size: 0.88rem;
    letter-spacing: 0.02em;
  }

  .home-hero-ctas {
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
  }

  .home-hero-ctas .btn,
  .home-hero-secondary {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* Hero stat strip — KEEP HORIZONTAL on mobile, just compact */
  .hero-stat-strip {
    flex-direction: row !important;   /* override style.css column rule */
    flex-wrap: nowrap;
    gap: 0.5rem;
    width: 100%;                      /* fill the flex parent */
    max-width: 100%;
    align-self: stretch;              /* stretch inside the column flex hero */
    margin: 1.75rem 0 0;
    justify-content: space-evenly;
    align-items: center;
    overflow: hidden;
    box-sizing: border-box;
  }

  .hero-stat-divider {
    width: 1px;
    height: 32px;
    background: var(--accent-gray);
    flex-shrink: 0;
  }

  .hero-stat {
    min-width: 0;
    flex: 1;
    text-align: center;
    padding: 0 0.25rem;
  }

  .hero-stat-value {
    font-size: clamp(1.05rem, 4.5vw, 1.4rem);
    letter-spacing: -0.02em;
    line-height: 1;
  }

  .hero-stat p {
    font-size: clamp(0.6rem, 2.2vw, 0.72rem);
    max-width: none;
    margin: 0.3rem auto 0;
    line-height: 1.25;
  }

  /* Marquee on mobile — smaller icons */
  .home-main-hero .marquee-container {
    margin-bottom: 0;
    padding: 0.5rem 0 0.25rem;
  }

  .home-main-hero .marquee-icon {
    flex: 0 0 58px;
    width: 58px;
    min-width: 58px;
  }

  .home-main-hero .marquee-icon img {
    width: 32px;
    height: 32px;
  }

  .marquee-icon span {
    font-size: 0.6rem;
  }
}

@media (max-width: 374px) {
  .home-hero-line-muted {
    font-size: 1.3rem;
  }

  .home-hero-line-strong {
    font-size: 1.6rem;
  }

  .home-hero-ctas {
    max-width: 280px;
  }
}

/* Hero interrupt on mobile */
@media (max-width: 767px) {
  .hero-interrupt {
    padding: 1.5rem 1rem;
  }

  .hero-interrupt-logo {
    width: clamp(110px, 36vw, 170px);
  }

  .hero-skip {
    font-size: 0.85rem;
    right: 1.25rem;
    bottom: 1.25rem;
  }
}

/* =============================================
   7. SECTIONS — General Spacing on Mobile
   ============================================= */

@media (max-width: 767px) {
  section {
    padding: 2rem 0;
  }

  .home-section {
    padding: 2.5rem 0;
  }

  #what-we-do,
  #how-we-fix-it,
  #solutions {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
}

@media (max-width: 374px) {
  section {
    padding: 1.5rem 0;
  }

  .home-section {
    padding: 1.75rem 0;
  }
}

/* =============================================
   8. HS-SPLIT — Two-column → single column
   ============================================= */

@media (max-width: 1023px) {
  .hs-split {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  #what-we-do .hs-split {
    grid-template-columns: 1fr !important;
  }
}

/* =============================================
   9. COMPARISON CARDS — Stack on Mobile
   ============================================= */

@media (max-width: 767px) {
  .comparison-container {
    flex-direction: column;
    gap: 1.25rem;
  }

  .comparison-card {
    min-height: 280px;
    padding: 1.25rem;
  }

  .flow-visual,
  .messy-visual {
    height: 220px;
  }
}

/* =============================================
   10. PATTERNS OF FAILURE — Flip Cards
   ============================================= */

@media (max-width: 767px) {
  .hs-sub {
    padding: 1.75rem 0;
  }

  /* On touch devices, use tap instead of hover */
  .hs-sub .indicator-card {
    height: 260px !important;
    min-height: unset !important;
  }

  /* Touch flip via JS-added class */
  .hs-sub .indicator-card.flipped .card-inner {
    transform: rotateY(180deg);
  }

  .hs-sub .card-front-img {
    height: 150px !important;
    min-height: unset;
  }

  .hs-sub .card-front-text {
    padding: 1.25rem;
  }

  .indicator-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .card-flip-hint {
    font-size: 0.7rem;
  }
}

@media (min-width: 480px) and (max-width: 767px) {
  .indicator-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
}

/* =============================================
   11. BUTTONS — Touch-Friendly Sizing
   ============================================= */

@media (max-width: 767px) {
  .btn {
    padding: 0.85rem 1.75rem;
    font-size: 0.92rem;
    min-height: 48px; /* iOS/Android touch target */
  }

  .btn-sm {
    padding: 0.72rem 1.15rem;
    min-height: 44px;
  }

  .btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 0.9rem;
    width: 100%;
    justify-content: center;
  }
}

/* =============================================
   12. SERVICE CARDS (Home) — Stack on Mobile
   ============================================= */

@media (max-width: 767px) {
  .hs-service-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem;
  }

  .hs-service-card {
    grid-template-columns: 2.5fr 7.5fr;
    min-height: 100px;
  }

  .hs-card-img {
    padding: 1rem;
  }

  .hs-card-img img {
    max-height: 64px;
  }

  .hs-card-text {
    padding: 1rem 1rem;
    gap: 0.35rem;
  }

  .hs-card-text h4 {
    font-size: 1rem;
  }

  .hs-card-text p {
    font-size: 0.88rem;
    line-height: 1.45;
  }
}

@media (max-width: 374px) {
  .hs-service-card {
    grid-template-columns: 2fr 8fr;
  }

  .hs-card-text h4 {
    font-size: 0.92rem;
  }

  .hs-card-text p {
    font-size: 0.82rem;
    display: none; /* Too cramped on very small screens */
  }
}

/* =============================================
   13. METRICS ROW
   ============================================= */

@media (max-width: 767px) {
  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .metrics-row > .metrics-item:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .metrics-value {
    font-size: clamp(1.6rem, 5vw, 2.2rem);
  }

  .metrics-label {
    font-size: 0.78rem;
  }
}

@media (max-width: 374px) {
  .metrics-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .metrics-item {
    padding: 1rem 0.75rem;
  }

  .metrics-value {
    font-size: 1.4rem;
  }
}

/* =============================================
   14. HOW WE FIX IT STEPS — Vertical Path
   ============================================= */

@media (max-width: 767px) {
  .hs-steps-path {
    padding: 0;
  }

  .hs-step {
    gap: 1.25rem;
    padding-bottom: 1.5rem;
  }

  .hs-step-marker {
    width: 36px;
    height: 36px;
    font-size: 0.68rem;
    flex-shrink: 0;
  }

  .hs-step-content h3 {
    font-size: 1.15rem;
  }

  .hs-step-content p {
    font-size: 0.92rem;
  }

  /* Fix the step connector line position */
  .hs-step:not(:last-child)::before {
    left: 17px;
    top: 38px;
  }
}

/* =============================================
   15. LOGO GRID (Trust Section)
   ============================================= */

@media (max-width: 767px) {
  .logo-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.75rem;
  }

  .logo-tile {
    padding: 0.9rem 0.75rem;
    min-height: 64px;
  }

  .logo-tile img {
    max-height: 36px;
  }
}

@media (max-width: 374px) {
  .logo-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.6rem;
  }

  .logo-tile img {
    max-height: 30px;
  }
}

/* =============================================
   16. TESTIMONIALS CAROUSEL
   ============================================= */

@media (max-width: 1023px) {
  .testimonial-card {
    flex: 0 0 calc((100% - 1.5rem) / 2);
  }
}

@media (max-width: 767px) {
  .section-testimonials {
    padding: 2rem 0;
  }

  .section-testimonials h2 {
    margin-bottom: 1.75rem;
    font-size: clamp(1.5rem, 6vw, 2.2rem);
  }

  .testimonial-card {
    flex: 0 0 100%;
    padding: 1.5rem;
  }

  .t-track {
    /* On mobile, full-width single card */
    gap: 1rem;
  }

  .t-body {
    font-size: 0.9rem;
    line-height: 1.68;
  }

  .t-author {
    gap: 0.6rem;
  }

  .t-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
  }

  .t-author-info h5 {
    font-size: 0.84rem;
  }

  .t-author-info p {
    font-size: 0.74rem;
  }

  .t-client-logo {
    height: 22px;
    max-width: 60px;
  }

  .t-dots {
    margin-top: 1.25rem;
  }

  .t-dot {
    width: 7px;
    height: 7px;
  }

  .t-dot--active {
    width: 20px;
  }
}

/* Touch swipe support for testimonial carousel */
@media (hover: none) and (pointer: coarse) {
  .t-carousel {
    touch-action: pan-y pinch-zoom;
  }
}

/* =============================================
   17. STICKY CTA BUTTON
   ============================================= */

@media (max-width: 767px) {
  .sticky-talk {
    bottom: 1rem;
    right: 1rem;
  }

  .sticky-talk a {
    font-size: 0.85rem;
    padding: 0.65rem 1.2rem;
    min-height: 44px;
    border-radius: 10px;
  }
}

@media (max-width: 374px) {
  .sticky-talk {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .sticky-talk a {
    font-size: 0.8rem;
    padding: 0.6rem 1rem;
  }
}

/* =============================================
   18. FOOTER — Responsive Grid
   ============================================= */

@media (max-width: 1023px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "brand brand"
      "company approach"
      "services services"
      "action action";
    gap: 2rem;
  }

  .footer-action-row {
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
  }

  .footer-action-right {
    grid-column: 2;
  }
}

@media (max-width: 767px) {
  .site-footer {
    padding-top: 2rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "company"
      "approach"
      "services"
      "action";
    gap: 1.75rem;
  }

  .footer-brand p {
    max-width: 100%;
    font-size: 0.88rem;
  }

  .footer-talk-btn {
    width: 100%;
    justify-content: center;
  }

  .footer-action-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .footer-action-cta,
  .footer-action-right {
    grid-column: 1;
  }

  .footer-action-cta .btn {
    width: 100%;
    justify-content: center;
  }

  .footer-bar {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    padding: 1.25rem 0;
  }

  .footer-col a {
    font-size: 0.88rem;
    margin-bottom: 0.55rem;
  }

  .footer-col h5 {
    font-size: 0.7rem;
    margin-bottom: 0.85rem;
  }
}

/* =============================================
   19. WHY SYSTEMS FAIL PAGE
   ============================================= */

@media (max-width: 767px) {
  .wsf-hero-title {
    font-size: clamp(1.75rem, 6.5vw, 2.4rem);
  }

  .wsf-split-card,
  .wsf-split-card--reverse {
    flex-direction: column !important;
  }

  .wsf-split-image {
    flex: none !important;
    width: 100% !important;
    height: 220px;
  }

  .wsf-split-image img {
    position: relative !important;
    width: 100%;
    height: 220px;
    object-fit: cover;
  }

  .wsf-split-content {
    padding: 1.5rem 1.25rem;
    gap: 0.85rem;
  }

  .wsf-data-quote {
    padding: 1.5rem 1.25rem;
    font-size: 1rem;
    line-height: 1.65;
  }

  .wsf-section-heading {
    font-size: clamp(1.5rem, 6vw, 2.2rem);
  }

  .wsf-hero-image {
    margin-top: 1.5rem;
    border-radius: 10px;
  }

  .wsf-hero-image img {
    max-height: 260px;
  }
}

@media (max-width: 374px) {
  .wsf-data-quote {
    padding: 1.25rem 1rem;
    font-size: 0.94rem;
  }
}

/* =============================================
   20. HOW WE FIX IT PAGE — Accordion
   ============================================= */

@media (max-width: 767px) {
  .hwfi-tech-nav-bar {
    position: static !important;
    padding: 0.75rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .hwfi-tech-nav {
    flex-wrap: nowrap !important;
    gap: 0.5rem;
    width: max-content;
    min-width: 100%;
    padding: 0 1rem;
  }

  .hwfi-tech-pill {
    font-size: 0.82rem;
    padding: 0.4rem 0.9rem;
    white-space: nowrap;
    min-height: 40px;
    flex-shrink: 0;
  }

  .hwfi-panel-header {
    padding: 0.9rem 1rem;
    gap: 0.75rem;
  }

  .hwfi-panel-logo {
    height: 56px !important;
    max-width: 110px;
  }

  .hwfi-panel-title {
    font-size: 1rem;
  }

  .hwfi-panel-sub {
    font-size: 0.78rem;
  }

  .hwfi-panel-body {
    padding: 0 1rem 1rem;
  }

  .hwfi-steps-flow {
    flex-direction: column !important;
    overflow-x: visible !important;
    gap: 0;
    padding-bottom: 0;
  }

  .hwfi-arrow {
    transform: rotate(90deg);
    padding: 0.2rem 0;
    justify-content: flex-start;
    padding-left: 0.75rem;
  }

  .hwfi-step-box {
    min-width: 0 !important;
  }

  .hwfi-step-box h4 {
    font-size: 0.9rem;
  }

  .hwfi-step-box p {
    font-size: 0.82rem;
  }
}

/* =============================================
   21. ZOHO SERVICE PAGE — Flip Tiles
   ============================================= */

@media (max-width: 1023px) {
  .zoho-tiles-grid {
    grid-auto-columns: calc((100% - 1.5rem) / 2) !important;
  }

  .zt-slider-shell {
    padding: 0 2.5rem;
  }
}

@media (max-width: 767px) {
  .zt-slider-shell {
    padding: 0 2.25rem;
  }

  .zoho-tiles-grid {
    grid-auto-columns: 100% !important;
    padding-bottom: 1.5rem !important;
  }

  .zt-card {
    height: auto !important;
    aspect-ratio: unset !important;
    min-height: unset !important;
  }

  .zt-front {
    position: relative !important;
    height: auto !important;
    overflow: hidden !important;
  }

  .zt-back {
    overflow: hidden !important;
  }

  .zt-card .zt-front-img {
    height: 220px !important;
  }

  .zt-card .zt-front-body-40 {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    gap: 1.5rem !important;
    padding: 1.5rem 1rem 2rem !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .zt-slide-btn {
    width: 34px;
    height: 34px;
    font-size: 1.4rem;
  }

  .zt-back {
    padding: 1.25rem 1.25rem;
  }

  .zt-back h3 {
    font-size: 1.1rem;
  }

  .zt-back-intro {
    font-size: 0.8rem;
  }

  /* Touch flip for Zoho tiles */
  .zt-card.zt-flipped .zt-card-inner {
    transform: rotateY(180deg);
  }
}

@media (max-width: 374px) {
  .zoho-tiles-grid {
    grid-auto-columns: 100% !important;
  }

  .zt-slider-shell {
    padding: 0 2rem;
  }
}

/* =============================================
   22. MAINFRAME SERVICE PAGE
   ============================================= */

@media (max-width: 767px) {
  .mf-path-btns {
    gap: 0.5rem;
  }

  .mf-path-btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.88rem;
    min-height: 44px;
  }

  .mf-path-panel-bg {
    padding: 1.25rem 1rem;
    border-radius: 14px;
  }

  .mf-path-headline {
    font-size: clamp(1.2rem, 5vw, 1.6rem);
  }

  .mf-path-body {
    font-size: 0.93rem;
  }

  .mf-layer-summary {
    padding: 0.85rem 1rem;
    gap: 0.75rem;
    min-height: 52px;
  }

  .mf-layer-body {
    padding-left: 2.5rem;
  }

  .mf-eng-cards {
    grid-template-columns: 1fr;
    border-radius: 12px;
  }

  .mf-eng-card {
    border-right: none !important;
    border-bottom: 1px solid var(--accent-gray) !important;
  }

  .mf-eng-card:last-child {
    border-bottom: none !important;
  }
}

/* =============================================
   23. SAP SERVICE PAGE
   ============================================= */

@media (max-width: 767px) {
  .sap-hub-cards-equal {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .sap-product-card {
    min-height: 260px;
  }

  .sap-pillar-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }

  .sap-pillar-left {
    position: static !important;
  }

  .sap-pillar-number {
    font-size: 3.5rem;
  }

  .sap-stat-cards {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
    max-width: 100%;
  }

  .sap-bento-grid {
    grid-template-columns: 1fr !important;
  }

  .sap-bento-wide-left,
  .sap-bento-wide-right {
    grid-column: 1 !important;
  }

  .three-sap-capabilities-layout {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }

  .sap-quote-card {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
    padding: 1.5rem;
  }

  .sap-nodes {
    flex-direction: column;
    gap: 0.5rem;
  }

  .sap-node-connector {
    width: 1px;
    height: 2rem;
    background: linear-gradient(to bottom, var(--accent-gray), var(--accent-blue), var(--accent-gray));
  }
}

/* =============================================
   24. CUSTOM DEVELOPMENT PAGE
   ============================================= */

@media (max-width: 767px) {
  .cd-steps {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }

  .cd-step::after {
    display: none !important;
  }

  .cd-tile {
    padding: 1.5rem;
    border-radius: 20px;
  }

  .gc-grid {
    grid-template-columns: 1fr !important;
  }

  .hwe-cards {
    flex-direction: column !important;
  }

  .hwe-card {
    border-right: 1px solid #e2e8f0 !important;
    border-bottom: none !important;
    border-radius: 0 !important;
    min-height: auto !important;
  }

  .hwe-card:first-child {
    border-radius: 14px 14px 0 0 !important;
  }

  .hwe-card:last-child {
    border-radius: 0 0 14px 14px !important;
    border-bottom: 1px solid #e2e8f0 !important;
  }

  .hwe-card--active {
    flex: none !important;
  }
}

@media (max-width: 1100px) {
  .cd-steps {
    grid-template-columns: repeat(3, 1fr);
  }

  .cd-step:nth-child(3)::after,
  .cd-step:nth-child(5)::after {
    display: none;
  }
}

/* =============================================
   25. ABOUT PAGE
   ============================================= */

@media (max-width: 900px) {
  .about-hero-copy,
  .about-split,
  .about-value-row,
  .about-founder {
    grid-template-columns: 1fr !important;
  }

  .about-section-heading {
    position: static !important;
  }

  .about-founder-copy {
    padding-left: 0 !important;
    padding-top: 1.25rem;
    border-left: none !important;
    border-top: 3px solid var(--accent-blue);
  }
}

@media (max-width: 767px) {
  .about-section {
    padding: 2rem 0;
  }

  .about-hero-emphasis {
    font-size: clamp(1.05rem, 4vw, 1.35rem);
  }

  .about-focus-list span {
    font-size: 0.82rem;
    padding: 0.38rem 0.75rem;
  }

  .about-tiles-list .premium-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
  }

  .about-tiles-list .premium-card .card-icon-container {
    margin-bottom: 0;
  }
}

/* =============================================
   26. CONTACT PAGE
   ============================================= */

@media (max-width: 767px) {
  .contact-info-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .contact-form-layout {
    grid-template-columns: 1fr !important;
    gap: 2rem;
  }

  .form-row {
    grid-template-columns: 1fr !important;
  }

  .premium-form-container {
    padding: 1.5rem 1.25rem;
    border-radius: 16px;
  }

  .input-group input,
  .input-group textarea {
    font-size: 16px !important; /* Prevent iOS zoom */
  }

  .form-submit-btn {
    min-height: 52px;
    font-size: 1rem;
  }
}

/* =============================================
   27. INDUSTRIES PAGE
   ============================================= */

@media (max-width: 1023px) {
  .industry-card-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.25rem;
  }
}

@media (max-width: 639px) {
  .industry-card-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .industry-card-img {
    height: 180px;
  }
}

/* =============================================
   28. PRODUCT SHOWCASE CARDS
   ============================================= */

@media (max-width: 767px) {
  .ps-product-card {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "media"
      "body" !important;
  }

  .ps-card-media {
    min-height: 200px;
    aspect-ratio: 16 / 10;
  }

  .ps-card-body {
    justify-content: flex-start;
    padding: 1.25rem;
  }

  .ps-card-body h3 {
    font-size: 1.3rem;
  }
}

/* =============================================
   29. SOLUTION TILES (Full-width)
   ============================================= */

@media (max-width: 767px) {
  .solution-tiles-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }

  .solution-tile {
    border-radius: 20px;
  }

  .tile-image {
    height: 200px;
  }

  .tile-content {
    padding: 1.4rem;
  }
}

/* =============================================
   30. ZOHO SERVICE — MARQUEE & ONE-LAYOUT
   ============================================= */

@media (max-width: 767px) {
  .zs-one-layout {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }

  .zs-one-image-col {
    flex-direction: row;
    justify-content: flex-start;
  }

  .zs-one-logo-compact {
    width: 80px;
    height: 80px;
  }
}

/* =============================================
   31. SC (CUSTOM CONSULTING) PAGE
   ============================================= */

@media (max-width: 1023px) {
  .sc-who-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .sc-engage-tiles {
    grid-template-columns: 1fr !important;
  }

  .sc-why-text {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }

  .sc-service-body-inner {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
    padding-left: 0 !important;
  }
}

@media (max-width: 767px) {
  .sc-who-grid {
    grid-template-columns: 1fr !important;
  }

  .sc-service-summary-inner {
    grid-template-columns: 40px 1fr 30px;
    gap: 0.85rem;
  }

  .sc-service-summary {
    padding: 1.25rem 0;
  }

  .sc-case-study {
    padding: 1.75rem 1.5rem;
  }

  .sc-who-card {
    padding: 1.5rem;
  }
}

/* =============================================
   32. HERO TILES (Home subline)
   ============================================= */

@media (max-width: 767px) {
  .hero-tiles {
    gap: 0.4rem;
    justify-content: center;
  }

  .hero-tile {
    font-size: 0.78rem;
    padding: 0.38rem 0.8rem;
  }
}

@media (max-width: 374px) {
  .hero-tile {
    font-size: 0.72rem;
    padding: 0.32rem 0.65rem;
  }
}

/* =============================================
   33. STAT GRID / SPLIT LAYOUT
   ============================================= */

@media (max-width: 767px) {
  .stat-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .split-layout {
    grid-template-columns: 1fr !important;
    gap: 2rem;
  }

  .fix-steps {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .solutions-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }

  .solution-card {
    flex-direction: column;
    min-height: auto;
  }

  .sol-image {
    flex: 0 0 auto;
    max-width: 100%;
    height: 200px;
  }

  .sol-content {
    padding: 1.5rem;
  }
}

/* =============================================
   34. CTA TILE GRID
   ============================================= */

@media (max-width: 1023px) {
  .cta-tile-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 767px) {
  .cta-tile-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
}

/* =============================================
   35. PRIVACY POLICY / SIMPLE CONTENT PAGES
   ============================================= */

@media (max-width: 767px) {
  .privacy-hero {
    padding-bottom: 1.5rem;
  }

  .privacy-policy-content {
    max-width: 100%;
  }

  .privacy-policy-content h2 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.5rem;
  }
}

/* =============================================
   36. PERFORMANCE: Disable GSAP cursor on touch
   ============================================= */

@media (hover: none) and (pointer: coarse) {
  .cursor-glow {
    display: none !important;
  }
}

/* =============================================
   37. OVERFLOW GUARD — Last line of defense
   ============================================= */

@media (max-width: 1023px) {
  /* Ensure nothing bleeds outside viewport */
  .home-hero,
  .home-main-hero,
  .home-hero-content,
  .marquee-container,
  .hero-stat-strip,
  .comparison-container,
  .hs-sub,
  .section-testimonials,
  .site-footer {
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Tables should scroll horizontally, not break layout */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
}

/* =============================================
   38. LANDSCAPE ORIENTATION — Phone Fixes
   ============================================= */

@media (max-height: 500px) and (orientation: landscape) {
  :root {
    --navbar-h: 56px;
  }

  .home-main-hero {
    min-height: 100dvh;
  }

  .home-hero-content {
    min-height: 100dvh;
    --home-hero-gap: 0.65rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .home-hero-line-strong {
    font-size: clamp(1.5rem, 5vw, 2rem);
  }

  .home-hero-line-muted {
    font-size: clamp(1.1rem, 4vw, 1.5rem);
  }

  .hero-stat-strip {
    /* Ensure horizontal in landscape too */
    flex-direction: row !important;
    flex-wrap: nowrap;
    gap: 0.5rem;
    max-width: 100%;
  }

  .hero-stat-divider {
    width: 1px;
    height: 30px;
  }

  .hero-interrupt-logo {
    width: clamp(80px, 15vw, 120px);
  }
}

/* =============================================
   39. TABLET PORTRAIT — 768px-1023px
   ============================================= */

@media (min-width: 768px) and (max-width: 1023px) {
  .container {
    padding: 0 3%;
  }

  .hs-service-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metrics-row {
    grid-template-columns: repeat(3, 1fr);
  }

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

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

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "brand brand"
      "company approach"
      "services services"
      "action action";
  }

  .indicator-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .hs-sub .indicator-card {
    height: 180px;
  }

  /* Testimonials: 2 visible on tablets */
  .testimonial-card {
    flex: 0 0 calc((100% - 1.5rem) / 2);
  }
}

/* =============================================
   40. LARGE TABLETS (iPad Pro, etc.) — 1024px
   ============================================= */

@media (min-width: 1024px) and (max-width: 1279px) {
  .container {
    padding: 0 4.5%;
  }

  .hs-split {
    gap: clamp(2rem, 4vw, 4rem);
  }

  .footer-grid {
    grid-template-columns: minmax(260px, 1.2fr) repeat(3, minmax(120px, 0.7fr));
  }

  /* Testimonials: 2 per slide on 1024 */
  .testimonial-card {
    flex: 0 0 calc((100% - 1.5rem) / 2);
  }
}

/* =============================================
   41. TOUCH DEVICE — Hover State Overrides
   ============================================= */

/* Remove hover transforms on touch to prevent sticky states */
@media (hover: none) {
  .btn:hover,
  .hs-service-card:hover,
  .indicator-card:hover,
  .logo-tile:hover,
  .premium-card:hover,
  .solution-card:hover,
  .industry-card:hover,
  .cta-tile:hover,
  .solution-tile:hover {
    transform: none !important;
    box-shadow: initial;
  }

  /* Keep border-color changes on touch for visual feedback */
  .hs-service-card:active {
    border-color: var(--accent-blue);
    box-shadow: 0 8px 24px rgba(0, 102, 204, 0.12);
  }

  /* Button press feedback on touch */
  .btn:active {
    transform: scale(0.97) !important;
    opacity: 0.92;
  }

  /* Flip cards: tap to flip on touch devices */
  .hs-sub .indicator-card:hover .card-inner {
    transform: none !important;
  }
}

/* =============================================
   42. FOCUS STYLES — Accessibility
   ============================================= */

@media (max-width: 1023px) {
  /* Better focus rings for touch+keyboard hybrid devices */
  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  textarea:focus-visible,
  select:focus-visible,
  [tabindex]:focus-visible {
    outline: 3px solid var(--accent-blue);
    outline-offset: 3px;
    border-radius: 4px;
  }
}

/* =============================================
   43. PRINT — Don't break layout on print
   ============================================= */

@media print {
  nav, .sticky-talk, .cursor-glow, #page-loader, .hero-interrupt {
    display: none !important;
  }

  body {
    padding-top: 0;
  }

  .container {
    max-width: 100%;
    padding: 0 1rem;
  }
}
