@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
  --bg: #F6F3EC;
  --surface: #FFFFFF;
  --ink: #1E2A32;
  --ink-soft: #52626B;
  --ink-faint: #8B958D;
  --accent: #B4682E;
  --accent-soft: #E9D9C8;
  --teal: #2F6F63;
  --teal-soft: #DCE9E4;
  --border: #DDD6C4;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 20px;
  color: var(--ink);
}
.wordmark svg { flex-shrink: 0; }

header.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 420px;
  min-width: 200px;
}
.search-wrap input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--ink);
}
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(30,42,50,0.08);
  max-height: 320px;
  overflow-y: auto;
  display: none;
  z-index: 20;
}
.search-results.open { display: block; }
.search-results a {
  display: block;
  padding: 10px 14px;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--bg); text-decoration: none; }
.search-results .cat-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--teal);
  display: block;
  margin-top: 2px;
}
.search-empty {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ink-faint);
}

.layout {
  display: flex;
  max-width: 1080px;
  margin: 0 auto;
  gap: 40px;
  padding: 40px 32px 80px;
  align-items: flex-start;
}

nav.sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 96px;
}
nav.sidebar .nav-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  text-transform: uppercase;
  margin-bottom: 10px;
  display: block;
}
nav.sidebar ul { list-style: none; margin: 0; padding: 0; }
nav.sidebar li { margin-bottom: 4px; }
nav.sidebar a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 14px;
}
nav.sidebar a:hover { background: var(--surface); text-decoration: none; color: var(--ink); }
nav.sidebar a.active { background: var(--teal-soft); color: var(--teal); font-weight: 500; }

main { flex: 1; min-width: 0; }

.breadcrumb {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--ink-faint);
  margin-bottom: 18px;
}
.breadcrumb a { color: var(--ink-faint); }

.hero {
  margin-bottom: 36px;
}
.hero h1 { font-size: 32px; margin-bottom: 10px; }
.hero p { color: var(--ink-soft); font-size: 16px; max-width: 560px; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: block;
  color: var(--ink);
}
.category-card:hover { border-color: var(--teal); text-decoration: none; }
.category-card .cat-icon {
  width: 28px; height: 28px;
  margin-bottom: 12px;
  color: var(--teal);
}
.category-card h3 { font-size: 17px; margin-bottom: 6px; }
.category-card p { font-size: 13px; color: var(--ink-soft); margin: 0; }

.article-list { list-style: none; margin: 0; padding: 0; }
.article-list li {
  border-bottom: 1px solid var(--border);
}
.article-list li:first-child { border-top: 1px solid var(--border); }
.article-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 4px;
  color: var(--ink);
  font-size: 15px;
}
.article-list a:hover { color: var(--teal); text-decoration: none; }
.article-list .arrow { color: var(--ink-faint); }

article.article-body h2 { font-size: 24px; margin-bottom: 16px; }
article.article-body p { color: var(--ink); margin: 0 0 16px; }
article.article-body ul, article.article-body ol { margin: 0 0 16px; padding-left: 22px; }
article.article-body li { margin-bottom: 6px; }
article.article-body .note {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 20px;
}

footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 32px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-faint);
}

@media (max-width: 720px) {
  .layout { flex-direction: column; padding: 24px 20px 60px; gap: 24px; }
  nav.sidebar { position: static; width: 100%; }
  .category-grid { grid-template-columns: 1fr; }
  header.site-header { padding: 14px 20px; }
}
