/* ============================================================
   짬프레스 공통 스타일
   - 색상은 :root 변수로 관리 (data/site.config.js 의 색과 맞춰 수정)
   - 모바일 우선 반응형
   ============================================================ */

:root {
  --main: #16324f;        /* 메인 딥 네이비 */
  --main-dark: #0e2338;
  --accent: #e8842c;      /* 서브 웜 오렌지 */
  --accent-soft: #fdf1e4;
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --text: #24303c;
  --text-soft: #5b6b7b;
  --line: #e3e8ee;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(22, 50, 79, 0.07);
  --w-content: 1080px;
  --w-article: 760px;
}

/* ---------- 리셋 & 기본 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.75;
  word-break: keep-all;
}
img { max-width: 100%; height: auto; }
a { color: var(--main); text-decoration: none; }
a:hover { color: var(--accent); }

.container { max-width: var(--w-content); margin: 0 auto; padding: 0 20px; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--main); color: #fff; padding: 8px 16px; z-index: 100;
}
.skip-link:focus { left: 0; color: #fff; }

/* ---------- 헤더 ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--main); color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; letter-spacing: -0.5px;
}
.brand-text { font-weight: 800; font-size: 20px; color: var(--main); line-height: 1.2; display: flex; flex-direction: column; }
.brand-text small { font-weight: 500; font-size: 11px; color: var(--text-soft); letter-spacing: 1.5px; }

.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  padding: 8px 12px; border-radius: 8px;
  font-size: 15px; color: var(--text);
}
.site-nav a:hover { background: var(--bg-soft); color: var(--main); }
.site-nav a.active { color: var(--accent); font-weight: 700; }

.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--main); margin: 5px 0; transition: 0.2s; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  /* 햄버거 → X 애니메이션 (aria-expanded 상태 기반) */
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .site-nav {
    display: none; width: 100%; flex-direction: column; padding: 4px 0 12px;
    animation: navDrop 0.18s ease-out;
  }
  .site-nav.open { display: flex; }
  /* 터치 타겟 확대(44px+) + 마지막 항목 구분선 제거 */
  .site-nav a { padding: 13px 8px; border-bottom: 1px solid var(--line); border-radius: 0; font-size: 15.5px; }
  .site-nav a:last-child { border-bottom: none; }
  .site-nav a.active { border-left: 3px solid var(--accent); padding-left: 12px; background: var(--accent-soft); }
  @keyframes navDrop {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

/* ---------- 히어로 ---------- */
.hero {
  background: linear-gradient(160deg, var(--main) 0%, var(--main-dark) 100%);
  color: #fff; padding: 72px 0;
}
.hero-kicker { color: var(--accent); font-weight: 700; letter-spacing: 0.5px; margin-bottom: 12px; }
.hero h1 { font-size: clamp(28px, 4.5vw, 42px); line-height: 1.35; margin-bottom: 18px; }
.hero-desc { max-width: 640px; color: #d6dee7; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-block; padding: 12px 22px; border-radius: 10px;
  font-weight: 700; font-size: 15px; transition: 0.15s; border: 1.5px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #d3731f; color: #fff; }
.btn-ghost { border-color: rgba(255,255,255,0.5); color: #fff; }
.btn-ghost:hover { border-color: #fff; color: #fff; background: rgba(255,255,255,0.08); }
.page-body .btn-ghost, .notfound .btn-ghost { border-color: var(--main); color: var(--main); }
.page-body .btn-ghost:hover, .notfound .btn-ghost:hover { background: var(--bg-soft); }

/* ---------- 섹션 공통 ---------- */
/* 주의: .container 와 같은 요소에 쓰이므로 좌우 패딩을 덮어쓰지 않게 상하만 지정 */
.section { padding-top: 56px; padding-bottom: 56px; }
.section-sm { margin: 40px 0; }
.section-tint { background: var(--bg-soft); }
.section h2, .section-sm h2 { font-size: 24px; color: var(--main); margin-bottom: 18px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-desc { color: var(--text-soft); margin: -8px 0 20px; }
.more-link { font-weight: 700; font-size: 14px; color: var(--accent); }

.two-col { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; gap: 28px; } }

/* ---------- 카테고리 카드 ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
@media (max-width: 960px) { .cat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .cat-grid { grid-template-columns: repeat(2, 1fr); } }
.cat-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 16px; display: flex; flex-direction: column; gap: 6px;
  transition: 0.15s; box-shadow: var(--shadow);
}
.cat-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.cat-icon { font-size: 26px; }
.cat-name { font-weight: 800; color: var(--main); }
.cat-short { font-size: 13px; color: var(--text-soft); line-height: 1.5; }

/* ---------- 글 카드 ---------- */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 580px) { .card-grid { grid-template-columns: 1fr; } }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: 0.15s; overflow: hidden;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-link { display: block; padding: 22px; height: 100%; color: inherit; }
.card-link:hover { color: inherit; }
.card-cat { font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.card-title { font-size: 17px; line-height: 1.5; color: var(--main); margin-bottom: 8px; }
.card-sub {
  font-size: 14px; color: var(--text-soft); line-height: 1.6; margin-bottom: 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { font-size: 12.5px; color: #93a1af; }

/* 칼럼 카드: 일반 글과 구분되는 톤 */
.column-card { background: var(--accent-soft); border-color: #f2ddc4; }
.column-card:hover { border-color: var(--accent); }
.column-label { color: var(--accent); font-weight: 800; font-size: 13px; letter-spacing: 0.3px; }

/* ---------- 홈 하단 ---------- */
.owner-strip { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: stretch; }
@media (max-width: 800px) { .owner-strip { grid-template-columns: 1fr; } }
.cta-box {
  background: var(--main); color: #fff; border-radius: var(--radius);
  padding: 28px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
}
.cta-box h2 { color: #fff; font-size: 20px; margin: 0; }
.cta-box p { color: #c9d4de; font-size: 14.5px; }

/* ---------- 운영자 박스 ---------- */
.author-box {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin: 36px 0 0;
}
.home-author { margin: 0; background: #fff; box-shadow: var(--shadow); }
.author-avatar {
  flex: none; width: 52px; height: 52px; border-radius: 50%;
  background: var(--main); color: #fff; font-weight: 800; font-size: 20px;
  display: grid; place-items: center;
}
.author-avatar.big { width: 76px; height: 76px; font-size: 30px; }
.author-name { font-size: 17px; font-weight: 800; color: var(--main); margin-bottom: 4px; }
.author-role { font-size: 13.5px; color: var(--text-soft); font-weight: 500; }
.author-bio { font-size: 14.5px; color: var(--text-soft); }
.owner-link { border-bottom: 2px solid var(--accent); padding-bottom: 1px; }

/* ---------- 페이지 공통 ---------- */
/* 주의: .container 와 같은 요소에 쓰이므로 좌우 패딩을 덮어쓰지 않게 상하만 지정 */
.page-body { padding-top: 36px; padding-bottom: 72px; }
.page-head { margin: 18px 0 32px; max-width: var(--w-article); }
.page-head h1 { font-size: clamp(26px, 4vw, 34px); color: var(--main); line-height: 1.4; margin-bottom: 12px; }
.page-head p { color: var(--text-soft); }

.breadcrumb { font-size: 13px; color: var(--text-soft); display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb .sep { color: #b6c0ca; }
.breadcrumb span[aria-current] { color: var(--text-soft); max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.count { font-size: 14px; color: var(--text-soft); font-weight: 500; }
.catlist-item { border-top: 1px solid var(--line); padding: 28px 0; max-width: var(--w-article); }
.catlist-item h2 { font-size: 21px; margin-bottom: 10px; }
.catlist-item p { color: var(--text-soft); margin-bottom: 10px; }

.plainlist { list-style: none; }
.plainlist li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- 글 상세 ---------- */
.article-body article { max-width: var(--w-article); margin: 0 auto; }
.article-head { margin: 20px 0 28px; }
.article-cat { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.article-cat a { color: var(--accent); }
.article-head h1 { font-size: clamp(25px, 4vw, 33px); line-height: 1.45; color: var(--main-dark); margin-bottom: 12px; }
.article-sub { font-size: 16.5px; color: var(--text-soft); margin-bottom: 14px; }
.article-meta { font-size: 13.5px; color: #93a1af; }

.article-body section { margin: 36px 0; }
.article-body h2 { font-size: 21px; color: var(--main); margin-bottom: 14px; padding-top: 8px; }
.article-body p { margin-bottom: 14px; font-size: 16px; }
.body-list { margin: 4px 0 14px 22px; }
.body-list li { margin-bottom: 8px; font-size: 15.5px; }

/* 요약 박스 */
.summary-box {
  background: var(--bg-soft); border-left: 4px solid var(--main);
  border-radius: 0 var(--radius) var(--radius) 0; padding: 20px 22px; margin: 28px 0;
}
.box-title { font-weight: 800; color: var(--main); margin-bottom: 10px; }
.summary-box ul { margin-left: 20px; }
.summary-box li { margin-bottom: 6px; font-size: 15px; }

/* 목차 */
.toc {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 22px; margin: 28px 0; background: #fff;
}
.toc-title { font-weight: 800; color: var(--main); margin-bottom: 8px; font-size: 15px; }
.toc ol { margin-left: 22px; }
.toc li { margin: 4px 0; font-size: 14.5px; }

/* 실수/체크리스트 박스 */
.mistakes-box {
  background: #fdf3f0; border-left: 4px solid #d9634a;
  border-radius: 0 var(--radius) var(--radius) 0; padding: 20px 22px;
}
.mistakes-box h2 { color: #b44a34; font-size: 18px; }
.mistakes-box ul { margin-left: 20px; }
.mistakes-box li { margin-bottom: 8px; font-size: 15px; }

.check-box {
  background: #f0f7f1; border-left: 4px solid #4a9159;
  border-radius: 0 var(--radius) var(--radius) 0; padding: 20px 22px;
}
.check-box h2 { color: #3a7447; font-size: 18px; }
.checklist { list-style: none; }
.checklist li { margin-bottom: 8px; font-size: 15px; padding-left: 26px; position: relative; }
.checklist li::before { content: "✓"; position: absolute; left: 2px; color: #4a9159; font-weight: 800; }

/* FAQ */
.faq details {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 18px; margin-bottom: 10px; background: #fff;
}
.faq summary { font-weight: 700; cursor: pointer; color: var(--main); font-size: 15.5px; }
.faq details p { margin: 10px 0 2px; font-size: 15px; color: var(--text-soft); }

.article-notice {
  font-size: 13.5px; color: #93a1af; border-top: 1px dashed var(--line);
  padding-top: 16px; margin-top: 40px;
}

/* 관련 글 */
.related { margin-top: 36px; }
.related h2 { font-size: 18px; }
.related ul { list-style: none; }
.related li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.tag-col {
  font-size: 11px; background: var(--accent-soft); color: var(--accent);
  padding: 2px 8px; border-radius: 20px; font-weight: 700; margin-left: 6px;
}

/* ---------- 칼럼 상세 ---------- */
.column-article .article-head { border-left: 4px solid var(--accent); padding-left: 18px; }
.column-para { font-size: 16.5px; margin-bottom: 20px; }

/* ---------- 운영자 페이지 ---------- */
.author-hero { display: flex; gap: 22px; align-items: center; }
.admin-cta {
  background: var(--accent-soft); border: 1px solid #f2ddc4; border-radius: var(--radius);
  padding: 18px 22px; margin: 0 0 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.admin-cta p { font-weight: 700; color: var(--main); }
.guest-note { color: var(--text-soft); margin-bottom: 20px; font-size: 15px; }
.principle-list { list-style: none; }
.principle-list li {
  padding: 10px 0 10px 24px; position: relative; font-size: 15px;
}
.principle-list li::before { content: "—"; position: absolute; left: 0; color: var(--accent); font-weight: 800; }

/* ---------- 일반 문서(prose) ---------- */
.prose { max-width: var(--w-article); }
.prose h2 { font-size: 20px; color: var(--main); margin: 32px 0 12px; }
.prose p { margin-bottom: 14px; }
.prose ul { margin: 0 0 14px 22px; }
.prose li { margin-bottom: 6px; }
.legal p, .legal li { font-size: 15px; }

/* ---------- 문의 폼 ---------- */
.contact-form { max-width: 560px; margin: 8px 0 36px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; color: var(--main); }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 15px; background: #fff;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--accent);
}
.contact-form .btn { border: none; cursor: pointer; }
.form-note { font-size: 13px; color: #93a1af; margin-top: 12px; }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 90px 20px; }
.nf-code { font-size: 80px; font-weight: 800; color: var(--line); line-height: 1; margin-bottom: 12px; }
.notfound h1 { color: var(--main); margin-bottom: 12px; }
.notfound p { color: var(--text-soft); margin-bottom: 24px; }
.notfound .hero-actions { justify-content: center; }

/* ---------- 푸터 ---------- */
.site-footer { background: var(--main-dark); color: #b9c5d1; margin-top: 40px; }
.footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; padding: 48px 20px 28px;
}
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; gap: 24px; } }
.footer-brand { color: #fff; font-weight: 800; font-size: 18px; margin-bottom: 10px; }
.footer-brand small { font-weight: 500; font-size: 11px; letter-spacing: 1.5px; color: #8fa0b0; }
.footer-about p { font-size: 14px; margin-bottom: 8px; }
.footer-owner a { color: #fff; }
.footer-owner a:hover { color: var(--accent); }
.footer-links { display: flex; gap: 48px; }
.footer-links-title { color: #fff; font-weight: 700; font-size: 13.5px; margin-bottom: 10px; }
.footer-links a { display: block; color: #b9c5d1; font-size: 14px; padding: 4px 0; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.12); padding: 18px 20px; font-size: 13px; color: #8fa0b0; }

/* ============================================================
   모바일 UI/UX 개선 (2026-08 개선분)
   - 가로 오버플로우 원천 차단 (좌우 잘림 방지)
   - 소형 화면 여백·타이포 최적화
   - 맨 위로 버튼
   ============================================================ */

/* 가로 스크롤/잘림 방지: 어떤 요소가 넘쳐도 페이지가 옆으로 밀리지 않게 */
html, body { overflow-x: clip; max-width: 100%; }
body { overflow-wrap: break-word; }  /* keep-all 유지하되 긴 토큰(URL 등)은 강제 줄바꿈 */
.card, .cat-card, .panel, .summary-box, .toc, .mistakes-box, .check-box { min-width: 0; }

/* 브레드크럼: 줄바꿈 대신 가로 스와이프 (제목이 길어도 레이아웃 안 깨짐) */
@media (max-width: 600px) {
  .breadcrumb {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding-bottom: 4px;
  }
  .breadcrumb::-webkit-scrollbar { display: none; }
  .breadcrumb a, .breadcrumb span { white-space: nowrap; }
}

/* 소형 화면 여백·타이포 최적화 */
@media (max-width: 600px) {
  .container { padding-left: 16px; padding-right: 16px; }
  .hero { padding: 44px 0; }
  .hero-desc { font-size: 15px; }
  .section { padding-top: 40px; padding-bottom: 40px; }
  .section h2, .section-sm h2 { font-size: 21px; }
  .page-body { padding-top: 24px; padding-bottom: 56px; }
  .page-head { margin: 14px 0 24px; }
  .card-grid { gap: 14px; }
  .card-link { padding: 18px; }
  .cat-grid { gap: 10px; }
  .cat-card { padding: 16px 14px; }
  .article-body h2 { font-size: 19.5px; }
  .article-sub { font-size: 15.5px; }
  .summary-box, .toc, .mistakes-box, .check-box { padding: 16px 18px; }
  .author-box { padding: 18px; gap: 12px; }
  .author-hero { gap: 14px; }
  .author-avatar.big { width: 60px; height: 60px; font-size: 24px; }
  .footer-grid { padding: 36px 16px 22px; }
  .footer-links { gap: 32px; }
  .btn { padding: 12px 18px; font-size: 14.5px; }
  .cta-box { padding: 22px; }
  .admin-cta { padding: 15px 18px; }
}

/* 터치 반응: 탭 하이라이트 제거 + 카드 눌림 피드백 */
a, button { -webkit-tap-highlight-color: transparent; }
@media (hover: none) {
  .card:active, .cat-card:active { transform: scale(0.985); border-color: var(--accent); }
}

/* 맨 위로 버튼 (main.js가 생성, 600px 이상 스크롤 시 표시) */
.back-to-top {
  position: fixed; right: 16px; bottom: 20px; z-index: 60;
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--main); color: #fff; font-size: 18px;
  box-shadow: 0 4px 14px rgba(22, 50, 79, 0.3);
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.back-to-top.show { opacity: 0.92; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover { opacity: 1; }
