@media (max-width: 900px) {
  .header {
    width: min(calc(100% - 20px), calc(var(--max-width) + 20px));
    border-radius: 28px;
    padding: 14px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .brand {
    max-width: calc(100% - 64px);
  }

  .menu-toggle {
    display: inline-grid;
    place-items: center;
  }

  .nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 8px;
  }

  .nav.active {
    display: flex;
  }

  .nav a {
    width: 100%;
    text-align: center;
    background: rgba(255, 255, 255, 0.08);
  }

  .header-actions {
    margin-left: auto;
  }

  .hero,
  .teacher-card,
  .contact-main {
    grid-template-columns: 1fr;
  }

  .teacher-card {
    align-items: start;
  }

  .teacher-card img {
    height: auto;
    max-height: none;
  }

  .contact-form-box .section-title,
  .contact-info-box .section-title,
  .section-shell > .section-title {
    text-align: left;
  }

  .hero-highlights,
  .stats-row,
  .teacher-stats,
  .field-row,
  .feature-grid,
  .why-grid,
  .about-grid {
    grid-template-columns: 1fr;
  }

  .hero-badge,
  .floating-note {
    position: static;
    margin-top: 14px;
  }

  .hero {
    padding-top: 22px;
  }

  .hero-visual::before,
  .hero-visual::after {
    display: none;
  }

  .hero-copy,
  .section-title {
    gap: 16px;
  }

  .hero h1,
  .section-title h1 {
    font-size: clamp(2.25rem, 12vw, 3.4rem);
  }

  .section-title h2 {
    font-size: clamp(1.75rem, 9vw, 2.55rem);
  }

  .hero-image-frame img {
    aspect-ratio: 4 / 3.6;
  }

  .header .btn.nav-btn {
    display: none;
  }
}

@media (max-width: 640px) {
  section {
    width: min(calc(100% - 22px), var(--max-width));
    padding: 34px 0;
  }

  .header {
    top: 8px;
    align-items: center;
  }

  .brand-mark {
    width: 50px;
    height: 50px;
    border-radius: 14px;
  }

  .brand-text span {
    display: none;
  }

  .brand-text strong {
    font-size: 0.95rem;
    line-height: 1.15;
  }

  .hero-card,
  .panel,
  .contact-form-box,
  .contact-info-box,
  .teacher-card,
  .cta,
  .card,
  .why-card,
  .course-card,
  .about-card {
    padding: 22px;
  }

  .btn,
  .btn-outline {
    width: 100%;
    min-height: 46px;
  }

  .hero-btns {
    flex-direction: column;
  }

  .contact-btn {
    align-items: flex-start;
    flex-direction: column;
  }

  .contact-btn > span {
    text-align: left;
  }

  .map iframe {
    min-height: 280px;
  }

  .whatsapp-float {
    width: 54px;
    height: 54px;
    right: 14px;
    bottom: 14px;
  }

  .whatsapp-float svg {
    width: 29px;
    height: 29px;
  }
}

@media (max-width: 420px) {
  .header {
    width: calc(100% - 14px);
    padding: 10px;
    border-radius: 22px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
  }

  .menu-toggle {
    width: 42px;
    height: 42px;
  }

  .hero-chip,
  .metric,
  .teacher-stats > div {
    padding: 14px;
  }

  .section-shell::after,
  .cta::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-visual::before,
  .hero-visual::after,
  .section-shell::after,
  .cta::after,
  .whatsapp-float {
    animation: none !important;
  }
}

/* Whole-site mobile alignment and speed pass */
@media (max-width: 900px), (hover: none) {
  body {
    overflow-x: hidden;
  }

  .site-wrap,
  .hero-card,
  .panel,
  .section-shell,
  .teacher-card,
  .contact-form-box,
  .contact-info-box,
  .card,
  .why-card,
  .about-card,
  .course-card,
  .cta {
    perspective: none;
    transform-style: flat;
  }

  .header,
  .section-shell,
  .panel,
  .hero-card,
  .teacher-card,
  .contact-form-box,
  .contact-info-box,
  .card,
  .why-card,
  .course-card,
  .about-card,
  .footer,
  .hero-chip,
  .stat-chip,
  .metric,
  .teacher-stats > div,
  .hero-badge,
  .floating-note,
  .contact-btn {
    backdrop-filter: none;
    box-shadow: var(--shadow-soft);
  }

  .hero-image-frame,
  .hero-badge,
  .floating-note,
  .whatsapp-float,
  .hero-visual::before,
  .hero-visual::after,
  .section-shell::after,
  .cta::after {
    animation: none;
  }

  .card:hover,
  .why-card:hover,
  .about-card:hover,
  .course-card:hover,
  .contact-btn:hover,
  .btn:hover,
  .btn:focus-visible,
  .btn-outline:hover,
  .btn-outline:focus-visible {
    transform: none;
  }

  .card::after,
  .why-card::after,
  .about-card::after,
  .course-card::after {
    display: none;
  }
}

@media (max-width: 640px) {
  .header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .header-actions {
    margin-left: 0;
  }

  .nav {
    grid-column: 1 / -1;
  }

  .brand,
  .brand-text,
  .section-title,
  .hero-copy,
  .card,
  .why-card,
  .about-card,
  .course-card,
  .panel,
  .contact-btn {
    min-width: 0;
  }

  .section-title h1,
  .section-title h2,
  .hero h1,
  .cta h2,
  .card h3,
  .why-card h3,
  .about-card h3,
  .course-card h3,
  .panel h3,
  .brand-text strong {
    overflow-wrap: anywhere;
  }

  .course-actions,
  .hero-btns,
  .section-actions {
    width: 100%;
  }

  .course-actions .btn,
  .course-actions .btn-outline,
  .section-actions .btn,
  .section-actions .btn-outline {
    width: 100%;
  }

  .gallery-modal-panel,
  .course-modal-panel {
    width: 100%;
  }
}

