:root {
  --accent: #8B0000;
  --accent-dark: #6b0000;
  --accent-muted: #a52a2a;
  --muted: #444444;
  --muted-light: #5c5c5c;
  --line: #d5d0c5;
  --line-strong: #b8b3a8;
  --bg: #f0ece0;
  --bg-card: #ffffff;
  --bg-warm: #e8e4d8;
  --text: #1a1a1a;
  --text-heading: #111111;
  --font-ui: 'Source Serif 4', Georgia, serif;
  --font-display: 'Source Serif 4', Georgia, serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --font-serif: var(--font-display);
  --color-text: var(--text);
  --color-border: var(--line);
  --color-accent: var(--accent);
  --color-text-secondary: var(--muted);
  --font-sans: var(--font-ui);
}

/* ===== DARK THEME ===== */
[data-theme="dark"] {
  --accent: #e0736b;
  --accent-dark: #cf5f56;
  --accent-muted: #e0736b;
  --muted: #b9b3a4;
  --muted-light: #8f8a7c;
  --line: #34302650;
  --line: #332f26;
  --line-strong: #4a4437;
  --bg: #16140f;
  --bg-card: #201d16;
  --bg-warm: #1d1a13;
  --text: #e8e4d8;
  --text-heading: #f4f0e7;
  color-scheme: dark;
}

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

html {
  background: var(--bg);
  color-scheme: light;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  --pad: 1.5rem;
  padding: 0 var(--pad);
  max-width: 1100px;
  margin: 0 auto;
  font-size: 1.05rem;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-md);
  color: var(--text-heading);
}

h1 { font-size: 2.8rem; }
h2 { font-size: 2rem; margin-top: 3rem; }
h3 { font-size: 1.5rem; margin-top: 2rem; }

p {
  margin-bottom: 1.5rem;
  color: var(--text);
  line-height: 1.8;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

a:hover {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

strong { font-weight: 700; color: var(--text-heading); }
em { font-style: italic; }

/* ===== SKIP LINK ===== */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 300;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 4px 0;
  border-bottom: none;
}
.skip-link:focus {
  left: 0;
}

/* ===== HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-strong);
  margin: 0 calc(-1 * var(--pad)) 3rem;
  padding: 0 var(--pad);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  width: 100%;
  padding: 1rem 0;
}

.logo { order: 0; }
.main-nav { order: 1; }
.theme-toggle { order: 2; }
.nav-burger { order: 3; }
.nav-toggle { order: 3; }

.logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-heading);
  text-decoration: none;
  letter-spacing: -0.3px;
  margin-right: auto;
  border-bottom: none;
}

.logo:hover {
  color: var(--accent);
  border-bottom: none;
}

.logo::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 0.6rem;
  vertical-align: middle;
}

.main-nav {
  display: flex;
  gap: 1.4rem;
  align-items: center;
  flex-wrap: wrap;
  font-weight: 500;
  font-size: 0.95rem;
}

.main-nav a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 0.2s, border-color 0.2s;
}

.main-nav a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* burger (hidden on desktop) */
.nav-toggle {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: none;
  cursor: pointer;
}
.nav-burger span {
  display: block;
  width: 1.15rem;
  height: 2px;
  background: var(--text-heading);
  border-radius: 2px;
  transition: 0.2s;
}

/* theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  transition: color 0.2s, border-color 0.2s;
  padding: 0;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline; }

/* ===== FOOTER ===== */
.site-footer {
  margin-top: 4rem;
  padding: 2rem 0 1.5rem;
  border-top: 1px solid var(--line-strong);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted-light);
  text-align: center;
}

.footer-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-heading);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: none;
}

.footer-links a:hover {
  text-decoration: underline;
  border-bottom: none;
}

.footer-copy {
  color: var(--muted-light);
  font-size: 0.85rem;
}

/* ===== HERO ===== */
.hero {
  position: relative;
  padding: 3rem 0;
  overflow: hidden;
}

.hero-grid {
  position: absolute;
  inset: 0;
  opacity: 0.15;
  pointer-events: none;
}

.hero-grid svg {
  width: 100%;
  height: 100%;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  max-width: 18ch;
  margin-bottom: 1rem;
  color: var(--text-heading);
}

.hero h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent-muted);
}

.hero-lead {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--muted);
  max-width: 55ch;
  margin-bottom: 1.5rem;
}

.hero-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted-light);
}

.hero-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.6;
}

/* Hero CTA */
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1.4rem;
  border-radius: 4px;
  border-bottom: none;
  transition: background 0.2s, transform 0.2s;
}
.hero-cta:hover {
  background: var(--accent-dark);
  color: #fff;
  border-bottom: none;
  transform: translateY(-1px);
}

/* ===== SECTION HEADER ===== */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line-strong);
}

.section-header h2 {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 0;
}

.line {
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ===== ARTICLES LIST ===== */
.articles-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding-bottom: 3rem;
}

.article-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.article-marginalia {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.35em;
  text-align: right;
  border-right: 1.5px solid var(--line);
  padding-right: 1rem;
}

.article-category {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: none;
}
.article-category:hover {
  color: var(--accent-dark);
  border-bottom: none;
}

.article-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted-light);
}

.article-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.article-body h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-top: 0;
}

.article-body h3 a {
  color: var(--text-heading);
  border-bottom: none;
  transition: color 0.2s;
}

.article-body h3 a:hover {
  color: var(--accent);
  border-bottom: none;
}

.article-body p {
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--muted);
  max-width: 60ch;
}

