/* ═══════════════════════════════════════════════════════════════
   Soft Neutral - Clean & Minimal Blog Skin
   ═══════════════════════════════════════════════════════════════ */

/* 1. VARIABLES */
:root {
  --ink: #222;
  --text: #444;
  --sub: #8a8a8a;
  --faint: #bbb;
  --line: #eee;
  --bg: #fafafa;
  --card: #fff;
  --hover-bg: #f5f5f5;

  --font: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --space-2xl: 64px;

  --content-width: 1060px;
  --content-narrow: 680px;
  --sidebar-width: 260px;

  --radius: 14px;
  --radius-sm: 10px;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eee;
    --text: #ccc;
    --sub: #888;
    --faint: #555;
    --line: #2a2a2a;
    --bg: #111;
    --card: #1a1a1a;
    --hover-bg: #222;
  }
}


/* 2. RESET & BASE */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }


/* 3. LAYOUT */
.wrap {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

#main {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: 44px;
  padding: 36px 0 80px;
}

#main.sidebarPosition.none {
  grid-template-columns: 1fr;
}

#content { min-width: 0; }


/* 4. HEADER */
#header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: box-shadow 0.2s;
}

#header.scrolled {
  box-shadow: 0 1px 8px rgba(0,0,0,0.04);
}

@media (prefers-color-scheme: dark) {
  #header.scrolled {
    box-shadow: 0 1px 8px rgba(0,0,0,0.2);
  }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 85px;
}

/* Logo */
#header-title h1,
#header-title .h1-style { margin: 0; }

#header-title a {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.03em;
}

/* Nav */
.header-nav {
  display: flex;
  gap: 20px;
}

.nav-link {
  font-size: 0.85rem;
  color: var(--sub);
  font-weight: 500;
  transition: color 0.15s;
}

.nav-link:hover { color: var(--ink); }

/* Search */
#search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 0.15s;
}

#search-bar:focus-within {
  border-color: var(--sub);
}

.search-icon { color: var(--faint); flex-shrink: 0; }

#search-input {
  border: none;
  background: transparent;
  font-size: 0.82rem;
  color: var(--text);
  width: 120px;
  outline: none;
  font-family: var(--font);
}

#search-input::placeholder { color: var(--faint); }


/* 5. POST LIST - Card Style */
.list-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.list-card:hover {
  border-color: #d0d0d0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

@media (prefers-color-scheme: dark) {
  .list-card:hover {
    border-color: #444;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  }
}

.card-link {
  display: flex;
  gap: 20px;
  padding: 20px;
  align-items: center;
}

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

.card-cat {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--sub);
  margin-bottom: 2px;
  display: block;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink);
  margin-bottom: 4px;
  word-break: keep-all;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--sub);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-date {
  font-size: 0.72rem;
  color: var(--faint);
  margin-top: 8px;
  display: block;
}

/* Thumbnail */
.card-thumb {
  width: 130px;
  height: 95px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--hover-bg);
}

.card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* 6. ARTICLE */
.article-head {
  text-align: center;
  padding: 44px 0 28px;
  max-width: var(--content-narrow);
  margin: 0 auto;
}

.article-meta {
  font-size: 0.75rem;
  color: var(--sub);
  margin-bottom: 10px;
}

.article-meta a {
  font-weight: 600;
  color: var(--ink);
  transition: color 0.15s;
}

.article-meta a:hover { opacity: 0.7; }

.sep { margin: 0 6px; }

.article-title {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  letter-spacing: -0.01em;
  word-break: keep-all;
}


/* 7. ARTICLE BODY */
.article-body {
  max-width: var(--content-narrow);
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text);
}

.article-body > * + * { margin-top: 1.4em; }

.article-body p { word-break: keep-all; }

/* Headings */
.article-body h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  margin: 2.2em 0 0.7em;
}

.article-body h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  margin: 1.8em 0 0.5em;
}

.article-body h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.5em 0 0.4em;
}

/* Links */
.article-body a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}

.article-body a:hover {
  text-decoration-color: var(--ink);
}

/* Blockquote */
.article-body blockquote {
  background: var(--hover-bg);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin: 1.5em 0;
  color: var(--sub);
  font-style: italic;
}

/* Lists */
.article-body ul,
.article-body ol {
  padding-left: var(--space-lg);
}

.article-body li { margin: 0.4em 0; }

/* Code */
.article-body code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.88em;
  background: var(--hover-bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
}

.article-body pre {
  background: var(--ink);
  color: var(--bg);
  padding: var(--space-lg);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1.5em 0;
}

