/* ======================================================
   RESPONSIVE BREAKPOINTS
   Tablet (1024) → Mobile (768) → Small (480)
   ====================================================== */

/* ========== TABLET — 1024px ========== */
@media (max-width: 1024px) {
  .hero__inner {
    grid-template-columns: 1fr;
    gap: var(--space-10);
  }

  .hero__content {
    max-width: 100%;
    text-align: center;
  }

  .hero__subtitle {
    margin-left: auto;
    margin-right: auto;
  }

  .hero__ctas {
    justify-content: center;
  }

  .hero__trust {
    justify-content: center;
  }

  .hero__trust-row {
    justify-content: center;
  }

  .hero__visual--road {
    max-width: 320px;
    margin: 0 auto;
    min-height: auto;
  }

  .hero__focal {
    width: 160px;
    height: 160px;
  }

  .hero__focal-core {
    width: 95px;
    height: 95px;
  }

  .hero__live-stats {
    justify-content: center;
  }

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

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

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

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

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

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

  .results__grid .result-card:nth-child(2) {
    border-right: none;
  }

  .results__grid .result-card:nth-child(-n+2) {
    border-bottom: 1px solid var(--color-border-subtle);
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

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

/* ========== MOBILE — 768px ========== */
@media (max-width: 768px) {
  :root {
    --container-padding: var(--space-5);
  }

  .section {
    padding: var(--space-12) 0;
  }

  .hero {
    padding: 100px 0 60px;
    min-height: auto;
  }

  .hero__title {
    font-size: 2rem;
  }

  .hero__visual--road {
    min-height: auto;
    padding-top: var(--space-8);
  }

  .hero__focal {
    width: 140px;
    height: 140px;
  }

  .hero__focal-core {
    width: 85px;
    height: 85px;
  }

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

  .hero__focal-label {
    font-size: 9px;
  }

  .hero__focal-glow {
    width: 200px;
    height: 200px;
  }

  .hero__live-stats {
    flex-wrap: wrap;
    gap: var(--space-4);
  }

  .hero__live-stat {
    border-right: none;
    padding: 0 var(--space-3);
  }

  .hero__badge {
    font-size: 11px;
  }

  .hero__trust-row {
    justify-content: center;
    gap: var(--space-4);
  }

  .hero__trust-item {
    font-size: 11px;
  }

  /* Mobile nav */
  .nav__toggle {
    display: flex;
  }

  .nav__menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 320px;
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    padding: 80px var(--space-6) var(--space-6);
    transform: translateX(100%);
    transition: transform 300ms var(--ease-out);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);
    z-index: var(--z-overlay);
  }

  .nav__menu.active {
    transform: translateX(0);
  }

  .nav__list {
    flex-direction: column;
    gap: 0;
  }

  .nav__link {
    padding: 12px 0;
    font-size: 15px;
    color: var(--color-text-heading);
    border-bottom: 1px solid var(--color-border-subtle);
  }

  .nav__link:hover {
    background: none;
  }

  .nav__item--has-dropdown .nav__dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 0 0 0 var(--space-4);
    background: none;
    display: none;
  }

  .nav__item--has-dropdown.open .nav__dropdown {
    display: block;
  }

  .nav__dropdown-link {
    padding: 8px 0;
    font-size: 13px;
    border-radius: 0;
  }

  .nav__dropdown-link:hover {
    background: none;
  }

  .nav__actions {
    margin-left: 0;
    margin-top: var(--space-6);
    flex-direction: column;
  }

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

  /* Grids */
  .services__grid,
  .industries__grid,
  .why__grid,
  .testimonials__grid {
    grid-template-columns: 1fr;
  }

  .process__list {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

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

  .results__grid .result-card {
    border-right: none !important;
  }

  .trust-strip__logo {
    width: 108px;
    height: 60px;
    padding: 10px 14px;
  }

  .footer__nav {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
  }

  .footer__bottom {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }

  .final-cta__title {
    font-size: var(--text-2xl);
  }
}

