:root {
  --bg-primary: #f8f7f4;
  --bg-secondary: #ffffff;
  --bg-elevated: #eef2f5;
  --text-primary: #1a1a2e;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --accent: #2d6a8f;
  --accent-glow: rgba(45, 106, 143, 0.12);
  --accent-subtle: rgba(45, 106, 143, 0.07);
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(45, 106, 143, 0.3);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 5vw, 4rem);
}

/* ── Nav (matches main site) ─────────────────────────────────────────────── */

nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 0.75rem 0;
  background: rgba(248, 247, 244, 0.95);
  border-bottom: 1px solid var(--border);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

nav.scrolled {
  background: rgba(248, 247, 244, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 20px rgba(0,0,0,0.06);
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links {
  display: none;
  gap: 2.5rem;
}

@media (min-width: 768px) { .nav-links { display: flex; } }

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.3s ease;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.nav-links a:hover { color: var(--text-primary); }
.nav-links a:hover::after { width: 100%; }

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
}

.nav-cta:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
  box-shadow: 0 0 30px var(--accent-glow);
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

footer {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
  text-align: center;
}

@media (min-width: 768px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.footer-left { display: flex; flex-direction: column; gap: 0.5rem; }
.footer-brand { font-weight: 600; font-size: 1rem; }
.footer-tagline { color: var(--text-muted); font-size: 0.875rem; }
.footer-right { color: var(--text-muted); font-size: 0.8125rem; }

/* ── Blog index ──────────────────────────────────────────────────────────── */

.article-main { padding-top: 6rem; padding-bottom: 4rem; }

.blog-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.section-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.blog-header h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  margin-bottom: 1rem;
}

.blog-header p {
  color: var(--text-secondary);
  font-size: 1.0625rem;
  max-width: 560px;
  margin: 0 auto;
}

/* Search */
.blog-search-wrap {
  position: relative;
  max-width: 420px;
  margin: 2rem auto 0;
}

.blog-search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.blog-search {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.blog-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.no-results {
  text-align: center;
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 3rem;
}

/* Post grid */
.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
}

@media (min-width: 640px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .post-grid { grid-template-columns: repeat(3, 1fr); }
}

.post-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.post-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.06);
}

.post-card-image-link { display: block; }

.post-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.post-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.post-date {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.post-card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.post-card h2 a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.post-card h2 a:hover { color: var(--accent); }

.post-card p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
  flex: 1;
}

.post-read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: gap 0.2s ease;
  margin-top: auto;
}

.post-read-more:hover { gap: 0.75rem; }

/* ── Article page ────────────────────────────────────────────────────────── */

.article-container {
  max-width: 760px;
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-decoration: none;
  margin-bottom: 2.5rem;
  transition: color 0.2s ease;
}

.back-link:hover { color: var(--accent); }

.article-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.article-date {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.article-header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 1rem;
  line-height: 1.1;
}

.article-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

.article-body { font-size: 1.0625rem; color: var(--text-secondary); }
.article-hero-image {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 2.5rem;
  display: block;
}
.article-body p { margin-bottom: 1.5rem; }
.article-body h2 { font-size: 1.75rem; color: var(--text-primary); margin: 2.5rem 0 1rem; }
.article-body h3 { font-size: 1.375rem; color: var(--text-primary); margin: 2rem 0 0.75rem; }
.article-body ul, .article-body ol { padding-left: 1.5rem; margin-bottom: 1.5rem; }
.article-body li { margin-bottom: 0.5rem; }
.article-body strong { color: var(--text-primary); font-weight: 600; }
.article-body em { font-style: italic; }
.article-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.article-body a:hover { text-decoration: none; }
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1.25rem;
  background: var(--accent-subtle);
  border-radius: 0 8px 8px 0;
  margin: 1.5rem 0;
  color: var(--text-primary);
  font-style: italic;
}
.article-body code {
  font-family: 'Courier New', monospace;
  font-size: 0.875em;
  background: var(--bg-elevated);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}
.article-body pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}
.article-body pre code { background: none; padding: 0; }

.article-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 1rem;
  color: var(--text-secondary);
}

.article-footer a { color: var(--accent); }
