/* ===== 기본 ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', system-ui, -apple-system, sans-serif;
  color: #1f2937;
  line-height: 1.6;
  background: #fff;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  word-break: keep-all;
}
img, svg { max-width: 100%; display: block; height: auto; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

:root {
  --primary: #1e3a8a;
  --primary-dark: #172554;
  --accent: #b08d57;
  --bg-alt: #f8fafc;
  --border: #e5e7eb;
  --muted: #6b7280;
  --text: #1f2937;
  --header-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* 고정 헤더가 앵커를 가리지 않도록 (모바일·데스크톱 공통) */
:target { scroll-margin-top: calc(var(--header-h) + 12px); }
[id] { scroll-margin-top: calc(var(--header-h) + 12px); }

.container { max-width: 1140px; margin: 0 auto; padding: 0 20px; }

/* ===== 헤더 ===== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s;
}
.site-header.scrolled { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.nav-wrap { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }
.brand { font-size: 18px; font-weight: 700; color: var(--primary); letter-spacing: -0.3px; }
.nav { display: flex; gap: 22px; align-items: center; }
.nav a {
  font-size: 15px; color: #374151; padding: 6px 0;
  position: relative;
  transition: color 0.15s;
}
.nav a:not(.nav-cta):hover { color: var(--primary); }
.nav-cta {
  background: var(--primary); color: #fff !important;
  padding: 8px 14px !important; border-radius: 6px;
  transition: background 0.15s;
}
.nav-cta:hover { background: var(--primary-dark); }

/* 햄버거 버튼 */
.nav-toggle {
  display: none;
  width: 42px; height: 42px;
  background: none; border: none; cursor: pointer;
  padding: 0; position: relative;
}
.nav-toggle-bar {
  position: absolute; left: 10px; right: 10px; height: 2px;
  background: #374151; border-radius: 2px;
  transition: transform 0.25s, opacity 0.2s, top 0.25s;
}
.nav-toggle-bar:nth-child(1) { top: 14px; }
.nav-toggle-bar:nth-child(2) { top: 20px; }
.nav-toggle-bar:nth-child(3) { top: 26px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { top: 20px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { top: 20px; transform: rotate(-45deg); }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #312e81 100%);
  color: #fff;
  padding: clamp(60px, 10vw, 110px) 0 clamp(50px, 8vw, 90px);
}
.hero-inner { text-align: center; }
.hero-title {
  font-size: clamp(26px, 6vw, 44px);
  font-weight: 800; margin: 0 0 14px; letter-spacing: -1px;
  line-height: 1.25;
}
.hero-subtitle {
  font-size: clamp(15px, 2.5vw, 19px);
  opacity: 0.92; margin: 0 0 clamp(24px, 4vw, 32px);
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ===== 버튼 ===== */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 6px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  border: 2px solid transparent;
  min-height: 44px;        /* 모바일 터치 타겟 */
  line-height: 1.2;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #8e7045; }
.btn-outline { background: transparent; color: #fff; border-color: rgba(255,255,255,0.6); }
.btn-outline:hover { background: rgba(255,255,255,0.1); border-color: #fff; }
.btn-lg { padding: 14px 32px; font-size: 16px; }

/* ===== 섹션 공통 ===== */
.section { padding: clamp(48px, 8vw, 80px) 0; }
.section-alt { background: var(--bg-alt); }
.section-title {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 700; text-align: center;
  margin: 0 0 14px; color: var(--primary-dark); letter-spacing: -0.5px;
}
.section-title::after {
  content: ''; display: block; width: 48px; height: 3px;
  background: var(--accent); margin: 14px auto 0;
}
.section-lead {
  text-align: center; color: var(--muted);
  font-size: clamp(14px, 2.4vw, 16px);
  max-width: 720px; margin: 0 auto clamp(28px, 5vw, 40px);
}
.empty { text-align: center; color: var(--muted); padding: 30px 0; }

/* ===== 그리드 ===== */
.grid { display: grid; gap: clamp(16px, 3vw, 24px); margin-top: clamp(28px, 5vw, 40px); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

.card {
  background: #fff; border: 1px solid var(--border);
  padding: clamp(20px, 3vw, 28px) clamp(18px, 3vw, 24px);
  border-radius: 8px; text-align: center;
  transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover { box-shadow: 0 6px 18px rgba(0,0,0,0.06); transform: translateY(-2px); }
.card h3 { margin: 0 0 10px; color: var(--primary); font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }

.feature { text-align: center; padding: 16px 12px; }
.feature-num { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: 1px; }
.feature h4 { margin: 8px 0 6px; font-size: 16px; color: var(--primary-dark); }
.feature p { margin: 0; font-size: 13px; color: var(--muted); }

/* ===== 교육과정 ===== */
.semester-list {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: clamp(16px, 3vw, 24px);
  margin-top: clamp(28px, 5vw, 40px);
}
.semester {
  background: #fff; border: 1px solid var(--border);
  border-radius: 8px; padding: clamp(18px, 3vw, 24px);
}
.semester-title {
  font-size: 18px; color: var(--primary); margin: 0 0 16px;
  padding-bottom: 12px; border-bottom: 2px solid var(--bg-alt);
}
.course-list { list-style: none; padding: 0; margin: 0; }
.course-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px dashed var(--border);
  font-size: 14px; flex-wrap: wrap;
}
.course-item:last-child { border-bottom: none; }
.badge {
  display: inline-block; padding: 2px 8px;
  font-size: 12px; font-weight: 600; border-radius: 4px; flex-shrink: 0;
}
.badge-required { background: #fef3c7; color: #92400e; }
.badge-optional { background: #dbeafe; color: #1e40af; }
.course-cat { color: var(--muted); font-size: 13px; min-width: 56px; }
.course-name { color: var(--text); font-weight: 500; flex: 1 1 auto; min-width: 0; }

/* ===== 수강안내 ===== */
.guide-table {
  margin-top: clamp(28px, 5vw, 40px);
  background: #fff;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.guide-row {
  display: grid; grid-template-columns: 180px 1fr;
  border-bottom: 1px solid var(--border);
}
.guide-row:last-child { border-bottom: none; }
.guide-key {
  background: var(--bg-alt); padding: 16px 20px;
  font-weight: 600; color: var(--primary-dark);
}
.guide-value { padding: 16px 20px; color: var(--text); word-break: break-word; }

/* ===== 공지사항 ===== */
.notice-list { list-style: none; padding: 0; margin: clamp(28px, 5vw, 40px) 0 0; }
.notice-item {
  background: #fff; border: 1px solid var(--border);
  border-radius: 6px; margin-bottom: 12px; transition: all 0.2s;
}
.notice-item:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(30,58,138,0.08); }
.notice-link { display: block; padding: 18px 20px; }
.notice-title {
  font-weight: 600; color: var(--primary-dark);
  margin-bottom: 6px;
  font-size: clamp(15px, 2.4vw, 16px);
  word-break: break-word;
}
.notice-summary { color: var(--muted); font-size: 14px; margin-bottom: 6px; word-break: break-word; }
.notice-date { color: #9ca3af; font-size: 13px; }

/* ===== Q&A ===== */
.qna-list { margin: clamp(28px, 5vw, 40px) auto 0; max-width: 860px; }
.qna-item {
  background: #fff; border: 1px solid var(--border);
  border-radius: 6px; margin-bottom: 10px; overflow: hidden;
}
.qna-q {
  width: 100%; background: none; border: none; cursor: pointer;
  padding: 16px 18px; display: flex; align-items: center; gap: 12px;
  text-align: left; font-size: 15px; color: var(--text); font-family: inherit;
  min-height: 56px;
}
.qna-q:hover { background: var(--bg-alt); }
.q-mark, .a-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.q-mark { background: var(--primary); color: #fff; }
.a-mark { background: var(--accent); color: #fff; }
.q-text { flex: 1; font-weight: 500; word-break: break-word; }
.q-arrow { color: var(--muted); transition: transform 0.2s; flex-shrink: 0; }
.qna-q[aria-expanded="true"] .q-arrow { transform: rotate(180deg); }
.qna-a {
  padding: 0 18px 16px; display: flex; gap: 12px;
  background: var(--bg-alt); align-items: flex-start;
}
.qna-a[hidden] { display: none; }
.a-text { flex: 1; padding-top: 16px; color: #374151; white-space: pre-wrap; word-break: break-word; }

/* ===== 신청·문의 ===== */
.apply-wrap { margin-top: clamp(28px, 5vw, 40px); }
.apply-cta {
  text-align: center; background: #fff;
  border: 1px solid var(--border);
  padding: clamp(24px, 4vw, 36px) clamp(18px, 3vw, 24px);
  border-radius: 8px; margin-bottom: 24px;
}
.apply-cta p { margin: 0 0 16px; color: var(--muted); }
.contact-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.contact-item {
  background: #fff; border: 1px solid var(--border);
  padding: 20px; border-radius: 8px; text-align: center;
}
.contact-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.contact-value {
  font-weight: 600; color: var(--primary-dark);
  font-size: 15px; word-break: break-all;
}
.contact-value a:hover { color: var(--accent); }

/* ===== 푸터 ===== */
.site-footer {
  background: var(--primary-dark); color: #cbd5e1;
  padding: 32px 0 calc(28px + var(--safe-bottom));
  font-size: 14px; margin-top: 0;
}
.footer-wrap { display: grid; gap: 14px; }
.footer-title { color: #fff; font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.footer-desc { color: #94a3b8; font-size: 13px; }
.footer-info {
  display: flex; flex-wrap: wrap; gap: 8px 22px;
  font-size: 13px; color: #cbd5e1;
}
.footer-info b { color: #fff; font-weight: 600; margin-right: 4px; }
.footer-info a:hover { color: #fff; text-decoration: underline; }
.footer-copy {
  color: #94a3b8; font-size: 12px;
  padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.08);
}

/* 서브 페이지일 때 푸터가 너무 위에 붙지 않도록 */
body.subpage .site-footer { margin-top: 60px; }

/* ===== 모달 ===== */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.modal-dialog {
  position: relative; background: #fff; border-radius: 10px;
  max-width: 680px; width: calc(100% - 32px);
  max-height: 86vh; overflow-y: auto;
  padding: clamp(22px, 4vw, 32px);
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.modal-close {
  position: absolute; top: 8px; right: 12px;
  background: none; border: none; font-size: 28px;
  cursor: pointer; color: var(--muted); line-height: 1;
  width: 40px; height: 40px;
}
.modal-close:hover { color: var(--text); }
.modal-title {
  margin: 0 0 8px; color: var(--primary-dark);
  font-size: clamp(18px, 3vw, 22px);
  padding-right: 32px;
  word-break: break-word;
}
.modal-date { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.modal-content { color: var(--text); white-space: pre-wrap; line-height: 1.7; word-break: break-word; }

/* ============================================================
   반응형 브레이크포인트
   ============================================================ */

/* 태블릿 가로 ~ 작은 데스크톱 */
@media (max-width: 1024px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}

/* 태블릿 세로 이하: 모바일 메뉴 시작 */
@media (max-width: 900px) {
  .nav-toggle { display: block; }

  /* 풀스크린 드롭다운 메뉴 */
  .nav {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    bottom: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #fff;
    padding: 8px 0 calc(20px + var(--safe-bottom));
    overflow-y: auto;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    border-top: 1px solid var(--border);
    box-shadow: 0 8px 16px rgba(0,0,0,0.06);
  }
  .nav.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .nav a {
    padding: 16px 22px;
    font-size: 16px;
    border-bottom: 1px solid var(--bg-alt);
    min-height: 52px;
    display: flex; align-items: center;
  }
  .nav a:last-child { border-bottom: none; }
  .nav-cta {
    margin: 14px 22px 0;
    text-align: center;
    justify-content: center;
    border-radius: 8px;
  }

  /* 메뉴 열림 시 본문 스크롤 잠금 */
  body.nav-open { overflow: hidden; }

  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .semester-list { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: repeat(2, 1fr); }
}

/* 모바일 (스마트폰) */
@media (max-width: 640px) {
  .container { padding: 0 16px; }

  .grid-3 { grid-template-columns: 1fr; }
  .grid-5 { grid-template-columns: repeat(2, 1fr); }

  /* 수강안내 행: 라벨 위, 값 아래 */
  .guide-row {
    grid-template-columns: 1fr;
  }
  .guide-key {
    padding: 12px 16px 6px;
    font-size: 13px;
    background: var(--bg-alt);
  }
  .guide-value {
    padding: 8px 16px 14px;
    background: #fff;
  }

  .hero-cta { flex-direction: column; align-items: stretch; padding: 0 8px; }
  .hero-cta .btn { width: 100%; }

  .footer-info { flex-direction: column; gap: 6px; }
}

/* 작은 모바일 */
@media (max-width: 380px) {
  .grid-5 { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .course-item { gap: 6px; }
  .course-cat { min-width: auto; }
}

/* 호버 비지원(터치) 기기에서 hover 효과 비활성화 */
@media (hover: none) {
  .card:hover { box-shadow: none; transform: none; }
  .notice-item:hover { border-color: var(--border); box-shadow: none; }
  .qna-q:hover { background: transparent; }
}