*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --black: #0f0f0f;
  --white: #fafaf8;
  --ink: #1a1a1a;
  --muted: #666;
  --rule: #e0ddd8;
  --accent: #c8401a;
  --font-serif: 'Georgia', 'Times New Roman', serif;
  --font-sans: system-ui, -apple-system, sans-serif;
  --max: 740px;
  --max-wide: 1100px;
}

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

body {
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

/* Header */
.site-header {
  border-bottom: 1px solid var(--rule);
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-wide);
  margin: 0 auto;
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: normal;
}

.logo span { color: var(--accent); }

nav { display: flex; gap: 2rem; font-size: 0.85rem; color: var(--muted); }
nav a:hover { color: var(--ink); }

/* Page containers */
.page { max-width: var(--max); margin: 0 auto; padding: 3rem 2rem 6rem; }
.page-wide { max-width: var(--max-wide); margin: 0 auto; padding: 3rem 2rem 6rem; }

/* Hero */
.hero { max-width: var(--max-wide); margin: 0 auto; padding: 5rem 2rem 2rem; }
.hero-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 1rem; }
.hero-title { font-family: var(--font-serif); font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.15; max-width: 660px; margin-bottom: 1.25rem; }
.hero-sub { font-size: 1rem; color: var(--muted); max-width: 500px; }

/* Section label */
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--rule); }

/* Article grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2.5rem; }

.card { border-top: 2px solid var(--rule); padding-top: 1.1rem; display: block; }
.card:hover .card-title { text-decoration: underline; }
.card-cat { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: 0.4rem; }
.card-title { font-family: var(--font-serif); font-size: 1.1rem; line-height: 1.35; margin-bottom: 0.5rem; }
.card-desc { font-size: 0.83rem; color: var(--muted); line-height: 1.5; margin-bottom: 0.6rem; }
.card-date { font-size: 0.72rem; color: var(--muted); }

/* Article list (for /articles page) */
.article-list { display: flex; flex-direction: column; }
.article-row { display: block; border-top: 1px solid var(--rule); padding: 1.4rem 0; }
.article-row:hover .article-row-title { text-decoration: underline; }
.article-row-cat { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: 0.3rem; }
.article-row-title { font-family: var(--font-serif); font-size: 1.1rem; margin-bottom: 0.3rem; }
.article-row-desc { font-size: 0.83rem; color: var(--muted); }

/* Article / prose */
.article-header { margin-bottom: 2.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--rule); }
.article-cat { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: 0.5rem; }
.article-title { font-family: var(--font-serif); font-size: 2rem; line-height: 1.2; margin-bottom: 0.75rem; }
.article-meta { font-size: 0.78rem; color: var(--muted); }

.prose { text-align: justify; hyphens: auto; }
.prose h2 { font-family: var(--font-serif); font-size: 1.35rem; margin: 2.5rem 0 0.75rem; text-align: left; }
.prose h3 { font-family: var(--font-serif); font-size: 1.1rem; margin: 2rem 0 0.5rem; text-align: left; }
.prose p { margin-bottom: 1.25rem; }
.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1.25rem; }
.prose li { margin-bottom: 0.4rem; }
.prose blockquote { border-left: 3px solid var(--accent); padding-left: 1.25rem; color: var(--muted); font-style: italic; margin: 1.5rem 0; }
.prose code { background: #f0ede8; padding: 0.15em 0.4em; border-radius: 3px; font-size: 0.82em; font-family: monospace; }
.prose pre { background: var(--black); color: #e8e8e8; padding: 1.5rem; border-radius: 6px; overflow-x: auto; margin: 1.5rem 0; font-size: 0.82rem; }
.prose pre code { background: none; padding: 0; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose strong { font-weight: 600; }
.prose hr { border: none; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

/* Filter bar & search */
.filter-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.filter-btn { padding: 0.3rem 0.85rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; border: 1px solid var(--rule); border-radius: 2rem; background: transparent; color: var(--muted); cursor: pointer; font-family: var(--font-sans); transition: all 0.12s; }
.filter-btn:hover { border-color: var(--ink); color: var(--ink); }
.filter-btn.active { background: var(--ink); border-color: var(--ink); color: var(--white); }

.search-wrap { position: relative; margin-bottom: 1.75rem; }
.search-wrap svg { position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; transition: color 0.12s; }
.search-wrap:focus-within svg { color: var(--ink); }
.search-bar { width: 100%; padding: 0.75rem 1rem 0.75rem 2.6rem; font-size: 0.88rem; font-family: var(--font-sans); border: 1px solid var(--rule); border-radius: 6px; background: var(--white); color: var(--ink); outline: none; box-sizing: border-box; transition: border-color 0.12s, box-shadow 0.12s; }
.search-bar:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(15,15,15,0.06); }
.search-bar::placeholder { color: #aaa; }
.no-results { padding: 2rem 0; color: var(--muted); font-size: 0.88rem; display: none; }

/* Article sections (grouped by category) */
.article-section { margin-bottom: 2.5rem; }
.article-section-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 1rem; margin-bottom: 0; padding-bottom: 0; }
.article-section-label::after { content: ''; flex: 1; height: 1px; background: var(--rule); }

.back-link { display: inline-block; margin-top: 3rem; font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 1.5rem; width: 100%; }
.back-link:hover { color: var(--ink); }

/* Page title */
.page-title { font-family: var(--font-serif); font-size: 2rem; margin-bottom: 2.5rem; }

@media (max-width: 640px) {
  .site-header { padding: 1rem 1.25rem; flex-wrap: wrap; gap: 0.75rem; }
  nav { gap: 1rem; flex-wrap: wrap; row-gap: 0.4rem; font-size: 0.78rem; }
  .page, .page-wide { padding: 2rem 1.25rem 4rem; }
  .hero { padding: 3rem 1.25rem 1.5rem; }
  .grid { grid-template-columns: 1fr; gap: 2rem; }
}
