:root {
  --bg: #f5f1e8;
  --surface: #fbf9f4;
  --surface-strong: #fffdf8;
  --ink: #171717;
  --muted: #6e6a62;
  --line: #d8d1c5;
  --accent: #b0008f;
  --accent-dark: #760060;
  --accent-wash: #ead8e5;
  --shadow: 0 18px 60px rgba(37, 31, 22, 0.07);
  --serif: "DM Serif Display", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --content: 1120px;
  --reading: 760px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 80% 0%, rgba(176, 0, 143, .08), transparent 28rem),
    var(--bg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  padding: .7rem 1rem;
  background: var(--ink);
  color: white;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

.site-header {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 241, 232, .88);
  backdrop-filter: blur(14px);
}

.header-inner {
  width: min(var(--content), calc(100% - 48px));
  min-height: 92px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  font-family: var(--serif);
  font-size: 1.65rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--sans);
  font-size: .9rem;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .35rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-list a {
  color: var(--muted);
  font-size: .86rem;
  font-weight: 600;
  text-decoration: none;
  transition: color .2s ease;
}

.nav-list a:hover {
  color: var(--ink);
}

.site-main {
  width: min(var(--content), calc(100% - 48px));
  margin: 0 auto;
  padding: 0 0 7rem;
}

.hero {
  max-width: 900px;
  padding: 8rem 0 6rem;
}

.eyebrow {
  margin: 0 0 .8rem;
  color: var(--accent-dark);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .16em;
  line-height: 1.4;
  text-transform: uppercase;
}

.hero h1,
.archive-header h1,
.post-header h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 150;
  letter-spacing: -.035em;
  line-height: .98;
}

.hero h1 {
  max-width: 900px;
  font-size: clamp(4rem, 4vw, 4rem);
}

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

.hero-copy {
  max-width: 650px;
  margin: 2rem 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  padding: .85rem 1.2rem;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  transition: transform .2s ease, background .2s ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  background: var(--ink);
  color: var(--surface);
}

.button-primary:hover {
  background: var(--accent-dark);
}

.latest-note {
  color: var(--muted);
  font-size: .82rem;
}

section {
  margin-top: 5rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.section-heading h2,
.archive-category-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 400;
  letter-spacing: -.025em;
  line-height: 1;
}

.section-heading .eyebrow {
  margin-bottom: .4rem;
}

.text-link,
.read-link,
.back-link {
  color: var(--muted);
  font-size: .85rem;
  font-weight: 700;
  text-decoration: none;
}

.text-link:hover,
.read-link:hover,
.back-link:hover {
  color: var(--accent-dark);
}

.feature-card {
  padding: clamp(1.6rem, 4vw, 3rem);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.feature-meta,
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.feature-meta span:first-child {
  color: var(--accent-dark);
}

.feature-card h3 {
  max-width: 850px;
  margin: 1rem 0 .7rem;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -.03em;
}

.feature-card h3 a,
.post-row h2 a,
.post-row h3 a {
  text-decoration: none;
}

.feature-card h3 a:hover,
.post-row h2 a:hover,
.post-row h3 a:hover {
  color: var(--accent-dark);
}

.feature-card p {
  max-width: 650px;
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.category-card {
  position: relative;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  background: var(--surface);
  text-decoration: none;
  overflow: hidden;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.category-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  background: var(--surface-strong);
}

.category-index {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
}

.category-name {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
}

.category-count {
  color: var(--muted);
  font-size: .78rem;
}

.category-arrow {
  position: absolute;
  top: 1.3rem;
  right: 1.3rem;
  font-size: 1.25rem;
  transition: transform .2s ease;
}

.category-card:hover .category-arrow {
  transform: translate(3px, -3px);
}

.post-list {
  border-top: 1px solid var(--line);
}

.post-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 30px;
  gap: 2rem;
  align-items: start;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line);
}

.post-row-date {
  padding-top: .35rem;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 600;
}

.post-row-body h2,
.post-row-body h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -.02em;
  line-height: 1.1;
}

.post-row-body h2 {
  font-size: 2rem;
}

.post-row-body h3 {
  font-size: 1.55rem;
}

.post-row-body p {
  margin: .45rem 0 0;
  color: var(--muted);
  font-size: .9rem;
}

