/* ============================================================
   모바일/태블릿 대응 (견고화 버전)
   - DC 런타임이 인라인 스타일을 CSSOM 정규화(콜론 뒤 공백)하므로
     속성 선택자는 정규화 형태/구분되는 부분 문자열로 작성.
   - 헤더/네비는 값에 의존하지 않게 구조 선택자로 처리.
   ============================================================ */

/* 가로 오버플로 하드 가드 */
@media (max-width: 1024px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  img, svg, video { max-width: 100%; height: auto; }
}

/* ---------- 태블릿 이하 (≤900px) ---------- */
@media (max-width: 900px) {
  /* 본문 컨테이너: 폭 제한 해제 + 좌우 여백 축소 */
  [style*="max-width: 1344px"],
  [style*="max-width: 1280px"],
  [style*="max-width: 1080px"],
  [style*="max-width: 980px"],
  [style*="max-width: 960px"],
  [style*="max-width: 920px"] {
    max-width: 100% !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  /* 헤더: 행 줄바꿈 허용, 네비는 전체폭 + 줄바꿈(잘림 방지) */
  header > div { flex-wrap: wrap !important; row-gap: 8px !important; }
  header nav {
    flex-basis: 100% !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 10px 16px !important;
    font-size: 15px !important;
  }
  header nav a { flex-shrink: 0 !important; white-space: nowrap !important; }
  /* 우측 더미 스페이서 숨김 */
  [style*="width: 150px"] { display: none !important; }

  /* 다단 그리드 → 축소/1열 */
  [style*="1.05fr"]      { grid-template-columns: 1fr !important; min-height: 0 !important; } /* 히어로 */
  [style*="1.5fr 1fr"]   { grid-template-columns: 1fr !important; }                          /* 푸터 */
  [style*="140px 1fr"]   { grid-template-columns: 1fr !important; }                          /* 폼 행(상담방식 등) */
  [style*="240px 1fr"]   { grid-template-columns: 1fr !important; }
  [style*="repeat(4"]    { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  [style*="repeat(3"]    { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

  /* 히어로 일러스트 칼럼/타이틀 */
  [style*="height: 412px"] { display: none !important; }
  [style*="font-size: 68px"] { font-size: 44px !important; }

  /* CTA 배너 세로 스택 */
  [style*="padding: 46px 52px"] { flex-direction: column !important; align-items: flex-start !important; padding: 32px 26px !important; }

  /* 그리드 자식이 안 줄어들어 넘치는 것 방지(한글 글자단위 줄바꿈 방지) */
  [style*="grid-template-columns"] > * { min-width: 0 !important; }
}

/* ---------- 모바일 (≤560px) ---------- */
@media (max-width: 560px) {
  [style*="max-width: 1344px"],
  [style*="max-width: 1280px"],
  [style*="max-width: 1080px"],
  [style*="max-width: 980px"],
  [style*="max-width: 960px"],
  [style*="max-width: 920px"] {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* 작은 폭 컨테이너(폼/카드)도 화면 안에 */
  [style*="max-width: 620px"],
  [style*="max-width: 520px"],
  [style*="max-width: 460px"],
  [style*="max-width: 440px"] { max-width: 100% !important; }

  /* 타이틀 축소 */
  [style*="font-size: 68px"] { font-size: 34px !important; }
  [style*="font-size: 30px"] { font-size: 24px !important; }
  [style*="font-size: 28px"] { font-size: 23px !important; }

  header nav { font-size: 14px !important; gap: 8px 12px !important; }

  /* 모든 콘텐츠 그리드 1열 */
  [style*="1fr 1fr"],
  [style*="repeat(2"],
  [style*="repeat(3"],
  [style*="repeat(4"],
  [style*="240px 1fr"],
  [style*="140px 1fr"],
  [style*="minmax(0"] { grid-template-columns: 1fr !important; }

  /* 라디오/체크박스 묶음: 줄바꿈 허용(글자 세로깨짐 방지) */
  [style*="gap: 26px"],
  [style*="justify-content: space-between"] { flex-wrap: wrap !important; }

  /* 전체기술 특허목록: 7열 → 3열(국가·기술명·화살표) */
  [style*="148px 150px"] { grid-template-columns: 40px 1fr 28px !important; }
  [style*="148px 150px"] > :nth-child(1),
  [style*="148px 150px"] > :nth-child(4),
  [style*="148px 150px"] > :nth-child(5),
  [style*="148px 150px"] > :nth-child(6) { display: none !important; }

  /* 상세 패널 2열 → 1열 */
  [style*="minmax(0, 1fr)"],
  [style*="minmax(0,1fr)"] { grid-template-columns: 1fr !important; }
}