.article-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-top: 0.25rem;
  transition: gap 0.2s;
  border-bottom: none;
}

.article-card:hover .article-link {
  gap: 0.5rem;
}

/* ===== ARCHIVE PAGE ===== */
.archive-page {
  padding: 2rem 0;
  max-width: 960px;
  margin: 0 auto;
}

.archive-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 1.5rem;
}

.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.filter-btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.archive-item {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.archive-item.hidden {
  display: none;
}

.archive-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.archive-category {
  color: var(--accent);
  font-weight: 500;
}

.archive-date {
  color: var(--muted-light);
}

.archive-item h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.5rem;
  margin-top: 0;
}

.archive-item h2 a {
  color: var(--text-heading);
  text-decoration: none;
  border-bottom: none;
  transition: color 0.2s ease;
}

.archive-item h2 a:hover {
  color: var(--accent);
}

.archive-item p {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
}

.archive-empty {
  font-family: var(--font-ui);
  color: var(--muted);
  font-style: italic;
  padding: 2rem 0;
}

/* ===== ARTICLE PAGE ===== */
.article-page {
  padding: 2rem 0;
}

.article-header {
  max-width: 720px;
  margin: 0 auto 2rem;
}

.article-meta-header {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.article-date, .article-read-time {
  color: var(--muted-light);
}

.article-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-heading);
  margin-bottom: 1rem;
}

.article-subtitle {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.5;
}

.article-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2rem;
  max-width: 960px;
  margin: 0 auto;
  align-items: start;
}

.article-main {
  min-width: 0;
}

.article-body {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text);
}

.article-body h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--text-heading);
}

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

.article-body ul, .article-body ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

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

/* ===== SIDEBAR / CARDS ===== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid var(--line);
}

.card-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.5rem;
  margin-top: 0;
}

.card-body {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
}

.card-body p {
  margin-bottom: 0;
}

/* ===== LANGUAGE SWITCHER ===== */
.lang-switcher {
  display: inline-flex;
  gap: 0.25rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.lang-switcher a {
  padding: 0.25rem 0.5rem;
  text-decoration: none;
  color: var(--muted-light);
  border-radius: 4px;
  transition: 0.2s;
  border-bottom: none;
}

.lang-switcher a:hover {
  color: var(--text-heading);
  background: var(--line);
  border-bottom: none;
}

.lang-switcher a.active {
  color: var(--text-heading);
  background: var(--line-strong);
  font-weight: 600;
}

/* ===== BREADCRUMBS ===== */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted-light);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: none;
  transition: color 0.2s;
}

.breadcrumbs a:hover {
  color: var(--accent);
  border-bottom: none;
}

.breadcrumbs .sep {
  color: var(--line-strong);
}

.breadcrumbs .current {
  color: var(--text-heading);
  font-weight: 500;
}

/* ===== HOME CATEGORIES ===== */
.home-categories {
  max-width: 960px;
  margin: 0 auto var(--space-xl);
  padding: 0;
  list-style: none;
}

.home-categories li {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-ui);
  line-height: 1.6;
  color: var(--muted);
}

.home-categories a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  border-bottom: none;
}

.home-categories a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  border-bottom: none;
}

/* ===== AUTHOR SIGNATURE — MONASTIC ===== */
.author-monastic {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-heading);
  border-left: 2px solid var(--accent);
  padding-left: 0.75rem;
  display: inline-flex;
  align-items: center;
  margin-bottom: 1.5rem;
}

.author-monastic .initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2em;
  height: 2.2em;
  border: 1px solid var(--accent);
  border-radius: 50%;
  font-weight: 500;
  color: var(--accent);
  margin-right: 0.5em;
  font-size: 0.9em;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .article-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    order: 2;
    margin-top: 2rem;
  }
  .article-main {
    order: 1;
  }
}

@media (max-width: 768px) {
  body {
    --pad: 1rem;
    font-size: 1rem;
  }
  .nav-burger {
    display: inline-flex;
  }
  .main-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.5rem 0 1.25rem;
  }
  .nav-toggle:checked ~ .main-nav {
    display: flex;
  }
  .main-nav {
    order: 99;
  }
  .main-nav a {
    font-size: 1.05rem;
  }
  .hero h1 {
    font-size: 2.2rem;
  }
  .hero-lead {
    font-size: 1rem;
  }
  .article-card {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .article-marginalia {
    text-align: left;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
    padding-bottom: 0.5rem;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
  }
  .archive-title {
    font-size: 1.8rem;
  }
  .filter-bar {
    gap: 0.4rem;
  }
  .filter-btn {
    padding: 0.35rem 0.7rem;
    font-size: 0.7rem;
  }
  .footer-inner {
    gap: 0.75rem;
  }
  .footer-links {
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.8rem;
  }
  .hero-lead {
    font-size: 0.95rem;
  }
  .article-body h3 {
    font-size: 1.25rem;
  }
  .article-title {
    font-size: 1.6rem;
  }
  .article-subtitle {
    font-size: 1rem;
  }
  .card {
    padding: 1rem;
  }
  .lang-switcher {
    font-size: 0.8rem;
  }
}

/* ===== UTILITIES ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }

/* ===== PRINT ===== */
@media print {
  body {
    background: white;
    color: black;
    padding: 0;
    max-width: 100%;
  }
  .site-header, .site-footer, .sidebar, .lang-switcher, .filter-bar, .skip-link, .theme-toggle, .nav-burger {
    display: none !important;
  }
  a {
    color: black;
    text-decoration: underline;
  }
  .article-layout {
    display: block;
  }
}