/* ============================================================
   svcman2 Mobile Optimization Patch
   - 디자인 소스(index.html)와 분리 — 핸드오프 받을 때마다 재사용
   - index.html의 inline <style> 뒤에 <link>로 로드되어 cascade 우선
   ============================================================ */

/* ───── 한글 word-break (모든 viewport)
   기본 word-break는 한글 단어 중간에서도 자름 ("설계합/니다" 식).
   keep-all로 단어 단위 줄바꿈, overflow-wrap은 긴 URL 등 안전망. */
body {
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* ───── select 외관 정규화 (iOS Safari 네이티브 스타일 차단)
   appearance: none + 커스텀 chevron으로 input과 통일.
   !important로 inline <style> 우선순위까지 강제. */
select,
select.input,
.field select,
.form-group select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%235A6B85' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='2,2 6,6 10,2'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  background-color: white !important;
  padding-right: 36px !important;
  cursor: pointer !important;
}

/* ───── AI 2.0 vibe — 그라데이션 shimmer + 우상단 AI 스파클 ✦ ─────
   AI 시대 느낌. 되돌리려면 이 블록 통째로 삭제. 헤더만 적용(푸터/topbar 제외) */
header.site .logo-tag,
.lp-head .wmk .wtag {
  position: relative;
  background-image: linear-gradient(120deg, #1B6BFF 0%, #8B5CFF 35%, #FF6B9D 65%, #1B6BFF 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800 !important;
  letter-spacing: 0.03em;
  padding-right: 9px;    /* 우상단 스파클 자리 */
  animation: aiShimmer 5s linear infinite;
}
/* 4-point 스파클 — 2.0의 0 위쪽 살짝 오른쪽에 부착 (고정) */
header.site .logo-tag::after,
.lp-head .wmk .wtag::after {
  content: "";
  position: absolute;
  top: -5px;
  right: -4px;
  width: 11px;
  height: 11px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><linearGradient id="aigrad" x1="2" y1="2" x2="22" y2="22" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="%231B6BFF"/><stop offset="0.5" stop-color="%238B5CFF"/><stop offset="1" stop-color="%23FF6B9D"/></linearGradient></defs><path d="M12 1L14 10L23 12L14 14L12 23L10 14L1 12L10 10Z" fill="url(%23aigrad)"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
}
@keyframes aiShimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  header.site .logo-tag,
  .lp-head .wmk .wtag { animation: none; }
}

/* ───── 체험신청 성공 모달 (전 viewport 공통) ─────
   form-handler.js가 동적 주입. 백드롭 클릭 / ESC / 확인 버튼으로 닫힘. */