/* ========== SMALL MOBILE — 480px ========== */
@media (max-width: 480px) {
  :root {
    --container-padding: var(--space-4);
  }

  .hero__title {
    font-size: 1.75rem;
  }

  .hero__ctas {
    flex-direction: column;
  }

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

  .hero__trust {
    flex-direction: column;
    gap: var(--space-3);
  }

  .results__grid {
    grid-template-columns: 1fr;
  }

  .footer__nav {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .section__title {
    font-size: var(--text-2xl);
  }
}

/* ======================================================
   MOBILE POLISH PASS — global safety net
   ====================================================== */

/* Prevent any rogue element from causing horizontal scroll */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}
img, svg, video, canvas { max-width: 100%; height: auto; }
canvas.hero__bg-canvas { height: 100%; } /* hero canvas keeps its own height */

/* Touch-friendly controls (WCAG 2.5.5 / Apple 44pt minimum) */
@media (hover: none) and (pointer: coarse) {
  .btn, .nav__toggle, .nav__link, .btn--sm,
  .pmark__chip, button, [role="button"] { min-height: 44px; }
  .btn--sm { padding: 10px 16px; }
  /* Disable pure-hover effects on touch */
  .pmark:hover { transform: none; }
  .plogo:hover, .why-card:hover, .service-card:hover,
  .industry-card:hover, .testimonial-card:hover { transform: none; }
}

/* iOS-safe form inputs (≥16px prevents zoom on focus) */
input[type="text"], input[type="email"], input[type="tel"],
input[type="url"], input[type="search"], input[type="number"],
input[type="password"], select, textarea {
  font-size: 16px;
}

/* ===== Tablet (≤900px) ===== */
@media (max-width: 900px) {
  :root { --container-padding: var(--space-5); }
  .container { padding-left: var(--container-padding); padding-right: var(--container-padding); }
  .section__title, .platforms__title, .why-section h2,
  .testimonials-section h2, .final-cta__title {
    font-size: clamp(1.5rem, 5vw, 2rem);
    line-height: 1.2;
  }
  .section__subtitle, .platforms__sub { font-size: 15px; }
}

