/* ==========================================================================
   Responsive overrides (desktop-first, loaded after main.css)
   1180 — tighten nav     1080 — mobile nav, stack hero
   900  — tablet layouts   640 — phones          400 — small phones
   ========================================================================== */

@media (max-width: 1180px) {
  .header-inner { gap: 1.25rem; }
  .nav-link { padding-inline: .6rem; }
  .nav-link::after { left: .6rem; right: .6rem; }
  .nav-login { display: none; }
  .course-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-top { grid-template-columns: 1.4fr repeat(3, 1fr); }
  .footer-contact { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem; }
  .footer-contact h2 { flex-basis: 100%; }
  .tutor-rates { grid-template-columns: 1fr auto; }
  .tr-list { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
}

/* Mobile navigation --------------------------------------------------------- */
@media (max-width: 1080px) {
  :root { --header-h: 68px; }
  .site-header.is-scrolled { --header-h: 62px; }
  .brand img, .is-scrolled .brand img { width: 132px; }
  .brand { position: relative; z-index: 2; }
  .topbar-links li:not(.topbar-social) { display: none; }

  .menu-toggle { display: grid; position: relative; z-index: 2; }

  .site-nav {
    position: fixed; inset: 0; z-index: 1;
    flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0;
    padding: calc(var(--header-h) + 1.75rem) var(--gutter) 2rem;
    background: var(--paper);
    overflow-y: auto; overscroll-behavior: contain;
    visibility: hidden; opacity: 0;
    clip-path: circle(0 at calc(100% - 46px) 34px);
    transition: clip-path .6s var(--ease-out), opacity .3s, visibility 0s .6s;
  }
  .nav-open .site-nav {
    visibility: visible; opacity: 1;
    clip-path: circle(150% at calc(100% - 46px) 34px);
    transition: clip-path .6s var(--ease-out), opacity .2s, visibility 0s;
  }
  .nav-open { overflow: hidden; }
  /* backdrop-filter would become the containing block for the fixed panel */
  .nav-open .site-header { background: var(--paper); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }

  .nav-list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav-item { border-bottom: 1px solid var(--line); }
  .nav-link {
    width: 100%; justify-content: space-between;
    padding: 1.05rem .25rem;
    font-family: var(--font-display); font-size: 1.45rem; font-weight: 600; letter-spacing: -.02em;
  }
  .nav-link::after { display: none; }

  .nav-open .nav-item { animation: nav-in .5s var(--ease-out) both; }
  .nav-open .nav-item:nth-child(2) { animation-delay: .04s; }
  .nav-open .nav-item:nth-child(3) { animation-delay: .08s; }
  .nav-open .nav-item:nth-child(4) { animation-delay: .12s; }
  .nav-open .nav-item:nth-child(5) { animation-delay: .16s; }
  .nav-open .nav-item:nth-child(6) { animation-delay: .2s; }

  .submenu, .submenu-wide {
    position: static; min-width: 0;
    padding: 0; border: 0; box-shadow: none; background: none;
    opacity: 1; visibility: visible; transform: none;
    display: none;
  }
  .submenu::before { display: none; }
  .nav-trigger[aria-expanded="true"] + .submenu { display: block; padding-bottom: .75rem; }
  .submenu a { padding: .6rem .25rem; }

  .nav-actions { flex-direction: column; align-items: stretch; gap: .75rem; margin-top: 2rem; }
  .nav-login { display: inline-flex; justify-content: center; min-height: 52px; border: 1.5px solid var(--line-strong); border-radius: var(--r-pill); }
  .nav-actions .btn { min-height: 54px; font-size: 1.05rem; }

  /* Hero stacks */
  .hero-inner { grid-template-columns: 1fr; }
  .hero-copy { max-width: 680px; }
  .hero-media { max-width: 540px; }
}

/* Method: five cards get too narrow below 1080px, so switch to a vertical
   timeline (the connector line turns vertical and fills top to bottom) */
@media (max-width: 1080px) {
  .method-track { max-width: 680px; margin-inline: auto; }
  .method-line {
    left: 38px; right: auto; top: 40px; bottom: 40px; width: 4px; height: auto;
    background: repeating-linear-gradient(180deg, var(--line-strong) 0 8px, transparent 8px 16px);
  }
  .method-line span { height: 100%; transform-origin: top; background: linear-gradient(180deg, #0A6E9B, #109FDA 50%, #ED812E); }
  .steps { grid-template-columns: 1fr; gap: 1rem; }
  .step {
    display: grid; grid-template-columns: 80px 1fr; column-gap: 1.25rem; align-items: center;
    margin-top: 0; padding: 0; text-align: left;
    background: none; border: 0;
  }
  .step:hover { transform: none; box-shadow: none; }
  .step::before, .step::after { display: none; }
  .step-node { grid-row: span 3; margin-top: 0; align-self: start; }
  .step-num, .step h3, .step p { grid-column: 2; }
  .step-num { margin-top: .4rem; }
  .step p { margin-bottom: .5rem; }
}

@keyframes nav-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Tablet -------------------------------------------------------------------- */
@media (max-width: 900px) {
  .section-head-split { flex-direction: column; align-items: flex-start; }

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

  .about-inner { grid-template-columns: 1fr; }
  .about-media { margin-inline: auto; }

  .stats-list { grid-template-columns: repeat(2, 1fr); row-gap: 1.5rem; }
  .stats-list li:nth-child(3) { border-left: 0; }


  .brooke-inner { grid-template-columns: 1fr; }
  .brooke-media { max-width: 420px; }

  .player-wrap { grid-template-columns: 1fr; }
  .playlist ul { grid-template-columns: repeat(2, 1fr); }

  .price-grid { grid-template-columns: 1fr; max-width: 520px; margin-inline: auto; }
  .price-featured, .price-featured:hover { transform: none; }
  .price-featured { order: -1; }
  .tutor-rates { grid-template-columns: 1fr; }
  .tr-list { grid-row: auto; }

  .carousel-track { grid-auto-columns: calc((100% - 1.25rem) / 2); }

  .faq-inner { grid-template-columns: 1fr; }
  .faq-aside { position: static; }

  .blog-grid { grid-template-columns: repeat(2, 1fr); }
  .post-feature { grid-column: 1 / -1; }

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

  .newsletter { grid-template-columns: auto 1fr; }
  .newsletter .btn { grid-column: 1 / -1; justify-self: start; }

  .footer-top { grid-template-columns: repeat(3, 1fr); }
  .footer-brand { grid-column: 1 / -1; }
}

/* Phones -------------------------------------------------------------------- */
@media (max-width: 640px) {
  .topbar-promo { font-size: .78rem; gap: .4rem; }
  .topbar-badge, .topbar-links { display: none; }
  .topbar-inner { justify-content: center; text-align: center; }

  .hero-ctas { flex-direction: column; align-items: stretch; }
  .hero-ctas .btn { width: 100%; }
  .btn-video { justify-content: center; }
  .hero-points { gap: .5rem 1rem; }

  /* Keep the composition, scale chips down */
  .hm-chip { padding: .5rem .7rem .5rem .5rem; gap: .5rem; }
  .hm-chip strong { font-size: .85rem; }
  .hm-chip small { font-size: .68rem; }
  .hm-chip-icon { width: 32px; height: 32px; border-radius: 10px; }
  /* Keep the face clear: the lede already says "perfect scorer", the YouTube
     chip sits on the top edge and the course card drops below the circle */
  .hero-media { margin-bottom: 9%; }
  .hm-chip-score { display: none; }
  .hm-chip-yt { right: -1%; top: 1%; }
  .hm-course { width: 74%; right: 0; bottom: -9%; gap: .6rem; padding: .55rem; }
  .hm-course-meta { display: none; }
  .hm-math { width: 36px; height: 36px; font-size: .95rem; border-radius: 11px; }
  .hm-math-b, .hm-math-c { display: none; }

  .cat-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .cat-card { padding: 1.2rem 1rem; }
  .cat-card p { display: none; }
  .cat-card h3 { font-size: .98rem; margin-top: .9rem; }
  .cat-icon { width: 48px; height: 48px; border-radius: 14px; }
  .cat-go { width: 30px; height: 30px; right: .75rem; top: .75rem; }

  .feature-grid { grid-template-columns: 1fr; }
  .am-seal { width: 26%; left: 30%; }

  .filter-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .filter-tab { padding-inline: .85rem; white-space: nowrap; }
  .course-grid { grid-template-columns: 1fr; }

  .stats-list li { padding-inline: .25rem; }

  .cred-list { grid-template-columns: 1fr; }
  .brooke-badge { right: -2%; }

  .playlist ul { grid-template-columns: 1fr; }
  .player-play { width: 68px; height: 68px; }
  .player-play .icon { width: 28px; height: 28px; }

  .pc-amount { font-size: 2.6rem; }
  .tr-list li { flex: 1 1 100%; }

  .carousel-track { grid-auto-columns: 88%; }

  .acc-btn { padding: .9rem 1rem .9rem 1.1rem; }
  .acc-inner > div { padding: 0 1.1rem 1.2rem; }

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

  .dual-card .btn { width: 100%; }

  .newsletter { grid-template-columns: 1fr; padding: 1.5rem; }
  .newsletter .btn { width: 100%; }

  .footer-top { grid-template-columns: repeat(2, 1fr); gap: 2rem 1.5rem; }
  .footer-contact { flex-direction: column; align-items: flex-start; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }

  .to-top { right: 1rem; bottom: 1rem; width: 46px; height: 46px; }
}

@media (max-width: 400px) {
  .hero-title { font-size: 2.3rem; }
  .cat-grid { grid-template-columns: 1fr; }
  .cat-card p { display: block; }
}

@media (min-width: 1600px) {
  :root { --container: 1320px; }
}
