/* Shared responsive rules — loaded on every page after the design-system styles.css.
   Grid containers get a class hook (rg-2 / rg-3 / rg-4 / footer-grid / services-dropdown)
   directly in their JSX; the desktop column layout stays inline (unchanged), and this
   file only overrides grid-template-columns + a few structural rules at narrower widths. */

/* Hard clamp: no horizontal-scroll strip (client logos, tools ticker, blog/portfolio
   carousels, testimonials tracks, etc.) can ever inflate the page's own scroll width. */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Tablet: 3- and 4-column grids drop to 2 columns. 2-column grids stay as authored. */
@media (max-width: 900px) {
  .rg-3, .rg-4, .rg-5, .footer-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Mobile: everything stacks to a single column. */
@media (max-width: 640px) {
  .rg-2, .rg-3, .rg-4, .rg-5, .footer-grid {
    grid-template-columns: 1fr !important;
  }
  .services-dropdown {
    grid-template-columns: 1fr !important;
    width: min(320px, 88vw) !important;
  }
}

/* Display type scales down so headlines don't overflow small screens. */
@media (max-width: 640px) {
  :root {
    --type-display-xl-size: 38px;
    --type-display-lg-size: 28px;
    --type-display-md-size: 22px;
    --type-body-lg-size: 16px;
  }
}

/* Reduce vertical gap between stacked sections site-wide. Sections are authored
   with inline "Npx 48px" padding (top/bottom often 70-100px) — this compresses
   just the vertical padding so consecutive sections sit closer together,
   leaving side padding and each section's own background/content untouched. */
section {
  padding-top: 40px !important;
  padding-bottom: 40px !important;
}

/* Single blog post: sidebar (TOC / related / tags) stacks below the article
   body on narrow viewports instead of squeezing into a slim column. */
@media (max-width: 860px) {
  .blog-post-layout {
    grid-template-columns: 1fr !important;
  }
  .blog-post-layout aside {
    position: static !important;
  }
}

/* Training page: FAQ + Enroll banner columns stack on narrow viewports. */
@media (max-width: 760px) {
  section > .rg-2 > div > img[alt="SEO training FAQ"],
  section > .rg-2 > div > img[alt="The Aryan Miya Mansoor team at work"] {
    max-height: 240px;
  }
}

/* Hero heading stays on one line at typical widths; wraps naturally on
   narrow phones instead of clipping or shrinking illegibly small. */
@media (max-width: 640px) {
  .hero-heading {
    white-space: normal !important;
    font-size: clamp(26px, 7vw, 34px) !important;
  }
}
@media (max-width: 640px) {
  section {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
}
.blog-scroll {
  scrollbar-width: thin;
}
@media (max-width: 640px) {
  .blog-scroll > a {
    flex-basis: 260px !important;
  }
}
@media (max-width: 640px) {
  .utility-bar-inner {
    justify-content: center !important;
  }
  .utility-bar-inner > div:first-child {
    justify-content: center !important;
    width: 100%;
    gap: 14px !important;
  }
  .utility-bar-location {
    display: none !important;
  }
  header {
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    padding: 8px 10px !important;
    gap: 8px !important;
  }
  header nav {
    flex-wrap: nowrap !important;
  }
  header + div,
  div:has(> header) {
    padding-top: 0 !important;
  }
  .nav-mobile-center {
    font-size: 10px !important;
    padding: 8px 10px !important;
    white-space: nowrap !important;
    flex: 1 1 auto !important;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .nav-mobile-dots {
    flex-shrink: 0 !important;
    gap: 6px !important;
  }
  .nav-mobile-flag {
    font-size: 16px !important;
    margin-right: 4px !important;
  }
}

/* Hero + training-hero floating tool chips: decorative on desktop, but they
   sit at negative/large % offsets that overflow and clutter narrow screens. */
@media (max-width: 640px) {
  .rank-dash-grid {
    direction: ltr !important;
  }
  .hero-photo-wrap [style*="position: absolute"] {
    padding: 6px 10px !important;
    gap: 5px !important;
  }
  .hero-photo-wrap [style*="position: absolute"] span {
    font-size: 10.5px !important;
  }
  .training-tool-chip {
    padding: 6px 10px !important;
    gap: 5px !important;
  }
  .training-tool-chip span {
    font-size: 10.5px !important;
  }
  .ai-seo-hero-float {
    padding: 12px 14px !important;
    width: 150px !important;
    right: -6px !important;
    left: -6px !important;
  }
  .nav-logo-img {
    height: 36px !important;
    width: 36px !important;
  }
}

/* Footer: center brand/social content, add breathing room and dividers
   between the stacked columns, and center the CTA bar + copyright line. */
@media (max-width: 640px) {
  .footer-cta-bar {
    flex-direction: column !important;
    text-align: center !important;
  }
  .footer-grid {
    gap: 36px !important;
    text-align: center !important;
  }
  .footer-col-brand {
    align-items: center !important;
  }
  .footer-col-brand > div:first-child {
    justify-content: center !important;
  }
  .footer-col-brand p {
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: justify !important;
  }
  .footer-col-brand > div:last-child {
    justify-content: center !important;
  }
  .footer-grid > div {
    padding-bottom: 24px !important;
    border-bottom: 1px solid var(--color-border-on-light);
  }
  .footer-grid > div:last-child {
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }
  .footer-grid > div:nth-child(2) {
    border-bottom: none !important;
    padding-bottom: 0 !important;
    margin-bottom: -18px;
  }
  .footer-grid > div:nth-child(3) > div:first-child {
    display: none !important;
  }
  .footer-grid a.footer-link {
    display: inline-block !important;
  }
  .footer-copyright {
    text-align: center !important;
  }
}

/* Hero: don't let global section-padding compression add extra top space
   above the already-tight mobile header. */
@media (max-width: 640px) {
  section[style*="background: #5D5590"] {
    padding-top: 0 !important;
  }
  section[style*="background: #5D5590"] .rg-2 {
    min-height: 0 !important;
  }
  section[style*="background: #5D5590"] .hero-photo-wrap {
    height: auto !important;
    min-height: 0 !important;
    align-items: flex-start !important;
  }
  section[style*="background: #5D5590"] .rg-2 > div:first-child {
    padding: 16px 0 24px !important;
  }
}