/* Gallery alignment */
.gallery-grid {
  align-items: stretch;
}

.gallery-card {
  height: 100%;
}

.gallery-card img {
  aspect-ratio: 4 / 3;
  height: auto;
}

.gallery-card-body {
  grid-template-rows: 1fr auto;
  height: 100%;
}

.gallery-card-body h3 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@media (min-width: 761px) {
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 521px) and (max-width: 760px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Production responsive polish */
html,
body {
  max-width: 100%;
}

body {
  overflow-x: clip;
}

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

.header,
section,
.footer,
.hero-card,
.section-shell,
.panel,
.cta,
.course-modal-panel,
.gallery-modal-panel {
  min-width: 0;
}

.nav {
  overflow: hidden;
}

.nav.active {
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.nav a {
  min-height: 44px;
}

.hero,
.contact-main,
.teacher-card,
.course-grid,
.gallery-grid,
.feature-grid,
.why-grid,
.about-grid,
.stats-row,
.hero-highlights,
.teacher-stats {
  min-width: 0;
}

.hero-image-frame,
.hero-gallery-slider,
.course-card,
.gallery-card {
  contain: layout paint;
}

.hero-image-frame img,
#heroGalleryImage {
  width: 100%;
  height: auto;
  min-height: 0;
  object-fit: cover;
}

.course-card-image,
.gallery-card img {
  width: 100%;
  object-fit: cover;
  object-position: center;
  background: var(--secondary-soft);
}

.course-card-body,
.gallery-card-body {
  min-width: 0;
}

.course-price-row,
.course-actions,
.hero-btns,
.contact-actions {
  min-width: 0;
}

.btn,
.btn-outline,
.contact-btn,
.course-actions a,
.course-actions button {
  min-width: 0;
  white-space: normal;
  text-align: center;
}

.map iframe,
.youtube iframe,
.preview-frame,
.video-frame {
  display: block;
  width: 100%;
  border: 0;
}

.course-modal,
.gallery-modal {
  align-items: center;
  justify-items: center;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.course-modal-panel,
.gallery-modal-panel {
  width: min(100%, 960px);
  max-height: calc(100dvh - 28px);
  overscroll-behavior: contain;
}

.course-modal-close,
.gallery-modal-close {
  position: sticky;
  top: 12px;
  margin-left: auto;
}

@media (max-width: 900px) {
  section {
    width: min(calc(100% - 24px), var(--max-width));
  }

  .header {
    align-items: center;
  }

  .hero {
    gap: 18px;
  }

  .hero-card,
  .section-shell,
  .panel,
  .contact-form-box,
  .contact-info-box,
  .teacher-card,
  .card,
  .why-card,
  .course-card,
  .about-card,
  .cta {
    border-radius: 20px;
  }

  .course-modal-panel,
  .gallery-modal-panel {
    grid-template-columns: 1fr;
  }

  .course-modal-panel img,
  .gallery-modal-panel img {
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: 42dvh;
    aspect-ratio: 16 / 10;
  }
}

@media (max-width: 640px) {
  section {
    width: min(calc(100% - 18px), var(--max-width));
    padding: 28px 0;
  }

  .header {
    top: 6px;
    width: calc(100% - 12px);
    gap: 8px;
    border-radius: 18px;
  }

  .brand-text strong {
    font-size: 0.9rem;
  }

  .nav {
    gap: 6px;
  }

  .nav a {
    padding: 11px 12px;
    text-align: left;
  }

  .hero-card,
  .section-shell,
  .panel,
  .contact-form-box,
  .contact-info-box,
  .teacher-card,
  .card,
  .why-card,
  .course-card,
  .about-card,
  .cta {
    padding: 18px;
    border-radius: 18px;
  }

  .hero h1,
  .section-title h1 {
    font-size: clamp(2rem, 11vw, 3rem);
    line-height: 1.06;
  }

  .section-title h2,
  .cta h2 {
    font-size: clamp(1.55rem, 8vw, 2.25rem);
  }

  .section-title p,
  .hero p,
  .lead,
  .mission p,
  .card p,
  .why-card p,
  .about-card p,
  .course-card p,
  .panel p {
    font-size: 0.96rem;
    line-height: 1.65;
  }

  .hero-image-frame {
    padding: 10px;
    border-radius: 20px;
  }

  .hero-image-frame img,
  #heroGalleryImage {
    border-radius: 16px;
    aspect-ratio: 4 / 3;
  }

  .course-card-image,
  .gallery-card img {
    aspect-ratio: 4 / 3;
  }

  .course-card-body,
  .gallery-card-body {
    padding: 18px;
  }

  .course-modal,
  .gallery-modal {
    padding: 8px;
  }

  .course-modal-panel,
  .gallery-modal-panel {
    max-height: calc(100dvh - 16px);
    border-radius: 16px;
  }

  .course-modal-copy,
  .gallery-modal-copy {
    padding: 18px;
  }

  .course-modal-close,
  .gallery-modal-close {
    width: 40px;
    height: 40px;
  }

  .footer {
    width: calc(100% - 18px);
    margin-bottom: 18px;
    border-radius: 18px;
  }
}
