/* Tree-Plenish — mobile-only fixes. All rules are inside max-width media queries. */

@media (max-width: 1023px) {
  html {
    overflow-x: clip;
  }

  body {
    overflow-x: clip;
    max-width: 100%;
  }

  /* Interior pages: show hamburger + Donate (site.css hid .nav-end below 1024px) */
  .nav-main {
    display: none !important;
  }

  .nav-end {
    display: flex !important;
    flex: 1;
    justify-content: flex-end;
    align-items: center;
    min-width: 0;
    padding-right: 0.5rem;
    gap: 0.35rem;
  }

  .nav-secondary,
  .nav-search-btn {
    display: none !important;
  }

  .nav-toggle {
    display: flex !important;
    flex-shrink: 0;
  }

  .nav-bar {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .logo-block {
    flex-shrink: 1;
    min-width: 0;
    max-width: 58%;
    padding: 0 0.75rem 0 0.65rem;
  }

  .logo-block__text {
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(0.88rem, 3.6vw, 1.05rem);
  }

  .nav-donate {
    flex-shrink: 0;
    padding: 0.55rem 0.8rem;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
  }

  .site-header {
    width: 100%;
    max-width: 100vw;
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
  }

  .mobile-drawer {
    z-index: 1250;
    padding-top: calc(4.75rem + env(safe-area-inset-top, 0px));
    padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
    padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(2rem, env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
  }

  .search-overlay {
    z-index: 1220;
    padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
  }

  .search-overlay__row {
    flex-wrap: nowrap;
  }

  .search-overlay__close {
    flex-shrink: 0;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .footer {
    padding-left: clamp(1rem, 4vw, 1.5rem);
    padding-right: clamp(1rem, 4vw, 1.5rem);
  }

  .footer__bar {
    padding-left: 1rem;
    padding-right: 1rem;
    word-break: break-word;
  }

  iframe,
  video,
  embed {
    max-width: 100%;
  }
}

@media (max-width: 767px) {
  /* Homepage sections */
  .hero {
    align-items: center;
    padding-top: clamp(5.5rem, 14vh, 6.5rem);
    padding-bottom: clamp(5rem, 22vh, 9rem);
    padding-left: clamp(1rem, 4vw, 1.5rem);
    padding-right: clamp(1rem, 4vw, 1.5rem);
  }

  .hero__content {
    max-width: 100%;
    width: 100%;
  }

  .hero__headline {
    max-width: 100%;
    text-wrap: balance;
  }

  .hero__actions {
    width: 100%;
    max-width: 100%;
  }

  .hero-cta {
    white-space: normal;
    text-align: center;
  }

  .what-we-do,
  .stats,
  .process,
  .our-students,
  .quote,
  .cta-banner,
  .feature__text,
  .feature__visual {
    padding-left: clamp(1rem, 4vw, 1.5rem);
    padding-right: clamp(1rem, 4vw, 1.5rem);
  }

  .what-we-do__inner,
  .stats__inner {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .stats__grid {
    width: 100%;
    max-width: 100%;
    gap: 0.85rem;
  }

  .stat-item {
    min-width: 0;
    padding: 1rem 0.5rem;
  }

  .stat-item__num {
    font-size: clamp(1.65rem, 6.5vw, 2.35rem);
  }

  .what-we-do__video-shell,
  .what-we-do__video-frame {
    width: 100%;
    max-width: 100%;
  }

  .process-tabs {
    width: 100%;
    max-width: 100%;
    border-radius: 14px;
  }

  .process-tabs__btn {
    font-size: 0.62rem;
    padding: 0.62rem 0.35rem;
    letter-spacing: 0.04em;
  }

  .process__course-panel,
  .process-track,
  .process-card {
    max-width: 100%;
    min-width: 0;
  }

  .process-card__thumb {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .students-carousel,
  .students-carousel__shell {
    max-width: 100%;
    width: 100%;
  }

  .students-carousel__shell {
    gap: 0.25rem;
    padding: 0;
  }

  .students-carousel__btn {
    width: 2.35rem;
    height: 2.35rem;
    flex-shrink: 0;
  }

  .cta-banner__inner {
    padding-left: clamp(1rem, 4vw, 1.5rem);
    padding-right: clamp(1rem, 4vw, 1.5rem);
  }

  /* Host an event */
  .page-hero {
    padding-left: clamp(1rem, 4vw, 1.5rem);
    padding-right: clamp(1rem, 4vw, 1.5rem);
  }

  .host-intro__inner,
  .host-modules__inner,
  .host-faq__inner,
  .host-cta-band__inner,
  .host-video-block__inner {
    padding-left: clamp(1rem, 4vw, 1.5rem);
    padding-right: clamp(1rem, 4vw, 1.5rem);
  }

  .host-intro__card,
  .host-module-card {
    max-width: 100%;
    min-width: 0;
  }

  .host-btn,
  .host-btn--xl {
    max-width: 100%;
    white-space: normal;
    text-align: center;
  }

  .host-faq__cta {
    flex-direction: column;
    align-items: stretch;
  }

  .host-faq__cta .host-btn {
    width: 100%;
    justify-content: center;
  }

  /* Our mission */
  .mission-stats__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    max-width: 100%;
  }

  .mission-stat {
    min-width: 0;
    padding: 1.25rem 0.85rem;
  }

  .mission-stat__num {
    font-size: clamp(1.45rem, 5.5vw, 1.85rem);
  }

  .mission-narrative__grid,
  .mission-timeline,
  .mission-seasons__grid {
    min-width: 0;
  }

  /* Our team */
  .team-grid--members,
  .team-grid--tech,
  .team-grid--education,
  .team-grid--directors {
    min-width: 0;
  }

  .team-person {
    min-width: 0;
  }

  .team-partners__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  /* Contact */
  .contact-cards__grid,
  .contact-form__row {
    min-width: 0;
  }

  .contact-card {
    min-width: 0;
  }

  /* Donate */
  .donate-hero__layout {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .donate-hero__widget,
  .donate-hero__widget iframe {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* Find an event */
  .find-hero {
    padding-left: clamp(1rem, 4vw, 1.5rem);
    padding-right: clamp(1rem, 4vw, 1.5rem);
  }

  .find-panel__inner {
    max-width: 100%;
  }

  /* Join us */
  .join-content__inner,
  .join-roles__item {
    min-width: 0;
  }
}

@media (max-width: 400px) {
  .nav-donate {
    padding: 0.5rem 0.55rem;
    font-size: 0.62rem;
  }

  .logo-block {
    max-width: 52%;
  }

  .process-tabs__btn {
    flex: 1 1 100%;
  }

  .hero__actions {
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  .mission-stats__grid {
    grid-template-columns: 1fr;
    max-width: 20rem;
    margin: 0 auto;
  }
}
