/* =====================================================================
   JinnyLang Korean — base.css  (공통 스타일)
   - 브랜드 색 · 간격 · 폰트 · 라이트/다크 · 공통 부품(헤더·카드·버튼·푸터)
   - 모든 앱 페이지가 이 파일 하나를 읽어 같은 모양이 됩니다.
   ===================================================================== */

/* ---------- 1. 폰트 (로고 사용지침 README 2026-08-20 규칙) ----------
   라틴·숫자 = Inter / 일본어 = M PLUS Rounded 1c / 한글 = 나눔고딕
   Google Fonts는 글자 범위별 서브셋(unicode-range)으로 나눠 배포하므로,
   font-family 순서를 Inter → M PLUS Rounded 1c → Nanum Gothic 으로 두면
   글자마다 앞에서부터 "그 글자를 가진 첫 폰트"가 쓰입니다.
   → 라틴·숫자는 Inter, 가나·한자는 M PLUS, 한글은 나눔고딕으로 자동 분리.
   (링크는 각 HTML <head>의 fonts.googleapis.com 한 줄)               */
:root {
  --font-stack: 'Inter', 'M PLUS Rounded 1c', 'Nanum Gothic',
                'Apple SD Gothic Neo', 'Hiragino Kaku Gothic ProN', system-ui, sans-serif;
  --font-logo: 'Quicksand', 'Inter', sans-serif;
}
/* 대문자 I 세리프(cv08) — TOPIK I·II 등 */
html { font-feature-settings: 'cv08' 1; }

/* ---------- 2. 색 (브랜드 키트) ---------- */
:root {
  --blue: #2E7DE0;          /* 브랜드 블루 · CTA */
  --blue-dark: #1E63BC;     /* hover·강조 */
  --sky: #EAF6FF;           /* 연하늘 배경 */
  --ink: #333333;           /* 본문 */
  --ink-2: #4A5563;         /* 보조 텍스트 */
  --muted: #7A8494;         /* 캡션 */
  --paper: #FFFFFF;         /* 카드·본문 배경 */
  --bg: #FFFFFF;            /* 페이지 배경 — 흰색(연하늘 강조가 보이도록, 2026-09-13 결정) */
  --line: #DCE5EF;          /* 구분선 */
  --ok: #2E9E6B;            /* 정답 */
  --no: #C94A4A;            /* 오답 (버튼·강조에 빨강 사용 금지, 피드백 전용) */
  --shadow: 0 4px 16px rgba(30, 99, 188, .08);
}
/* 다크 (사용자가 선택했을 때만: <html data-theme="dark">) */
html[data-theme="dark"] {
  --blue: #5B9DF0;
  --blue-dark: #8AB9F5;
  --sky: #17263A;
  --ink: #E8EEF6;
  --ink-2: #C2CCD8;
  --muted: #8E9AAB;
  --paper: #141C27;
  --bg: #0F151E;
  --line: #2A3646;
  --shadow: 0 4px 16px rgba(0, 0, 0, .35);
}

/* ---------- 3. 간격 · 크기 ---------- */
:root {
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --radius: 12px; --radius-lg: 18px;
  --wrap: 1040px;             /* 본문 최대 폭 */
  --wrap-narrow: 760px;       /* 설명글·정책 페이지 */
  --fs-base: 17px;            /* 30~60대 배려: 기본 17px */
  --lh: 1.75;
}

/* ---------- 4. 리셋 · 기본 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-stack); font-size: var(--fs-base); line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 var(--s-3); font-weight: 700; }
h1 { font-size: clamp(26px, 4.5vw, 36px); }
h2 { font-size: clamp(21px, 3.2vw, 26px); }
h3 { font-size: 18px; }
p  { margin: 0 0 var(--s-4); }
.muted { color: var(--muted); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s-4); }
.wrap--narrow { max-width: var(--wrap-narrow); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
*:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

/* 줄바꿈 원칙 (2026-09-17 선생님 지시 · 2026-09-18 pages.css에서 옮겨 사이트 전체 적용)
   브라우저가 단어 중간에서 마음대로 줄을 바꾸지 않게 한다.
   한국어 = 어절(띄어쓰기) 단위 / 일본어 = 문절 단위 / 영어 = 단어 단위.
   짧은 문구(부제·버튼 옆 문장)는 문장 부호(、·?)나 의미 단위 위치에 <br>로 직접 나눈다. */
