/* ============================================================
   PETERLEE.DEV_LAB — custom dark laboratory skin v1.0.0
   ============================================================ */
:root {
  --bg: #0a0d0b;
  --bg-soft: #0d110e;
  --panel: #11160f;
  --panel-2: #141a15;
  --line: #223028;
  --line-soft: #1a241e;
  --ink: #d9e2dc;
  --ink-strong: #f2f7f3;
  --muted: #84998b;
  --accent: #46f2a0;
  --accent-dim: rgba(70, 242, 160, 0.12);
  --code-bg: #0c0f0d;
  --sans: "Pretendard Variable", Pretendard, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(70, 242, 160, 0.055), transparent),
    linear-gradient(rgba(70, 242, 160, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70, 242, 160, 0.025) 1px, transparent 1px);
  background-size: 100% 100%, 44px 44px, 44px 44px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
::selection { background: var(--accent); color: #06110b; }
.mono { font-family: var(--mono); }

/* 스크롤 진행바 */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 200; background: transparent; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); box-shadow: 0 0 8px rgba(70, 242, 160, 0.7); }

/* ---------- 헤더 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10, 13, 11, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner {
  max-width: 1140px; margin: 0 auto; padding: 0 20px;
  height: 60px; display: flex; align-items: center; gap: 28px;
}
.logo { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.logo-mark { color: var(--accent); font-size: 20px; line-height: 1; }
.logo-text { font-family: var(--mono); font-weight: 800; font-size: 16px; letter-spacing: 0.04em; color: var(--ink-strong); }
.logo-text em { font-style: normal; color: var(--accent); }
.blog-menu { margin-left: auto; }
.blog-menu ul { display: flex; gap: 4px; list-style: none; }
.blog-menu a {
  display: block; padding: 7px 12px; font-size: 14px; font-weight: 600; color: var(--muted);
  border-radius: 6px; transition: color 0.15s, background 0.15s;
}
.blog-menu a:hover { color: var(--accent); background: var(--accent-dim); }
.header-search { flex-shrink: 0; }
.search-input {
  width: 170px; padding: 8px 12px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); font-family: var(--mono); font-size: 13px; outline: none;
  transition: border-color 0.15s, width 0.2s;
}
.search-input:focus { border-color: var(--accent); width: 210px; }
.search-input::placeholder { color: var(--muted); }

/* ---------- 레이아웃 ---------- */
.layout {
  max-width: 1140px; margin: 0 auto; padding: 36px 20px 60px;
  display: grid; grid-template-columns: minmax(0, 1fr) 296px; gap: 44px;
  align-items: start;
}

/* ---------- 히어로 ---------- */
.hero {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel-2), var(--bg-soft));
  padding: 40px 36px 32px; margin-bottom: 40px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 190px; height: 190px;
  border: 1px solid rgba(70, 242, 160, 0.18); border-radius: 50%;
  box-shadow: 0 0 0 26px rgba(70, 242, 160, 0.03), 0 0 0 60px rgba(70, 242, 160, 0.02);
}
.hero-kicker { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.22em; color: var(--accent); margin-bottom: 14px; }
.hero-title { font-size: 40px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink-strong); line-height: 1.15; }
.hero-desc { margin-top: 12px; font-size: 16.5px; color: var(--muted); max-width: 560px; }
.hero-meta { margin-top: 26px; display: flex; gap: 18px; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.12em; color: var(--muted); }
.hero-meta .live { color: var(--accent); display: flex; align-items: center; gap: 6px; }
.hero-meta .live i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; animation: blink 1.6s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ---------- 목록 ---------- */
.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.list-title { font-size: 22px; font-weight: 800; color: var(--ink-strong); letter-spacing: -0.01em; }
.list-sub { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.18em; color: var(--muted); white-space: nowrap; }

.log-item { border-bottom: 1px solid var(--line-soft); }
.log-link { display: flex; gap: 22px; padding: 24px 10px; border-radius: 8px; transition: background 0.15s; }
.log-link:hover { background: rgba(70, 242, 160, 0.03); }
.log-link:hover .log-title { color: var(--accent); }
.log-main { flex: 1; min-width: 0; }
.log-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.log-date { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.log-title { font-size: 19.5px; font-weight: 700; color: var(--ink-strong); line-height: 1.4; letter-spacing: -0.01em; transition: color 0.15s; }
.log-summary { margin-top: 7px; font-size: 14.5px; color: var(--muted); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.log-thumb { flex-shrink: 0; width: 148px; height: 104px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line-soft); }
.log-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.chip {
  display: inline-block; padding: 2.5px 9px; border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em; color: var(--muted);
}
.chip.accent { border-color: rgba(70, 242, 160, 0.45); color: var(--accent); background: var(--accent-dim); }

.empty { padding: 56px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); margin-top: 24px; }
.empty-title { font-size: 17px; font-weight: 700; color: var(--ink-strong); }
.empty-desc { margin-top: 6px; font-size: 14px; color: var(--muted); }

