/* ==========================================================
   yangsw.tistory.com 스킨 스타일
   ========================================================== */

/* ---- 변수 · 다크모드 ---- */
:root {
  color-scheme: light dark;
  --bg: #fafafa;
  --surface: #fff;
  --text: #1c1c1e;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --radius: 12px;
  --gap: clamp(12px, 2vw, 20px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #181b21;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: #2a2f39;
    --accent: #60a5fa;
  }
}

/* ---- 기본 ---- */
*, *::before, *::after {
  box-sizing: border-box;
}
body {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 40px);
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
}
a:hover,
a:focus-visible {
  text-decoration: underline;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
h1 {
  margin: 0 0 var(--gap);
  text-align: center;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  letter-spacing: -0.02em;
}
h3 {
  margin: 0 0 .4em;
  font-size: 1.05rem;
}
ul {
  margin: 0;
  padding-left: 1.2em;
}
iframe {
  width: 560px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--radius);
}
input,
button,
textarea,
select {
  font-family: inherit;
}
.cnt {
  color: var(--muted);
}
.cnt:not(:empty)::before { content: "["; }
.cnt:not(:empty)::after { content: "]"; }

/* ---- 접근성 ---- */
.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 8px;
  top: 8px;
  z-index: 10;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- 레이아웃 ---- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: var(--gap);
  align-items: start;
}
@media (max-width: 860px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- 카드 ---- */
.card,
.post,
.list,
.taglog,
.guestbook {
  margin-bottom: var(--gap);
  padding: var(--gap);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / .04);
}

/* ---- 헤더 · 검색 ---- */
.site-header {
  margin-bottom: var(--gap);
  text-align: center;
}
.site-header h1 a {
  color: inherit;
}
.desc {
  margin: 0;
  color: var(--muted);
}
.blog-menu ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5em 1em;
  margin: .75em 0;
  padding: 0;
  list-style: none;
}
.search {
  display: flex;
  justify-content: center;
  gap: .5em;
}
.search input {
  width: min(100%, 360px);
  padding: .55em 1em;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.search button {
  padding: .5em 1em;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

/* ---- 글 공통 ---- */
.titleWrap h2 {
  margin: 0 0 .25em;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  line-height: 1.35;
}
.titleWrap a {
  color: inherit;
}
.meta {
  margin: 0 0 var(--gap);
  color: var(--muted);
  font-size: .875rem;
}
.meta .category::after {
  content: " · ";
  color: var(--muted);
}
.admin {
  font-size: .8rem;
  text-align: right;
}
.tags {
  margin: var(--gap) 0 0;
  color: var(--muted);
  font-size: .875rem;
}
.comments {
  margin-top: var(--gap);
}

/* ---- 글 본문 (에디터가 넣는 인라인 폰트 무시하고 통일) ---- */
.article,
.article * {
  font-family: inherit !important;
}
.article :where(p, li, span, div, td, th, blockquote, a, strong, em, b, i, u, font) {
  font-size: inherit !important;
  line-height: inherit !important;
  letter-spacing: normal !important;
}
.article h1 { font-size: 1.6em !important; }
.article h2 { font-size: 1.4em !important; }
.article h3 { font-size: 1.2em !important; }
.article h1,
.article h2,
.article h3,
.article h4 {
  margin: 1.4em 0 .5em;
  line-height: 1.4 !important;
}
.article p {
  margin: 0 0 1em;
}
.article img,
.article video {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}
.article table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}
.article blockquote {
  margin-inline: 0;
  padding-left: 1em;
  border-left: 3px solid var(--border);
  color: var(--muted);
}
.article hr {
  border: 0;
  border-top: 1px solid var(--border);
}
.article pre {
  overflow-x: auto;
  padding: 1em;
  border-radius: 8px;
  background: var(--bg);
}
.article pre,
.article pre *,
.article code,
.article code * {
  font-family: ui-monospace, SFMono-Regular, "D2Coding", Consolas, Menlo, monospace !important;
  font-size: .9em !important;
}

/* ---- 홈 글 목록 ---- */
.post.index-item {
  display: flex;
  gap: var(--gap);
}
.post .thumb,
.list .thumb {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
}
.index-body h2 {
  margin: 0 0 .3em;
  font-size: 1.15rem;
}
.index-body h2 a {
  color: inherit;
}
.summary {
  margin: 0 0 .4em;
  color: var(--muted);
  font-size: .9rem;
}

/* ---- 카테고리 · 검색 · 태그 목록 ---- */
.list ol {
  margin: 0;
  padding: 0;
  list-style: none;
}
.list li {
  display: flex;
  gap: var(--gap);
  padding-block: .7em;
  border-top: 1px solid var(--border);
}
.taglog ul {
  display: flex;
  flex-wrap: wrap;
  gap: .4em .9em;
  padding: 0;
  list-style: none;
}
.taglog .cloud1 { font-size: .85rem; }
.taglog .cloud2 { font-size: .95rem; }
.taglog .cloud3 { font-size: 1.05rem; }
.taglog .cloud4 { font-size: 1.2rem; }
.taglog .cloud5 { font-size: 1.4rem; font-weight: 600; }

/* ---- 이전/다음 글 · 관련 글 ---- */
.prev-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  margin-top: var(--gap);
}
.prev-next a {
  display: block;
  padding: .7em 1em;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: inherit;
}
.prev-next small {
  display: block;
  color: var(--muted);
}
.prev-next .next {
  grid-column: 2;
  text-align: right;
}
.related time,
.recentPost time {
  margin-left: .5em;
  color: var(--muted);
  font-size: .8rem;
}

/* ---- 페이지 이동 ---- */
.paging {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5em;
  margin-block: var(--gap);
}
.paging a {
  padding: .3em .8em;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.paging .no-more-prev,
.paging .no-more-next {
  visibility: hidden;
}
.paging .numbox {
  display: inline-flex;
  gap: .5em;
}
.paging .num {
  display: inline-block;
  min-width: 2em;
  text-align: center;
}

/* ---- 사이드바 ---- */
.sidebar-wrap .recentPost ul,
.sidebar-wrap .category ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.counter {
  display: flex;
  flex-direction: column;
  color: var(--muted);
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}

/* ---- 링크 모음 (홈 화면에서만 표시) ---- */
body:not(#tt-body-index) #links {
  display: none;
}
#links details {
  padding-block: .6em;
  border-top: 1px solid var(--border);
}
#links summary {
  cursor: pointer;
  font-weight: 600;
}
#links ul {
  margin-top: .5em;
}
#links iframe {
  margin-top: var(--gap);
}
.nav-inline {
  display: flex;
  flex-wrap: wrap;
  gap: .5em 1em;
  margin: 0;
}

/* ---- 푸터 ---- */
.site-footer {
  margin-top: calc(var(--gap) * 2);
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}