/*
Theme Name: OSMU Reader
Description: 정보 글을 읽기 좋게 보여 주는 가벼운 클래식 테마(모바일 우선 · 한국어 본문 · 다크 모드 · 자바스크립트 없음). 사이트 이름 · 설명은 WordPress 설정, 유튜브 주소 · 소개 문구는 사용자 정의하기에서 정한다.
Version: 0.1.0
Requires at least: 6.4
Requires PHP: 8.1
License: GPL-2.0-or-later
Text Domain: osmu-reader
*/

/* 색 · 크기 토큰(밝은 화면 기본 · 다크 모드는 시스템 설정을 따름) */
:root {
  --bg: #fbfbf8;
  --fg: #1d2129;
  --muted: #5b6472;
  --faint: #8a919c;
  --line: #e4e1d9;
  --soft: #f1efe9;
  --stripe: #f6f5f1;
  --accent: #1f5fbf;
  --box-bg: #eef3fb;
  --box-line: #2f6bd0;
  --measure: 700px;
  --gutter: 20px;
  --radius: 8px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Noto Sans KR", "Malgun Gothic", "맑은 고딕", system-ui, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b;
    --fg: #e5e7eb;
    --muted: #a0a8b4;
    --faint: #7c8490;
    --line: #2d3139;
    --soft: #1e2127;
    --stripe: #1a1d22;
    --accent: #84b3ff;
    --box-bg: #1b2433;
    --box-line: #5b8fe6;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: -0.005em;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

@media (min-width: 768px) {
  body {
    font-size: 18px;
  }
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

img {
  max-width: 100%;
  height: auto;
}

.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

.skip-link:focus {
  position: static !important;
  width: auto;
  height: auto;
  clip: auto;
  display: block;
  padding: 0.5em var(--gutter);
  background: var(--soft);
}

.wrap {
  max-width: calc(var(--measure) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* 머리글: 사이트 이름 · 설명 · 카테고리(가로로 밀어 보는 메뉴 · 스크립트 없음) */
.site-header {
  border-bottom: 1px solid var(--line);
}

.site-brand {
  padding: 18px 0 10px;
}

.site-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.site-title a {
  color: var(--fg);
  text-decoration: none;
}

.site-description {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.site-nav ul {
  display: flex;
  gap: 4px 18px;
  margin: 0;
  padding: 4px 0 12px;
  list-style: none;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  font-size: 0.92rem;
}

.site-nav ul::-webkit-scrollbar {
  display: none;
}

.site-nav ul ul {
  display: none;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav .current-menu-item > a,
.site-nav .current-cat > a,
.site-nav a:hover {
  color: var(--fg);
  font-weight: 700;
}

main {
  padding: 28px 0 48px;
}

/* 글 머리 */
.entry-category {
  margin: 0 0 6px;
  font-size: 0.85rem;
  font-weight: 700;
}

.entry-category a {
  text-decoration: none;
}

.entry-title {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.38;
  letter-spacing: -0.025em;
  font-weight: 800;
}

@media (min-width: 768px) {
  .entry-title {
    font-size: 2rem;
  }
}

.entry-meta {
  margin: 10px 0 0;
  color: var(--faint);
  font-size: 0.82rem;
}

.entry-thumbnail {
  margin: 22px 0 6px;
}

.entry-thumbnail img {
  display: block;
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: var(--radius);
}

/* 본문 */
.entry-content,
.editor-styles-wrapper {
  margin-top: 24px;
}

.entry-content > * {
  margin-top: 0;
  margin-bottom: 1.15em;
}

.entry-content h2,
.editor-styles-wrapper h2 {
  margin: 2.3em 0 0.7em;
  font-size: 1.32em;
  line-height: 1.42;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.entry-content h3,
.editor-styles-wrapper h3 {
  margin: 1.8em 0 0.55em;
  font-size: 1.12em;
  line-height: 1.5;
  font-weight: 700;
}

.entry-content h4 {
  margin: 1.5em 0 0.4em;
  font-size: 1em;
  font-weight: 700;
}

.entry-content strong {
  font-weight: 700;
}

.entry-content ul,
.entry-content ol {
  padding-left: 1.3em;
}

.entry-content li + li {
  margin-top: 0.35em;
}

/* 기준일 상자(글 머리 한 줄) */
.entry-content .osmu-as-of,
.editor-styles-wrapper .osmu-as-of {
  margin: 0 0 1.6em;
  padding: 0.8em 1em;
  background: var(--box-bg);
  border-left: 4px solid var(--box-line);
  border-radius: 4px var(--radius) var(--radius) 4px;
  color: var(--fg);
  font-size: 0.88em;
  line-height: 1.65;
}

/* 인용 · 공식 한 줄 */
.entry-content .wp-block-quote,
.entry-content blockquote {
  margin: 1.5em 0;
  padding: 0.2em 0 0.2em 1em;
  border-left: 3px solid var(--line);
  font-weight: 600;
}

.entry-content blockquote p {
  margin: 0.3em 0;
}

/* 표: 가로로 밀어 보기 · 줄무늬 · 숫자 열 오른쪽 정렬 */
.entry-content .wp-block-table {
  margin: 1.6em 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.entry-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
  line-height: 1.55;
}

.entry-content .wp-block-table table:has(th:nth-child(4)) {
  min-width: 34rem;
}

.entry-content th,
.entry-content td {
  padding: 0.6em 0.75em;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.entry-content thead th {
  background: var(--soft);
  border-bottom: 2px solid var(--line);
  font-weight: 700;
}

.entry-content tbody tr:nth-child(even) {
  background: var(--stripe);
}

.entry-content .has-text-align-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.entry-content figcaption,
.entry-content .wp-element-caption {
  margin-top: 0.6em;
  color: var(--muted);
  font-size: 0.8em;
  line-height: 1.55;
}

/* 그림(대표 카드 · 그래프): 흰 그래프가 다크 모드에서도 떠 보이지 않게 테두리 */
.entry-content .wp-block-image {
  margin: 1.8em 0;
}

.entry-content .wp-block-image img {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* 출처 목록 · 안내 문구는 작게 */
.entry-content .osmu-sources {
  color: var(--muted);
  font-size: 0.82em;
  line-height: 1.6;
}

.entry-content h2.osmu-sources,
.entry-content h3.osmu-sources {
  margin-top: 2.6em;
  padding-top: 1.2em;
  border-top: 1px solid var(--line);
  color: var(--fg);
  font-size: 0.95em;
}

.entry-content ul.osmu-sources {
  padding-left: 1.1em;
}

.entry-content .osmu-disclaimer {
  color: var(--faint);
  font-size: 0.8em;
}

/* 글 아래: 태그 · 소개 · 같은 분야 글 */
.entry-footer {
  margin-top: 36px;
}

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
}

.entry-tags a {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
}

.about-box {
  margin-top: 28px;
  padding: 16px 18px;
  background: var(--soft);
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.65;
}

.about-box p {
  margin: 0;
}

.about-box p + p {
  margin-top: 6px;
}

.related {
  margin-top: 36px;
}

.related h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.related ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.related li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
  line-height: 1.5;
}

.related a {
  color: var(--fg);
  text-decoration: none;
}

/* 글 목록(최신 · 카테고리 · 태그 · 검색) */
.archive-header {
  margin-bottom: 18px;
}

.archive-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
}

.archive-description {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-card {
  display: flex;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.post-card-body {
  flex: 1;
  min-width: 0;
}

.post-card-title {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.45;
  font-weight: 700;
}

.post-card-title a {
  color: var(--fg);
  text-decoration: none;
}

.post-card-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.post-card-meta {
  margin: 6px 0 0;
  color: var(--faint);
  font-size: 0.78rem;
}

.post-card-thumb {
  flex: none;
  width: 112px;
}

.post-card-thumb img {
  display: block;
  width: 112px;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: 6px;
}

@media (max-width: 380px) {
  .post-card-thumb {
    display: none;
  }
}

.pagination,
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  font-size: 0.9rem;
}

.nav-links .page-numbers {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
}

.nav-links .current {
  background: var(--soft);
  color: var(--fg);
  font-weight: 700;
}

/* 광고 자리(위젯을 넣었을 때만 나옴 · 높이를 미리 잡아 화면 밀림을 줄임) */
.ad-slot {
  margin: 28px 0;
  min-height: 100px;
  text-align: center;
}

.ad-slot .widget-title {
  display: none;
}

/* 바닥글 */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0 40px;
  color: var(--faint);
  font-size: 0.82rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.footer-links a {
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

/* 고정 페이지(소개 · 개인정보처리방침) */
.page .entry-content h2 {
  font-size: 1.15em;
}