:lang(ko) { word-break: keep-all; overflow-wrap: break-word; }
:lang(ja) { word-break: auto-phrase; overflow-wrap: break-word; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- 5. 헤더 ---------- */
.site-header {
  background: var(--paper); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.site-header .wrap { display: flex; align-items: center; gap: var(--s-4); min-height: 64px; }
.logo { display: flex; align-items: center; flex-shrink: 0; }
/* 헤더 로고 = 공식 워드마크(J 위에 가로선) 이미지. 다크 모드는 흰색판으로 교체(2026-09-13 확정) */
.logo img { display: block; height: 30px; width: auto; }
.logo .logo-white { display: none; }
html[data-theme="dark"] .logo .logo-blue { display: none; }
html[data-theme="dark"] .logo .logo-white { display: block; }
.nav { display: flex; gap: var(--s-4); align-items: center; flex-wrap: nowrap; }   /* 언어 전환 + 테마 버튼 */
.nav a { color: var(--ink-2); font-weight: 600; }
/* 주 메뉴(앱·소개·문의) — PC는 헤더 한 줄 오른쪽, 좁은 화면은 헤더 둘째 줄 (2026-09-18 확정)
   ※ 메뉴는 최대 4개까지. 일본어 'お問い合わせ'가 가장 길어 375px에서 4개가 한계입니다. */
.nav-row { display: flex; align-items: center; gap: var(--s-4); margin-left: auto; }
.nav-row a.nav-link { color: var(--blue-dark); font-weight: 700; white-space: nowrap; padding: 3px 5px; border-radius: 6px; transition: background .15s, color .15s; }
.nav-row a.nav-link:hover { color: var(--blue); background: var(--sky); }
@media (max-width: 820px) { .nav { gap: var(--s-3); } }
.lang-switch { display: flex; gap: 2px; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.lang-switch a, .lang-switch span {
  padding: 4px 10px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.lang-switch [aria-current="true"] { background: var(--blue); color: #fff; }
.theme-btn { border: 0; background: var(--sky); border-radius: 999px; width: 36px; height: 36px; }
/* 좁은 화면(휴대폰·태블릿): 헤더를 2줄로 — 1줄 로고·언어·테마 / 2줄 앱·소개·문의
   예전에는 .nav-link를 display:none으로 숨기기만 해서 휴대폰에서 메뉴가 사라졌습니다(2026-09-18 수정) */
@media (max-width: 820px) {
  .site-header .wrap { flex-wrap: wrap; row-gap: 0; min-height: 0; }
  .logo, .nav { min-height: 48px; }
  .nav { margin-left: auto; }
  .nav-row {
    order: 3; flex-basis: 100%; margin-left: 0; justify-content: center;
    gap: var(--s-5); min-height: 38px; border-top: 1px solid var(--line);
  }
}
/* 헤더 축소(2026-09-18b): 첫 화면(스크롤 전)에도 헤더가 커 보인다는 지적 — 글자는 그대로, 틀만 축소 */
@media (max-width: 640px) {
  .site-header .wrap { padding-right: calc(var(--s-4) + 4px); }
  .logo img { height: 20px; }
  .lang-switch a, .lang-switch span { padding: 3px 6px; font-size: 11.5px; }
  .theme-btn { width: 28px; height: 28px; }
  .nav-row { gap: var(--s-4); font-size: 14px; min-height: 34px; }
}
/* 좁은 화면: 아래로 스크롤하면 헤더가 접히고, 위로 올리면 다시 나온다 (layout.js가 is-hidden을 붙임) */
@media (max-width: 820px) {
  .site-header { transition: transform .2s ease; }
  .site-header.is-hidden { transform: translateY(-100%); }
}

/* ---------- 6. 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: 12px 22px; border-radius: 999px; border: 2px solid var(--blue);
  background: var(--blue); color: #fff; font-weight: 700; min-height: 46px;
  transition: background .15s, transform .15s;
}
.btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; text-decoration: none; transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--blue); }
.btn--ghost:hover { background: var(--sky); color: var(--blue-dark); }
.btn--sm { padding: 8px 14px; min-height: 36px; font-size: 15px; }
.btn--block { width: 100%; }

/* ---------- 7. 홈: 히어로·카드 ---------- */
.hero { padding: var(--s-7) 0 var(--s-5); text-align: center; }
.hero h1 { margin-bottom: var(--s-2); }
.hero .lead { color: var(--ink-2); font-size: 18px; max-width: 640px; margin: 0 auto var(--s-4); }
.free-line {
  display: inline-block; background: var(--sky); color: var(--blue-dark);
  border-radius: 999px; padding: 6px 16px; font-weight: 600; font-size: 15px;
}
.section { padding: var(--s-6) 0; }
.section-title { display: flex; align-items: baseline; gap: var(--s-3); margin-bottom: var(--s-4); }
.section-title h2 { margin: 0; }

.cards {
  display: grid; gap: var(--s-4);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));   /* 3 → 2 → 1열, 잘림 없음 */
}
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: calc(var(--s-5) - 6px) var(--s-5) var(--s-5); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: var(--s-2);
  transition: transform .15s, border-color .15s; position: relative;
}
.card:hover { transform: translateY(-3px); border-color: var(--blue); }
.card .card-icon { font-size: 30px; line-height: 1; }   /* 0918: 34px → 30px, 전체적으로 크다는 의견 */
.card h3 { margin: var(--s-1) 0 0; }
.card p { color: var(--ink-2); margin: 0; font-size: 15.5px; line-height: 1.55; min-height: 3.3em; }   /* 0918: 줄간격을 var(--lh) 1.75 → 1.55로 살짝 줄임 */
.card .card-meta { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: auto; padding-top: var(--s-2); }
.badge {
  font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 3px 10px;
  background: var(--sky); color: var(--blue-dark);
}
.badge--soon { background: var(--line); color: var(--ink-2); }
.card--soon { opacity: .75; }
.card a.card-link::after { content: ""; position: absolute; inset: 0; }   /* 카드 전체 클릭 */

/* ---------- 8. 앱 페이지 6블록 ---------- */
.app-head { padding: var(--s-6) 0 var(--s-4); }
.app-head .subtitle { color: var(--ink-2); font-size: 18px; margin: 0; }
.app-head .title-row { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.info-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--blue);
  background: var(--paper); color: var(--blue); font-weight: 800; font-family: var(--font-logo);
}
.app-body {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: var(--s-5); box-shadow: var(--shadow); min-height: 320px;
}
.app-placeholder {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: var(--s-7) var(--s-4);
  text-align: center; color: var(--muted);
}
.app-desc { padding: var(--s-6) 0; }
.app-desc h2 { margin-top: var(--s-5); }
.app-desc .pattern {
  background: var(--sky); border-left: 4px solid var(--blue); padding: var(--s-3) var(--s-4);
  border-radius: 0 var(--radius) var(--radius) 0; margin: var(--s-3) 0;
}
.example { display: grid; grid-template-columns: 110px 1fr; gap: var(--s-2) var(--s-3); align-items: baseline; }
.example .role { font-size: 13.5px; color: var(--muted); font-weight: 700; }
/* FAQ (문단 2개+FAQ 3문답 구조, 010 창 확정 2026-09-19) — <details>/<summary> 네이티브 아코디언 */
.faq { margin-top: var(--s-4); }
.faq-item {
  border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-3); background: var(--paper);
}
.faq-item summary {
  cursor: pointer; font-weight: 700; color: var(--blue-dark); list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-3);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--blue); font-weight: 800; flex-shrink: 0; }
