:root {
  --bg: #f7f1e8;
  --surface: #fffdf8;
  --surface-strong: #f0e4d4;
  --ink: #1f1d1a;
  --muted: #6a6258;
  --line: #ddd1c1;
  --accent: #8d3b1f;
  --accent-dark: #5c2311;
  --shadow: 0 20px 50px rgba(60, 39, 22, 0.08);
  --serif: "Libre Baskerville", Georgia, serif;
  --sans: "Source Sans 3", Arial, sans-serif;
  --toggle-bg: #e0d5c5;
  --toggle-knob: #fff;
  --toggle-border: #c4b39e;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0f0d0b;
  --surface: #1a1713;
  --surface-strong: #252118;
  --ink: #f0ebe3;
  --muted: #9c9080;
  --line: #332d24;
  --accent: #c96b42;
  --accent-dark: #e0845a;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  --toggle-bg: #3a3228;
  --toggle-knob: #f0ebe3;
  --toggle-border: #4a4035;
  color-scheme: dark;
}

/* Explicit dark mode overrides — belt-and-suspenders */
[data-theme="dark"] .site-header {
  background: #1c1917;
  border-bottom-color: #2e2822;
}

[data-theme="dark"] .brand a {
  color: #c0b9b0;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(141, 59, 31, 0.1), transparent 28%),
    linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  font-family: var(--sans);
  line-height: 1.7;
  transition: background 0.35s ease, color 0.35s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

.container {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
  transition: background 0.35s ease, border-color 0.35s ease;
}

.header-inner,
.footer-inner {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 0;
}

.brand a {
  display: inline-block;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 700;
}

.brand p,
.site-footer p,
.hero-copy p,
.page-intro p,
.post-meta,
.post-card-meta,
.archive-list time {
  color: var(--muted);
}

.brand p {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-nav a {
  color: var(--ink);
  font-weight: 600;
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
}

.site-main {
  padding: 2rem 0 4rem;
}

.hero,
.page-intro,
.post-page {
  animation: rise 500ms ease both;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: start;
  padding: 2rem 0 3rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1,
.page-intro h1,
.post-header h1 {
  margin: 0;
  font-family: var(--serif);
  line-height: 1.15;
}

.hero h1 {
  font-size: clamp(2.3rem, 5vw, 4.5rem);
}

.hero-copy p,
.page-intro p {
  max-width: 60ch;
  font-size: 1.1rem;
}

.hero-panel,
.post-card,
.archive-panel,
.simple-panel {
  background: var(--surface);
  border: 1px solid rgba(221, 209, 193, 0.9);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 1.5rem;
}

.hero-panel h2,
.post-card h2,
.simple-panel h2 {
  margin-top: 0;
  font-family: var(--serif);
}

.hero-panel ul {
  padding-left: 1.1rem;
  margin: 0;
}

.section-heading {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-size: 2rem;
}

.posts-grid {
  display: grid;
  gap: 1.5rem;
}

.post-card {
  padding: 1.6rem;
}

.post-card h2 {
  margin-bottom: 0.4rem;
  font-size: 1.6rem;
}

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

.post-card-meta,
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 0.95rem;
}

.post-card-link,
.text-link {
  display: inline-block;
  margin-top: 1rem;
  font-weight: 700;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.45fr 0.8fr;
  gap: 2rem;
}

.archive-panel,
.simple-panel {
  padding: 1.5rem;
}

.archive-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.archive-list li+li {
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding-top: 1rem;
}

.archive-list a {
  display: block;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.page-intro {
  padding: 1.5rem 0 2rem;
}

.post-page {
  max-width: 760px;
}

.post-header {
  margin-bottom: 2rem;
}

.post-content {
  font-size: 1.08rem;
}

.post-content h2,
.post-content h3 {
  font-family: var(--serif);
  margin-top: 2rem;
}

.post-content code {
  background: var(--surface-strong);
  border-radius: 4px;
  padding: 0.1rem 0.3rem;
}

.button-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.button.button-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.site-footer {
  border-top: 1px solid rgba(221, 209, 193, 0.7);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {

  .hero,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .header-inner,
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .site-main {
    padding-top: 1rem;
  }

  .hero h1,
  .page-intro h1,
  .post-header h1 {
    font-size: 2.2rem;
  }

  .post-card,
  .hero-panel,
  .archive-panel,
  .simple-panel {
    border-radius: 18px;
  }
}

/* ── Theme toggle ─────────────────────────────────────────── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--toggle-bg);
  border: 1px solid var(--toggle-border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--surface-strong);
  color: var(--ink);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.theme-toggle .toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--surface-strong);
  border: 1px solid var(--toggle-border);
  border-radius: 999px;
  transition: background 0.3s ease;
  flex-shrink: 0;
}

.theme-toggle .toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
}

[data-theme="dark"] .theme-toggle .toggle-knob {
  transform: translateX(16px);
}

.theme-toggle .toggle-icon {
  font-size: 1rem;
  line-height: 1;
  user-select: none;
}