/* Font loaded via <link> in HTML for non-blocking performance */

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

:root {
  --bg: #faf8f4;
  --bg-card: #f3f0ea;
  --border: #e2ddd5;
  --text: #2c2a27;
  --text-muted: #6b6560;
  --accent: #b85c2a;
  --accent-light: #f0e8df;
  --link: #7a3d1a;
  --link-hover: #b85c2a;
  --max-width: 700px;
  --font: 'Source Serif 4', Georgia, serif;
}

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────── */

header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.site-logo {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

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

nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

nav a:hover {
  color: var(--text);
  background: var(--bg-card);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text);
}

.nav-toggle svg {
  display: block;
  width: 22px;
  height: 22px;
}

/* ── Main layout ─────────────────────────────────────── */

main {
  flex: 1;
  width: 100%;
}

.page-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.page-wrap-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* ── Article typography ──────────────────────────────── */

article h1 {
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}

.article-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.article-meta .sep {
  opacity: 0.4;
}

.article-body {
  font-size: 1rem;
}

.article-body p {
  margin-bottom: 1.25rem;
}

.article-body h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

.article-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.25rem 1.5rem;
}

.article-body li {
  margin-bottom: 0.4rem;
}

.article-body a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.article-body a:hover {
  color: var(--link-hover);
}

.article-body strong {
  font-weight: 600;
}

.callout {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  padding: 0.85rem 1.1rem;
  border-radius: 0 4px 4px 0;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.callout p {
  margin-bottom: 0 !important;
}

/* ── FAQ section ─────────────────────────────────────── */

.faq-section {
  margin-top: 2.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.faq-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.8rem;
}

details {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}

details summary {
  font-size: 0.97rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::after {
  content: '+';
  font-size: 1.2rem;
  font-weight: 300;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s;
}

details[open] summary::after {
  transform: rotate(45deg);
}

details .faq-answer {
  padding-top: 0.6rem;
  font-size: 0.93rem;
  color: var(--text);
  line-height: 1.6;
}

/* ── Related articles ────────────────────────────────── */

.related-section {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.related-section h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.related-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.related-links a {
  color: var(--link);
  text-decoration: none;
  font-size: 0.93rem;
}

.related-links a:hover {
  text-decoration: underline;
  color: var(--link-hover);
}

/* ── Homepage ────────────────────────────────────────── */

.home-hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 1.5rem;
}

.home-hero h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 0.6rem;
}

.home-hero p {
  color: var(--text-muted);
  font-size: 1rem;
}

.category-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.category-section + .category-section {
  padding-top: 0;
}

.category-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.article-card {
  background: var(--bg);
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  display: block;
  transition: background 0.1s;
}

.article-card:hover {
  background: var(--bg-card);
}

.article-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.article-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── About page ──────────────────────────────────────── */

.about-body h1 {
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1.75rem;
}

.about-body p {
  margin-bottom: 1.25rem;
  font-size: 1rem;
}

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

footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

footer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

footer a:hover {
  color: var(--text);
}

/* ── Mobile ──────────────────────────────────────────── */

@media (max-width: 640px) {
  html {
    font-size: 16px;
  }

  .nav-toggle {
    display: block;
  }

  nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    gap: 0;
  }

  nav.open {
    display: flex;
  }

  nav a {
    width: 100%;
    padding: 0.6rem 0.5rem;
  }

  article h1 {
    font-size: 1.5rem;
  }

  .home-hero h1 {
    font-size: 1.6rem;
  }

  .article-grid {
    grid-template-columns: 1fr;
  }
}
