/* 모바일 우선, 최소 스타일. 정적 사이트 기본 레이아웃.
   색 변수(--fg/--bg/--muted/--line/--brand/--max/--font-sans/--brand-soft/--bg-subtle/
   --surface-elevated/--brand-contrast/--disclaimer-*/--ad-bg 등)는 static/css/tokens.css 가 정의한다.
   main.css 는 하드코딩 색 없이 var()로만 참조한다 — 라이트+다크모드 모두 토큰에서 지원. */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--line);
}
.site-logo {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.site-logo img {
  display: block;
  height: 32px;
  width: auto;
}
/* 네비: 시기가 12개라 모바일에서 가로 스크롤(넘치지 않게) */
.site-nav {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 0.25rem 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.4rem;
}
.site-nav a {
  text-decoration: none;
  color: var(--brand);
  font-weight: 500;
  white-space: nowrap;
  flex: 0 0 auto;
}
.site-nav::-webkit-scrollbar { height: 6px; }
.site-nav::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

main { max-width: var(--max); margin: 0 auto; padding: 1.5rem 1rem 3rem; }

h1 { font-size: 1.5rem; line-height: 1.3; }
h2 { font-size: 1.15rem; margin-top: 2rem; border-bottom: 1px solid var(--line); padding-bottom: 0.3rem; }

.body { overflow-wrap: break-word; }
.body blockquote { margin: 1rem 0; padding: 0.5rem 1rem; border-left: 4px solid var(--brand); background: var(--brand-soft); }
.body ul, .body ol { padding-left: 1.3rem; }
code { background: var(--bg-subtle); padding: 0 0.3rem; border-radius: 4px; }

/* 고지 — 발달 관련 페이지 상단 (disclaimer 전용 토큰) */
.disclaimer {
  background: var(--disclaimer-bg);
  border: 1px solid var(--disclaimer-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--disclaimer-fg);
  font-size: 0.95rem;
}

/* 광고 슬롯 — 본문과 분리, '광고' 라벨 (ad 전용 배경) */
.ad-slot {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 2rem 0;
  background: var(--ad-bg);
}
.ad-label {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 0.4rem;
  margin-bottom: 0.5rem;
}
.ad-hint { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 0.5rem; }

.age-links { list-style: none; padding: 0; }
.age-links li { margin: 0.4rem 0; }
.age-links a {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: var(--brand);
}

.site-footer { max-width: var(--max); margin: 0 auto; padding: 1rem 1rem 2.5rem; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line); }
.site-footer a { color: var(--brand); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.muted { color: var(--muted); }

@media (min-width: 48em) {
  h1 { font-size: 2rem; }
  main { padding: 2.5rem 1.5rem 4rem; }
}

/* 월령 문항 — CDC 4개 영역 체크리스트 (문항은 data/milestones.yaml 에서 렌더링) */
.domain { margin: 1.75rem 0; }
.domain-sub { color: var(--muted); font-size: 0.85rem; margin: -0.4rem 0 0.75rem; }
.milestone-list { list-style: none; padding: 0; margin: 0.75rem 0; }
.milestone-item { margin: 0.75rem 0; }
.milestone-label { display: flex; align-items: flex-start; gap: 0.5rem; cursor: pointer; }
.milestone-label input[type=checkbox] { flex: 0 0 auto; margin-top: 0.35rem; width: 1.1rem; height: 1.1rem; accent-color: var(--brand); }
.milestone-ko { flex: 1 1 auto; }
.milestone-en { margin: 0.3rem 0 0; }
.milestone-en summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
.milestone-en[open] { border-top: 1px solid var(--line); padding-top: 0.5rem; margin-top: 0.5rem; }
.milestone-en p { margin: 0.25rem 0; color: var(--muted); font-size: 0.9rem; }

/* 출처·면책 (광고 위, 페이지 하단) */
.attribution { margin: 2rem 0; }
.attribution h2 { margin-top: 1rem; }
.attribution-source { margin: 0.5rem 0; }
.attribution-source a { color: var(--brand); text-decoration: underline; }
.attribution-text { white-space: pre-line; color: var(--fg); font-size: 0.9rem; line-height: 1.6; }
.attribution-en { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.6; }

/* '우리 아이 몇 개월?' 선택기 (홈) */
.age-picker {
  margin: 1.75rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-subtle);
}
.age-picker h2 { margin: 0 0 0.4rem; font-size: 1.1rem; border: none; padding: 0; }
.age-picker-hint { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.8rem; }
.age-picker-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.age-picker-form label { font-size: 0.9rem; }
.age-picker-form select {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--surface-elevated);
}
.age-picker-form button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--brand);
  color: var(--brand-contrast);
  font-size: 0.95rem;
  cursor: pointer;
}
.age-picker-form button:active { opacity: 0.9; }
.age-picker-result { margin: 0.8rem 0 0; font-size: 0.95rem; line-height: 1.7; }
.age-picker-link {
  display: inline-block;
  margin: 0.3rem 0.7rem 0.3rem 0;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-elevated);
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
}

/* 상단 네비 접이식 메뉴 — <details>/<summary>, JS 없음. 3열 격자, 390px 폭에서 안 넘침. */
.nav-ages {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 15rem;
}
.nav-ages-summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
}
.nav-ages-summary::-webkit-details-marker { display: none; }
.nav-ages-grid {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-subtle);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem 0.5rem;
}
.nav-ages-grid li { min-width: 0; }
.nav-ages-grid a {
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--brand);
  font-size: 0.9rem;
  word-break: keep-all;
}
.nav-ages-grid a:hover { background: var(--surface-elevated); }

/* 마크다운 표 — .table-wrap 에서 표만 가로 스크롤 (좁은 화면 대응) */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.9rem 0;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.table-wrap th,
.table-wrap td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 0.45rem 0.6rem;
  text-align: left;
  vertical-align: top;
  line-height: 1.55;
  word-break: keep-all;
}
.table-wrap th {
  background: var(--bg-subtle);
  font-weight: 600;
}
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap th:last-child,
.table-wrap td:last-child { border-right: none; }
