/* ═══════════════════════════════════════════════════════════
   ONGYEOL · MOBILE OPTIMIZATION PATCH
   - 모든 페이지 </head> 직전에 로드 (페이지별 인라인 스타일보다 뒤)
   - 기준: 360–430px 스마트폰
   ═══════════════════════════════════════════════════════════ */

/* 0. 가로 스크롤 원천 차단 (sticky 유지되는 clip 사용) */
html, body { overflow-x: clip; }

@media (max-width: 720px) {

  /* ───── 1. 공통 리듬: 섹션 여백 축소 ───── */
  .section { padding: 64px 0; }
  .section--tight { padding: 48px 0; }

  /* ───── 2. 탭 타깃 & 최소 글자 크기 ───── */
  .footer__col a,
  .footer__legal a,
  .info-link { display: inline-block; padding: 8px 0; }
  .ba-card__lbl { font-size: 11px; }
  .logo-intro__scroll, .logo-intro__scroll span { font-size: 11px; }
  .qc__agree input,
  .form-wrap input[type="checkbox"] { width: 18px; height: 18px; }
  /* iOS: 16px 미만 입력창은 포커스 시 화면이 확대됨 */
  .qc-sheet .qc__field input,
  .qc-sheet .qc__field select,
  .form-wrap input:not([type="checkbox"]):not([type="radio"]),
  .form-wrap select,
  .form-wrap textarea { font-size: 16px; }

  /* ───── 3. 메인 · 브랜드 카드 3장 → 가로 스와이프 (세로 길이 약 1/2) ───── */
  /* → 세로 리스트: 사진(좌) + 번호·제목·설명(우), 한눈에 3개 모두 보이도록 */
  .brand__features {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    border-top: 1px solid var(--hairline);
  }
  .brand__features .feature {
    display: grid;
    grid-template-columns: 112px 1fr;
    column-gap: 18px;
    align-items: center;
    aspect-ratio: auto !important;
    background: none;
    overflow: visible;
    padding: 20px 0;
    border-bottom: 1px solid var(--hairline);
  }
  .brand__features .feature::before { display: none; }
  .brand__features .feature__photo {
    position: relative; inset: auto;
    grid-column: 1; grid-row: 1 / span 2;
    width: 112px; height: 136px;
  }
  .brand__features .feature__num {
    position: relative; top: auto; left: auto;
    grid-column: 2; grid-row: 1;
    align-self: end;
    color: var(--camel);
    font-size: 13px;
    padding: 0 0 0 34px;
    margin-bottom: 10px;
  }
  .brand__features .feature__num::before {
    top: 50%; width: 24px;
    background: var(--camel);
  }
  .brand__features .feature__body {
    position: static;
    grid-column: 2; grid-row: 2;
    align-self: start;
    padding: 0;
  }
  .brand__features .feature__body h3 {
    font-size: 18px;
    color: var(--deep-brown);
    margin-bottom: 6px;
    line-height: 1.4;
    word-break: keep-all;
  }
  .brand__features .feature__body p {
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--muted);
    word-break: keep-all;
  }
  .brand__head { margin-bottom: 32px; }

  /* ───── 4. 메인 · 고민 카드 2열 가독성 ───── */
  .concern-card__body { padding: 16px 14px 18px; }
  .concern-card h3 { font-size: 16.5px; line-height: 1.35; }
  .concern-card p { font-size: 12.5px; line-height: 1.6; }

  /* ───── 5. 메인 · 진료 과정 5단계 촘촘하게 ───── */
  .process__steps { gap: 22px; }
  .step { grid-template-columns: 52px 1fr; gap: 18px; }
  .step__dot { width: 52px; height: 52px; font-size: 15px; }

  /* ───── 6. 메인 · 네이버 리뷰 콜라주 → 스와이프 캐러셀
           (화면 밖으로 넘치던 r4·r5 카드 문제 해결) ───── */
  .reviews__stage {
    height: auto;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin: 0 -22px 32px;
    padding: 6px 22px 20px;
    scroll-padding: 0 22px;
    scrollbar-width: none;
  }
  .reviews__stage::-webkit-scrollbar { display: none; }
  .reviews__stage .review-card,
  .reviews__stage .review-card[class*="review-card--r"] {
    position: relative;
    top: auto; left: auto;
    flex: 0 0 64%;
    width: auto; height: 300px;
    transform: none;
    z-index: auto;
    scroll-snap-align: start;
    padding: 6px;
  }
  .reviews__stage .review-card:hover { transform: none !important; }
  .reviews__fade { display: none; }

  /* ───── 7. 메인 · 오시는 길 버튼 풀폭 ───── */
  .loc__ctas { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .loc__ctas .btn { width: 100%; }

  /* ───── 8. 시술 메뉴 · 카테고리 탭 컴팩트 + 스크롤 힌트 ───── */
  .tabs-wrap { padding-top: 40px; }
  .tabs-bar {
    grid-template-columns: repeat(5, minmax(116px, 1fr));
    margin-bottom: 40px;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
            mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .tab-btn { padding: 18px 10px 16px; }
  .tab-btn__kr { font-size: 16px; }
  .tab-btn__en { font-size: 11px; letter-spacing: 0.16em; margin-bottom: 6px; }

  /* ───── 9. 시술 상세 · HOW 섹션 가로 넘침 버그 (556px → 화면폭) ───── */
  .td-how__split,
  body[data-variant] .td-how__split { grid-template-columns: minmax(0, 1fr); margin-bottom: 40px; }
  .td-how__split > * { min-width: 0; }
  .td-how__visual { min-height: 0; max-height: none; aspect-ratio: 4 / 3; }
  .td-how__copy { padding: 32px 22px; }
  .td-how__step { padding: 26px 22px; }
  .td-how__step-num { font-size: 34px; margin-bottom: 16px; padding-bottom: 14px; }

  /* ───── 10. 푸터 압축 (1177px → 약 750px) ───── */
  .site-footer { padding: 52px 0 28px; }
  .footer__top {
    grid-template-columns: 1fr 1fr;
    gap: 32px 20px;
    padding-bottom: 32px;
  }
  .footer__brand { grid-column: 1 / -1; }
  .footer__brand img { height: 38px; margin-bottom: 14px; }
  .footer__col h4 { margin-bottom: 10px; font-size: 14px; }
  .footer__col ul li { margin-bottom: 2px; font-size: 13px; line-height: 1.7; }
  .footer__col ul li[style*="margin-top"] { margin-top: 10px !important; }
  .footer__notice { margin-top: 20px; padding: 14px 16px; font-size: 11.5px; }
  .footer__bottom { padding-top: 22px; gap: 10px; font-size: 11.5px; }
  .footer__legal { gap: 16px; }
}

/* ───── 2차 보정 (390px 점검 결과 반영) ───── */
@media (max-width: 720px) {
  /* A. 우측 플로팅 버튼: 작게, 화면 끝에 바짝 + 반투명 → 본문 가림 최소화 */
  .side-rail { right: 6px; bottom: 92px; gap: 6px; }
  .side-rail__btn {
    width: 36px; height: 36px;
    background: rgba(74, 55, 42, 0.78);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    box-shadow: 0 6px 16px -8px rgba(40, 28, 20, 0.5);
  }
  /* 시각 크기는 36px, 터치 영역은 44px 확보 */
  .side-rail__btn::after { content: ""; position: absolute; inset: -4px; }
  .side-rail__btn svg { width: 16px; height: 16px; }
  .side-rail__txt { font-size: 10.5px; }

  /* B. 작은 탭 타깃 → 최소 44px 높이 */
  .btn--link,
  .loc__map-cta,
  .logo-intro__replay,
  .logo-intro__scroll {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .btn--link { padding-top: 0; padding-bottom: 0; }

  /* C. 10px 글자 → 11px 이상 */
  .ba-card__badge small { font-size: 11px; letter-spacing: 0.1em; }
  .tv-tweak__btn small { font-size: 11px; }
}

/* 아주 작은 폰 (≤360px) */
@media (max-width: 360px) {
  .container { padding: 0 18px; }
  .brand__features, .reviews__stage { margin-left: -18px; margin-right: -18px; padding-left: 18px; padding-right: 18px; }
  .concerns__grid { gap: 8px; }
  .concern-card p { display: none; }
}
