/* =========================================================
   PrepLingo mobile safety layer
   Added after page CSS so every standalone page stays usable
   on phones, even though pages were designed separately.
   ========================================================= */

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

img,
video {
  height: auto;
}

iframe {
  border: 0;
}

table {
  width: 100%;
  max-width: 100%;
  display: block;
  overflow-x: auto;
}

h1,
h2,
h3,
h4,
p,
a,
span,
li,
strong,
small {
  overflow-wrap: break-word;
}

/* Keep embedded data-image logos/cards from forcing horizontal scroll. */
.brand img,
.brand-logo,
.hero img,
.hero-card img,
.hero-photo-card img,
.footer-brand img {
  max-width: 100%;
  height: auto;
}

@media (max-width: 980px) {
  .container,
  .about-container,
  .footer-container,
  .pl-seo-cluster .pl-seo-wrap {
    width: min(100% - 28px, 1180px) !important;
  }

  .header-container,
  .header-wrap,
  .header-row,
  .header {
    min-height: auto !important;
    gap: 12px !important;
  }

  .header-wrap,
  .header-row,
  .header {
    flex-wrap: wrap !important;
  }

  .brand,
  .brand a {
    min-width: 0 !important;
  }

  .brand img,
  .brand-logo {
    width: min(132px, 42vw) !important;
    max-width: 132px !important;
  }

  /* Pages with the advanced header already have a proper mobile panel. */
  .header-container .nav-area {
    display: none !important;
  }

  .header-container .mobile-toggle {
    display: block !important;
    flex: 0 0 auto !important;
  }

  .mobile-panel.open {
    display: block !important;
  }

  .mobile-courses,
  .dropdown-grid,
  .pl-seo-links {
    grid-template-columns: 1fr !important;
  }

  /* Pages with the simpler header had the nav hidden on mobile;
     show it as swipeable chips instead of losing navigation. */
  .site-header .nav {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 8px !important;
    padding: 4px 0 8px !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .site-header .nav::-webkit-scrollbar {
    display: none;
  }

  .site-header .nav a,
  .site-header .nav button {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    font-size: 13px !important;
    padding: 9px 12px !important;
  }

  .header-btn,
  .header-btn.btn,
  .btn,
  .demo-btn,
  .btn-primary,
  .btn-secondary,
  .header-actions a {
    white-space: nowrap;
  }

  .hero-grid,
  .about-hero-grid,
  .contact-hero-grid,
  .contact-grid,
  .terms-grid,
  .footer-grid,
  .testimonials-shell,
  .intro-grid,
  .two-col,
  .score-showcase,
  .cta-box,
  .result-card,
  .hero-proof,
  .quick-strip,
  .quick-facts,
  .facts,
  .facts-grid,
  .focus-grid,
  .inside-grid,
  .benefit-grid,
  .skills-grid,
  .skill-grid,
  .result-grid,
  .cards-grid,
  .modules-grid,
  .task-grid,
  .journey-grid,
  .path-grid,
  .compare-grid,
  .course-grid,
  .courses-grid,
  .service-grid,
  .faq-layout,
  .reports-grid,
  .story-grid,
  .value-grid,
  .map-grid,
  .office-grid,
  .form-grid,
  .newsletter-row,
  .footer-main-grid {
    grid-template-columns: 1fr !important;
  }

  .hero,
  .about-hero,
  .contact-hero,
  .terms-hero,
  .section,
  .section-pad,
  .testimonials-section,
  .intro-section,
  .focus-section,
  .choose-section,
  .skills-section,
  .journey-section,
  .modules-section,
  .path-section,
  .compare-section,
  .exam-section,
  .problems-section,
  .why-section,
  .task-section,
  .result-section,
  .pl-seo-cluster {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .dropdown-menu {
    max-width: calc(100vw - 28px) !important;
  }
}

@media (max-width: 760px) {
  .container,
  .about-container,
  .footer-container,
  .pl-seo-cluster .pl-seo-wrap {
    width: min(100% - 24px, 760px) !important;
  }

  h1 {
    font-size: clamp(34px, 10vw, 46px) !important;
    line-height: 1.04 !important;
  }

  h2,
  .section-head h2,
  .section-title h2,
  .cta-panel h2,
  .cta h2 {
    font-size: clamp(27px, 8vw, 38px) !important;
    line-height: 1.12 !important;
  }

  h3 {
    font-size: clamp(21px, 6vw, 30px) !important;
    line-height: 1.18 !important;
  }

  p,
  li {
    font-size: 14.5px;
  }

  .hero,
  .about-hero,
  .contact-hero,
  .terms-hero {
    padding-top: 42px !important;
    padding-bottom: 52px !important;
  }

  .section,
  .section-pad,
  .testimonials-section,
  .intro-section,
  .focus-section,
  .choose-section,
  .skills-section,
  .journey-section,
  .modules-section,
  .path-section,
  .compare-section,
  .exam-section,
  .problems-section,
  .why-section,
  .task-section,
  .result-section,
  .pl-seo-cluster {
    padding-top: 46px !important;
    padding-bottom: 46px !important;
  }

  .card,
  .course-card,
  .stat-box,
  .fact-card,
  .module-card,
  .skill-card,
  .benefit-card,
  .result-card,
  .review-card,
  .testimonial-slide,
  .left-story-panel,
  .slider-panel,
  .reports-panel,
  .cta-panel,
  .cta-box,
  .dark-board,
  .big-copy,
  .pl-seo-cluster .pl-seo-wrap {
    border-radius: 24px !important;
    padding: 22px 18px !important;
  }

  .btn-row,
  .hero-actions,
  .cta-actions,
  .button-row,
  .actions,
  .header-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  .btn-row a,
  .hero-actions a,
  .cta-actions a,
  .button-row a,
  .actions a {
    flex: 1 1 220px !important;
    justify-content: center !important;
    text-align: center !important;
  }

  /* Convert decorative floating elements into normal flow on very small screens
     so text and score badges do not overlap. */
  .floating-stars,
  .floating-note,
  .floating-card,
  .floating-proof,
  .floating-proof-label,
  .hero-badge,
  .score-badge,
  .mini-card,
  .mock-card,
  .proof-card {
    max-width: 100% !important;
  }

  .mobile-panel {
    width: min(100% - 24px, 760px) !important;
  }

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

  .footer-grid {
    gap: 24px !important;
  }
}

@media (max-width: 520px) {
  .container,
  .about-container,
  .footer-container,
  .pl-seo-cluster .pl-seo-wrap {
    width: min(100% - 20px, 520px) !important;
  }

  .site-header .nav a,
  .site-header .nav button {
    font-size: 12.5px !important;
    padding: 8px 11px !important;
  }

  .header-btn,
  .btn,
  .demo-btn,
  .btn-primary,
  .btn-secondary {
    min-height: 42px !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
  }

  .brand img,
  .brand-logo {
    width: min(122px, 46vw) !important;
  }

  .hero,
  .about-hero,
  .contact-hero,
  .terms-hero {
    padding-top: 34px !important;
    padding-bottom: 44px !important;
  }

  .section,
  .section-pad,
  .testimonials-section,
  .intro-section,
  .focus-section,
  .choose-section,
  .skills-section,
  .journey-section,
  .modules-section,
  .path-section,
  .compare-section,
  .exam-section,
  .problems-section,
  .why-section,
  .task-section,
  .result-section,
  .pl-seo-cluster {
    padding-top: 38px !important;
    padding-bottom: 38px !important;
  }

  .hero-proof,
  .quick-strip,
  .quick-facts,
  .facts,
  .facts-grid,
  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  .pl-seo-links a {
    padding: 13px 14px !important;
  }
}

@media (max-width: 640px) {
  body * {
    max-width: 100%;
  }

  body *::before,
  body *::after {
    max-width: 100vw !important;
  }

  .score-card,
  .duo-score-card,
  .duo-lesson-card,
  .duo-speak-card,
  .lecture-card,
  .speaking-card,
  .writing-card,
  .format-pill,
  .mission-card,
  .visual-card,
  .phone-card,
  .result-card,
  .hero-card {
    width: auto !important;
    max-width: calc(100vw - 24px) !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .hero-visual,
  .toefl-visual,
  .pte-visual,
  .ielts-visual,
  .duo-panel,
  .mission-board,
  .phone-mockup,
  .globe-inner,
  .stage-bg {
    max-width: calc(100vw - 24px) !important;
    overflow: hidden;
  }
}
