:root {
  color-scheme: dark;
  --page-bg: #13171f;
  --surface-1: #242938;
  --surface-2: #1d2230;
  --surface-3: #2a3144;
  --surface-4: #31384c;
  --text: #f4f7fb;
  --text-soft: #c8d0df;
  --text-muted: #95a1b8;
  --border: rgba(238, 243, 255, 0.12);
  --border-strong: rgba(238, 243, 255, 0.2);
  --primary: #7f87ff;
  --primary-soft: rgba(127, 135, 255, 0.14);
  --accent: #74d1c6;
  --code-bg: #1a1b26;
  --code-border: rgba(0, 0, 0, 0.24);
  --code-line-border: rgba(154, 165, 206, 0.16);
  --code-line-number: #565f89;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shell: 72rem;
  --narrow: 64rem;
}

html.light {
  color-scheme: light;
  --page-bg: #f1f4f9;
  --surface-1: #ffffff;
  --surface-2: #edf1f7;
  --surface-3: #e4e9f3;
  --surface-4: #dbe2ed;
  --text: #131927;
  --text-soft: #445068;
  --text-muted: #68758d;
  --border: rgba(19, 25, 39, 0.1);
  --border-strong: rgba(19, 25, 39, 0.16);
  --primary: #5660d8;
  --primary-soft: rgba(86, 96, 216, 0.1);
  --accent: #159f90;
  --code-bg: #d5d6db;
  --code-border: rgba(60, 56, 54, 0.16);
  --code-line-border: rgba(86, 90, 110, 0.16);
  --code-line-number: #9699a3;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.6;
  letter-spacing: -0.015em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.drawer-open {
  overflow: hidden;
}

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

img,
svg {
  display: block;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

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

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

.site-header {
  position: relative;
  z-index: 20;
}

.nav-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 0 0;
}

.brand {
  flex: 0 0 auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background:
    linear-gradient(145deg, rgba(127, 135, 255, 0.24), rgba(116, 209, 198, 0.14)),
    var(--surface-1);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.brand-mark svg {
  width: 1rem;
  height: 1rem;
}

.nav-pills {
  display: none;
  margin: 0 auto;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(18px);
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.58rem 1rem;
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 600;
  transition:
    background-color 0.18s ease,
    color 0.18s ease;
}

.nav-pill:hover,
.nav-pill:focus-visible {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
}

.nav-pill.is-active {
  background: var(--surface-1);
  color: var(--primary);
}

.nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--text);
  outline: none;
}

.icon-button svg {
  width: 1rem;
  height: 1rem;
}

.icon-sun {
  display: none;
}

html.light .icon-sun {
  display: block;
}

html.light .icon-moon {
  display: none;
}

html.dark .icon-moon {
  display: block;
}

html.dark .icon-sun {
  display: none;
}

.nav-toggle {
  display: inline-flex;
}

.mobile-drawer[hidden] {
  display: none;
}

.mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.mobile-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 10, 18, 0.7);
}

.mobile-panel {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(22rem, 82vw);
  padding: 1.5rem;
  background: var(--surface-1);
  border-left: 1px solid var(--border);
}

.mobile-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.mobile-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.mobile-nav {
  display: grid;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

.mobile-nav a {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-soft);
  font-weight: 600;
}

.mobile-nav a.is-active {
  background: var(--surface-2);
  color: var(--primary);
  border-color: rgba(127, 135, 255, 0.22);
}

.site-main {
  width: min(calc(100% - 2rem), var(--shell));
  margin: 0.75rem auto 0;
  background: transparent;
  border: 1px solid transparent;
}

.page-section {
  padding: 4.75rem 0 5.5rem;
}

.page-header {
  max-width: 44rem;
}

.page-kicker {
  margin: 0 0 0.9rem;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  font-size:  clamp(1.9rem, 3vw, 2.75rem);
  line-height: 0.96;
  font-weight: 750;
  text-wrap: balance;
}

