/* =========================================================
   jdfb 테마 스타일
   - 모바일 우선, 접근성 우선 (CLAUDE.md 6절)
   - 색·글꼴 기본값은 theme.json, 컴포넌트는 이 파일
   ========================================================= */

/* ===== 토큰 ===== */
:root {
  --bg: #ffffff;
  --surface: #f5f3ee;
  --text: #1b1b1b;          /* 흰 배경 대비 17:1 */
  --muted: #45474d;         /* 9.6:1 */
  --brand: #1d3d6b;         /* 11:1 */
  --brand-ink: #ffffff;
  --brand-soft: #e7edf6;
  --accent: #b4440a;        /* 5.6:1, 장식·강조 */
  --line: #d4d0c6;
  --footer-bg: #18202c;
  --footer-text: #eef0f3;   /* 14:1 */
  --footer-muted: #c3c8d1;  /* 9.4:1 */
  --focus: #ffbf00;
  --radius: 14px;
  --container: 1440px;
  --gutter: clamp(16px, 4vw, 32px);
  --rainbow: linear-gradient(90deg, #e94b5b, #f39c34, #f6d23c, #4cb86b, #3b8fd9, #7a5bd0);
}
html[data-contrast="high"] {
  --bg: #000000;
  --surface: #000000;
  --text: #ffffff;
  --muted: #ffffff;
  --brand: #ffeb3b;
  --brand-ink: #000000;
  --brand-soft: #1a1a1a;
  --accent: #ffeb3b;
  --line: #ffffff;
  --footer-bg: #000000;
  --footer-text: #ffffff;
  --footer-muted: #ffffff;
  --focus: #00e5ff;
  --wp--preset--color--base: #000000;
  --wp--preset--color--text: #ffffff;
  --wp--preset--color--brand: #ffeb3b;
}

/* ===== 기본 ===== */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
html[data-fontsize="1"] { font-size: 112.5%; }
html[data-fontsize="2"] { font-size: 125%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
img { max-width: 100%; height: auto; }
a { color: inherit; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px #1b1b1b;
  border-radius: 6px;
}
.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -200px; z-index: 1000;
  background: var(--focus); color: #000; font-weight: 700; padding: 12px 20px; border-radius: 0 0 10px 10px;
  text-decoration: none;
}
.skip-link:focus { top: 0; }
.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.2em; }

/* 블록 레이아웃 기본 간격 제거(영역 간격은 각 섹션이 관리) */
.wp-site-blocks > *, .site-main > *, .home-main > * { margin-block: 0; }
.wp-site-blocks { padding: 0; }

h2.section-title {
  font-size: 1.625rem; line-height: 1.35; margin: 0 0 20px; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 12px;
}
h2.section-title::before { content: ""; width: 6px; height: 1.1em; border-radius: 3px; background: var(--rainbow); }
html[data-contrast="high"] h2.section-title::before { background: var(--brand); }

