:root {
  --bg: #fdfcfb;
  --fg: #2b2b2b;
  --muted: #767676;
  --accent: #ff8a3d;
  --card-bg: #ffffff;
  --border: #ececec;
  --chip-bg: #fff3e8;
  --chip-fg: #d9601f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Pretendard", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo { font-size: 1.25rem; font-weight: 700; }

.search-box { position: relative; }

#search-input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 220px;
  font-size: 0.9rem;
}

.search-results {
  position: absolute;
  right: 0;
  top: 120%;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  display: none;
}

.search-results.open { display: block; }

.search-results a {
  display: block;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--chip-bg); }
.search-results .empty { padding: 0.6rem 0.9rem; color: var(--muted); font-size: 0.85rem; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 2rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
}

.content h1 { font-size: 1.6rem; margin-top: 0; }

.card-list { display: flex; flex-direction: column; gap: 1rem; }

.card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card:hover { box-shadow: 0 8px 20px rgba(0,0,0,0.06); transform: translateY(-1px); }

.card-meta { display: flex; gap: 0.75rem; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.4rem; }
.card-category { color: var(--accent); font-weight: 600; }
.card-title { margin: 0 0 0.4rem 0; font-size: 1.15rem; }
.card-summary { margin: 0 0 0.6rem 0; color: var(--muted); font-size: 0.92rem; }
.card-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.tag-chip {
  display: inline-block;
  background: var(--chip-bg);
  color: var(--chip-fg);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
}

.sidebar-section { margin-bottom: 2rem; }
.sidebar-section h3 { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 0.75rem; }
.category-tree { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.category-tree a { display: flex; justify-content: space-between; font-size: 0.92rem; }
.count { color: var(--muted); font-size: 0.8rem; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.post-header h1 { margin-bottom: 0.5rem; }
.post-meta { display: flex; gap: 0.75rem; align-items: center; color: var(--muted); font-size: 0.9rem; margin-bottom: 0.6rem; }
.post-category { color: var(--accent); font-weight: 600; }
.post-tags { display: flex; gap: 0.4rem; margin-bottom: 1.5rem; }
.post-body { font-size: 1.02rem; }
.post-body pre { background: #282c34; color: #eee; padding: 1rem; border-radius: 8px; overflow-x: auto; }
.post-body code { font-family: "SFMono-Regular", Consolas, monospace; }
.post-body :not(pre) > code { background: var(--chip-bg); padding: 0.1rem 0.35rem; border-radius: 4px; }
.post-body img { max-width: 100%; border-radius: 8px; }

.site-footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 2rem; }

@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  #search-input { width: 140px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --fg: #ececec;
    --muted: #9a9a9a;
    --card-bg: #242426;
    --border: #333335;
    --chip-bg: #3a2a1e;
    --chip-fg: #ffb073;
  }
}