.home-intro {
  max-width: 42rem;
}

.home-title {
  font-size: clamp(1.9rem, 3vw, 2.75rem);
  line-height: 1.05;
}

.home-description {
  max-width: 39rem;
  margin: 1.25rem 0 0;
  color: var(--text-soft);
  font-size: clamp(1.05rem, 1.8vw, 1.2rem);
  line-height: 1.65;
}

.page-subtitle {
  max-width: 40rem;
  margin: 1.5rem 0 0;
  color: var(--text-soft);
  font-size: 1.08rem;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.78rem 1.1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.92rem;
  font-weight: 700;
  transition:
    transform 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.button-primary {
  background: var(--primary);
  color: #eef1ff;
}

.button-primary:hover,
.button-primary:focus-visible {
  background: color-mix(in srgb, var(--primary) 88%, white);
}

.button-secondary {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.button-secondary:hover,
.button-secondary:focus-visible {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.meta-pill {
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.timeline {
  margin-top: 4rem;
  border-left: 1px solid var(--border);
}

.post-row {
  position: relative;
  display: grid;
  gap: 1rem;
  padding: 2.2rem 0 2.2rem 1.6rem;
}

.post-row::before {
  content: "";
  position: absolute;
  left: -0.42rem;
  top: 2.7rem;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
  background: var(--primary);
  border: 3px solid var(--surface-1);
}

.post-row + .post-row {
  border-top: 1px solid var(--border);
}

.post-date {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.post-copy h2 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.2;
  font-weight: 700;
}

.post-copy p {
  margin: 0.9rem 0 0;
  color: var(--text-soft);
  max-width: 42rem;
}

.read-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.1rem;
  color: var(--primary);
  font-size: 0.92rem;
  font-weight: 700;
}

.read-link:hover,
.read-link:focus-visible {
  color: color-mix(in srgb, var(--primary) 85%, white);
  outline: none;
}

.split-grid {
  display: grid;
  gap: 1.2rem;
  margin-top: 3rem;
}

.card {
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%),
    var(--surface-2);
}

.card h2,
.card h3 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.25;
}

.card p {
  margin: 0.75rem 0 0;
  color: var(--text-soft);
}

.card-list {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}

.status {
  color: var(--accent);
}

.newsletter-form {
  display: grid;
  gap: 0.85rem;
  margin-top: 2rem;
}

.input {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--text);
}

.input::placeholder {
  color: var(--text-muted);
}

.input:focus-visible {
  outline: 2px solid rgba(127, 135, 255, 0.28);
  outline-offset: 1px;
}

.microcopy {
  margin: 0.7rem 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.archive-list {
  display: grid;
  gap: 0.9rem;
  margin-top: 2rem;
}

.archive-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.archive-item strong {
  display: block;
  font-size: 1rem;
}

.archive-item span {
  color: var(--text-soft);
  font-size: 0.92rem;
}

.article-shell {
  display: block;
  max-width: 44rem;
}

.article-header {
  margin-top: 1.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--text);
  outline: none;
}

.article-title {
  margin: 0;
  font-size: clamp(1.9rem, 3vw, 2.75rem);
  line-height: 0.98;
  font-weight: 760;
  text-wrap: balance;
}