.post-row-body .post-category {
  margin: 0 0 .3rem;
  color: var(--accent-dark);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.row-arrow {
  padding-top: .25rem;
  color: var(--muted);
  font-size: 1.1rem;
  text-align: right;
  text-decoration: none;
}

.row-arrow:hover {
  color: var(--accent-dark);
}

.archive-header {
  max-width: 800px;
  padding: 7rem 0 3rem;
}

.archive-header h1 {
  font-size: clamp(4rem, 9vw, 7rem);
}

.archive-header>p:last-child {
  max-width: 650px;
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.archive-category {
  margin-top: 4rem;
}

.archive-category-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.archive-category-heading h2 a {
  text-decoration: none;
}

.archive-category-heading h2 a:hover {
  color: var(--accent-dark);
}

.archive-category-heading>span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.archive-list {
  margin-top: 0;
}

.post {
  max-width: var(--reading);
  margin: 0 auto;
  padding-top: 7rem;
}

.post-header {
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--line);
}

.category-label {
  display: inline-block;
  text-decoration: none;
}

.post-header h1 {
  font-size: clamp(2rem, 4vw, 4rem);
}

.post-meta {
  margin-top: 1.4rem;
  text-transform: none;
  letter-spacing: 0;
}

.post-content {
  padding-top: 2.5rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.12rem;
  line-height: 1.85;
}

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

.post-content h2,
.post-content h3,
.post-content h4 {
  margin: 2.5em 0 .65em;
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -.02em;
}

.post-content h2 {
  font-size: 2.2rem;
}

.post-content h3 {
  font-size: 1.7rem;
}

.post-content p {
  margin: 1.25em 0;
}

.post-content a {
  color: var(--accent-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 1rem;
  box-shadow: var(--shadow);
}

.post-content blockquote {
  margin: 2rem 0;
  padding: .4rem 1.5rem;
  border-left: 3px solid var(--accent);
  color: #514c45;
  background: rgba(255, 255, 255, .45);
}

.post-content ul,
.post-content ol {
  padding-left: 1.4rem;
}

.post-content li {
  margin: .45rem 0;
}

.post-content code {
  padding: .12em .35em;
  border: 1px solid var(--line);
  border-radius: .35rem;
  background: #eee9df;
  font-family: var(--mono);
  font-size: .82em;
}

.post-content pre {
  overflow-x: auto;
  margin: 2rem 0;
  padding: 1.2rem 1.3rem;
  border: 1px solid #d3d6da;
  border-radius: .8rem;
  background: #f1f3f5;
  color: #202428;
  font-family: var(--mono);
  font-size: .84rem;
  line-height: 1.6;
}

.post-content pre code {
  padding: 0;
  border: 0;
  background: transparent;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95em;
}

.post-content th,
.post-content td {
  padding: .7rem;
  border: 1px solid var(--line);
  text-align: left;
}

.post-content th {
  background: #eee9df;
}

.highlight {
  overflow-x: auto;
  border-radius: .8rem;
}

.highlight pre {
  margin: 0;
}

.post-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.error-page {
  max-width: 700px;
  margin: 0 auto;
  padding: 9rem 0;
  text-align: center;
}

.error-code {
  margin: 0;
  color: var(--accent-dark);
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .2em;
}

.error-page h1 {
  margin: .5rem 0 1rem;
  font-family: var(--serif);
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 400;
  line-height: 1;
}

.error-page p:not(.error-code) {
  margin: 0 auto 2rem;
  max-width: 520px;
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--line);
}

.footer-inner {
  width: min(var(--content), calc(100% - 48px));
  min-height: 110px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  color: var(--muted);
  font-size: .78rem;
}

.footer-inner p {
  margin: 0;
}

.footer-links {
  display: flex;
  gap: 1.2rem;
}

.footer-links a {
  text-decoration: none;
}

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

mjx-container {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding: .35em 0;
}

@media (max-width: 760px) {
  .header-inner {
    min-height: auto;
    padding: 1.25rem 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 1rem;
  }

  .nav-list {
    justify-content: flex-start;
  }

  .hero {
    padding: 5rem 0 4rem;
  }

  .hero h1 {
    font-size: clamp(3.5rem, 15vw, 6rem);
  }

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

  .category-card {
    min-height: 180px;
  }

  .post-row {
    grid-template-columns: 1fr 26px;
    gap: .5rem 1rem;
  }

  .post-row-date {
    grid-column: 1 / -1;
    padding: 0;
  }

  .post-row-body h2 {
    font-size: 1.65rem;
  }

  .post-row-body h3 {
    font-size: 1.35rem;
  }

  .site-main {
    padding-bottom: 5rem;
  }

  .section-heading {
    align-items: flex-start;
  }

  .text-link {
    white-space: nowrap;
  }

  .footer-inner {
    padding: 1.5rem 0;
    align-items: flex-start;
    flex-direction: column;
    gap: .75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
