@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600&display=swap");

:root {
  --bg: #f6f5f1;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --text: #111111;
  --muted: rgba(17, 17, 17, 0.64);
  --line: rgba(17, 17, 17, 0.11);
  --accent: #111111;
  --accent-soft: #ece9df;
  --shadow: 0 20px 40px rgba(17, 17, 17, 0.06);
  --radius: 28px;
  --content-width: 1120px;
  --article-width: 760px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(219, 214, 202, 0.6), transparent 30%),
    linear-gradient(180deg, #f9f8f4 0%, #f3f2ee 100%);
  color: var(--text);
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  line-height: 1.6;
}

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

img {
  max-width: 100%;
}

.site-shell {
  min-height: 100vh;
}

.site-width {
  width: min(calc(100% - 2rem), var(--content-width));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: rgba(246, 245, 241, 0.74);
  border-bottom: 1px solid transparent;
}

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

.site-mark {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.site-nav a {
  color: var(--muted);
  font-size: 0.95rem;
  transition: color 180ms ease;
}

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

.site-main {
  padding: 3.5rem 0 5rem;
}

.site-footer {
  padding: 0 0 2rem;
}

.site-footer-inner {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.hero,
.section,
.post-shell {
  position: relative;
}

.hero {
  padding: 3rem 0 2rem;
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero h1,
.section h1,
.post-header h1,
.section h2,
.prose h1,
.prose h2,
.prose h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.hero h1 {
  max-width: 12ch;
  font-size: clamp(3.25rem, 8vw, 6.4rem);
}

.lede,
.section-copy,
.post-summary {
  max-width: 46rem;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.95rem;
  font-weight: 600;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    color 180ms ease,
    border-color 180ms ease;
}

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

.button-primary {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.6);
}

.section {
  margin-top: 3.5rem;
}

.section-header {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1.4rem;
}

.section-header h1,
.section-header h2 {
  font-size: clamp(2.4rem, 5vw, 4rem);
}

.post-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.post-card {
  grid-column: span 4;
  display: grid;
  gap: 1rem;
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  min-height: 240px;
}

.post-card-featured {
  grid-column: span 12;
  padding: 2rem;
  min-height: 280px;
}

.post-card-meta,
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.post-card h3 {
  font-size: 1.5rem;
  line-height: 1.1;
}

.post-card p {
  margin: 0;
  color: var(--muted);
}

.post-card-tags,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-card-tags span,
.tag-list li {
  display: inline-flex;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 0.82rem;
}

.post-shell {
  width: min(100%, var(--article-width));
}

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

.post-header {
  display: grid;
  gap: 1rem;
  padding-bottom: 2rem;
}

.post-header h1,
.section h1 {
  font-size: clamp(2.8rem, 6vw, 4.8rem);
}

.prose {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.14rem;
  line-height: 1.9;
  color: rgba(17, 17, 17, 0.78);
}

.prose > * + * {
  margin-top: 1.1rem;
}

.prose h2,
.prose h3 {
  margin-top: 2.7rem;
  font-family: "Manrope", "Avenir Next", sans-serif;
  color: var(--text);
}

.prose h2 {
  font-size: 2rem;
}

.prose h3 {
  font-size: 1.4rem;
}

.prose p,
.prose li,
.prose blockquote,
.prose table,
.prose pre {
  max-width: 100%;
}

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

.prose li + li {
  margin-top: 0.45rem;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.prose blockquote {
  margin: 1.4rem 0;
  padding: 1.2rem 1.3rem;
  border-left: 3px solid rgba(17, 17, 17, 0.24);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  color: rgba(17, 17, 17, 0.72);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.prose thead {
  background: #f0ece2;
}

.prose th,
.prose td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose tbody tr:last-child td {
  border-bottom: none;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.prose :not(pre) > code {
  padding: 0.15rem 0.4rem;
  border-radius: 8px;
  background: rgba(17, 17, 17, 0.07);
}

.prose pre,
.mermaid-figure {
  overflow-x: auto;
  padding: 1rem 1.1rem;
  border-radius: 24px;
  background: #0d1117;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.prose pre code {
  display: block;
}

.mermaid-figure {
  background: rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 0 0 1px var(--line);
}

.mermaid-figure svg {
  display: block;
  min-width: 28rem;
}

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.4rem 0;
}

@media (max-width: 980px) {
  .post-card,
  .post-card-featured {
    grid-column: span 12;
  }
}

@media (max-width: 720px) {
  .site-header-inner,
  .site-footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-main {
    padding-top: 2.5rem;
  }

  .hero {
    padding-top: 1rem;
  }

  .hero h1 {
    max-width: 100%;
  }

  .site-width {
    width: min(calc(100% - 1.25rem), var(--content-width));
  }

  .prose {
    font-size: 1.04rem;
  }

  .prose th,
  .prose td {
    padding: 0.72rem 0.78rem;
  }

  .mermaid-figure svg {
    min-width: 20rem;
  }
}