.article-summary {
  max-width: 42rem;
  margin: 1rem 0 0;
  color: var(--text-soft);
  font-size: 1.08rem;
  overflow-wrap: anywhere;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  margin: 1.1rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.article-divider {
  height: 1px;
  margin: 1.6rem 0 1.8rem;
  border: 0;
  background: var(--border);
}

.article-prose {
  max-width: 44rem;
  min-width: 0;
}

.article-prose h2 {
  margin: 2.7rem 0 1rem;
  font-size: 1.65rem;
  line-height: 1.15;
}

.article-prose h3 {
  margin: 2rem 0 0.85rem;
  font-size: 1.2rem;
  line-height: 1.2;
}

.article-prose p,
.article-prose li {
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.article-prose p + p,
.article-prose ul + p,
.article-prose ol + p {
  margin-top: 1rem;
}

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

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

.article-prose strong,
.article-prose code {
  color: var(--text);
}

.article-prose a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.article-prose blockquote {
  margin: 1.8rem 0;
  padding: 0.15rem 0 0.15rem 1.2rem;
  border-left: 3px solid var(--primary);
}

.article-prose blockquote p {
  margin: 0;
  color: var(--text);
  font-style: italic;
}

.article-prose blockquote p + p {
  margin-top: 0.8rem;
}

.article-prose hr {
  height: 1px;
  margin: 2.5rem 0;
  border: 0;
  background: var(--border);
}

.article-prose table {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 1.6rem 0;
  overflow-x: auto;
  border-collapse: collapse;
}

.article-prose th,
.article-prose td {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  text-align: left;
}

.article-prose th {
  background: var(--surface-3);
  color: var(--text);
}

.article-prose td {
  color: var(--text-soft);
}

.article-prose input[type="checkbox"] {
  margin-right: 0.45rem;
  accent-color: var(--primary);
}

.article-prose .footnote-definition {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.article-prose code {
  padding: 0.1rem 0.35rem;
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.95em;
}

.article-prose pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.article-prose pre code {
  padding: 0;
  background: none;
}

.article-prose pre.code-block {
  padding: 0.9rem 0;
  border-color: var(--code-border);
  background: var(--code-bg);
}

.article-prose pre.code-block code {
  display: block;
  min-width: max-content;
  counter-reset: code-line;
  font-size: 0.94rem;
  line-height: 1.6;
}

.article-prose .code-line {
  display: block;
  min-height: 1.6em;
  padding-right: 1.1rem;
  counter-increment: code-line;
}

.article-prose .code-line::before {
  content: counter(code-line);
  display: inline-block;
  width: 3.2rem;
  margin-right: 1rem;
  padding-right: 0.8rem;
  border-right: 1px solid var(--code-line-border);
  color: var(--code-line-number);
  text-align: right;
  user-select: none;
}

.callout {
  margin: 1.8rem 0;
  padding: 1.1rem 1.2rem;
  border: 1px solid rgba(127, 135, 255, 0.25);
  border-radius: var(--radius-md);
  background: var(--primary-soft);
}

.callout p {
  margin: 0;
}

.two-column {
  display: grid;
  gap: 1.1rem;
  margin-top: 2rem;
}

.stack-list {
  display: grid;
  gap: 0.9rem;
}

.stack-item {
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.stack-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.site-footer {
  width: min(calc(100% - 2rem), var(--shell));
  margin: 0 auto 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

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

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

.footer-links a {
  color: var(--text-soft);
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.3em;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--text);
  text-decoration-color: var(--primary);
}

.footer-copyright {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

@media (min-width: 720px) {
  .newsletter-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (min-width: 768px) {
  .nav-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
  }

  .nav-pills {
    display: inline-flex;
    margin: 0;
  }

  .nav-actions {
    justify-self: end;
    margin-left: 0;
  }

  .nav-toggle {
    display: none;
  }

  .post-row {
    grid-template-columns: 11rem minmax(0, 1fr);
    gap: 2rem;
  }

  .split-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-column {
    grid-template-columns: minmax(0, 1.7fr) minmax(18rem, 0.9fr);
    align-items: start;
  }
}

@media (max-width: 767px) {
  .page-section {
    padding: 3.7rem 0 4.5rem;
  }

  .page-title,
  .article-title {
    text-wrap: pretty;
  }

  .article-prose pre {
    margin-inline: -0.2rem;
    border-radius: 1rem;
  }

  .article-prose pre.code-block code {
    font-size: 0.86rem;
  }

  .archive-item {
    flex-direction: column;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }
}
