/* Clasoom Mobile Responsive Fix
   Mobile-only overrides. Desktop/base design remains unchanged.
*/

@media (max-width: 900px) {
  html, body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .container {
    width: 92%;
    max-width: 100%;
  }

  /* Mobile navigation: full menu remains scrollable so Login is always reachable. */
  .nav.open {
    display: flex !important;
    position: fixed !important;
    top: 122px !important;
    left: 4% !important;
    right: 4% !important;
    width: auto !important;
    max-height: calc(100vh - 132px) !important;
    max-height: calc(100dvh - 132px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    flex-direction: column;
    align-items: stretch;
    padding: 18px !important;
    z-index: 200 !important;
  }

  .nav.open a,
  .nav.open .login-btn,
  .nav.open .user-menu {
    flex: 0 0 auto;
  }

  .nav.open .login-btn {
    width: 100% !important;
    margin-top: 4px;
  }

  .nav.open .user-menu {
    display: block !important;
    width: 100%;
  }

  .nav.open .user-menu[hidden] {
    display: none !important;
  }

  /* Prevent long hero text from overflowing the phone screen. */
  .hero,
  .hero-copy,
  .hero-grid,
  .section,
  .section-head,
  .page-hero {
    max-width: 100%;
    min-width: 0;
  }

  .hero-grid,
  .why-grid,
  .about-card,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy h1,
  .hero h1 {
    font-size: clamp(34px, 10vw, 44px) !important;
    line-height: 1.08 !important;
    letter-spacing: -1.4px !important;
    overflow-wrap: normal;
    word-break: normal;
  }

  .hero-copy p,
  .hero p,
  .page-hero p,
  .section-head p {
    font-size: 16px;
    line-height: 1.55;
    max-width: 100%;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .hero-card {
    max-width: 100%;
    margin: auto;
  }

  .screen {
    width: 100%;
    max-width: 450px;
  }

  .class-grid,
  .extra-grid,
  .feature-grid,
  .teachers {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 560px) {
  .brand img {
    width: 165px;
    max-width: 60vw;
  }

  .nav.open {
    top: 122px !important;
    left: 3% !important;
    right: 3% !important;
    max-height: calc(100vh - 130px) !important;
    max-height: calc(100dvh - 130px) !important;
    padding: 15px !important;
  }

  .hero {
    padding: 48px 0 58px;
  }

  .hero-copy h1,
  .hero h1 {
    font-size: clamp(32px, 9.5vw, 40px) !important;
    line-height: 1.08 !important;
    letter-spacing: -1.2px !important;
  }

  .hero-copy p,
  .hero p {
    font-size: 15px;
  }

  .class-grid,
  .extra-grid,
  .feature-grid,
  .teachers {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 58px 0;
  }

  .page-hero h1 {
    font-size: 38px !important;
    line-height: 1.1 !important;
  }

  .footer-wrap {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .top-banner {
    font-size: 9px;
  }

  /* Keep horizontally-oriented stat rows inside the viewport. */
  .trust-row {
    flex-wrap: wrap;
    gap: 20px;
  }
}
