:root {
  --bg: #f3f0ea;
  --bg-soft: #faf7f2;
  --sidebar-bg: #ebe5dc;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --text: #181411;
  --muted: #6f685f;
  --line: rgba(24, 20, 17, 0.1);
  --accent: #8a6140;
  --accent-soft: rgba(138, 97, 64, 0.08);
  --shadow: 0 18px 40px rgba(31, 24, 18, 0.06);
  --sidebar-width: 284px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #2c3139;
  --bg-soft: #343943;
  --sidebar-bg: #262b33;
  --surface: rgba(43, 48, 56, 0.72);
  --surface-strong: rgba(50, 55, 64, 0.9);
  --text: #ece4d7;
  --muted: #b8aea2;
  --line: rgba(236, 228, 215, 0.1);
  --accent: #d5b08a;
  --accent-soft: rgba(213, 176, 138, 0.08);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.22), transparent 18%),
    radial-gradient(circle at bottom right, rgba(138, 97, 64, 0.08), transparent 24%),
    linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 100%);
  color: var(--text);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.65;
  transition: background-color 180ms ease, color 180ms ease;
}

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

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

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.site-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.site-sidebar {
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-content: start;
  padding: 28px 22px 32px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 16%),
    var(--sidebar-bg);
  border-right: 1px solid var(--line);
}

.sidebar-block {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.site-main {
  min-width: 0;
  min-height: 100vh;
  padding: 36px 36px 60px;
}

.brand,
.home-title,
.featured-post h2,
.archive-heading h2,
.post-title,
.post-row h3,
.empty-state h2 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  letter-spacing: -0.03em;
}

.brand {
  display: inline-block;
  font-size: clamp(2rem, 2.8vw, 3rem);
  font-weight: 700;
}

.site-tagline {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.sidebar-label,
.section-kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sidebar-nav,
.sidebar-posts {
  display: grid;
  gap: 8px;
}

.sidebar-nav a,
.sidebar-post-link {
  display: block;
  padding: 8px 0;
}

.sidebar-post-link span,
.sidebar-value {
  display: block;
  font-weight: 700;
}

.sidebar-post-link small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.sidebar-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.theme-toggle {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.home-page,
.post-page {
  display: grid;
  gap: 34px;
}

.intro-block {
  padding: 0 0 28px;
  border-bottom: 1px solid var(--line);
}

.intro-grid {
  display: block;
}

.intro-heading-wrap {
  width: 100%;
  max-width: none;
}

.home-title {
  margin: 0;
  max-width: none;
  font-size: clamp(2.8rem, 4.8vw, 5rem);
  font-weight: 700;
  line-height: 0.96;
}

.intro-copy {
  max-width: 74ch;
  padding-top: 18px;
  color: var(--muted);
}

.intro-copy p {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.8;
}

.featured-post {
  padding: 28px 32px 32px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(135deg, var(--accent-soft), transparent 58%),
    var(--surface-strong);
  box-shadow: var(--shadow);
}

.featured-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.post-date {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.featured-copy {
  padding-top: 22px;
}

.featured-post h2 {
  margin: 0;
  max-width: 22ch;
  font-size: clamp(2rem, 3.1vw, 3.4rem);
  font-weight: 700;
  line-height: 1.05;
}

.post-subtitle {
  margin: 14px 0 0;
  max-width: 70ch;
  color: var(--muted);
  font-size: 1.08rem;
}

.post-excerpt {
  max-width: 78ch;
  margin: 14px 0 0;
  font-size: 1.04rem;
  line-height: 1.78;
}

.featured-cta {
  display: inline-flex;
  margin-top: 24px;
  color: var(--accent);
  font-size: 0.96rem;
  font-weight: 700;
}

.archive-section {
  padding-top: 4px;
}

.archive-heading {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.archive-heading h2,
.empty-state h2 {
  margin: 0;
  font-size: clamp(1.8rem, 2.8vw, 2.5rem);
  line-height: 1.08;
}

.archive-list {
  display: grid;
}

.post-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.post-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.post-row-copy h3 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.08;
}

.post-row-copy .post-subtitle {
  margin-top: 10px;
}

.post-row-excerpt {
  max-width: 74ch;
  margin: 12px 0 0;
  color: var(--muted);
}

.post-row-link {
  align-self: center;
  color: var(--muted);
  font-size: 0.95rem;
  white-space: nowrap;
}

.archive-empty {
  margin: 22px 0 0;
  color: var(--muted);
}

.empty-state {
  padding-top: 24px;
}

.back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 0.95rem;
}

.post-article {
  max-width: none;
}

.post-hero {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.post-title {
  margin: 10px 0 0;
  max-width: 18ch;
  font-size: clamp(2.8rem, 4.6vw, 5rem);
  font-weight: 700;
  line-height: 1.02;
}

.post-subtitle-large {
  max-width: 66ch;
  font-size: 1.16rem;
}

.post-body {
  max-width: 80ch;
  padding-top: 28px;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 1.16rem;
  line-height: 1.84;
}

.post-body > :first-child {
  margin-top: 0;
}

.post-body p,
.post-body ul,
.post-body ol,
.post-body blockquote,
.post-body pre,
.post-body h2,
.post-body h3 {
  margin: 0 0 1.2em;
}

.post-body h2,
.post-body h3 {
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.post-body a {
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

.post-body blockquote {
  margin-left: 0;
  padding-left: 18px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.post-body pre,
.post-body code {
  background: rgba(127, 127, 127, 0.08);
}

.post-body pre {
  overflow-x: auto;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.post-body :not(pre) > code {
  padding: 0.18em 0.45em;
  border-radius: 8px;
}

@media (max-width: 1080px) {
  .site-shell {
    grid-template-columns: 1fr;
  }

  .site-sidebar {
    position: static;
    min-height: auto;
    padding: 18px 18px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .site-main {
    padding: 24px 18px 40px;
  }
}

@media (max-width: 760px) {
  .site-main {
    padding: 20px 16px 34px;
  }

  .sidebar-meta,
  .post-row {
    grid-template-columns: 1fr;
  }

  .featured-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .home-title,
  .featured-post h2,
  .post-title {
    max-width: none;
  }

  .post-row {
    gap: 8px;
  }

  .post-body {
    max-width: none;
    font-size: 1.08rem;
  }
}
