/* ─────────────────────────────────────────────────────────────
   한문기 수학교습소 — 모바일 최적화 (.ac-* 셸 전용)
   academy.css 위에 얹는 mobile overrides.
   <link media="(max-width: 768px)"> 로 로드되므로 전체가 모바일 한정.
   ───────────────────────────────────────────────────────────── */

/* ── iOS / Android 안정화 ── */
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(99,102,241,.15);
  text-size-adjust: 100%;
}
body.ac-body {
  font-size: 17px;            /* 모바일은 약간 축소하되 18px 기조 유지 */
  /* iPhone notch / Android cutout safe area */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
button, a, summary { touch-action: manipulation; }
img, iframe, video { max-width: 100%; height: auto; }
/* 한국어 줄바꿈 자연스럽게 */
.ac-body p, .ac-body h1, .ac-body h2, .ac-body h3, .ac-body h4, .ac-body li, .ac-body td {
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* ── Container ── */
.ac-container {
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
}

/* ── Top utility bar (모바일: 10% 좌우 → 14px 고정으로 가독성 우선) ── */
.ac-topbar { font-size: 11px; }
.ac-topbar-row {
  padding: 6px 14px !important;  /* desktop 10%를 mobile에서 override */
  gap: 6px; flex-wrap: wrap; line-height: 1.5;
}
.ac-topbar-sep, .ac-topbar-hours { display: none; }
.ac-topbar-phone { margin-left: auto; }

/* 모바일: 국기 라인은 가로 스크롤 (10개 다 보여주되 공간 절약) */
.ac-topbar-langs {
  order: 3; flex-basis: 100%;
  margin: 4px 0 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
  scrollbar-width: none;
}
.ac-topbar-langs::-webkit-scrollbar { display: none; }
.ac-topbar-langs a { width: 26px; height: 22px; flex: 0 0 auto; }
.ac-topbar-langs .ac-flag { font-size: 14px; }
.ac-topbar-langs .fi { width: 20px; height: 14px; }

/* 매우 작은 화면(<380px)에서는 국기 영역만 숨김 — 헤더 안 lang switcher로 대체 */
@media (max-width: 380px) {
  .ac-topbar-langs { display: none; }
}

/* ── Header (모바일: 10% 데스크톱 → 14px 고정 가독성 우선) ── */
.ac-header-row {
  height: auto; min-height: 60px;
  padding: 8px 14px !important;   /* desktop 10%를 override */
  gap: 8px;
}
.ac-logo-text { font-size: 16px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-logo-mark { width: 32px; height: 32px; font-size: 16px; }

/* 모바일: 전화번호 CTA는 작은 아이콘만 표시 (숫자는 드로어 안에서 보임) */
.ac-cta-call { padding: 8px 10px; font-size: 0; box-shadow: none; }
.ac-cta-call .ac-cta-icon { font-size: 18px; }
.ac-cta-call .ac-cta-num { display: none; }

.ac-nav-toggle { display: inline-flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }

/* Mobile drawer nav */
.ac-nav {
  display: none;
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 84vw; max-width: 360px;
  background: #fff;
  padding: 72px 16px max(24px, env(safe-area-inset-bottom));
  flex-direction: column; gap: 2px;
  box-shadow: -16px 0 40px rgba(15,23,42,.2);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform .2s ease;
  z-index: 70;
}
.ac-nav.open {
  display: flex;
  transform: translateX(0);
}
.ac-nav a, .ac-nav-btn {
  padding: 14px 12px;
  font-size: 15px;
  border-radius: 8px;
  min-height: 44px;
  display: flex; align-items: center;
}

/* 블로그 메뉴 — 드로어에서도 강조 유지 */
.ac-nav .ac-nav-blog {
  margin: 8px 0 4px !important;
  background: linear-gradient(135deg, #FB923C 0%, #F59E0B 60%, #EA580C 100%) !important;
  color: #fff !important;
  border-radius: 12px !important;
  padding: 14px 16px !important;
  font-size: 16px !important;
  justify-content: flex-start;
  box-shadow: 0 4px 12px rgba(245,158,11,.32);
}
.ac-nav .ac-nav-blog .ac-nav-blog-pulse {
  margin-left: auto;
}
.ac-nav-group { display: block; }
.ac-nav-group ul {
  position: static;
  display: block;
  border: 0;
  box-shadow: none;
  margin: 0 0 4px;
  padding: 0 0 4px 12px;
  background: var(--ac-bg-soft);
  border-radius: 8px;
}
.ac-nav-group ul a {
  font-size: 14px;
  padding: 12px 10px;
  min-height: 40px;
}

/* Backdrop when nav open */
.ac-nav-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.4);
  z-index: 65;
}
.ac-nav-backdrop.show { display: block; }

/* Lang switcher: full-width dropdown */
.ac-lang-switcher ul {
  position: fixed;
  right: 14px;
  left: auto;
  top: 64px;
  width: calc(100vw - 28px);
  max-width: 320px;
  max-height: 70vh;
  z-index: 80;
}
.ac-lang-switcher ul a { padding: 14px 12px; min-height: 44px; }

/* ── Hero (모바일: 중앙정렬 + 큰 타이틀 + CTA 풀폭, 콘텐츠 분량 늘어서 높이 증가) ── */
.ac-hero { padding: 56px 0 84px; min-height: 660px; }
.ac-hero-inner { padding: 0 14px; }
.ac-hero-eyebrow { font-size: 13px; padding: 5px 14px; gap: 6px; }
.ac-eyebrow-icon { width: 12px; height: 12px; }
.ac-hero-title { font-size: clamp(28px, 8vw, 42px); line-height: 1.2; margin: 16px 0 10px; }
.ac-hero-divider { width: 100px; height: 12px; margin: 14px auto; }
.ac-hero-desc { font-size: 17px; line-height: 1.55; padding: 0 4px; }
.ac-hero-cta { gap: 8px; margin: 26px 0 22px; flex-direction: column; align-items: stretch; }
.ac-hero-cta .ac-btn { width: 100%; padding: 14px 16px; font-size: 16px; min-height: 50px; justify-content: center; }
.ac-btn-icon { width: 18px; height: 18px; }
.ac-btn-num { padding-left: 8px; margin-left: 2px; }
.ac-hero-meta {
  font-size: 13.5px;
  gap: 8px 16px;
  display: flex; flex-direction: column; align-items: center;
}
.ac-hero-meta li { padding: 1px 0; text-align: center; }
.ac-meta-icon { width: 16px; height: 16px; }
.ac-hero-dots { bottom: 18px; gap: 8px; }
.ac-hero-dot { width: 28px; height: 4px; }
.ac-hero-dot.is-active { width: 44px; }

/* ── Sections ── */
.ac-section { padding: 40px 0; }
.ac-section-title { font-size: 22px; }
.ac-section-sub { font-size: 14px; margin: 0 0 18px; }

/* ── Buttons ── */
.ac-btn { min-height: 44px; padding: 12px 18px; font-size: 14px; }

/* ── Features (차별화 3블록 + 컬러 사이드바 + 번호 워터마크) ── */
.ac-features { grid-template-columns: 1fr; gap: 14px; }
.ac-feature { padding: 24px 20px 22px; border-radius: 16px; }
.ac-feature::before { width: 4px; }
.ac-feature::after { width: 130px; height: 130px; top: -30px; right: -30px; }
.ac-feature-num { font-size: 44px; top: 14px; right: 18px; }
.ac-feature-head { gap: 12px; margin-bottom: 12px; }
.ac-feature-icon { width: 42px; height: 42px; border-radius: 12px; }
.ac-feature-icon svg { width: 22px; height: 22px; }
.ac-feature h3 { font-size: 19px; line-height: 1.3; }
.ac-feature p { font-size: 16px; line-height: 1.7; }

/* ── Programs (학년별 컬러 + 한자 워터마크) ── */
.ac-programs { grid-template-columns: 1fr; gap: 14px; }
.ac-program-card { padding: 22px 20px 20px; }
.ac-program-watermark { font-size: 130px; right: -6px; bottom: -22px; }
.ac-program-head { gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.ac-program-tag { padding: 4px 12px; font-size: 12px; }
.ac-program-card h3 { font-size: 19px; line-height: 1.3; }
.ac-program-card p { font-size: 16px; line-height: 1.7; margin-bottom: 14px; }
.ac-program-stats { grid-template-columns: 1fr 1fr; gap: 6px; }
.ac-program-stat { padding: 10px 12px; }
.ac-program-stat small { font-size: 10px; }
.ac-program-stat strong { font-size: 13px; }
.ac-program-arrow { width: 28px; height: 28px; top: 20px; right: 18px; }
.ac-program-arrow svg { width: 14px; height: 14px; }
.ac-program-meta { font-size: 13px; }

/* ── Results ── */
.ac-results { grid-template-columns: 1fr; gap: 10px; }
.ac-result { padding: 18px; }
.ac-result-jump { font-size: 22px; }

/* ── Multicultural banner (전화 CTA) ── */
.ac-banner-mc { padding: 40px 0; }
.ac-banner-langs { font-size: 14px; line-height: 1.7; }
.ac-banner-mc p { margin-bottom: 22px; }

/* 전화 CTA — 모바일에서는 풀폭 가까이 */
.ac-banner-phone {
  gap: 12px;
  padding: 14px 20px 14px 16px;
  width: calc(100% - 28px);
  max-width: 360px;
  justify-content: center;
}
.ac-banner-phone-icon { width: 40px; height: 40px; }
.ac-banner-phone-icon svg { width: 20px; height: 20px; }
.ac-banner-phone-label { font-size: 11px; margin-bottom: 3px; }
.ac-banner-phone-num { font-size: 22px; }
.ac-banner-link { font-size: 13px; margin-top: 16px; }

/* ── Blog posts ── */
.ac-posts { grid-template-columns: 1fr; gap: 12px; }
.ac-post-card { padding: 18px; }
.ac-post-title { font-size: 18px; line-height: 1.35; }
.ac-post-snippet { font-size: 15px; line-height: 1.65; }

/* ── Results (메달 + Before→After) ── */
.ac-result { padding: 26px 20px 22px; border-radius: 18px; }
.ac-result-medal { width: 60px; height: 60px; margin-bottom: 14px; }
.ac-result-medal svg { width: 30px; height: 30px; }
.ac-result-who { margin-bottom: 16px; }
.ac-result-who small { font-size: 10px; }
.ac-result-who strong { font-size: 16px; }
.ac-result-progress { padding: 16px 12px; gap: 6px; margin-bottom: 14px; }
.ac-result-before em { font-size: 20px; }
.ac-result-after em { font-size: 24px; }
.ac-result-arrow { width: 28px; height: 20px; }
.ac-result-period { font-size: 12px; padding: 6px 14px; }
.ac-result-period svg { width: 12px; height: 12px; }

/* ── Map card (Kakao Roughmap) ── */
.ac-mapcard { border-radius: 16px; }
.ac-mapcard-header { padding: 12px 16px; gap: 8px; }
.ac-mapcard-brand strong { font-size: 15px; }
.ac-mapcard-addr { font-size: 12px; flex-basis: 100%; }
.ac-mapcard-iframe iframe { height: 360px !important; }
.ac-mapcard-footer { padding: 12px 14px; flex-direction: column; gap: 8px; }
.ac-mapcard-cta { width: 100%; padding: 14px 16px; font-size: 15px; }
.ac-mapcard-nav { width: 100%; padding: 12px 16px; }

/* ── Static page (page.php) ── */
.ac-page { padding: 28px 0 48px; }
.ac-page-hero { padding: 24px 0; }
.ac-page-hero h1 { font-size: 24px; }
.ac-page h1 { font-size: 26px; }
.ac-page h2 { font-size: 18px; margin-top: 24px; }
.ac-page h3 { font-size: 16px; }
.ac-page p, .ac-page li { font-size: 15px; line-height: 1.7; }

/* Page content tables — make them horizontally scrollable */
.ac-page article { width: 100%; }
.ac-page article table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 12.5px;
}
.ac-page article table thead,
.ac-page article table tbody,
.ac-page article table tr { display: table; width: max-content; min-width: 100%; }
.ac-page article table th, .ac-page article table td { padding: 6px 8px !important; }

/* Page content card grids (e.g. /p/materials catalog) */
.ac-page article div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

/* ── Footer ── */
.ac-footer { margin-top: 32px; }
.ac-footer-grid { grid-template-columns: 1fr; gap: 22px; padding: 32px 16px; }
.ac-footer-col h3 { font-size: 13px; margin-top: 4px; }
.ac-footer-col ul li { padding: 8px 0; font-size: 14px; min-height: 32px; }
.ac-footer-nap > div { flex-direction: column; gap: 2px; padding: 4px 0; }
.ac-footer-nap dt { font-size: 11px; min-width: 0; }
.ac-footer-nap dd { font-size: 14px; }
.ac-footer-langs { columns: 2; column-gap: 10px; }
.ac-footer-langs li { padding: 6px 0; }

/* ── Popup mobile center ── */
.popup-stack {
  left: 16px !important; right: 16px !important; top: 50% !important;
  transform: translateY(-50%) !important;
  align-items: center;
}
.popup {
  width: calc(100vw - 32px) !important; max-width: 460px;
  margin: 0 auto;
}
.popup img { width: 100%; height: auto; }

/* ── Very small screens (320–380px) ── */
@media (max-width: 380px) {
  .ac-container { padding-left: 12px; padding-right: 12px; }
  .ac-logo-text { max-width: 130px; font-size: 14px; }
  .ac-hero-title { font-size: clamp(24px, 7.5vw, 32px); }
  .ac-section { padding: 32px 0; }
  .ac-page article table { font-size: 11.5px; }
}

/* ─────────────────────────────────────────────────────────────
   gt-* / ab-* / pe-* magazine page content — safety net
   매거진 페이지(인사말/교습소소개/프로그램) inline CSS 보강.
   ───────────────────────────────────────────────────────────── */
/* hero grids → 1 column on mobile */
.ac-page .gt-hero,
.ac-page .ab-hero,
.ac-page .pe-hero,
.ac-page .pm-hero,
.ac-page .ph-hero,
.ac-page .sc-hero,
.ac-page .sw-hero,
.ac-page .ss-hero,
.ac-page .mt-hero,
.ac-page .tu-hero,
.ac-page .ct-hero,
.ac-page .ab-director {
  grid-template-columns: 1fr !important;
  padding: 28px 18px !important;
  gap: 22px !important;
  margin: -16px 0 32px !important;
  border-radius: 16px !important;
}
/* Magazine pages — common safety net */
.ac-page .sw-goals, .ac-page .ss-goals,
.ac-page .sw-highlights, .ac-page .ss-highlights, .ac-page .mt-why,
.ac-page .sw-strip-grid, .ac-page .ss-strip-grid,
.ac-page .mt-books, .ac-page .sc-info {
  grid-template-columns: 1fr !important;
  gap: 14px !important;
}
.ac-page .mt-sample { grid-template-columns: 1fr !important; padding: 28px 22px !important; }
.ac-page .sc-grid { grid-template-columns: 76px repeat(6, minmax(60px,1fr)) !important; padding: 12px !important; gap: 4px !important; }
.ac-page .sc-cell { font-size: 11px !important; min-height: 44px !important; padding: 6px 4px !important; }
.ac-page .sw-cta, .ac-page .ss-cta, .ac-page .mt-cta, .ac-page .sc-cta,
.ac-page .tu-cta, .ac-page .ct-cta {
  flex-direction: column !important;
  text-align: center;
  padding: 26px 20px !important;
  gap: 12px !important;
}
/* tuition / contact extra collapses */
.ac-page .tu-pricing, .ac-page .tu-included, .ac-page .tu-faq,
.ac-page .ct-nap, .ac-page .ct-transport, .ac-page .ct-hours-grid {
  grid-template-columns: 1fr !important;
  gap: 14px !important;
}
.ac-page .ct-hours { grid-template-columns: 1fr !important; gap: 20px !important; padding: 28px 22px !important; }
.ac-page .ct-map-section { padding: 22px 18px !important; border-radius: 18px !important; }
.ac-page .ct-map-frame { aspect-ratio: 4/5 !important; }
.ac-page .tu-refund-row { grid-template-columns: 1fr !important; gap: 8px !important; }
/* portrait/art constraints */
.ac-page .gt-portrait,
.ac-page .ab-hero-art,
.ac-page .ab-director-art,
.ac-page .pe-hero-art {
  max-width: 100%;
  margin: 0 auto;
}
.ac-page .gt-portrait { max-width: 260px; }
.ac-page .ab-director-art { max-width: 280px; }
/* grids → 1 column */
.ac-page .gt-stats,
.ac-page .gt-philosophy,
.ac-page .ab-pillars,
.ac-page .ab-facility,
.ac-page .pe-grades,
.ac-page .pe-method,
.ac-page .pe-faq {
  grid-template-columns: 1fr !important;
  gap: 14px !important;
}
.ac-page .pe-step-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
/* CTA bars */
.ac-page .gt-cta-bar,
.ac-page .pe-cta {
  flex-direction: column !important;
  text-align: center;
  padding: 24px 18px !important;
  gap: 12px !important;
}
/* timeline rows */
.ac-page .ab-tl-row {
  grid-template-columns: 1fr !important;
  gap: 4px !important;
}
/* map card padding */
.ac-page .ab-map-section { padding: 22px 16px !important; border-radius: 18px !important; }
.ac-page .ab-map-pills { gap: 6px; }
.ac-page .ab-map-pill { padding: 10px 14px; font-size: 13px; }
/* signature alignment */
.ac-page .gt-signature { text-align: center !important; padding-top: 24px !important; }
.ac-page .gt-sign-name { font-size: 26px !important; letter-spacing: .25em !important; }

/* hero typography on very small screens */
@media (max-width: 380px) {
  .ac-page .gt-h1, .ac-page .ab-h1, .ac-page .pe-h1 { font-size: 26px !important; line-height: 1.18 !important; }
  .ac-page .gt-lead, .ac-page .ab-lead, .ac-page .pe-lead { font-size: 15px !important; }
  .ac-page .gt-quote p { font-size: 17px !important; }
  .ac-page .gt-body p, .ac-page .ab-prose p { font-size: 15px !important; line-height: 1.8 !important; }
}

/* iframe (Google Maps) safe height */
.ac-page .ab-map-frame { aspect-ratio: 4/5; }
@media (min-width: 480px) { .ac-page .ab-map-frame { aspect-ratio: 16/10; } }

/* ── Landscape phone (height < 500) ── */
@media (max-height: 500px) and (orientation: landscape) {
  .ac-hero { padding: 24px 0; }
  .ac-hero-title { font-size: 30px; margin: 6px 0; }
  .ac-nav { padding-top: 56px; }
}

/* ── Reduce motion respect ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