/* ---------- 페이징 ---------- */
.paging { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 38px; font-family: var(--mono); font-size: 13px; }
.paging a { padding: 7px 12px; border: 1px solid var(--line-soft); border-radius: 7px; color: var(--muted); transition: all 0.15s; }
.paging a:hover { border-color: var(--accent); color: var(--accent); }
.paging a.selected, .paging .page-num.selected { background: var(--accent); border-color: var(--accent); color: #06110b; font-weight: 800; }
.paging a.no-more-prev, .paging a.no-more-next { opacity: 0.35; pointer-events: none; }

/* ---------- 글 본문 ---------- */
.article-head { padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 30px; }
.article-head .chip { margin-bottom: 14px; }
.article-title { font-size: 32px; font-weight: 800; line-height: 1.32; letter-spacing: -0.02em; color: var(--ink-strong); }
.article-meta { margin-top: 14px; display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.admin-links a { color: var(--muted); font-size: 12.5px; margin-right: 8px; }
.admin-links a:hover { color: var(--accent); }
.ad-state { font-size: 12px; }

.toc {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft);
  padding: 18px 22px; margin-bottom: 30px;
}
.toc-title { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.16em; color: var(--accent); margin-bottom: 10px; }
.toc ul { list-style: none; }
.toc li { padding: 3px 0; font-size: 14.5px; }
.toc li.sub { padding-left: 18px; font-size: 13.5px; }
.toc a { color: var(--muted); }
.toc a:hover { color: var(--accent); }

.article-desc { font-size: 16.5px; line-height: 1.85; color: var(--ink); word-break: keep-all; overflow-wrap: break-word; }
.article-desc p { margin: 0 0 1.15em; }
.article-desc h2 {
  font-size: 24px; font-weight: 800; color: var(--ink-strong); letter-spacing: -0.015em;
  margin: 1.7em 0 0.7em; padding-left: 14px; border-left: 3px solid var(--accent); line-height: 1.35;
}
.article-desc h3 { font-size: 19.5px; font-weight: 700; color: var(--ink-strong); margin: 1.5em 0 0.6em; }
.article-desc h4 { font-size: 17px; font-weight: 700; color: var(--ink-strong); margin: 1.3em 0 0.5em; }
.article-desc a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(70, 242, 160, 0.4); }
.article-desc strong { color: var(--ink-strong); }
.article-desc ul, .article-desc ol { margin: 0 0 1.15em; padding-left: 22px; }
.article-desc li { margin-bottom: 0.35em; }
.article-desc li::marker { color: var(--accent); }
.article-desc blockquote {
  margin: 1.4em 0; padding: 14px 20px; border-left: 3px solid var(--accent);
  background: var(--accent-dim); border-radius: 0 8px 8px 0; color: var(--ink);
}
.article-desc blockquote p { margin: 0; }
.article-desc img { border-radius: 8px; border: 1px solid var(--line-soft); }
.article-desc figure { margin: 1.4em 0; text-align: center; }
.article-desc figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }
.article-desc table { width: 100%; border-collapse: collapse; margin: 1.3em 0; font-size: 14.5px; }
.article-desc th, .article-desc td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; }
.article-desc th { background: var(--panel-2); color: var(--ink-strong); font-weight: 700; }
.article-desc hr { border: none; border-top: 1px solid var(--line); margin: 2em 0; }

/* 코드 */
.article-desc pre {
  position: relative; background: var(--code-bg) !important; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin: 1.3em 0; overflow-x: auto;
}
.article-desc pre code {
  font-family: var(--mono); font-size: 13.5px; line-height: 1.7; background: transparent !important; padding: 0 !important;
}
.article-desc code {
  font-family: var(--mono); font-size: 0.88em; background: var(--panel-2);
  border: 1px solid var(--line-soft); border-radius: 5px; padding: 1.5px 6px; color: #a7f3c9;
}
.copy-btn {
  position: absolute; top: 10px; right: 10px; padding: 4px 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
  opacity: 0; transition: opacity 0.15s, color 0.15s;
}
.article-desc pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }

