/* 자동화 장비 템플릿 커스텀 CSS */
:root{
  --primary: #1e40af; /* deep blue */
  --accent: #0ea5e9;
  --muted: #6b7280;
}

body{ -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; }

button:focus, a:focus, input:focus, textarea:focus{
  outline: 3px solid rgba(30,64,175,0.12);
  outline-offset: 2px;
}

.product-img{ width:100%; height:220px; object-fit:cover; }

/* 가운데 정렬 보조 스타일: 이미지 중앙배치 */
.product-img{ display:block; margin-left:auto; margin-right:auto; }

/* 작은 화면에서 히어로 이미지 비율 조정 */
@media (max-width:640px){ .product-img{ height:180px; } }

/* Hero background image: ensure .hero-bg class shows the hero background
   Use root-relative URL so it resolves correctly when served from the site root */
.hero-bg {
  background-image: url('/assets/images/hero-bg.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

/* 모바일 텍스트 줄바꿈 및 가독성 개선
   - 한국어 기본 동작을 유지하되(단어 단위 불필요한 분리 방지),
     긴 영어 단어/URL 등으로 인한 오버플로우는 허용하여 줄바꿈 처리합니다.
   - 작은 화면에서 라인-하이트를 약간 늘려 가독성 향상.
*/
html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  /* 한국어 텍스트의 자연스러운 줄바꿈을 우선하고, 필요시 강제 줄바꿈 허용 */
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 공통 블록 텍스트의 기본 처리 */
p, li, h1, h2, h3, h4, h5, h6 {
  word-break: keep-all;
  overflow-wrap: break-word;
  hyphens: auto;
}

@media (max-width: 640px) {
  body {
    font-size: 15px; /* 모바일 기본 폰트 사이즈 조정 (필요시 더 낮추거나 높일 수 있음) */
    line-height: 1.7;
  }

  /* 긴 단어(예: URL, verylongword)로 인한 레이아웃 깨짐 방지 */
  .break-anywhere {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

/* Footer: ensure address on first line, phone+fax on next line and center on small screens */
@media (max-width: 640px) {
  footer .max-w-7xl { text-align: center; }
  footer .max-w-7xl > div { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
  .footer-contact { display: block; }
  .footer-address { white-space: normal; }
  .footer-telfax { white-space: normal; margin-top: 0.15rem; }
  /* Remove vertical transform offsets applied inline for desktop so mobile alignment is natural */
  footer .max-w-7xl a img { transform: none !important; }
  footer .max-w-7xl .text-sm { transform: none !important; }
}

/* 문의폼 개인정보처리방침 동의문구: 모바일에서 줄바꿈/정렬 개선 */
@media (max-width: 640px) {
  /* 체크박스와 라벨 텍스트를 같은 라인에 붙이고 수직 중앙 정렬 */
  .consent-wrapper { display: flex; align-items: center; gap: 0.5rem; }
  .consent-wrapper input[type="checkbox"] { margin-top: 0; flex: 0 0 auto; }
  .consent-text { display: block; font-size: 14px; line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere; }
  /* 링크 문구는 괄호 단위로 유지되도록 줄바꿈 억제 */
  .consent-text .consent-link { white-space: nowrap; display: inline-block; margin-left: 0.25rem; }
}

/* Mobile nav styles */
@media (max-width:640px){
  .mobile-nav { position: absolute; left: 0; right: 0; top: 100%; z-index: 40; background: #fff; }
  .mobile-nav .mobile-quickbar { display: flex; gap: 0.5rem; justify-content: center; }
  .mobile-nav .mobile-quickbar a { font-size: 14px; }
  .mobile-nav .mobile-links a { color: #111827; padding-left: 0.5rem; padding-right: 0.5rem; }
  .mobile-nav .mobile-links a:hover { background: #f8fafc; }
  body.mobile-menu-open { overflow: hidden; }
  .mobile-nav { animation: nk-slide-down .16s ease-out; }
  @keyframes nk-slide-down { from { transform: translateY(-8px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
}

/* 프로젝트 페이지: 모바일에서 사이드 네비 숨김 (작은 화면에서 의미가 적으므로 제거) */
@media (max-width:640px){
  .projects-aside { display: none !important; }
}

/* Overview grid: mobile 3x2 and final location card full-width (3x2x1) */
@media (max-width:640px) {
  /* Ensure the company overview grid uses 3 columns on small screens only
     (narrow the selector so other nested grids like 시설현황 are unaffected) */
  #about [data-panel="overview"] .overview-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem; /* matches Tailwind gap-3 */
  }

  /* Make the 소재지 (location) card span full width as the last row */
  #about [data-panel="overview"] .overview-cards .location-card {
    grid-column: 1 / -1;
  }
}

/* Center the pair of cards (임직원수, 자본금) on mobile without breaking desktop grid
   - On large screens the wrapper becomes `display: contents` so each card remains a grid item
   - On small screens the wrapper becomes a block that spans the full row and centers its children
*/
.overview-pair,
.overview-pair .pair-inner {
  display: contents;
}

@media (max-width:640px) {
  .overview-pair { display: block; grid-column: 1 / -1; }
  .overview-pair .pair-inner { display: flex; gap: 0.75rem; justify-content: center; align-items: stretch; }
  .overview-pair .pair-inner > * { flex: 0 0 45%; max-width: 45%; }
}