/* ===== ① 상단 바 ===== */
.topbar { background: var(--brand); color: var(--brand-ink); font-size: 1rem; }
html[data-contrast="high"] .topbar { background: #000; color: #fff; border-bottom: 2px solid #fff; }
.topbar .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 24px; min-height: 52px; padding-block: 6px; }
.topbar ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; }
.topbar a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; text-decoration: none; font-weight: 600; color: inherit; }
.topbar a:hover { text-decoration: underline; text-underline-offset: 4px; }
.a11y-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.a11y-label { font-weight: 600; }
.tool-btn {
  min-width: 44px; min-height: 40px; padding: 0 12px; border-radius: 8px; cursor: pointer;
  border: 2px solid currentColor; background: transparent; color: inherit; font: inherit; font-weight: 700;
}
.tool-btn[aria-pressed="true"] { background: var(--brand-ink); color: var(--brand); }
html[data-contrast="high"] .tool-btn[aria-pressed="true"] { background: #fff; color: #000; }
.tool-sep { width: 1px; height: 20px; background: currentColor; opacity: .5; }

/* ===== ② 헤더 ===== */
.site-header { position: relative; z-index: 50; background: var(--bg); }
.masthead { border-bottom: 1px solid var(--line); }
.masthead .container { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 88px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); border-radius: 10px; }
.brand img { width: 60px; height: 60px; object-fit: contain; }
html[data-contrast="high"] .brand img { background: #fff; border-radius: 10px; padding: 3px; }
.brand-text { font-size: 1.375rem; font-weight: 800; line-height: 1.25; letter-spacing: -0.02em; }
.brand-sub { display: block; font-size: 0.875rem; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.rainbow-line { height: 5px; background: var(--rainbow); }
html[data-contrast="high"] .rainbow-line { background: #fff; height: 2px; }

.gnb > ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
.gnb li { position: relative; }
.gnb-toggle, .gnb-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 18px;
  border: 0; background: transparent; color: var(--text); font: inherit; font-size: 1.1875rem; font-weight: 700; cursor: pointer;
  border-radius: 10px; text-decoration: none;
}
.gnb-toggle:hover, .gnb-toggle[aria-expanded="true"], .gnb-link:hover { background: var(--brand-soft); color: var(--brand); }
.gnb-toggle .chev { transition: transform .2s; }
.gnb-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.gnb .submenu {
  list-style: none; margin: 0; padding: 10px; position: absolute; left: 0; top: calc(100% + 6px); min-width: 220px;
  background: var(--bg); border: 2px solid var(--brand); border-radius: var(--radius); box-shadow: 0 12px 28px rgba(0,0,0,.14);
}
.gnb .submenu[hidden] { display: none; }
.gnb .submenu a { display: flex; align-items: center; padding: 10px 14px; min-height: 44px; border-radius: 8px; text-decoration: none; font-weight: 600; color: var(--text); }
.gnb .submenu a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: underline; }
.gnb .submenu a[aria-current="page"] { color: var(--brand); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.menu-open-btn { display: none; }

/* ===== ③ 메인 비주얼 ===== */
.hero { background: var(--surface); padding-top: 24px; }
.hero-viewport { position: relative; overflow: hidden; width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.hero-track { display: grid; }
.hero-slide { grid-area: 1 / 1; opacity: 0; visibility: hidden; transition: opacity .8s ease, visibility .8s; margin: 0; }
.hero-slide.is-active { opacity: 1; visibility: visible; }
.hero-slide img { display: block; width: 100%; height: auto; aspect-ratio: 1904 / 507; object-fit: cover; }
/* 조작 버튼: 이미지 오른쪽 아래에 겹침(흰 바탕 알약으로 사진 위에서도 대비 확보) */
.hero-controls {
  position: absolute; right: 16px; bottom: 16px;
  display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 999px;
  background: rgba(255,255,255,.94); box-shadow: 0 4px 16px rgba(0,0,0,.18);
}
html[data-contrast="high"] .hero-controls { background: #000; border: 2px solid #fff; }
.hero-controls button {
  min-width: 44px; min-height: 44px; border-radius: 999px; border: 2px solid var(--brand); background: var(--bg);
  color: var(--brand); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 1rem; font-weight: 700;
}
.hero-controls button:hover { background: var(--brand); color: var(--brand-ink); }
.hero-pause { padding-inline: 14px; }
.hero-pause .icon-play { display: none; }
.hero-pause[aria-pressed="true"] .icon-play { display: inline; }
.hero-pause[aria-pressed="true"] .icon-pause { display: none; }
.hero-count { min-width: 3.6em; text-align: center; font-weight: 700; font-size: 1rem; color: var(--text); }
.hero-bar { border-bottom: 1px solid var(--line); }
.hero:not(:has(.hero-bar)) { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.hero-caption { margin: 0 auto; padding-block: 14px 18px; }
.hero-caption strong { display: block; font-size: 1.25rem; }
.hero-caption[hidden] { display: none; }

/* ===== ④ 최신 소식 3단 ===== */
.news { padding-block: 44px 48px; }
.news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 24px 20px; display: flex; flex-direction: column; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 2px solid var(--text); margin-bottom: 6px; }
.card-head h3 { margin: 0; font-size: 1.375rem; display: flex; align-items: center; gap: 10px; }
.card-head h3 .icon { color: var(--accent); }
.more { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding-inline: 8px; font-size: 1rem; font-weight: 700; color: var(--brand); text-decoration: none; border-radius: 8px; white-space: nowrap; }
.more:hover { text-decoration: underline; text-underline-offset: 4px; }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li { border-bottom: 1px solid var(--line); }
.post-list li:last-child { border-bottom: 0; }
.post-list a { display: block; padding: 12px 4px; text-decoration: none; color: var(--text); }
.post-list a:hover .t { text-decoration: underline; text-underline-offset: 4px; }
.post-list .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; }
.post-list time { display: block; font-size: 1rem; color: var(--muted); margin-top: 2px; }
.post-list .secret { display: inline-flex; align-items: center; gap: 2px; font-size: .9375rem; color: var(--muted); }
.card .empty { color: var(--muted); margin: 16px 4px; }
.photo-grid { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photo-grid a { display: block; text-decoration: none; border-radius: 10px; color: var(--text); }
.photo-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; }
.photo-grid span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 1rem; font-weight: 600; margin-top: 6px; line-height: 1.45; }
.photo-grid a:hover span { text-decoration: underline; }

/* ===== ⑤ 바로가기 ===== */
.quick { background: var(--surface); padding-block: 44px 48px; }
.quick-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.quick-list a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 168px; padding: 20px 12px;
  background: var(--bg); border: 2px solid var(--line); border-radius: var(--radius); text-decoration: none; text-align: center; color: var(--text);
  transition: border-color .15s, transform .15s;
}
.quick-list a:hover { border-color: var(--brand); transform: translateY(-2px); }
.q-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 6px; }
.q-svg { width: 34px; height: 34px; }
.q-label { font-size: 1.1875rem; font-weight: 700; }
.q-desc { font-size: 0.9375rem; color: var(--muted); }

