:root {
  --responsive-gutter: clamp(1.25rem, 4vw, 3.5rem);
  --responsive-section: clamp(3.75rem, 6vw, 5.5rem);
}

body.subpage .page-header {
  padding: clamp(8rem, 11vw, 9.5rem) var(--responsive-gutter) clamp(4rem, 6vw, 5rem);
}
body.subpage .page-title {
  font-size: clamp(2.7rem, 5vw, 4.4rem);
  line-height: 1.12;
  text-wrap: balance;
  word-break: keep-all;
}
body.subpage .page-subtitle,
body.subpage .section-desc {
  font-size: clamp(1.05rem, .3vw + 1rem, 1.18rem);
  line-height: 1.7;
  font-weight: 400;
  text-wrap: pretty;
  word-break: keep-all;
}
body.subpage .content-section,
body.subpage .teachers-section {
  width: 100%;
  padding: var(--responsive-section) var(--responsive-gutter);
}
@media (min-width: 901px) {
  body.subpage .nav-links a { font-size: clamp(.9rem, .25vw + .82rem, 1rem); }
  body.subpage .nav-cta { font-size: .95rem !important; padding: .65rem 1.4rem; }
}
body.subpage .step-desc,
body.subpage .step-details-list li,
body.subpage .info-text,
body.subpage .faq-answer,
body.subpage .teacher-bio {
  font-size: clamp(.98rem, .2vw + .94rem, 1.06rem);
  line-height: 1.72;
  font-weight: 400;
}
body.subpage .teacher-major,
body.subpage .tag { font-size: .9rem; }
body.subpage .teacher-card { padding: clamp(1.8rem, 2.6vw, 2.5rem); }
body.subpage .cta-section {
  width: calc(100% - 3rem);
  max-width: 680px;
  margin: 4rem auto;
  padding: 3.75rem clamp(1.75rem, 4vw, 2.5rem);
}

/* How page: stepped typography and layout instead of one abrupt mobile switch */
body.how-page .content-section { max-width: 1120px; }
body.how-page .steps-container { margin-bottom: clamp(3.5rem, 6vw, 5rem); }
body.how-page .step-item {
  grid-template-columns: 92px minmax(0, 1fr);
  gap: clamp(1.75rem, 3vw, 2.75rem);
  margin-bottom: clamp(3rem, 5vw, 4.25rem);
}
body.how-page .step-number { width: 92px; height: 92px; font-size: 2.15rem; }
body.how-page .step-content { min-width: 0; padding-top: .55rem; }
body.how-page .step-title,
body.how-page .step-desc,
body.how-page .step-details-list li,
body.how-page .info-title,
body.how-page .info-text,
body.how-page .faq-question,
body.how-page .faq-answer,
body.how-page .cta-title,
body.how-page .cta-text {
  word-break: keep-all;
  overflow-wrap: break-word;
  text-wrap: pretty;
}
body.how-page .step-title { font-size: clamp(1.55rem, 1.3vw + 1.1rem, 1.9rem); line-height: 1.3; }
body.how-page .step-details { padding: clamp(1.4rem, 2.4vw, 1.8rem); }
body.how-page .step-details-list { display: grid; gap: .15rem; }
body.how-page .info-grid { gap: clamp(1.25rem, 2.5vw, 2rem); }
body.how-page .info-box { min-width: 0; padding: clamp(1.8rem, 3vw, 2.5rem); }
body.how-page .faq-section { padding: clamp(2rem, 4vw, 3rem); }
body.how-page .faq-item { padding: clamp(1.3rem, 2.5vw, 1.7rem) clamp(1.3rem, 3vw, 2rem); }
body.how-page footer {
  flex-wrap: wrap;
  gap: 1rem;
}
body.how-page .footer-info {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  align-items: flex-end;
}
body.how-page .footer-text { line-height: 1.55; }
body.how-page .footer-text a { color: inherit; }

