:root {
  --bg: #0b1020;
  --bg-elevated: #121933;
  --bg-code: #080c18;
  --border: rgba(232, 236, 248, 0.1);
  --text: #e8ecf8;
  --text-muted: #9aa6c3;
  --heading: #f5f7ff;
  --accent: #f0b429;
  --accent-soft: rgba(240, 180, 41, 0.14);
  --link: #8ec8ff;
  --link-hover: #c5e2ff;
  --table-stripe: rgba(255, 255, 255, 0.03);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --max: 46rem;
  --font-sans: "IBM Plex Sans", system-ui, sans-serif;
  --font-serif: "Newsreader", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(240, 180, 41, 0.12), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, rgba(90, 140, 255, 0.14), transparent 50%),
    var(--bg);
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

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

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

.wrap {
  width: min(var(--max), calc(100% - 2.5rem));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(11, 16, 32, 0.82);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--heading);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-mark {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #ff7a59);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  align-items: center;
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
}

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

.nav-external {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.prose {
  padding: 2.5rem 0 4rem;
}

.prose > h1:first-child {
  margin-top: 0.4rem;
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--heading);
}

.prose > p:nth-of-type(1) {
  font-size: 1.2rem;
  color: var(--accent);
  font-weight: 500;
}

.prose > p:nth-of-type(2) {
  color: var(--text-muted);
  font-style: italic;
}

.prose h2,
.prose h3,
.prose h4 {
  color: var(--heading);
  line-height: 1.25;
  scroll-margin-top: 5rem;
}

.prose h2 {
  margin-top: 2.8rem;
  margin-bottom: 0.9rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.prose h3 {
  margin-top: 2rem;
  font-size: 1.2rem;
  font-weight: 600;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose table {
  margin: 1rem 0;
}

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

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

.prose strong {
  color: var(--heading);
  font-weight: 600;
}

.prose blockquote {
  margin-left: 0;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--accent-soft);
  color: #ffe3a1;
  padding: 0.12em 0.38em;
  border-radius: 0.35rem;
}

.prose pre {
  overflow-x: auto;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-code);
  box-shadow: var(--shadow);
}

.prose pre code {
  background: transparent;
  color: #d7e0f5;
  padding: 0;
  font-size: 0.88rem;
  line-height: 1.55;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

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

.prose th {
  color: var(--heading);
  font-size: 0.92rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
}

.prose tr:nth-child(even) td {
  background: var(--table-stripe);
}

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

.prose img {
  max-width: 100%;
  height: auto;
}

.prose .mermaid {
  margin: 1.4rem 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow-x: auto;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.6rem 0 2.4rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-note {
  margin: 0;
  opacity: 0.85;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 640px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.85rem 0;
  }

  .prose {
    padding-top: 1.6rem;
  }
}