/* ===== ⑦ 유관기관 ===== */
.partners { padding-block: 44px 52px; }
.partner-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.partner-list a { display: grid; place-items: center; min-height: 84px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.partner-list a:hover { border-color: var(--brand); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.partner-list img { width: 160px; max-height: 44px; object-fit: contain; }

/* ===== ⑧ 푸터 ===== */
.site-footer { background: var(--footer-bg); color: var(--footer-text); }
html[data-contrast="high"] .site-footer { border-top: 2px solid #fff; }
.footer-main { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; padding-block: 48px 40px; }
.footer-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.footer-brand img { width: 72px; height: 72px; background: #fff; border-radius: 16px; padding: 6px; object-fit: contain; }
.footer-brand p { margin: 0; font-size: 1.375rem; font-weight: 800; line-height: 1.35; }
.footer-brand p span { display: block; font-size: 1rem; font-weight: 500; color: var(--footer-muted); }
.contact-list { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 20px; }
.contact-list dt { font-weight: 700; color: var(--footer-muted); }
.contact-list dd { margin: 0; }
.site-footer a { color: var(--footer-text); text-underline-offset: 4px; }
.footer-links h2 { font-size: 1.125rem; margin: 0 0 12px; color: var(--footer-muted); }
.footer-links ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.footer-links a { display: inline-flex; min-height: 44px; align-items: center; text-decoration: none; font-weight: 600; }
.footer-links a:hover { text-decoration: underline; }

/* ===== ⑨ 하단 바 ===== */
.bottombar { border-top: 1px solid rgba(255,255,255,.18); }
.bottombar .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-block: 16px; font-size: 1rem; color: var(--footer-muted); }
.bottombar p { margin: 0; }
.sns { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sns a, .to-top {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 2px solid var(--footer-muted); color: var(--footer-text); text-decoration: none; font: inherit; font-weight: 600; background: transparent; cursor: pointer;
}
.sns a:hover, .to-top:hover { background: var(--footer-text); color: var(--footer-bg); }
.sns img { width: 22px; height: 22px; }

/* ===== 서브페이지 공통 ===== */
.page-head { background: var(--surface); border-bottom: 1px solid var(--line); padding-block: 28px 32px; }
.page-title { margin: 6px 0 0; font-size: 2rem; line-height: 1.3; letter-spacing: -0.02em; }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: 1rem; color: var(--muted); }
.breadcrumb li + li::before { content: "›"; margin-right: 6px; color: var(--muted); }
.breadcrumb a { color: var(--brand); font-weight: 600; text-underline-offset: 4px; display: inline-flex; min-height: 32px; align-items: center; }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 700; }

.page-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 48px; padding-block: 40px 72px; }
.page-layout.no-side, .page-layout:not(:has(.section-nav)) { grid-template-columns: minmax(0, 1fr); }
.section-nav { align-self: start; position: sticky; top: 16px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.section-nav-title { margin: 0; padding: 14px 18px; font-size: 1.125rem; background: var(--brand); color: var(--brand-ink); }
.section-nav ul { list-style: none; margin: 0; padding: 8px; }
.section-nav a { display: flex; align-items: center; min-height: 48px; padding: 8px 12px; border-radius: 8px; text-decoration: none; font-weight: 600; color: var(--text); }
.section-nav a:hover { background: var(--brand-soft); color: var(--brand); }
.section-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 800; box-shadow: inset 4px 0 0 var(--brand); }

/* 본문 글 */
.entry-content { min-width: 0; }
.entry-content > * + * { margin-block-start: 1.1em; }
.entry-content h2, .entry-content h3, .entry-content h4 { margin-block: 1.8em .6em; }
.entry-content p, .entry-content li { max-width: 72ch; }
.entry-content a { color: var(--brand); text-underline-offset: 4px; }
.entry-content img { height: auto; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.entry-content th, .entry-content td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.entry-content th { background: var(--surface); }
.entry-content .wp-block-table, .entry-content .table-wrap { overflow-x: auto; }

/* ===== 반응형 ===== */
@media (max-width: 1023px) {
  .news-grid { grid-template-columns: 1fr 1fr; }
  .news-grid .card:last-child { grid-column: 1 / -1; }
  .news-grid .card:last-child .photo-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-list { grid-template-columns: repeat(3, 1fr); }
  .page-layout { grid-template-columns: 200px minmax(0, 1fr); gap: 32px; }
}
@media (max-width: 860px) {
  .menu-open-btn {
    display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 10px; flex: none; white-space: nowrap;
    border: 2px solid var(--brand); background: var(--bg); color: var(--brand); font: inherit; font-weight: 700; cursor: pointer;
  }
  .gnb { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--bg); border-bottom: 3px solid var(--brand); padding: 8px var(--gutter) 20px; box-shadow: 0 16px 24px rgba(0,0,0,.12); }
  .gnb.is-open { display: block; }
  .masthead { position: relative; }
  .gnb > ul { flex-direction: column; gap: 0; }
  .gnb-toggle, .gnb-link { width: 100%; justify-content: space-between; border-bottom: 1px solid var(--line); border-radius: 0; }
  .gnb .submenu { position: static; border: 0; box-shadow: none; padding: 4px 0 8px 12px; min-width: 0; }
  .brand img { width: 48px; height: 48px; }
  .brand-text { font-size: 1.125rem; }
  .brand-sub { font-size: 0.75rem; }
  .masthead .container { min-height: 76px; }
  .page-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-block: 24px 56px; }
  .section-nav { position: static; }
  .section-nav ul { display: flex; flex-wrap: wrap; gap: 4px; }
  .section-nav li { flex: 1 1 auto; }
  .section-nav a { justify-content: center; text-align: center; }
  .section-nav a[aria-current="page"] { box-shadow: inset 0 -4px 0 var(--brand); }
  .page-title { font-size: 1.625rem; }
}
@media (max-width: 640px) {
  .news-grid { grid-template-columns: 1fr; }
  .news-grid .card:last-child .photo-grid { grid-template-columns: 1fr 1fr; }
  .quick-list { grid-template-columns: 1fr 1fr; }
  .quick-list li:last-child { grid-column: 1 / -1; }
  .quick-list a { min-height: 132px; }
  .footer-main { grid-template-columns: 1fr; }
  .topbar .container { justify-content: flex-start; }
  .hero { padding-top: 0; }
  .hero-viewport { width: 100%; border-radius: 0; box-shadow: none; }
  .hero-controls { position: static; justify-content: flex-end; border-radius: 0; box-shadow: none; background: var(--surface); padding: 8px var(--gutter); }
  h2.section-title { font-size: 1.5rem; }
  .card { padding: 20px 18px 16px; }
}
@media (min-width: 1680px) {
  html { font-size: 106.25%; }
  html[data-fontsize="1"] { font-size: 118.75%; }
  html[data-fontsize="2"] { font-size: 131.25%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .gnb, .menu-open-btn, .hero-controls, .to-top, .skip-link { display: none !important; }
}