/* 티스토리 에디터 기본 클래스 보정 */
.article-desc .tt_article_useless_p_margin p { margin: 0 0 1.15em; }
.article-desc div[data-ke-type="moreLess"] { border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; }

.article-tags { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line-soft); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tags-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; color: var(--muted); margin-right: 4px; }
.article-tags a, .tag-chip {
  display: inline-block; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 13px; color: var(--muted); transition: all 0.15s;
}
.article-tags a:hover, .tag-chip:hover { border-color: var(--accent); color: var(--accent); }

.related { margin-top: 40px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); padding: 22px 24px; }
.related-title { font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: 0.14em; color: var(--accent); margin-bottom: 14px; }
.related-list { list-style: none; }
.related-list li { border-top: 1px solid var(--line-soft); }
.related-list li:first-child { border-top: none; }
.related-list a { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; font-size: 15px; }
.related-list a:hover .rel-title { color: var(--accent); }
.rel-date { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

.prev-next { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 34px; }
.pn { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: block; transition: border-color 0.15s; }
.pn:hover { border-color: var(--accent); }
.pn.next { text-align: right; }
.pn-label { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; color: var(--muted); margin-bottom: 6px; }
.pn-title { font-size: 15px; font-weight: 700; color: var(--ink-strong); }

/* 보호글 */
.protected { border: 1px solid var(--line); border-radius: var(--radius); padding: 44px 36px; text-align: center; background: var(--bg-soft); }
.protected-kicker { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.22em; color: var(--accent); }
.protected-title { font-size: 24px; font-weight: 800; color: var(--ink-strong); margin-top: 12px; }
.protected-date { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.protected-desc { margin-top: 16px; color: var(--muted); font-size: 14.5px; }
.protected-form { margin-top: 20px; display: flex; justify-content: center; gap: 8px; }
.protected-input { padding: 10px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); outline: none; }
.protected-input:focus { border-color: var(--accent); }
.protected-btn { padding: 10px 20px; background: var(--accent); color: #06110b; font-weight: 700; border: none; border-radius: 8px; cursor: pointer; }

/* 댓글/방명록 (티스토리 기본 그룹 다크 보정) */
.comments, .guestbook { margin-top: 44px; }
.comments a, .guestbook a { color: var(--accent); }
.comments input[type="text"], .comments input[type="password"], .comments textarea,
.guestbook input[type="text"], .guestbook input[type="password"], .guestbook textarea {
  background: var(--bg-soft) !important; border: 1px solid var(--line) !important; border-radius: 8px;
  color: var(--ink) !important; padding: 9px 12px; outline: none;
}

/* 태그 페이지 */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 9px; padding-top: 20px; }
.tag-cloud .tag-chip { font-size: 14px; padding: 6px 15px; }

/* ---------- 사이드바 ---------- */
.sidebar { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 18px; }
.side-box { border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--bg-soft); padding: 20px; }
.side-title { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.14em; color: var(--accent); margin-bottom: 14px; }

