/* 다힘국어논술 — 공통 디자인 토큰 + 헤더 + 푸터 스타일
   (index.php의 React 셸과 일관된 룩앤필을 정적 페이지에도 적용) */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --surface-tint: #eff6ff;
  --emph: #0f172a;
  --accent-soft: #fff7ed;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text: #0f172a;
  --text-2: #334155;
  --text-3: #475569;
  --text-4: #94a3b8;

  --primary: #2563eb;
  --primary-700: #1d4ed8;
  --primary-50: #eff6ff;
  --accent: #ea580c;
  --accent-700: #c2410c;
  --accent-50: #fff7ed;

  --green: #16a34a;
  --red: #dc2626;

  --ui: "Pretendard", -apple-system, "Apple SD Gothic Neo", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

body.dahim-shell {
  margin: 0;
  font-family: var(--ui) !important;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.011em;
}
body.dahim-shell a { color: inherit; text-decoration: none; }

.dh-wrap { max-width: 1240px; margin: 0 auto; padding: 0 32px; }

/* ── NAV ────────────────────────────────────────────────── */
.dh-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(248, 250, 252, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 24px -10px rgba(15, 23, 42, 0.08);
}
.dh-nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 76px; gap: 24px;
}

.dh-brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.dh-brand-mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; letter-spacing: -0.04em;
  box-shadow: 0 6px 16px -4px rgba(37, 99, 235, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.dh-brand-name { display: flex; flex-direction: column; line-height: 1.1; }
.dh-brand-name .ko { font-weight: 800; font-size: 16.5px; letter-spacing: -0.025em; color: var(--text); }
.dh-brand-name .en { font-size: 9.5px; color: var(--text-4); letter-spacing: 0.22em; text-transform: uppercase; font-weight: 600; margin-top: 3px; }

.dh-nav-links { display: flex; align-items: center; gap: 2px; list-style: none; padding: 0; margin: 0; }
.dh-nav-links > li { position: relative; }
.dh-nav-links > li > a, .dh-nav-links > li > button {
  position: relative;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 9px 13px; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  color: var(--text-2);
  background: transparent; border: 0;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
  white-space: nowrap;
  font-family: inherit;
}
.dh-nav-links > li > a:hover, .dh-nav-links > li > button:hover {
  color: var(--text);
  background: rgba(15, 23, 42, 0.04);
}
.dh-nav-links a.dh-nav-ai {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(37, 99, 235, 0.02) 100%);
  color: var(--primary) !important;
  border: 1px solid rgba(37, 99, 235, 0.18);
  padding-right: 28px;
}
.dh-nav-links a.dh-nav-ai::after {
  content: '';
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 5px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.18);
}

/* Dropdown */
.dh-nav-dd { position: relative; }
.dh-nav-dd > button .dh-caret { transition: transform .2s ease; }
.dh-nav-dd:hover > button .dh-caret { transform: rotate(180deg); }
.dh-nav-dd-menu {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(-4px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 8px;
  box-shadow: 0 24px 48px -16px rgba(15, 23, 42, 0.18), 0 2px 4px rgba(15, 23, 42, 0.04);
  min-width: 300px; z-index: 100;
  opacity: 0; visibility: hidden;
  transition: opacity .22s ease, transform .22s ease, visibility .22s;
}
.dh-nav-dd:hover .dh-nav-dd-menu, .dh-nav-dd:focus-within .dh-nav-dd-menu {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}
.dh-dd-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; border-radius: 10px;
  transition: background .15s ease;
  color: var(--text);
}
.dh-dd-item:hover { background: var(--primary-50); }
.dh-dd-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--surface-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background .15s ease, color .15s ease;
}
.dh-dd-item:hover .dh-dd-icon { background: var(--primary); color: #fff; }
.dh-dd-text { display: flex; flex-direction: column; min-width: 0; }
.dh-dd-title { font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.dh-dd-sub { font-size: 11.5px; color: var(--text-4); margin-top: 2px; }

/* CTA + gear */
.dh-nav-cta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.dh-nav-gear {
  width: 38px; height: 38px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-4);
  transition: background .15s ease, color .15s ease;
}
.dh-nav-gear:hover { background: var(--surface-soft); color: var(--text-2); }

.dh-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 999px;
  font-weight: 600; font-size: 13.5px;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
  border: 1px solid transparent; white-space: nowrap;
  text-decoration: none;
}
.dh-btn-accent { background: var(--accent); color: #fff !important; box-shadow: 0 6px 16px -6px rgba(234, 88, 12, 0.4); }
.dh-btn-accent:hover { background: var(--accent-700); transform: translateY(-1px); }

/* Mobile burger */
.dh-burger {
  display: none;
  width: 40px; height: 40px; border-radius: 10px;
  background: transparent; border: 0;
  color: var(--text-2); cursor: pointer;
  align-items: center; justify-content: center;
}
.dh-burger:hover { background: var(--surface-soft); }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   React Nav (landing/app.jsx) 의 모바일 햄버거 + drawer
   index.php 같은 React 셸 페이지에서 사용
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.nav-burger {
  display: none;
  width: 40px; height: 40px; border-radius: 10px;
  background: transparent; border: 0;
  color: var(--text-2); cursor: pointer;
  align-items: center; justify-content: center;
}
.nav-burger:hover { background: var(--surface-soft); }

.nav-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 2147483645;
  cursor: pointer;
  animation: navBackdropIn .2s ease;
}
@keyframes navBackdropIn { from { opacity: 0; } to { opacity: 1; } }