/* User-controlled mobile teacher carousel */
.mobile-teacher-carousel {
  display: flex !important;
  width: auto !important;
  max-width: none !important;
  gap: 1rem !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding: .25rem 0 1rem !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.mobile-teacher-carousel.auto-teacher-carousel { scroll-snap-type: none; }
.mobile-teacher-carousel.auto-teacher-carousel > .teach-card,
.mobile-teacher-carousel.auto-teacher-carousel > .teacher-card { scroll-snap-align: none; }
.mobile-teacher-carousel::-webkit-scrollbar { display: none; }
.mobile-teacher-carousel > .teach-card,
.mobile-teacher-carousel > .teacher-card {
  flex: 0 0 min(78vw, 300px) !important;
  width: min(78vw, 300px) !important;
  scroll-snap-align: center;
  opacity: 1 !important;
  transform: none !important;
}
.teacher-carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  margin: .35rem auto 0;
}
.teacher-carousel-btn {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(74,144,226,.25);
  border-radius: 50%;
  background: #fff;
  color: #2E6DC2;
  font: 800 1.1rem/1 'Pretendard', sans-serif;
  cursor: pointer;
}
.teacher-carousel-btn:disabled { opacity: .35; cursor: default; }
.teacher-carousel-status {
  min-width: 48px;
  color: #6B7684;
  font-size: .9rem;
  font-weight: 700;
  text-align: center;
}

/* Application and trial flows */
body.form-page main { max-width: 700px; padding-inline: clamp(1.1rem, 4vw, 1.6rem); }
body.form-page .qcard { padding: clamp(1.6rem, 4vw, 2.2rem); }
body.form-page .qtitle { font-size: clamp(1.35rem, 2.8vw, 1.6rem); }
body.form-page .qsub {
  margin-bottom: 1.15rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -.01em;
}
body.form-page .tier-opt-desc,
body.form-page .tier-more,
body.form-page .duration-opt-desc,
body.form-page .field-label,
body.form-page .consent-detail { font-size: max(.88rem, 14px); }
body.form-page .history-edit,
body.form-page .trust-label { font-size: max(.9rem, 14px); }
body.form-page .tier-opt-badge { font-size: .875rem; }
body.form-page #freqToggle span { font-size: .8rem !important; }
body.form-page .teacher-match-copy small,
body.form-page .teacher-detail-meta { font-size: max(.78rem, 13px); }

/* Legal documents */
body.legal-page .wrap { max-width: 880px; padding: clamp(2.5rem, 6vw, 4.5rem) var(--responsive-gutter) 6rem; }
body.legal-page .doc-title { font-size: clamp(2rem, 4vw, 2.7rem); line-height: 1.2; }
body.legal-page .doc-meta,
body.legal-page .back-link { font-size: .95rem; }
body.legal-page .doc-card { padding: clamp(1.5rem, 4vw, 2.4rem); }
body.legal-page h2 { font-size: clamp(1.2rem, 2vw, 1.4rem); }
body.legal-page h3 { font-size: 1.08rem; }
body.legal-page p,
body.legal-page li { font-size: 1rem; line-height: 1.75; }
body.legal-page table { font-size: .92rem; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 1199px) and (min-width: 901px) {
  body.subpage .content-section,
  body.subpage .teachers-section { max-width: 1040px; }
  body.how-page .step-item { grid-template-columns: 82px minmax(0, 1fr); gap: 2rem; }
  body.how-page .step-number { width: 82px; height: 82px; font-size: 1.95rem; }
}

@media (max-width: 900px) {
  body.subpage .page-header { padding: 7.5rem var(--responsive-gutter) 4rem; }
  body.subpage .page-title { font-size: clamp(2.5rem, 8vw, 3.6rem); }
  body.subpage .step-item { grid-template-columns: 72px minmax(0, 1fr); gap: 1.25rem; }
  body.subpage .step-number { width: 72px; height: 72px; margin: 0; font-size: 1.8rem; }
  body.subpage .step-content { padding-top: .25rem; }
  body.subpage .teachers-grid:not(.mobile-teacher-carousel) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.how-page .content-section { max-width: 780px; }
  body.how-page .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.how-page .footer-info { align-items: center; }
  body.subpage .cta-section { margin: 3rem auto; }
}

@media (max-width: 699px) {
  body.how-page .info-grid { grid-template-columns: 1fr; }
  body.how-page .info-box { max-width: 560px; width: 100%; margin-inline: auto; }
  body.how-page .faq-title { font-size: clamp(1.65rem, 7vw, 2rem); margin-bottom: 2rem; }
  body.how-page .cta-title { font-size: clamp(1.65rem, 7vw, 2rem); }
}