.faq-item[open] summary::after { content: '\2212'; }
.faq-item p { margin-top: var(--s-2); color: var(--ink-2); }
.ad-slot {
  margin: var(--s-5) auto; min-height: 100px; max-width: 728px;
  border: 1px dashed var(--line); border-radius: var(--radius); display: flex; align-items: center;
  justify-content: center; color: var(--muted); font-size: 13px;
}
.related { padding: var(--s-6) 0; }

/* ---------- 9. 팝업(ⓘ 규칙, 온보딩) ---------- */
.modal--hover { pointer-events: none; background: rgba(15, 21, 30, .25); }
.modal--hover .modal-box { pointer-events: auto; }
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 100; background: rgba(15, 21, 30, .55);
  display: flex; align-items: center; justify-content: center; padding: var(--s-4);
}
.modal-box {
  background: var(--paper); color: var(--ink); border-radius: var(--radius-lg);
  width: min(560px, 100%); max-height: 90vh; overflow: auto; padding: var(--s-5);
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-box h2 { margin-top: 0; }
.modal-box ol { padding-left: 22px; margin: 0 0 var(--s-4); }
.modal-box li { margin-bottom: var(--s-2); }
.modal-close { float: right; border: 0; background: transparent; font-size: 26px; line-height: 1; color: var(--muted); }

/* 온보딩 */
.ob-progress { font-size: 13.5px; color: var(--muted); margin-bottom: var(--s-2); }
.ob-q { font-size: 21px; font-weight: 700; margin: 0 0 var(--s-4); }
.ob-options { display: grid; gap: var(--s-2); }
.ob-opt {
  text-align: left; padding: 14px 18px; border-radius: var(--radius); border: 2px solid var(--line);
  background: var(--paper); font-weight: 600; font-size: 17px;
}
.ob-opt:hover, .ob-opt:focus-visible { border-color: var(--blue); background: var(--sky); }
.ob-foot { display: flex; justify-content: space-between; align-items: center; margin-top: var(--s-4); }
.ob-skip { background: none; border: 0; color: var(--muted); text-decoration: underline; }

/* ---------- 10. 푸터 ---------- */
.site-footer { background: #10161F; color: #B9C4D2; margin-top: var(--s-8); padding: var(--s-6) 0 var(--s-5); font-size: 14.5px; }
.site-footer a { color: #E8EEF6; }
.footer-grid { display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.footer-grid h4 { color: #fff; margin: 0 0 var(--s-2); font-size: 15px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 6px; }
.footer-brand img { height: 28px; width: auto; }
.footer-brand p { margin: 0 0 var(--s-1); }  /* 태그라인·이메일 줄간격 축소(2026-09-18c) */
.cta-logo { justify-content: center; margin: 16px 0 18px; }
.cta-logo img { width: 380px; max-width: 88%; height: auto; }
.footer-legal { border-top: 1px solid #253040; margin-top: var(--s-5); padding-top: var(--s-4); font-size: 13px; color: #8E9AAB; }
.footer-legal .copy { font-family: var(--font-logo); color: #B9C4D2; }
/* Apps 목록은 grid 칸에 넣지 않고 통짜 1줄로 분리 — 앱이 5~8개로 늘어도 다른 칸(brand/Site/Legal)과 안 맞물림(2026-09-18e) */
.footer-apps { margin-top: var(--s-5); }
.footer-apps h4 { color: #fff; margin: 0 0 var(--s-2); font-size: 15px; }
.footer-apps ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }
.footer-apps li { margin: 0; }
/* 휴대폰 푸터: 한 줄씩 길게 늘어져 오른쪽이 비어 보이던 것을 좌우 2단으로 (2026-09-18) */
@media (max-width: 640px) {
  /* 하단 여백 축소(2026-09-18b) + 푸터 2x2 전면 2단(2026-09-18c): 글자 크기는 유지, 틀·줄간격만 축소 */
  .section, .related { padding: var(--s-4) 0; }
  .site-footer { font-size: 13.5px; margin-top: var(--s-5); padding: var(--s-4) 0 var(--s-3); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--s-4) var(--s-3); }
  .footer-grid > :last-child { grid-column: 1 / -1; }
  .footer-grid > :last-child ul { display: flex; gap: var(--s-3); flex-wrap: wrap; }
  .footer-grid h4 { font-size: 14px; margin-bottom: var(--s-1); }
  .footer-grid li { margin-bottom: 3px; }
  .footer-apps { margin-top: var(--s-4); }
  .footer-apps h4 { font-size: 14px; margin-bottom: var(--s-1); }
  .footer-apps ul { gap: var(--s-1) var(--s-4); font-size: 13.5px; }
  .footer-legal { margin-top: var(--s-4); padding-top: var(--s-3); font-size: 12px; }
}

/* ---------- 11. 쿠키 배너 (EU·UK·CH만) ---------- */
.cookie-bar[hidden] { display: none; }
.cookie-bar {
  position: fixed; left: var(--s-4); right: var(--s-4); bottom: var(--s-4); z-index: 10000;   /* FAQ 위젯(9999)보다 위 */
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,.25); padding: var(--s-4); display: flex; gap: var(--s-3);
  align-items: center; flex-wrap: wrap; max-width: 720px; margin: 0 auto;
}
.cookie-bar p { margin: 0; flex: 1 1 300px; font-size: 15px; }

/* ---------- 12. 유틸 ---------- */
.notice { background: var(--sky); border-radius: var(--radius); padding: var(--s-3) var(--s-4); color: var(--blue-dark); }
.grid-2 { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--blue); width: 0; transition: width .2s; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: var(--sky); }