@media (prefers-color-scheme: dark) {
  .article-body pre {
    background: #0d0d0d;
    color: #ddd;
  }
}

.article-body pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 0.85rem;
  line-height: 1.6;
}

/* Images */
.article-body img {
  border-radius: var(--radius-sm);
  margin: 1.5em auto;
}

.article-body figure { margin: 1.5em 0; }

.article-body figcaption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--sub);
  margin-top: var(--space-sm);
}

/* Tables */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.92rem;
}

.article-body th,
.article-body td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.article-body th {
  font-weight: 600;
  color: var(--ink);
  background: var(--hover-bg);
}

/* HR */
.article-body hr {
  border: none;
  height: 1px;
  background: var(--line);
  margin: 2.5em 0;
}


/* 8. SIDEBAR */
#sidebar {
  position: sticky;
  top: 80px;
  height: fit-content;
}

.sb-module { margin-bottom: 20px; }

/* About */
.sb-about {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 20px;
}

.sb-about-inner { text-align: center; }

.sb-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--line);
  margin: 0 auto 10px;
}

.sb-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
}

.sb-desc {
  font-size: 0.78rem;
  color: var(--sub);
  margin-top: 2px;
  line-height: 1.5;
}

/* Category */
.sb-category {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.sb-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sub);
  margin-bottom: 12px;
}

.sb-cat-list a {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.85rem;
  color: var(--text);
  transition: color 0.15s;
}

.sb-cat-list a:hover { color: var(--ink); }

.sb-cat-list .c_cnt {
  font-size: 0.75rem;
  color: var(--faint);
}

/* N 뱃지 이미지 고정 크기 */
.sb-cat-list img {
  width: 14px;
  height: 14px;
  display: inline-block;
  align-self: center;
  flex-shrink: 0;
}

/* 카테고리 계층 들여쓰기 */
.sb-cat-list .tt_category {
  padding-left: 10px;
}
.sb-cat-list .category_list {
  padding-left: 14px;
}
.sb-cat-list .sub_category_list {
  padding-left: 14px;
}
.sb-cat-list .sub_category_list a {
  font-size: 0.8rem;
  color: var(--sub);
}
.sb-cat-list .sub_category_list a:hover {
  color: var(--text);
}


/* 9. PAGINATION */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 28px 0;
}

.pg-nums {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pg-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  font-size: 0.82rem;
  color: var(--sub);
  border-radius: 8px;
  transition: all 0.15s;
}

.pg-num:hover {
  background: var(--hover-bg);
  color: var(--ink);
}

/* Current page */
.pg-num:has(.selected) {
  background: var(--ink);
  color: var(--card);
  font-weight: 600;
  pointer-events: none;
}

.pg-num span.selected {
  color: inherit;
}

.pg-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--sub);
  border-radius: 8px;
  transition: all 0.15s;
}

.pg-arrow:hover {
  background: var(--hover-bg);
  color: var(--ink);
}

.no-more-prev,
.no-more-next {
  opacity: 0.3;
  pointer-events: none;
}


/* 10. COMMENTS & REACTIONS */
.post-reply {
  max-width: var(--content-narrow);
  margin: var(--space-lg) auto 0;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--line);
}

.another_category {
  margin: var(--space-lg) 0 var(--space-md) !important;
}

.post-reply .tt-box-profile,
.post-reply .tt_box_namecard {
  margin: var(--space-md) 0 !important;
  padding: var(--space-md) !important;
}

.post-reply .tt-box-total {
  margin-top: var(--space-sm) !important;
}

.post-reply .rp_wrap,
.post-reply #entry0Comment,
.post-reply .tt_box_total,
.post-reply .tt_cmt_input {
  color: var(--text) !important;
  background: transparent !important;
}

.post-reply input,
.post-reply textarea {
  color: var(--text) !important;
  background: var(--card) !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  padding: var(--space-sm) var(--space-md) !important;
}

.post-reply input::placeholder,
.post-reply textarea::placeholder {
  color: var(--faint) !important;
}

/* Comment buttons - reset all first */
.post-reply button {
  background: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  color: inherit !important;
}

/* Submit buttons */
.post-reply .tt-btn-register,
.post-reply button[type="submit"],
.post-reply .tt-comment-cont .tt-btn-text,
.post-reply .tt_btn_submit {
  background: var(--ink) !important;
  color: var(--card) !important;
  border-radius: 8px !important;
  padding: var(--space-sm) var(--space-md) !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  transition: opacity 0.15s !important;
  line-height: 1.4 !important;
}