@media (max-width: 599px) {
  :root { --responsive-gutter: 1.25rem; --responsive-section: 3.75rem; }
  body.subpage .page-header { padding: 7rem var(--responsive-gutter) 3.5rem; }
  body.subpage .page-title { font-size: clamp(2.25rem, 10vw, 2.8rem); }
  body.subpage .content-section,
  body.subpage .teachers-section { padding: var(--responsive-section) var(--responsive-gutter); }
  body.subpage .step-item { grid-template-columns: 54px minmax(0, 1fr); gap: 1rem; }
  body.subpage .step-number { width: 54px; height: 54px; font-size: 1.35rem; }
  body.subpage .step-title { font-size: 1.4rem; }
  body.subpage .step-details,
  body.subpage .info-box,
  body.subpage .faq-section { padding: 1.4rem; }
  body.subpage .cta-section {
    width: calc(100% - (var(--responsive-gutter) * 2));
    margin: 3rem auto;
    padding: 3.25rem 1.4rem;
  }
  body.form-page .topbar-inner,
  body.form-page .bottombar { padding-inline: 1rem; }
  body.form-page .teacher-match-list { grid-template-columns: 1fr; }
  body.form-page .teacher-match-card { padding: .9rem; }
  body.form-page .teacher-match-photo.compact { width: 58px; height: 58px; }
  body.form-page .teacher-match-detail { padding: 1rem; }
  body.legal-page .doc-card { border-radius: 1rem; }
  body.legal-page table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  body.how-page .step-item { align-items: start; margin-bottom: 3rem; }
  body.how-page .step-content { padding-top: .15rem; }
  body.how-page .step-desc { margin-bottom: 1.2rem; }
  body.how-page .faq-item { margin-bottom: .8rem; }
  body.how-page footer { padding: 2.5rem var(--responsive-gutter); }
  body.how-page .footer-text { font-size: .86rem; }
}

@media (max-width: 479px) {
  body.form-page .success-wrap { padding-inline: 1rem; }
  body.form-page .success-title { font-size: clamp(1.3rem, 6.3vw, 1.5rem); line-height: 1.35; }
  body.form-page .success-text { max-width: 22rem; font-size: .92rem; line-height: 1.75; }
  body.form-page .success-actions { flex-direction:column; }
  body.form-page .success-actions .btn-home { width:100%; }
  body.form-page .teacher-detail-head { align-items:flex-start; }
  body.form-page .teacher-match-photo:not(.compact) { width:76px;height:76px;border-radius:50%; }
  body.how-page .page-subtitle { max-width: 19rem; }
  body.how-page .step-item { grid-template-columns: 48px minmax(0, 1fr); gap: .85rem; }
  body.how-page .step-number { width: 48px; height: 48px; font-size: 1.15rem; }
  body.how-page .step-title { font-size: clamp(1.28rem, 6.2vw, 1.45rem); margin-bottom: .7rem; }
  body.how-page .step-desc,
  body.how-page .step-details-list li,
  body.how-page .info-text,
  body.how-page .faq-answer { font-size: .96rem; line-height: 1.68; }
  body.how-page .step-details,
  body.how-page .info-box,
  body.how-page .faq-section { border-radius: 1rem; }
  body.how-page .faq-question { line-height: 1.5; }
}

@media (max-width: 349px) {
  :root { --responsive-gutter: 1rem; }
  body.how-page .step-item { grid-template-columns: 1fr; gap: .8rem; }
  body.how-page .step-content { padding-top: 0; }
  body.how-page .step-number { width: 44px; height: 44px; }
  body.how-page .step-details { padding: 1.15rem; }
  body.how-page .step-details-list li { padding-left: 1.3rem; }
}

.trial-place-note {
  margin-top: 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: 0.8rem;
  background: var(--accent-light);
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.55;
}

@media (max-width: 480px) {
  body.form-page .qcard {
    padding: 1.35rem 1.1rem;
  }

  body.form-page .qtitle {
    font-size: 1.3rem;
    line-height: 1.35;
    margin-bottom: 0.45rem;
  }

  body.form-page .qsub {
    font-size: 0.94rem;
    line-height: 1.5;
    margin-bottom: 1rem;
  }

  body.form-page .opt {
    padding: 0.9rem 1rem;
  }

  body.form-page .opt-label {
    font-size: 1rem;
    line-height: 1.4;
  }
}
