/* NYT풍 에디토리얼 테마: 세리프 헤드라인, 흑백 위주 팔레트, 카드 박스 대신 얇은 구분선.
   색상/타이포그래피 변수와 다크모드 토글, 화면 크기와 무관한 구조를 담는다.
   레이아웃(폭/여백/글자 크기)은 site-mobile.css / site-desktop.css에서 화면별로 정의한다. */

:root {
  --bg: #ffffff;
  --text: #121212;
  --text-muted: #666666;
  --border: #dcdcdc;
  --rule: #121212;
  --accent: #a2201d;
  --implication-bg: #f5f4f1;
  --serif: "Noto Serif KR", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Malgun Gothic", sans-serif;
}

/* 첫 로드 시엔 시스템 설정과 무관하게 항상 라이트 모드로 뜨고, 토글 버튼으로 명시적으로
   다크를 선택했을 때만 다크 모드가 적용된다 (선택값은 쿠키에 저장되어 다음 방문에도 유지). */
:root[data-theme="dark"] {
  --bg: #000000;
  --text: #e6e6e6;
  --text-muted: #9a9a9a;
  --border: #333333;
  --rule: #e6e6e6;
  --accent: #e2726f;
  --implication-bg: #19191a;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
}

a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ---------- 헤더 / 마스트헤드 ---------- */
.site-header { background: var(--bg); }

.utility-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

/* 좌우로 슬라이딩하는 스위치형 다크모드 토글: .theme-toggle이 트랙, .theme-toggle-thumb이
   슬라이딩하는 손잡이. 손잡이 안의 아이콘은 기존 방식대로 상태에 따라 교체된다. */
.theme-toggle {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  padding: 3px;
  display: flex;
  align-items: center;
}
.theme-toggle:hover { border-color: var(--text); }

.theme-toggle-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  line-height: 1;
  transition: transform 0.2s ease;
}

.icon-moon, .icon-sun { display: none; }
:root:not([data-theme="dark"]) .icon-moon { display: inline; }
:root[data-theme="dark"] .icon-sun { display: inline; }

:root[data-theme="dark"] .theme-toggle-thumb { transform: translateX(var(--toggle-travel)); }

/* ---------- 언어 선택 드롭다운 ---------- */
.lang-select { position: relative; }

.lang-select-trigger {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--sans);
  display: flex;
  align-items: center;
  line-height: 1;
}
.lang-select-trigger:hover { border-color: var(--text); }

.lang-select-caret { color: var(--text-muted); }

.lang-select-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  margin: 0;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  z-index: 20;
}
.lang-select-list[hidden] { display: none; }

.lang-select-list li {
  font-family: var(--sans);
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
}
.lang-select-list li:hover { background: var(--implication-bg); }
:root[data-lang="ko"] .lang-select-list li[data-lang-value="ko"],
:root[data-lang="en"] .lang-select-list li[data-lang-value="en"] {
  font-weight: 700;
}

/* ---------- 다국어 (한국어 / 영어) ---------- */
:root[data-lang="ko"] .lang-en { display: none; }
:root[data-lang="en"] .lang-ko { display: none; }

/* ---------- 이메일 구독 ---------- */
.subscribe-box {
  text-align: center;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.subscribe-title {
  font-family: var(--serif);
  font-weight: 700;
  margin: 0 0 4px;
}

.subscribe-desc {
  font-family: var(--sans);
  color: var(--text-muted);
  margin: 0;
}

.subscribe-form {
  display: flex;
  justify-content: center;
  margin: 0 auto;
}

.subscribe-input {
  flex: 1;
  font-family: var(--sans);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
}
.subscribe-input:focus { outline: none; border-color: var(--text); }

.subscribe-submit {
  font-family: var(--sans);
  font-weight: 700;
  border: 1px solid var(--rule);
  background: var(--rule);
  color: var(--bg);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.subscribe-submit:hover { opacity: 0.85; }
.subscribe-submit:disabled { opacity: 0.5; cursor: default; }

.subscribe-status {
  font-family: var(--sans);
  color: var(--text-muted);
}

.header-inner {
  text-align: center;
  border-bottom: 3px double var(--rule);
}

.site-header h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.site-header h1 a { color: var(--text); text-decoration: none; }

.tagline {
  font-family: var(--sans);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mission {
  font-family: var(--serif);
  color: var(--text-muted);
  text-align: left;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* 문단을 왼쪽 정렬(중앙 정렬은 여러 줄에서 가독성이 떨어짐)하고, 두 문장을 시각적으로
   분리해 "소스 구성" 문장과 "왜 중요한지" 문장을 구분한다. */
.mission .lang-ko,
.mission .lang-en {
  display: block;
}

.mission-para {
  display: block;
}
.mission-para + .mission-para {
  margin-top: 0.6em;
}

.mission-emphasis {
  color: var(--text);
}

/* ---------- 날짜 바 ---------- */
.date-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--sans);
  border-bottom: 1px solid var(--border);
}

.date-label { font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

.archive-badge {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  padding: 2px 10px;
}

.back-link { margin-left: auto; text-transform: uppercase; letter-spacing: 0.03em; }

.empty-state { font-family: var(--serif); color: var(--text-muted); }

/* ---------- 목차 ---------- */
.toc {
  font-family: var(--sans);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.toc-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.toc-list a {
  display: flex;
  align-items: baseline;
  color: var(--text);
  text-decoration: none;
}
.toc-list a:hover { color: var(--accent); }
.toc-list a:hover .toc-text { text-decoration: underline; text-decoration-color: var(--accent); }

.toc-num {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ---------- 기사 목록 (카드 박스 대신 얇은 구분선) ---------- */
.article-list { display: flex; flex-direction: column; }

.article-card { border-bottom: 1px solid var(--border); scroll-margin-top: 16px; }
.article-card:last-child { border-bottom: none; }

.article-meta {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.article-meta .dot { margin: 0 6px; }

.article-title { font-family: var(--serif); font-weight: 700; }
.article-title a { color: var(--text); text-decoration: none; }
.article-title a:hover { color: var(--accent); text-decoration: underline; }

.block-label {
  font-family: var(--sans);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.article-summary p { font-family: var(--serif); margin: 0; }

.article-implication {
  border-left: 3px solid var(--rule);
  background: var(--implication-bg);
  border-radius: 0 3px 3px 0;
}
.article-implication .block-label { color: var(--text); }
.article-implication p { font-family: var(--serif); margin: 0; }

/* ---------- 아카이브 ---------- */
.archive-section { border-top: 3px double var(--rule); }

.archive-title {
  font-family: var(--sans);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.archive-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  font-family: var(--sans);
}
.archive-list a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); }
.archive-list a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.site-footer {
  text-align: center;
  color: var(--text-muted);
  font-family: var(--sans);
  border-top: 1px solid var(--border);
}