/* ===== Phone (≤640px) — tighter spacing & typography ===== */
@media (max-width: 640px) {
  :root {
    --container-padding: 18px;
    --space-20: 56px;
    --space-16: 44px;
    --space-12: 36px;
  }
  .section, section { padding-top: var(--space-12); padding-bottom: var(--space-12); }

  /* Hero — kill the 72px grid pattern + noise overlay (those are the faint horizontal/vertical lines on mobile) */
  .hero::before, .hero::after { display: none; }
  /* Tame the blurred orbs so they don't bleed past the viewport */
  .hero__orb--blue { width: 320px; height: 320px; right: -80px; top: -60px; }
  .hero__orb--orange { width: 260px; height: 260px; left: -60px; bottom: -40px; }
  /* Canvas should never trap taps on mobile */
  .hero__bg-canvas { pointer-events: none; }

  /* Hero — taller breathing room, single-column */
  .hero { padding: 96px 0 48px; min-height: auto; }
  .hero__title { font-size: clamp(1.75rem, 8vw, 2.25rem); line-height: 1.15; letter-spacing: -0.02em; }
  .hero__subtitle { font-size: 15px; line-height: 1.55; }
  .hero__badge { font-size: 11px; padding: 6px 12px; }
  .hero__ctas { flex-direction: column; gap: 10px; width: 100%; }
  .hero__ctas .btn { width: 100%; justify-content: center; }
  .hero__visual--road, .hero__focal { display: none; } /* declutter mobile hero */
  .hero__inner { gap: var(--space-6); }

  /* Buttons */
  .btn { padding: 12px 20px; font-size: 14px; }
  .btn--lg { padding: 14px 24px; font-size: 15px; }

  /* Stat strips & meta rows */
  .platforms__row { padding: 22px 0; }
  .platforms__row-marks { gap: 10px 14px; }
  .pmark { font-size: 13px; gap: 7px; }
  .pmark__chip, .pmark__logo { width: 22px; height: 22px; flex-basis: 22px; }
  .pmark__chip { font-size: 10px; border-radius: 6px; }
  .platforms__meta { font-size: 13px; }
  .platforms__meta-stats { gap: 8px 12px; }

  /* Cards & grids */
  .services__grid, .industries__grid, .why__grid,
  .testimonials__grid, .results__grid, .case-studies__grid,
  .capabilities__grid, .values__grid, .bento { grid-template-columns: 1fr !important; }
  .why-card, .service-card, .industry-card, .result-card,
  .testimonial-card, .case-study-card { padding: 22px; }

  /* Process steps — vertical timeline feel */
  .process__list { grid-template-columns: 1fr; gap: 18px; }
  .process__step { padding: 18px 20px; }
  .process__step-number { width: 32px; height: 32px; font-size: 14px; }

  /* Trust strip — wrap and shrink logos */
  .trust__grid, .trust-strip__grid { grid-template-columns: repeat(2, 1fr) !important; gap: 0; }
  .trust__logo, .trust-strip__logo { height: 64px; padding: 8px 12px; }

  /* Forms */
  .form__row { grid-template-columns: 1fr; gap: 14px; }
  .form__field input, .form__field textarea, .form__field select { padding: 12px 14px; }
  .form__label { font-size: 13px; }

  /* Footer */
  .footer { padding: 48px 0 24px; }
  .footer__grid { gap: var(--space-6); }
  .footer__nav { grid-template-columns: 1fr 1fr; gap: var(--space-5); }
  .footer__col h4 { font-size: 13px; margin-bottom: 12px; }
  .footer__col a, .footer__col li { font-size: 13px; }
  .footer__bottom { flex-direction: column; align-items: flex-start; gap: 12px; text-align: left; }

  /* Page hero (subpages) */
  .page-hero { padding: 96px 0 56px; }
  .page-hero__title { font-size: clamp(1.65rem, 7vw, 2.25rem); line-height: 1.18; }
  .page-hero__subtitle { font-size: 15px; }

  /* Final CTA */
  .final-cta { padding: 56px 20px; }
  .final-cta__title { font-size: clamp(1.5rem, 6vw, 2rem); }
  .final-cta__ctas { flex-direction: column; gap: 10px; }
  .final-cta__ctas .btn { width: 100%; justify-content: center; }

  /* Tables / comparison rows stack */
  .compare__row, .compare__head { grid-template-columns: 1fr !important; }

  /* FAQ — comfortable tap targets */
  .faq__question, details > summary { padding: 16px 18px; font-size: 15px; }
  .faq__answer, details[open] > div { padding: 0 18px 16px; font-size: 14px; }
}

/* ===== Tiny phones (≤380px) — extra defensive ===== */
@media (max-width: 380px) {
  :root { --container-padding: 14px; }
  .hero__title { font-size: 1.55rem; }
  .section__title, .page-hero__title { font-size: 1.45rem; }
  .nav__logo .logo-text { font-size: 14px; }
  .pmark__name { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
  .platforms__row-marks { gap: 8px 10px; }
}

/* ===== Mobile polish — footer & case-studies tap-target / overflow fixes ===== */
@media (max-width: 768px) {
  /* WCAG 2.5.5 — give footer legal links a real tap target */
  .footer__legal {
    flex-wrap: wrap;
    gap: 4px 12px;
  }
  .footer__legal a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 4px;
    font-size: 13px;
  }
}

/* Case-studies filter row — wrap & scroll horizontally if needed,
   never push the page wider than the viewport on small phones. */
@media (max-width: 720px) {
  .cs-grid__header,
  .cs-grid__heading,
  .section__header--split { min-width: 0; }
  .cs-grid__heading,
  .cs-grid__lede,
  .section__title { max-width: 100%; }
  .cs-filter {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .cs-filter::-webkit-scrollbar { display: none; }
  .cs-filter__btn {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 36px;
  }
}

/* ===== Landscape phones — keep hero compact ===== */
@media (max-height: 520px) and (orientation: landscape) {
  .hero { min-height: auto; padding: 88px 0 40px; }
  .hero__visual--road, .hero__focal { display: none; }
}