/* 모바일 전용(폭 768px 이하). PC 화면에는 영향을 주지 않는다.
   복구: git 태그 pre-mobile-redesign */
@media (max-width: 768px) {
  /* ---------- 히어로: 낮추고, 글은 아래쪽에 모아서 버튼이 항상 첫 화면에 보이게 ---------- */
  html body.joy-hero-rebuild-ready .hero-banner-top,
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero,
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__swiper,
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__swiper .swiper-wrapper,
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__slide {
    height: clamp(520px, 80svh, 700px) !important;
    min-height: 0 !important;
  }
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__media img,
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__media video { object-position: 50% 42%; }
  html body.joy-hero-rebuild-ready .hero-banner-top .swiper-wrapper .swiper-slide.joy-hero__slide,
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__slide .joy-hero__media,
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__slide .joy-hero__media img,
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__slide .joy-hero__media video,
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__slide .joy-hero__copy,
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__slide .joy-hero__scene { height: 100% !important; min-height: 0 !important; max-height: none !important; }
  /* 글자가 잘 읽히도록 아래쪽을 어둡게 */
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__media::after {
    content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: linear-gradient(180deg, rgba(5,10,24,0.18) 0%, rgba(5,10,24,0) 22%, rgba(5,10,24,0.1) 40%, rgba(5,10,24,0.78) 58%, rgba(5,10,24,0.95) 78%, rgba(5,10,24,0.98) 100%);
  }
  /* 장식(숫자 카드·흐르는 글·배지)은 모바일에서 숨긴다 */
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__scene { display: none !important; }

  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__copy {
    height: 100% !important; max-height: none !important;
    top: 0 !important; bottom: 0 !important;
    align-items: flex-end !important; justify-content: flex-start !important;
    padding: 70px 20px 50px !important;
    z-index: 6 !important;
  }
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__copy-stack {
    display: flex !important; flex-direction: column; gap: 10px !important;
    width: 100% !important; max-width: none !important; transform: none !important; text-align: left !important; justify-items: stretch !important;
  }
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__eyebrow { margin: 0 !important; font-size: 12px !important; letter-spacing: 0.12em; }
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__copy h2 { margin: 0 !important; font-size: clamp(26px, 7.4vw, 32px) !important; line-height: 1.18 !important; letter-spacing: -0.03em; }
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__subtitle { margin: 0 !important; font-size: 15px !important; line-height: 1.45 !important; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__description,
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__accent { display: none !important; }
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__actions { display: flex !important; flex-direction: column; gap: 8px; width: 100% !important; margin-top: 6px !important; }
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__btn { width: 100% !important; min-height: 48px !important; height: auto !important; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 15px !important; border-radius: 12px !important; margin: 0 !important; }
  html body.joy-hero-rebuild-ready .hero-banner-top .joy-hero__btn--secondary { min-height: 42px !important; background: rgba(255,255,255,0.08) !important; border: 1px solid rgba(255,255,255,0.28) !important; color: #fff !important; }
  html body.joy-hero-rebuild-ready .hero-banner-top .swiper-pagination { bottom: 20px !important; top: auto !important; z-index: 4; }

  /* ---------- 나타나는 효과 끄기: 키가 큰 섹션(갤러리 등)이 화면에 한참 들어온 뒤에야 나타나 빈 칸처럼 보이던 문제 ---------- */
  body [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }

  /* ---------- 선택한 세차 가격: 차량을 고르기 전에는 숨김 ---------- */
  #estimate.hero-estimator:not(.has-vehicle) { display: none !important; }

  /* ---------- 가격 요약: 카드를 좌우로 넘기기 ---------- */
  #pricing .price-grid {
    display: flex !important; gap: 12px !important; overflow-x: auto; scroll-snap-type: x mandatory;
    margin: 0 -16px; padding: 4px 16px 12px; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  #pricing .price-grid::-webkit-scrollbar { display: none; }
  #pricing .price-card { flex: 0 0 82% !important; scroll-snap-align: center; min-width: 0; }
  #pricing .section-head.split { margin-bottom: 14px !important; }

  /* ---------- 예약 일정: 오늘·내일 칩 + 주간 일정 팝업 ---------- */
  #schedule .section-head p:not(.section-kicker),
  #schedule .schedule-week,
  #schedule .schedule-note { display: none !important; }
  .m-schedule { display: grid; gap: 14px; }
  .m-schedule__loading { color: #9ca3af; font-size: 14px; margin: 0; }
  .m-schedule__day { padding: 14px; border-radius: 14px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.04); display: grid; gap: 10px; }
  .m-schedule__day strong { font-size: 15px; color: #f1f5f9; }
  .m-schedule__none { color: #9ca3af; font-size: 14px; }
  .m-schedule__chips { display: flex; flex-wrap: wrap; gap: 8px; }
  .m-chip { min-width: 72px; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid rgba(43,99,246,0.65); background: rgba(43,99,246,0.18); color: #dbe6ff; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
  .m-schedule__week { min-height: 46px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.22); background: rgba(255,255,255,0.07); color: #f1f5f9; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }

  /* ---------- 공통: 눌러서 펼치는 영역, 탭, 점, 안내 ---------- */
  .m-toggle { width: 100%; min-height: 52px; margin: 14px 0 4px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border-radius: 14px; border: 1px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.06); color: #f1f5f9; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
  .m-toggle i { font-style: normal; transition: transform .2s; }
  .m-toggle[aria-expanded="true"] i { transform: rotate(180deg); }
  .m-collapsible:not(.is-open) { display: none !important; }
  .m-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 14px; background: rgba(255,255,255,0.06); margin: 6px 0 14px; }
  .m-tabs button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: #aeb7c6; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
  .m-tabs button.on { background: #2b63f6; color: #fff; }
  .m-dots { display: flex; justify-content: center; gap: 6px; margin-top: 6px; }
  .m-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.28); }
  .m-dots i.on { width: 20px; border-radius: 4px; background: #5aa2ff; }
  .m-hint { margin: 4px 0 0; text-align: center; font-size: 13px; color: #9ca3af; }

  /* ---------- 서비스 소개: 탭으로 하나씩 ---------- */
  #service .section-head p:not(.section-kicker) { display: none !important; }
  #service .tracks-grid { display: block !important; }
  #service .tracks-grid[data-m-active="premium"] .track-card--lite,
  #service .tracks-grid[data-m-active="lite"] .track-card--premium { display: none !important; }
  #service .track-media { max-height: 170px; overflow: hidden; }

  /* ---------- 세차 종류 / 진행 과정: 펼치면 좌우로 넘기기 ---------- */
  #wash-types .section-head p:not(.section-kicker),
  #process .section-head p:not(.section-kicker) { display: none !important; }
  #wash-types .wash-types-grid.is-open,
  #process .service-steps.is-open {
    display: flex !important; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
    margin: 0 -16px; padding: 6px 16px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  #wash-types .wash-types-grid::-webkit-scrollbar, #process .service-steps::-webkit-scrollbar { display: none; }
  #wash-types .wash-type-card, #process .service-step { flex: 0 0 82% !important; scroll-snap-align: center; min-width: 0; }
  #wash-types .wash-type-image { height: 150px !important; }
  #process .step-image { height: 200px !important; }
  #wash-types .m-dots, #process .m-dots { display: none; }
  #wash-types:has(.is-open) .m-dots, #process:has(.is-open) .m-dots { display: flex; }

  /* ---------- 작업 사례: 좌우로 넘기기 ---------- */
  #gallery .section-head .section-kicker + h2 + p { display: none !important; }
  #gallery .section-head.split { display: block !important; }
  #gallery .section-actions { display: none !important; }
  #galleryPosts {
    display: flex !important; gap: 12px !important; overflow-x: auto; scroll-snap-type: x mandatory;
    margin: 0 -16px; padding: 4px 16px 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  #galleryPosts::-webkit-scrollbar { display: none; }
  #galleryPosts .gallery-post { flex: 0 0 78% !important; scroll-snap-align: center; min-width: 0; }
  #galleryPager { margin-top: 8px; display: flex !important; flex-wrap: nowrap !important; justify-content: center; gap: 4px !important; overflow: hidden; }
  #galleryPager[hidden] { display: none !important; }
  #galleryPager .gallery-pager-btn { flex: 0 0 auto; min-width: 34px !important; height: 36px !important; padding: 0 9px !important; font-size: 13px !important; white-space: nowrap; }
  #galleryPager .gallery-pager-gap { flex: 0 0 auto; padding: 0 1px; }

  /* ---------- AI 상담: 대화 미리보기는 숨기고 바로 시작 ---------- */
  #ai-chat .section-head p:not(.section-kicker) { display: none !important; }
  #ai-chat .ai-preview, #ai-chat .ai-visual, #ai-chat .ai-note { display: none !important; }

  /* ---------- 요청 / 문의: 버튼을 먼저, 목록은 접기 ---------- */
  #board-request .section-head p:not(.section-kicker),
  #board-inquiry .section-head p:not(.section-kicker) { display: none !important; }
  #board-request .section-head.split, #board-inquiry .section-head.split { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; gap: 12px; }
  #board-request .section-head.split > *, #board-inquiry .section-head.split > * { width: 100% !important; max-width: none !important; justify-self: stretch !important; }
  #board-request .section-head .btn, #board-inquiry .section-head .btn, #requestWriteBtn, #board-inquiry .section-actions > * { width: 100% !important; min-height: 50px; justify-content: center; box-sizing: border-box; text-align: center; display: flex; align-items: center; }
  #board-inquiry .section-actions { display: grid !important; gap: 10px; width: 100%; }

  /* ---------- 안내형 견적(차량 → 세차 방식 → 세차 종류 → 비용 → 일정) ---------- */
  body.m-guide-on .hero-form-grid,
  body.m-guide-on .hero-intro .btn.primary,
  body.m-guide-on #estimateDeluxeNote { display: none !important; }
  body.m-guide-on #estimate:not(.m-show-estimate) { display: none !important; }
  body.m-guide-on [data-reset-estimator="1"] { display: none !important; }
  .hero-search-shell.m-collapsed { display: none !important; }
  .m-guide { display: grid; gap: 10px; margin-top: 10px; }
  .m-progress { display: flex; gap: 6px; }
  .m-progress i { flex: 1; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.16); transition: background .3s; }
  .m-progress i.on { background: #3b82f6; }
  .m-progress i.cur { background: #f3d28a; }
  .m-coach { margin: 0; padding: 8px 12px; border-radius: 12px; background: rgba(209,163,77,0.14); border: 1px solid rgba(209,163,77,0.45); color: #f3d28a; font-size: 14px; font-weight: 700; line-height: 1.4; }
  .m-coach:empty { display: none; }
  .m-pill { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 12px; border-radius: 12px; background: rgba(43,99,246,0.18); border: 1px solid rgba(43,99,246,0.5); color: #e6eeff; font-weight: 700; font-size: 15px; }
  .m-pill[hidden] { display: none; }
  .m-pill__edit { border: 1px solid rgba(255,255,255,0.3); background: transparent; color: #fff; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; }
  .m-block { border-radius: 14px; padding: 2px; transition: box-shadow .25s; }
  .m-block[hidden] { display: none; }
  /* 강조 테두리는 하나만: 큰 금색 외곽선(히어로 버튼으로 이동했을 때와 같은 모양). 두 겹으로 겹치지 않게 한다 */
  .m-block.m-active { outline: 3px solid #f3d28a; outline-offset: 6px; border-radius: 14px; animation: joyCtaPulse 1.1s ease-in-out 3; }
  .hero-search-shell.m-active:not(.is-cta-target) { outline: 3px solid #f3d28a; outline-offset: 12px; border-radius: 14px; animation: joyCtaPulse 1.1s ease-in-out 3; }
  .hero-search-shell.m-active.is-cta-target { box-shadow: none; }
  html body .hero-search-shell.m-active #heroVehicleSearch, html body .hero-search-shell.is-cta-target #heroVehicleSearch, html body .hero-search-shell.m-active #heroVehicleSearch:focus { box-shadow: none !important; outline: none !important; }
  .m-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .m-chips[data-kind="style"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .m-block.m-done .m-chips { grid-template-columns: 1fr; }
  .m-block.m-done .m-chip2:not(.on), .m-block.m-done .m-note { display: none; }
  .m-block.m-done .m-chip2.on { position: relative; padding-right: 64px; }
  .m-block.m-done .m-chip2.on::after { content: '변경'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; color: #cbd5e1; border: 1px solid rgba(255,255,255,0.3); border-radius: 999px; padding: 2px 10px; }
  .m-chip2 { display: grid; gap: 2px; text-align: left; padding: 9px 10px; min-height: 48px; align-content: center; border-radius: 12px; border: 1px solid rgba(255,255,255,0.22); background: rgba(255,255,255,0.06); color: #f1f5f9; font: inherit; cursor: pointer; }
  .m-chip2 b { font-size: 14px; line-height: 1.25; }
  .m-chip2 small { font-size: 11px; color: #aeb7c6; }
  .m-chip2.on { border-color: #3b82f6; background: rgba(59,130,246,0.28); }
  .m-chip2:disabled { opacity: 0.4; cursor: not-allowed; }
  .m-note { margin: 8px 0 0; padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(209,163,77,0.45); background: rgba(209,163,77,0.1); color: #f3d28a; font-size: 13px; line-height: 1.5; }
  .m-note[hidden] { display: none; }
  .m-price { display: grid; gap: 4px; padding: 14px; border-radius: 14px; background: rgba(8,14,30,0.7); border: 1px solid rgba(255,255,255,0.18); }
  .m-price__label { font-size: 13px; color: #aeb7c6; }
  .m-price__value { font-size: 32px; color: #f3d28a; line-height: 1.15; }
  .m-price__meta { font-size: 13px; color: #cbd5e1; }
  .m-blink { animation: mBlink .7s ease-in-out 4; }
  @keyframes mBlink { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.2; transform: scale(1.07); } }
  .m-cta { min-height: 52px; border-radius: 14px; border: 0; background: #2b63f6; color: #fff; font: inherit; font-size: 17px; font-weight: 800; cursor: pointer; margin-top: 10px; width: 100%; }
  .m-pulse { animation: mPulse 1.2s ease-in-out 4; }
  @keyframes mPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(43,99,246,0.7); } 50% { box-shadow: 0 0 0 10px rgba(43,99,246,0); } }
  .m-link { margin-top: 8px; width: 100%; background: transparent; border: 0; color: #9db8ff; font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; padding: 8px; }

  /* ---------- 하단 고정 바 ---------- */
  body.has-mobile-bar { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  /* 평소에는 붙어 있고, 스크롤할 때 가운데 72px 를 비운다: 폰 브라우저가 가운데 아래에 띄우는 스크롤 버튼(⌃ ⌄)과 겹치지 않게 */
  .mobile-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1250;
    display: grid; grid-template-columns: 1.45fr 6px 1fr; align-items: end; transition: grid-template-columns .25s ease;
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(8,14,30,0) 0%, rgba(8,14,30,0.55) 100%);
    pointer-events: none;
  }
  /* 스크롤하는 동안에만 가운데를 벌린다(폰 브라우저의 스크롤 버튼이 그때 나타남) */
  .mobile-bar.is-scrolling { grid-template-columns: 1.45fr 72px 1fr; }
  .mobile-bar__side { display: flex; gap: 6px; pointer-events: auto; }
  .mobile-bar__side > * { flex: 1 1 0; min-width: 0; }
  /* 전화는 작게, AI 상담과 예약 접수는 크고 높게 */
  .mobile-bar__side > a[href^="tel:"] { flex: 0 0 52px; font-size: 12px; }
  .mobile-bar .mobile-bar__ai, .mobile-bar .mobile-bar__main { min-height: 56px; font-size: 15px; font-weight: 800; }
  .mobile-bar a, .mobile-bar button {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 48px; padding: 0 6px; border-radius: 14px; border: 1px solid rgba(255,255,255,0.22);
    background: rgba(12, 20, 40, 0.96); color: #f1f5f9; font: inherit; font-size: 13px; font-weight: 700;
    text-decoration: none; cursor: pointer; white-space: nowrap;
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  }
  .mobile-bar .mobile-bar__main { background: #2b63f6; border-color: #2b63f6; color: #fff; }
  /* 오른쪽 아래에 떠 있던 AI 상담 버튼은 하단 바로 합친다 */
  body.has-mobile-bar .aichat-fab { display: none !important; }
}
@media (max-width: 768px) {
  /* AI 상담 버튼 강조: 금빛 테두리, 캐릭터가 통통 튀고 빛이 지나감 */
  .mobile-bar .mobile-bar__ai { position: relative; overflow: hidden; background: linear-gradient(180deg, #3a2f12, #1d1808); border: 1px solid #d1a34d; color: #f3d28a; font-weight: 800; animation: mAiGlow 3.2s ease-in-out infinite; }
  .mobile-bar__face { display: inline-block; margin-right: 4px; transform-origin: 50% 90%; animation: mAiFace 3.2s ease-in-out infinite; }
  .mobile-bar .mobile-bar__ai::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.45) 50%, transparent 65%); background-size: 250% 100%; background-position: 160% 0; animation: mAiShine 3.2s ease-in-out infinite; }
  .aichat-tip { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); left: 12px; right: auto; }
}
@keyframes mAiGlow { 0%, 55%, 100% { box-shadow: 0 0 0 0 rgba(209,163,77,0); } 70% { box-shadow: 0 0 0 6px rgba(209,163,77,.35); } }
@keyframes mAiFace { 0%, 58%, 100% { transform: rotate(0); } 64% { transform: rotate(-16deg) scale(1.2); } 72% { transform: rotate(14deg) scale(1.2); } 80% { transform: rotate(-6deg); } }
@keyframes mAiShine { 0%, 50% { background-position: 160% 0; } 75%, 100% { background-position: -60% 0; } }
@media (prefers-reduced-motion: reduce) { .mobile-bar .mobile-bar__ai, .mobile-bar__face, .mobile-bar .mobile-bar__ai::after { animation: none !important; } }
@media (min-width: 769px) { .mobile-bar { display: none !important; } }