.profile { text-align: left; }
.profile-img { width: 62px; height: 62px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line); display: block; }
.profile-name { margin-top: 13px; font-size: 17px; font-weight: 800; color: var(--ink-strong); }
.profile-desc { margin-top: 5px; font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.profile-gh { display: inline-block; margin-top: 12px; font-size: 12.5px; color: var(--accent); }
.profile-gh:hover { text-decoration: underline; }

/* 카테고리 (티스토리 기본 마크업) */
.category ul { list-style: none; }
.category .tt_category { font-size: 14.5px; }
.category a { display: inline-block; padding: 3.5px 0; color: var(--muted); transition: color 0.15s; }
.category a:hover { color: var(--accent); }
.category .link_tit { font-weight: 700; color: var(--ink); }
.category .category_list { margin: 2px 0 6px; }
.category .sub_category_list { padding-left: 14px; border-left: 1px solid var(--line-soft); margin: 2px 0 6px 4px; }
.category .c_cnt { font-family: var(--mono); font-size: 11px; color: var(--accent); margin-left: 5px; }

.recent-posts, .recent-comments { list-style: none; }
.recent-posts li { padding: 8px 0; border-top: 1px solid var(--line-soft); }
.recent-posts li:first-child { border-top: none; padding-top: 0; }
.recent-posts a { font-size: 14.5px; font-weight: 600; color: var(--ink); display: block; line-height: 1.5; }
.recent-posts a:hover { color: var(--accent); }
.rp-date { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

.recent-comments li { padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.recent-comments li:first-child { border-top: none; padding-top: 0; }
.recent-comments a { color: var(--muted); display: block; }
.rc-name { color: var(--accent); font-weight: 700; margin-right: 6px; }
.rc-desc { display: block; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-time { font-family: var(--mono); font-size: 11px; }

.side-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.side-tags .tag-chip { font-size: 12.5px; padding: 3px 11px; }

.counter { display: flex; flex-direction: column; gap: 8px; }
.counter div { display: flex; justify-content: space-between; align-items: baseline; }
.counter span { font-size: 11px; letter-spacing: 0.14em; color: var(--muted); }
.counter strong { font-size: 15px; color: var(--ink-strong); font-weight: 600; }

/* ---------- 푸터 ---------- */
.site-footer { border-top: 1px solid var(--line-soft); background: var(--bg-soft); }
.footer-inner { max-width: 1140px; margin: 0 auto; padding: 38px 20px 44px; }
.footer-logo { font-size: 14px; font-weight: 800; letter-spacing: 0.06em; color: var(--ink-strong); }
.footer-desc { margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.footer-copy { margin-top: 14px; font-size: 11.5px; letter-spacing: 0.06em; color: var(--muted); }

/* 맨 위로 */
#toTop {
  position: fixed; right: 22px; bottom: 22px; width: 42px; height: 42px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--accent); font-size: 17px;
  cursor: pointer; opacity: 0; pointer-events: none; transition: opacity 0.2s, border-color 0.15s; z-index: 90;
}
#toTop.show { opacity: 1; pointer-events: auto; }
#toTop:hover { border-color: var(--accent); }

/* ---------- 반응형 ---------- */
@media (max-width: 1020px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .sidebar { position: static; }
}
@media (max-width: 680px) {
  .header-inner { gap: 14px; }
  .header-search { display: none; }
  .hero { padding: 28px 22px 24px; }
  .hero-title { font-size: 29px; }
  .article-title { font-size: 25px; }
  .log-link { flex-direction: column; gap: 14px; }
  .log-thumb { width: 100%; height: 170px; }
  .prev-next { grid-template-columns: 1fr; }
  .list-head { flex-direction: column; gap: 4px; }
}

/* ---------- 인터랙티브 ---------- */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(70, 242, 160, 0.09), transparent 65%);
  opacity: 0; transition: opacity 0.3s;
}
.hero:hover::before { opacity: 1; }
.hero::after { z-index: 0; }
.hero > *:not(canvas) { position: relative; z-index: 1; }
#labCanvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

/* 히어로 터미널 */
.terminal {
  margin-top: 26px; max-width: 520px;
  background: rgba(7, 9, 8, 0.82); border: 1px solid var(--line); border-radius: 10px;
  font-family: var(--mono); overflow: hidden; text-align: left;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}
.term-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: rgba(255, 255, 255, 0.03); border-bottom: 1px solid var(--line-soft); }
.term-bar span { width: 10px; height: 10px; border-radius: 50%; background: #2a352e; display: inline-block; }
.term-bar span:first-child { background: rgba(255, 95, 86, 0.55); }
.term-bar span:nth-child(2) { background: rgba(255, 189, 46, 0.55); }
.term-bar span:nth-child(3) { background: rgba(70, 242, 160, 0.6); }
.term-bar em { font-style: normal; margin-left: 8px; font-size: 11px; color: var(--muted); letter-spacing: 0.06em; }
.term-body { padding: 13px 16px 15px; font-size: 13px; min-height: 74px; }
.term-prompt { color: var(--accent); font-weight: 600; }
.term-caret { display: inline-block; width: 8px; height: 15px; margin-left: 3px; background: var(--accent); vertical-align: -2px; animation: blink 1s steps(1) infinite; }
.term-out { margin-top: 7px; color: var(--muted); opacity: 0; transform: translateY(3px); transition: opacity 0.35s, transform 0.35s; }
.term-out.show { opacity: 1; transform: none; }

/* 스크롤 리빌 */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* 로그 아이템 호버 글로우 */
.log-item { position: relative; }
.log-item::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: 8px;
  background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%), rgba(70, 242, 160, 0.05), transparent 65%);
  opacity: 0; transition: opacity 0.25s;
}
.log-item:hover::before { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .term-caret, .hero-meta .live i { animation: none; }
}