.svc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 27, 51, .6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: svcModalBackdropIn .2s ease;
}
.svc-modal {
  background: white;
  width: 100%;
  max-width: 480px;
  border-radius: 16px;
  padding: 32px 28px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  animation: svcModalIn .25s cubic-bezier(.2, .9, .3, 1);
}
.svc-modal-icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--brand-50, #eef3ff);
  display: grid; place-items: center;
}
.svc-modal-icon svg {
  width: 28px; height: 28px;
  stroke: var(--brand, #1B6BFF);
  fill: none;
}
.svc-modal-title {
  margin: 0 0 14px;
  font-size: 18px; font-weight: 800;
  text-align: center;
  color: var(--ink, #0B1B33);
  letter-spacing: -0.02em;
  word-break: keep-all;
}
.svc-modal-body {
  margin: 0 0 22px;
  font-size: 14px; line-height: 1.7;
  color: var(--ink-2, #1F2D45);
  word-break: keep-all;
}
.svc-modal-body p { margin: 0 0 10px; }
.svc-modal-body p:last-child { margin: 0; }
.svc-modal-close {
  display: block;
  width: 100%;
  padding: 13px 18px;
  background: var(--brand, #1B6BFF);
  color: white;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.svc-modal-close:hover { background: #1559e0; }
@keyframes svcModalBackdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes svcModalIn {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ───── 모바일에서 상단 topbar 숨김 ─────
   1599-1579 / 1:1문의 안내 띠 — 하단 CTA 바에 동일 진입점 있어 중복. */
@media (max-width: 720px) {
  .topbar { display: none !important; }
}

/* ───── PC 전용 우측 하단 floating 버튼 스택 (≥721px만 노출) ─────
   체험신청 primary + 1:1 문의 secondary. 모바일은 하단 CTA 바에 둘 다 있어 중복 회피. */
.pc-fab-stack { display: none; }
@media (min-width: 721px) {
  .pc-fab-stack {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 95;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
  }
  .pc-fab {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 22px 13px 18px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: -0.01em;
    text-decoration: none !important;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .pc-fab svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }
  .pc-fab:active { transform: translateY(0); }

  /* Secondary — 1:1 문의 (위쪽, 흰 배경) */
  .pc-fab-qna {
    background: white;
    color: var(--ink) !important;
    border: 1px solid var(--line);
    box-shadow: 0 4px 12px rgba(15,40,90,.08);
  }
  .pc-fab-qna:hover {
    border-color: var(--brand);
    color: var(--brand) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(27,107,255,.18);
  }

  /* Primary — 체험 신청 (아래쪽, brand 컬러) */
  .pc-fab-demo {
    background: var(--brand);
    color: white !important;
    padding: 14px 22px 14px 20px;
    font-size: 15px;
    box-shadow: 0 8px 24px rgba(27,107,255,.35), 0 2px 6px rgba(0,0,0,.08);
  }
  .pc-fab-demo:hover {
    background: #1559e0;
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(27,107,255,.45), 0 4px 8px rgba(0,0,0,.1);
  }
  .pc-fab-demo svg { width: 20px; height: 20px; }
  .pc-fab-demo .arrow {
    font-size: 16px;
    margin-left: 2px;
    transition: transform .2s ease;
  }
  .pc-fab-demo:hover .arrow { transform: translateX(3px); }
}

/* ───── 데스크톱에서 모바일 CTA 바 강제 숨김 ─────
   JS가 모든 viewport에 inject하지만 CSS는 720px 이하에서만 .mobile-cta-bar 스타일 적용.
   기본값으로 숨겨놓고 모바일 미디어쿼리에서 display:flex로 켠다. */
.mobile-cta-bar { display: none; }

/* ───── Footer 운영사 로고 (가로형) ─────
   foot-bottom 우측에 위넥스소프트 로고 표시. 흰 배경 라이트 톤 보정 위해
   opacity·height 조정. 모바일에선 줄바꿈 방지 + 사이즈 축소. */
.foot-corp-logo {
  height: 38px;
  width: auto;
  opacity: .85;
  flex-shrink: 0;
  filter: brightness(1.1);
}
@media (max-width: 720px) {
  .foot-bottom { flex-wrap: wrap; gap: 16px; }
  .foot-corp-logo { height: 30px; }
}

/* ───── Toast 방어적 숨김 (모든 viewport)
   디자인은 transform translate(-50%, 100px)로 화면 밖 처리하지만
   iOS Safari 등 일부 브라우저에서 transform이 stuck되는 케이스가 있어
   .show 없으면 명시적으로 invisible + 클릭 불가 처리. */
.toast { visibility: hidden; pointer-events: none; }
.toast.show { visibility: visible; pointer-events: auto; }

/* ───── 980px BP: 디자인이 1차 폴백한 곳 보강 ───── */
@media (max-width: 980px) {
  section { padding: 64px 0; }
  .container { padding: 0 20px; }
  .logos { grid-template-columns: repeat(3, 1fr); }
}

/* ───── 720px BP: 모바일 본격 처리 ───── */
@media (max-width: 720px) {
  section { padding: 56px 0; }
  .container { padding: 0 16px; }

  /* 디자인이 980px에서 2컬럼 유지로 둔 그리드들 → 1컬럼 강제 */
  .flow-grid,
  .industries,
  .philo-grid,
  .foot-grid {
    grid-template-columns: 1fr;
  }

  /* 5컬럼 로고 그리드 → 모바일 2컬럼 */
  .logos { grid-template-columns: repeat(2, 1fr); }

  /* hero 신뢰지표 4개 — flex+wrap이면 4번째가 줄 밀림 → 2×2 그리드로 정렬 */
  .hero-meta {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 18px 14px !important;
  }
  .hero-meta b { font-size: 20px; }

  /* hero 상단 여백 축소 — 헤더(로고)와 pill 간격을 pill 아래 간격과 맞춤 */
  .hero { padding: 24px 0 64px !important; }

  /* 데스크톱 nav 숨김 → 햄버거가 대신함 */
  nav.main { display: none; }
  /* topbar — 모바일은 1:1 문의만 노출 (공지사항은 햄버거 메뉴에) */
  .topbar .links { display: flex !important; gap: 12px; align-items: center; }
  .topbar .links a[href="/notice.php"] { display: none; }
  .topbar .links a { font-size: 11.5px; padding: 0; white-space: nowrap; opacity: 1; }
  /* 좌측 고객센터 텍스트 — board.css가 520px에서 강제 숨김 처리하므로 !important로 재노출 */
  .topbar-inner { gap: 10px; }
  .topbar-inner > div:first-child,
  .topbar > .container > div:first-child {
    display: block !important;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 auto;
    min-width: 0;
  }

  /* 햄버거 토글 노출 (JS가 주입한 요소) */
  .nav-mobile-toggle { display: inline-flex; }

  /* 헤더 액션 영역 — 데스크톱 ghost 버튼 숨김(드로워에서 대체) */
  .nav-actions { gap: 6px; margin-left: auto; }
  .nav-actions .btn.ghost { display: none; }

  /* 타이포그래피 모바일 추가 축소 */
  h1.hero-title { font-size: 32px; line-height: 1.2; }
  h2.section-title { font-size: 24px; line-height: 1.25; }

  /* 터치 타겟 ≥ 44px (iOS HIG / Material) */
  .btn { padding: 12px 18px; min-height: 44px; }
  .btn.lg { padding: 16px 22px; min-height: 52px; }

  /* 폼 입력 — iOS 자동 줌 방지(16px 이상) + 터치 친화 */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="password"],
  textarea,
  select {
    min-height: 44px;
    font-size: 16px;
  }

  /* Hero dashboard mock — 모바일에선 시각적 노이즈 → 숨김
     (디자인의 .mock-wrap 슬라이더 + .mock-dots 페이저 모두 제거) */
  .mock-wrap,
  .mock-dots,
  .mock { display: none !important; }

  /* ROI 결과 카드 — flex space-between으로 라벨·값 양쪽이 좁아져 wrap 발생.
     모바일에선 세로로 쌓아 각 항목 가독성 확보 */
  .roi-results .head { flex-direction: column !important; align-items: flex-start !important; gap: 4px; }
  .roi-row { flex-direction: column !important; align-items: flex-start !important; gap: 4px; }
  .roi-row b { font-size: 22px; }
  /* ROI 박스 — "/ 도입비 대비"가 줄바꿈으로 깨지므로 block 처리해 자연 정렬 */
  .roi-savings { padding: 22px 16px !important; }
  .roi-savings .big { font-size: 34px !important; }
  .roi-savings .unit { display: block; margin-left: 0 !important; margin-top: 6px; font-size: 14px; }

  /* 기능 탭 패널 (.tab-panel + .feat-grid) — 데스크톱 padding 36px가 모바일에서 너무 커서
     2컬럼 .feat 박스가 좁아짐. 모바일은 1컬럼으로 펼쳐서 컨텐츠 가독성 우선. */
  .tab-panel { padding: 18px !important; min-height: 0 !important; border-radius: 14px !important; }
  .tab-panel h3 { font-size: 22px; }
  .tab-panel > p.lead { font-size: 14px; margin: 0 0 18px; }
  .feat-grid { grid-template-columns: 1fr !important; gap: 10px !important; }
  .feat { padding: 14px; min-width: 0; }

  /* 체험신청 폼 + board의 .form-row — 모바일에서 무조건 1컬럼.
     인라인 style="grid-template-columns: 1fr 3fr" 같은 것도 !important로 무효화 */
  .form-grid,
  .form-row,
  .form-row.dual {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .field, .field.full { grid-column: auto !important; }
  .field label { font-size: 13px; }
  /* width:100% — 체크박스/라디오는 제외 (네이티브 사이즈 보존, 실폰에서 100%로 늘어나면 라벨이 깨짐) */
  .field input[type="text"],
  .field input[type="email"],
  .field input[type="tel"],
  .field input[type="number"],
  .field input[type="password"],
  .field select,
  .field textarea {
    width: 100%;
    box-sizing: border-box;
  }
  /* 체크박스 행 — 네이티브 크기 유지 + 라벨 옆에 자연스럽게 */
  .field .check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }
  .field .check-row input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
  }
  .field .check-row label {
    flex: 1 1 auto;
    font-size: 14px !important;
    line-height: 1.5;
  }

  /* 회사소개 카드 — 디자인이 인라인 style="grid-template-columns: repeat(3, 1fr)"로
     박아둬서 미디어쿼리가 안 먹음. 속성 선택자로 surgical 매칭 */
  div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* Footer 아코디언 — h5 클릭 토글. 회사정보(첫 div) 제외 나머지 섹션이 펼침/접힘 */
  footer .foot-grid {
    gap: 0 !important;          /* 디자인의 40px gap → 모바일 0 (h5 padding이 간격 담당) */
    margin-bottom: 16px !important;
  }
  footer .foot-grid > div {
    border-bottom: 1px solid rgba(255,255,255,.08);
    padding: 0;
  }
  footer .foot-grid > div:last-child { border-bottom: 0; }
  footer .foot-grid > div:first-child { padding: 0 0 16px; }
  footer h5 {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    margin: 0 !important;
  }
  footer h5::after {
    content: '+';
    font-size: 22px;
    font-weight: 400;
    color: rgba(255,255,255,.55);
    line-height: 1;
  }
  footer h5.acc-open::after { content: '−'; }
  footer .foot-grid > div ul {
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease, padding .25s ease;
  }
  footer h5.acc-open + ul {
    max-height: 600px;
    padding-bottom: 16px;
  }

  /* Phone frame mock — 모바일에서 너무 큼 → 축소 */
  .phone-frame { transform: scale(0.85); transform-origin: top center; }

  /* 가로 스크롤 방지 안전망 */
  body { overflow-x: hidden; }
  .container { max-width: 100%; }

  /* ───── 하단 고정 CTA 바 (모바일 전용) ─────
     항상 보이는 메뉴·1:1 문의 진입점. JS가 동적 주입. */
  .mobile-cta-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 90;
    display: flex;
    height: 56px;
    padding-bottom: env(safe-area-inset-bottom);
    background: white;
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgba(15,40,90,.06);
  }
  .mobile-cta-btn {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    border: 0;
    color: var(--ink-2);
    font-size: 10.5px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none !important;
    padding: 0;
    transition: color .12s, background .12s;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: -0.01em;
  }
  .mobile-cta-btn + .mobile-cta-btn {
    border-left: 1px solid var(--line);
  }
  .mobile-cta-btn:active {
    background: var(--bg-2);
    color: var(--brand);
  }
  .mobile-cta-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  /* 본문 하단 padding (CTA 바와 겹치지 않게) */
  body {
    padding-bottom: calc(56px + env(safe-area-inset-bottom));
  }
}

/* ───── 380px 이하 초소형 폰 (Galaxy fold open 등) ───── */
@media (max-width: 380px) {
  h1.hero-title { font-size: 28px; }
  h2.section-title { font-size: 22px; }
  .container { padding: 0 14px; }
  .logos { grid-template-columns: repeat(2, 1fr); }
}

/* ───── 햄버거 토글 + 드로워 컴포넌트 (JS가 주입) ───── */

.nav-mobile-toggle {
  display: none; /* 720px 이하에서 inline-flex */
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s;
}
.nav-mobile-toggle:hover { border-color: var(--brand); }
.nav-mobile-toggle:active { transform: scale(0.96); }
.nav-mobile-toggle svg {
  width: 22px;
  height: 22px;
  stroke: var(--ink);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.nav-mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(11, 27, 51, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.nav-mobile-drawer.open {
  opacity: 1;
  pointer-events: auto;
}
.nav-mobile-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 84vw);
  background: white;
  padding: 16px 20px 24px;
  box-shadow: -10px 0 40px rgba(15, 40, 90, .18);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.32,.72,.0,1);
  overflow-y: auto;
}
.nav-mobile-drawer.open .nav-mobile-panel {
  transform: translateX(0);
}
.nav-mobile-panel-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}
.nav-mobile-panel-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  color: var(--ink);
}
.nav-mobile-panel-close:hover { background: var(--bg-2); }
.nav-mobile-panel a {
  display: block;
  padding: 14px 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-2);
  border-radius: 10px;
  text-decoration: none;
  transition: all .12s;
}
.nav-mobile-panel a:hover {
  background: var(--bg-2);
  color: var(--brand);
}
.nav-mobile-panel .nav-mobile-divider {
  height: 1px;
  background: var(--line);
  margin: 14px 4px;
}
.nav-mobile-panel .nav-mobile-cta {
  margin-top: auto;
  padding-top: 18px;
}
.nav-mobile-panel .nav-mobile-cta .btn {
  width: 100%;
  justify-content: center;
}

/* 드로워 열렸을 때 body 스크롤 잠금 */
body.nav-mobile-locked { overflow: hidden; }
