/* Mobile refinements for the original static TeachX screens. */
@media (max-width: 767px) {
  /* Keep the document element as the single vertical scroll owner on phones.
     `overflow-x:hidden` on body creates a nested scroll container in mobile
     browsers and can make touch scrolling feel stuck inside the iframe. */
  html, body { max-width: 100%; overflow-x: clip !important; }
  html { overflow-y: auto !important; overscroll-behavior-y: auto !important; }
  body { overflow-y: visible !important; overscroll-behavior-y: auto !important; -webkit-overflow-scrolling: touch; }
  body { font-size: 15px !important; line-height: 1.55 !important; }
  header { width: 100% !important; position: static !important; }
  .privacy-guarantee-banner, .privacy-sidebar { position: static !important; top: auto !important; z-index: auto !important; }
  header > div:first-child { padding: 5px 12px !important; }
  header > div:first-child .max-w-7xl { gap: 4px !important; font-size: 11px !important; line-height: 1.3 !important; }
  header > div:first-child .max-w-7xl > div:last-child { gap: 9px !important; }
  header > div:first-child .max-w-7xl > div:last-child > div { display: none !important; }
  header > div:nth-child(2) { height: 56px !important; min-height: 56px !important; padding: 0 12px !important; gap: 8px !important; position: relative !important; }
  header > div:nth-child(2) > div:first-child { gap: 7px !important; }
  header > div:nth-child(2) > div:first-child img { max-width: 46px !important; max-height: 34px !important; }
  header > div:nth-child(2) > div:first-child span:first-child { font-size: 16px !important; line-height: 1.1 !important; }
  header > div:nth-child(2) > div:first-child span:last-child { font-size: 8px !important; letter-spacing: .08em !important; }
  header > div:nth-child(2) > nav { display: none !important; position: absolute !important; left: 10px !important; right: 10px !important; top: calc(100% - 1px) !important; z-index: 60 !important; padding: 10px !important; background: #fff !important; border: 1px solid #e1e7f0 !important; border-radius: 0 0 12px 12px !important; box-shadow: 0 12px 24px #10263820 !important; }
  header > div:nth-child(2) > nav.teachx-mobile-open { display: flex !important; flex-direction: column !important; align-items: stretch !important; gap: 2px !important; }
  header > div:nth-child(2) > nav a { display: block !important; padding: 10px 12px !important; font-size: 14px !important; }
  header > div:nth-child(2) > div:last-child { gap: 6px !important; }
  header > div:nth-child(2) > div:last-child > a:first-child { display: none !important; }
  header > div:nth-child(2) > div:last-child > a[data-path="find-a-tutor"] { padding: 9px 11px !important; min-height: 40px !important; font-size: 12px !important; white-space: nowrap !important; }
  .teachx-mobile-toggle { display: inline-flex !important; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid #dbe2eb; border-radius: 9px; background: #fff; color: #102638; font-size: 21px; line-height: 1; }
  main { padding-top: 0 !important; }
  main h1 { font-size: clamp(28px, 7.8vw, 36px) !important; line-height: 1.14 !important; letter-spacing: -.035em !important; overflow-wrap: anywhere !important; }
  main h2 { font-size: clamp(21px, 5.8vw, 26px) !important; line-height: 1.22 !important; letter-spacing: -.025em !important; }
  main h3 { font-size: clamp(18px, 5vw, 22px) !important; line-height: 1.3 !important; }
  main p, main li { font-size: 15px !important; line-height: 1.55 !important; }
  main .text-headline-xl, main .text-headline-xl-mobile { font-size: clamp(28px, 7.8vw, 36px) !important; line-height: 1.14 !important; }
  main .text-headline-lg, main .text-headline-lg-mobile { font-size: clamp(21px, 5.8vw, 26px) !important; line-height: 1.22 !important; }
  main .grid-cols-3, main .grid-cols-4 { grid-template-columns: minmax(0, 1fr) !important; }
  #registration-portal .grid.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  #registration-portal [id^="step-tab-"] { justify-content: center !important; padding-bottom: 4px !important; }
  main .gap-gutter { gap: 16px !important; }
  main .px-margin { padding-left: 16px !important; padding-right: 16px !important; }
  main a[class*="px-"], main button[class*="px-"] { max-width: 100%; }
  main img { max-width: 100%; height: auto; }
  main section { scroll-margin-top: 100px; }
  footer .grid-cols-4, footer .grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  footer h2, footer h3 { font-size: 15px !important; line-height: 1.3 !important; }
  footer p, footer a { font-size: 12px !important; line-height: 1.5 !important; overflow-wrap: anywhere; }
}

/* Turn the wide comparison matrix into readable stacked cards on phones. */
@media (max-width: 767px) {
  .comparison-table { width: 100%; overflow: visible !important; }
  .comparison-card { width: 100%; min-width: 0 !important; border-radius: 14px; }
  .comparison-header { display: none !important; }
  .comparison-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 9px !important;
    padding: 14px !important;
    border-bottom: 1px solid #e4e9f1;
    background: #fff !important;
  }
  .comparison-row > div { grid-column: 1 !important; width: 100%; min-width: 0; }
  .comparison-row > div:first-child { padding: 2px 1px 5px; }
  .comparison-row > div:first-child p:first-child { margin-bottom: 2px; font-size: 16px !important; line-height: 1.3 !important; }
  .comparison-row > div:first-child p:last-child { margin: 0; font-size: 12px !important; line-height: 1.4 !important; }
  .comparison-row > div:nth-child(2),
  .comparison-row > div:nth-child(3) {
    position: relative;
    align-items: flex-start !important;
    padding: 34px 11px 11px !important;
    border-radius: 9px;
    font-size: 13px !important;
    line-height: 1.45 !important;
    overflow-wrap: anywhere;
  }
  .comparison-row > div:nth-child(2) { background: #f4f6fa; }
  .comparison-row > div:nth-child(3) { background: #e8f7f4 !important; }
  .comparison-row > div:nth-child(2)::before,
  .comparison-row > div:nth-child(3)::before {
    position: absolute;
    top: 8px;
    left: 11px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    line-height: 1.2;
    text-transform: uppercase;
  }
  .comparison-row > div:nth-child(2)::before { content: 'Traditional local bureaus'; color: #5d6876; }
  .comparison-row > div:nth-child(3)::before { content: 'TeachX Consultancy'; color: #08766f; }
}

@media (max-width: 380px) {
  header > div:first-child .max-w-7xl { font-size: 10px !important; }
  header > div:nth-child(2) { padding-inline: 9px !important; }
  header > div:nth-child(2) > div:first-child img { max-width: 38px !important; }
  header > div:nth-child(2) > div:last-child > a[data-path="find-a-tutor"] { padding-inline: 8px !important; font-size: 11px !important; }
  main .grid-cols-2 { grid-template-columns: minmax(0, 1fr) !important; }
}
#section-5, #section-6, a[href="#section-5"], a[href="#section-6"] { display: none !important; }

/* Compact, balanced homepage metrics and parent feedback cards. */
#stats-strip .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#stats-strip .stats-grid > div { min-width: 0; }
.reviews-section .reviews-grid { max-width: 900px; margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: 10px; }
.reviews-section .review-card { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 15px 18px; border: 1px solid #e1e7f0; border-radius: 14px; background: #fff; box-shadow: 0 5px 18px rgb(16 38 56 / 6%); }
.reviews-section .review-avatar { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: #d9f4f0; color: #08766f; font-weight: 700; font-size: 13px; }
.reviews-section .review-content { min-width: 0; display: grid; grid-template-columns: minmax(150px, .32fr) minmax(0, 1fr); align-items: center; gap: 4px 18px; }
.reviews-section .review-meta { display: flex; flex-direction: column; gap: 2px; }
.reviews-section .review-meta strong { color: #102638; font-size: 14px; }
.reviews-section .review-meta small { color: #64748b; font-size: 12px; }
.reviews-section .review-content p { margin: 0; color: #34475a; font-size: 14px; line-height: 1.5; }
.reviews-section .review-stars { color: #087e78; letter-spacing: 2px; font-size: 14px; white-space: nowrap; }
@media (max-width: 767px) {
  #stats-strip { padding-top: 20px !important; padding-bottom: 20px !important; }
  #stats-strip .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  #stats-strip .stats-grid > div { min-height: 120px; justify-content: center; padding: 12px 8px !important; border: 1px solid rgb(157 243 228 / 16%); border-radius: 12px; background: rgb(255 255 255 / 4%); text-align: center !important; }
  #stats-strip .stats-grid > div > div { justify-content: center; }
  #stats-strip [data-counter] { font-size: 27px !important; line-height: 1.1 !important; }
  #stats-strip .material-symbols-outlined { font-size: 21px !important; }
  #stats-strip .font-label-lg { font-size: 13px !important; line-height: 1.25 !important; }
  #stats-strip .font-body-sm { font-size: 11px !important; line-height: 1.35 !important; }
  .reviews-section .reviews-grid { gap: 9px; }
  .reviews-section .review-card { grid-template-columns: 38px minmax(0, 1fr); gap: 10px; padding: 12px; }
  .reviews-section .review-avatar { width: 38px; height: 38px; font-size: 11px; }
  .reviews-section .review-content { grid-template-columns: 1fr; gap: 5px; }
  .reviews-section .review-content p { grid-row: 1; font-size: 13px !important; line-height: 1.45 !important; }
  .reviews-section .review-meta { grid-row: 2; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
  .reviews-section .review-meta strong { font-size: 12px; }
  .reviews-section .review-meta small { font-size: 11px; }
  .reviews-section .review-stars { grid-column: 2; justify-self: start; font-size: 12px; letter-spacing: 1px; }
}
@media (max-width: 380px) {
  #stats-strip .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