.post-reply .tt-btn-register:hover,
.post-reply button[type="submit"]:hover,
.post-reply .tt-comment-cont .tt-btn-text:hover,
.post-reply .tt_btn_submit:hover {
  opacity: 0.8 !important;
}

/* Cancel buttons */
.post-reply .tt-btn-cancel,
.post-reply button[data-action="cancel"] {
  background: transparent !important;
  color: var(--sub) !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  padding: var(--space-sm) var(--space-md) !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
}

/* More button */
.post-reply .tt-button-modify {
  width: 24px !important;
  height: 24px !important;
  font-size: 0 !important;
  position: relative !important;
  border-radius: 4px !important;
}

.post-reply .tt-button-modify::after {
  content: '⋯' !important;
  position: absolute !important;
  inset: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 16px !important;
  color: var(--faint) !important;
}

.post-reply .tt-button-modify:hover {
  background: var(--hover-bg) !important;
}

.post-reply .tt_txt_g,
.post-reply .tt_cmt_info,
.post-reply .tt_date {
  color: var(--sub) !important;
}

.post-reply a { color: var(--text) !important; }
.post-reply a:hover { color: var(--ink) !important; }

.container_postbtn {
  max-width: var(--content-narrow);
  margin: var(--space-xl) auto;
  visibility: hidden;
}

/* Dark mode comments */
@media (prefers-color-scheme: dark) {
  .post-reply .tt_txt_g,
  .post-reply .tt-link-user,
  .post-reply .tt_txt_user,
  .post-reply a.tt_txt_user {
    color: var(--ink) !important;
  }

  .post-reply .tt_txt_cnt,
  .post-reply p,
  .post-reply span:not(.tt_date) {
    color: var(--text) !important;
  }

  .post-reply .tt-wrap-cmt,
  .post-reply .tt-item-reply {
    border-color: var(--line) !important;
  }

  .another_category,
  .another_category table {
    background: transparent !important;
    color: var(--text) !important;
  }

  .another_category a { color: var(--text) !important; }
  .another_category a:hover { color: var(--ink) !important; }
  .another_category th { background: var(--hover-bg) !important; color: var(--ink) !important; }
  .another_category td { border-color: var(--line) !important; }
}


/* 11. FOOTER */
#footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  text-align: center;
}

.footer-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.footer-nav a {
  font-size: 0.78rem;
  color: var(--sub);
  font-weight: 500;
  transition: color 0.15s;
}

.footer-nav a:hover { color: var(--ink); }

.footer-sep { color: var(--faint); user-select: none; }

.footer-copy {
  font-size: 0.75rem;
  color: var(--faint);
}

.footer-copy a {
  color: var(--sub);
  font-weight: 500;
}


/* 12. RESPONSIVE */
@media screen and (max-width: 860px) {
  #main {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  #sidebar {
    position: static;
    padding-top: var(--space-xl);
    border-top: 1px solid var(--line);
  }

  .header-nav { display: none; }
}

@media screen and (max-width: 600px) {
  :root {
    --space-lg: 20px;
    --space-xl: 32px;
    --space-2xl: 48px;
  }

  .header-inner { height: 50px; }

  #header-title a { font-size: 1rem; }

  .card-link {
    flex-direction: column-reverse;
    gap: 12px;
  }

  .card-thumb {
    width: 100%;
    height: 180px;
    border-radius: var(--radius-sm);
  }

  .card-title { font-size: 1rem; }

  .article-title { font-size: 1.4rem; }

  .article-body { font-size: 0.95rem; }

  .article-body h2 { font-size: 1.2rem; }

  #search-input { width: 80px; font-size: 0.8rem; }
}


/* 13. ACCESSIBILITY */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--card);
  padding: var(--space-sm) var(--space-lg);
  border-radius: 0 0 8px 8px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 9999;
  transition: top 0.15s;
}

.skip-link:focus { top: 0; outline: none; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

:target { scroll-margin-top: 80px; }

::selection {
  background: var(--ink);
  color: var(--card);
}


/* 14. PRINT */
@media print {
  #header, #sidebar, #footer, .container_postbtn { display: none; }
  #main { display: block; }
  .article-body { max-width: none; font-size: 12pt; }
}

/* 15. REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ── 스크롤 읽기 게이지 ── */
#reading-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: #ef4444;
  transition: width 0.1s linear;
  z-index: 101;
  border-radius: 0 2px 2px 0;
}
   