@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-card: #ffffff;
  --border: #e3e6ea;
  --text: #16191d;
  --text-dim: #5c636b;
  --text-faint: #8b939c;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --up: #d92d20;
  --down: #1570ef;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .04);
  --maxw: 860px;
}

[data-theme="dark"] {
  --bg: #0e1116;
  --bg-soft: #151a21;
  --bg-card: #161b22;
  --border: #262d36;
  --text: #e6e9ed;
  --text-dim: #9aa4b0;
  --text-faint: #6e7781;
  --accent: #58a6ff;
  --accent-soft: #17263d;
  --up: #f87171;
  --down: #60a5fa;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .2);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: break-word;
  transition: background .2s, color .2s;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 62px; gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px; letter-spacing: -.02em;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: grid; place-items: center;
  color: #fff; font-size: 13px; font-weight: 800;
}
.nav { display: flex; align-items: center; gap: 6px; }
.nav a {
  color: var(--text-dim); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 7px 11px; border-radius: 8px;
}
.nav a:hover { color: var(--text); background: var(--bg-soft); }
.theme-btn {
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-dim);
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  display: grid; place-items: center; font-size: 15px; padding: 0;
}
.theme-btn:hover { color: var(--text); border-color: var(--text-faint); }

/* ---------- hero ---------- */
.hero { padding: 56px 0 32px; border-bottom: 1px solid var(--border); }
.hero h1 {
  margin: 0 0 12px; font-size: 34px; font-weight: 800;
  letter-spacing: -.035em; line-height: 1.25;
}
.hero p { margin: 0; color: var(--text-dim); font-size: 16px; }

/* ---------- search ---------- */
.toolbar {
  display: flex; gap: 12px; align-items: center;
  padding: 26px 0 6px;
}
.count {
  font-size: 13px; color: var(--text-faint); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.search {
  flex: 1; min-width: 0;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  border-radius: 10px; padding: 9px 13px; font-size: 14px; font-family: inherit;
  outline: none;
}
.search:focus { border-color: var(--accent); }
.search::placeholder { color: var(--text-faint); }

/* ---------- post list ---------- */
.posts { padding: 18px 0 64px; display: flex; flex-direction: column; gap: 12px; }
.card {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--border); background: var(--bg-card);
  border-radius: var(--radius); padding: 20px 22px;
  transition: .18s ease;
}
.card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow); transform: translateY(-1px);
}
.card-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text-faint); margin-bottom: 8px;
}
.tag {
  background: var(--accent-soft); color: var(--accent);
  padding: 2.5px 9px; border-radius: 6px; font-size: 12px; font-weight: 600;
}
.card h2 {
  margin: 0 0 7px; font-size: 19px; font-weight: 700;
  letter-spacing: -.025em; line-height: 1.4;
}
.card p { margin: 0; color: var(--text-dim); font-size: 14.5px; line-height: 1.65; }
.empty {
  text-align: center; color: var(--text-faint); padding: 64px 0; font-size: 15px;
}

/* ---------- article ---------- */
/* main 요소에 .wrap 과 .article 이 함께 붙으므로 padding 단축 속성을 쓰면
   .wrap 의 좌우 여백(0 20px)이 덮여 모바일에서 본문이 화면 끝에 붙는다.
   반드시 상하 padding 만 개별 지정한다. */
.article { padding-top: 48px; padding-bottom: 40px; }
.article-head { border-bottom: 1px solid var(--border); padding-bottom: 26px; margin-bottom: 34px; }
.article-head h1 {
  margin: 12px 0 10px; font-size: 32px; font-weight: 800;
  letter-spacing: -.035em; line-height: 1.3;
}
.article-head .sub { color: var(--text-dim); font-size: 15.5px; margin: 0; }
.article-body { font-size: 16.5px; }
.article-body h2 {
  margin: 44px 0 14px; font-size: 22px; font-weight: 750; letter-spacing: -.025em;
  padding-bottom: 9px; border-bottom: 1px solid var(--border);
}
.article-body h3 { margin: 30px 0 10px; font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.article-body p { margin: 0 0 16px; }
.article-body ul, .article-body ol { margin: 0 0 16px; padding-left: 22px; }
.article-body li { margin-bottom: 6px; }
.article-body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.article-body a:hover { border-bottom-color: var(--accent); }
.article-body strong { font-weight: 700; }
.article-body blockquote {
  margin: 0 0 18px; padding: 14px 18px; border-left: 3px solid var(--accent);
  background: var(--bg-soft); border-radius: 0 10px 10px 0; color: var(--text-dim);
}
.article-body code {
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 1.5px 6px; border-radius: 5px; font-size: .88em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.article-body img { max-width: 100%; border-radius: 10px; }
.article-body hr { border: 0; border-top: 1px solid var(--border); margin: 36px 0; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 0 20px; -webkit-overflow-scrolling: touch; }
.article-body table {
  width: 100%; border-collapse: collapse; font-size: 14.5px;
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.article-body th {
  background: var(--bg-soft); text-align: left; font-weight: 650;
  padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.article-body td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
.article-body tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.article-body th.num { text-align: right; }
.article-body th.center, .article-body td.center { text-align: center; }
.up { color: var(--up); font-weight: 600; }
.down { color: var(--down); font-weight: 600; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 24px; }
.stat {
  border: 1px solid var(--border); background: var(--bg-card);
  border-radius: 12px; padding: 15px 17px;
}
.stat .label { font-size: 12.5px; color: var(--text-faint); margin-bottom: 5px; }
.stat .value { font-size: 22px; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 13px; font-weight: 600; margin-top: 2px; }

/* callout */
.callout {
  border: 1px solid var(--border); background: var(--bg-soft);
  border-radius: 12px; padding: 16px 18px; margin: 0 0 22px; font-size: 15px;
}
.callout.warn { border-color: color-mix(in srgb, #f59e0b 40%, var(--border)); }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); padding: 28px 0 44px;
  color: var(--text-faint); font-size: 13px;
}
.site-footer .wrap { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.site-footer a { color: var(--text-dim); text-decoration: none; }
.back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-dim); text-decoration: none; font-size: 14px; font-weight: 500;
}
.back:hover { color: var(--accent); }
.disclaimer {
  margin-top: 40px; padding: 15px 17px; border: 1px dashed var(--border);
  border-radius: 10px; color: var(--text-faint); font-size: 13px; line-height: 1.6;
}

@media (max-width: 640px) {
  .hero { padding: 40px 0 26px; }
  .hero h1 { font-size: 27px; }
  .article { padding-top: 32px; padding-bottom: 32px; }
  .article-head h1 { font-size: 25px; }
  .article-body { font-size: 16px; }
  .card { padding: 17px 18px; }
  .card h2 { font-size: 17.5px; }
  .nav a { display: none; }

  /* 표는 좌우 여백까지 꽉 채워 쓰되, 스크롤 가능하다는 것이 보이도록 한다 */
  .table-wrap {
    margin-left: -4px; margin-right: -4px;
    padding-left: 4px; padding-right: 4px;
  }
  .article-body table { font-size: 13.5px; }
  .article-body th, .article-body td { padding: 9px 11px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; }
  .callout, .stat { padding: 14px 15px; }
}