.nav-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(340px, 86vw);
  background: #ffffff;
  z-index: 2147483647;
  display: flex; flex-direction: column;
  box-shadow: -10px 0 30px rgba(15, 23, 42, 0.2);
  animation: navDrawerIn .25s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
  pointer-events: auto;
}
@keyframes navDrawerIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

.nav-drawer * { pointer-events: auto !important; }

.nav-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}
.nav-drawer-close {
  width: 38px; height: 38px; border-radius: 10px;
  background: #ffffff; border: 1px solid var(--border);
  color: var(--text-2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.nav-drawer-close:hover { background: var(--surface-soft); color: var(--text); }

.nav-drawer-body {
  flex: 1; overflow-y: auto;
  padding: 16px 14px 28px;
  display: flex; flex-direction: column; gap: 4px;
}

.nav-drawer-link {
  display: block; padding: 13px 16px;
  border-radius: 10px;
  font-size: 15px; font-weight: 700; color: var(--text);
  text-decoration: none;
  transition: background .15s ease;
}
.nav-drawer-link:hover { background: var(--surface-soft); }
.nav-drawer-link.ai {
  background: linear-gradient(135deg, rgba(37,99,235,0.08), rgba(37,99,235,0.02));
  color: var(--primary);
  position: relative; padding-right: 30px;
}
.nav-drawer-link.ai::after {
  content: ''; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 6px; background: var(--accent);
  box-shadow: 0 0 0 3px rgba(234,88,12,0.18);
}

.nav-drawer-group {
  margin: 6px 0 4px;
  padding: 8px 0;
  border-top: 1px dashed var(--border);
}
.nav-drawer-group:first-child { border-top: 0; }
.nav-drawer-label {
  padding: 6px 16px;
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.1em;
  color: var(--text-4); text-transform: uppercase;
}
.nav-drawer-sub {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; margin: 2px 6px;
  border-radius: 10px;
  text-decoration: none; color: var(--text);
}
.nav-drawer-sub:hover { background: var(--primary-50); }
.nav-drawer-sub-icon {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--surface-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.nav-drawer-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 14px 6px 6px;
  padding: 14px 16px;
  background: var(--accent);
  color: #ffffff !important;
  font-weight: 800; font-size: 14.5px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 6px 16px -6px rgba(234,88,12,0.45);
}
.nav-drawer-cta:hover { background: var(--accent-700); color: #ffffff !important; }
.nav-drawer-admin {
  display: block; margin: 8px 6px 0;
  padding: 11px 16px;
  background: var(--surface-soft); color: var(--text-3);
  border-radius: 10px; text-align: center;
  font-size: 13px; font-weight: 700; text-decoration: none;
}
.nav-drawer-admin:hover { background: var(--border); color: var(--text); }

@media (max-width: 1040px) {
  /* React Nav: 데스크톱 메뉴 숨기고 햄버거 표시 */
  .nav-links { display: none !important; }
  .nav-burger { display: inline-flex !important; }
  /* 데스크톱 nav-cta 의 기어/상담 버튼은 그대로 두고 햄버거 옆에 표시 */
}

@media (max-width: 1180px) {
  .dh-nav-links > li > a, .dh-nav-links > li > button { font-size: 13px; padding: 8px 10px; }
}
@media (max-width: 1040px) {
  .dh-nav-links { display: none; }
  .dh-brand-name .en { display: none; }
  .dh-burger { display: inline-flex; }

  /* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
     모바일 nav — 진짜 drawer + backdrop (회색 영역이 클릭 흡수 못하게)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

  /* 백드롭: body 의 가상요소로 만들고, 클릭 시 nav 닫기 (JS 가 처리) */
  body.dahim-nav-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 2147483645;
    cursor: pointer;
  }

  /* 드로어 패널: 화면 우측에 고정, 무조건 최상위, 클릭 가능 보장 */
  body.dahim-nav-open .dh-nav-links {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: min(320px, 85vw) !important;
    background: #ffffff !important;
    padding: 64px 18px 24px !important;
    gap: 6px;
    box-shadow: -8px 0 24px rgba(15, 23, 42, 0.18);
    z-index: 2147483647 !important;
    overflow-y: auto;
    pointer-events: auto !important;
    list-style: none;
    margin: 0;
  }
  body.dahim-nav-open .dh-nav-links > li {
    width: 100%;
    position: relative;
  }
  body.dahim-nav-open .dh-nav-links > li > a,
  body.dahim-nav-open .dh-nav-links > li > button {
    display: flex !important;
    width: 100%;
    justify-content: flex-start;
    padding: 13px 16px;
    font-size: 15px;
    border-radius: 10px;
    pointer-events: auto !important;
    border-bottom: 1px solid var(--border);
  }
  body.dahim-nav-open .dh-nav-links a,
  body.dahim-nav-open .dh-nav-links button { pointer-events: auto !important; }

  /* 드롭다운(커리큘럼) - 드로어 안에선 펼친 상태로 표시 */
  body.dahim-nav-open .dh-nav-dd-menu {
    position: static !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    box-shadow: none;
    border: 0;
    padding: 4px 0 8px 12px;
    min-width: 0;
    background: transparent;
  }

  /* 드로어 안 우상단 닫기(X) - ::after 가상 버튼이 아니라 JS 가 실제 버튼 삽입 */
  body.dahim-nav-open .dh-burger {
    position: fixed;
    top: 14px;
    right: calc(min(320px, 85vw) - 50px);
    z-index: 2147483647;
    background: #f1f5f9;
    border-radius: 8px;
  }
}
@media (max-width: 880px) {
  .dh-wrap { padding: 0 20px; }
  .dh-nav-inner { height: 64px; }
}
@media (max-width: 480px) {
  .dh-nav-inner { height: 56px; }
  .dh-brand-name .en { display: none; }
  .dh-nav-cta .dh-btn { display: none; }
}

/* ── FOOTER ─────────────────────────────────────────────── */
.dh-footer {
  border-top: 1px solid var(--border);
  padding: 80px 0 36px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--ui);
}
.dh-footer-campuses {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 48px;
}
.dh-campus-card {
  background: var(--surface-soft); border: 1px solid var(--border);
  border-radius: 20px; padding: 22px 26px;
  display: flex; align-items: center; gap: 20px;
}
.dh-campus-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.dh-campus-card.primary .dh-campus-icon { background: rgba(37, 99, 235, 0.12); color: var(--primary); }
.dh-campus-card.accent  .dh-campus-icon { background: rgba(234, 88, 12, 0.12); color: var(--accent); }
.dh-campus-body { flex: 1; min-width: 0; }
.dh-campus-tag {
  display: inline-flex; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; margin-right: 8px;
}
.dh-campus-card.primary .dh-campus-tag { background: rgba(37, 99, 235, 0.12); color: var(--primary); }
.dh-campus-card.accent  .dh-campus-tag { background: rgba(234, 88, 12, 0.12); color: var(--accent); }
.dh-campus-city { font-size: 13px; color: var(--text-3); }
.dh-campus-addr { font-size: 15.5px; font-weight: 700; margin-top: 6px; }
.dh-campus-tel  { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.dh-campus-link { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.dh-campus-card.primary .dh-campus-link { color: var(--primary); }
.dh-campus-card.accent  .dh-campus-link { color: var(--accent); }

.dh-footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px;
}
.dh-footer-brand .dh-brand { margin-bottom: 18px; }
.dh-footer-brand p {
  margin: 0; font-size: 13px; color: var(--text-3); line-height: 1.6; max-width: 340px;
}
.dh-footer-brand .dh-footer-tel { margin-top: 18px; font-size: 13px; color: var(--text-3); }
.dh-footer-col-h {
  font-family: var(--mono);
  font-size: 11px; color: var(--text-4); letter-spacing: 0.14em; text-transform: uppercase;
}
.dh-footer-list { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 10px; }
.dh-footer-list li { font-size: 13.5px; }
.dh-footer-list a { color: var(--text-2); }
.dh-footer-list a:hover { color: var(--text); }

.dh-footer-bottom {
  margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
  font-size: 12px; color: var(--text-4);
}
.dh-footer-bottom a { color: var(--text-4); margin-left: 16px; }
.dh-visitors { display: flex; gap: 14px; }
.dh-visitors strong { color: var(--text-2); }

@media (max-width: 980px) {
  .dh-footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .dh-footer-brand { grid-column: 1 / -1; }
  .dh-footer-campuses { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .dh-footer { padding: 60px 0 32px; }
  .dh-footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .dh-campus-card { padding: 18px 18px; gap: 14px; }
  .dh-footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* Body padding fix — 기존 페이지는 fixed navbar 가정해서 padding-top 80px 쓰는 곳 있음.
   새 nav는 sticky라 자동으로 흐름을 차지하므로 무시. */
body.dahim-shell { padding-top: 0 !important; }
