:root {
  --bg: #1f2329;
  --surface: #262b33;
  --text: #d2d9e2;
  --muted: #9ca5b1;
  --border: #3a414c;
  --link: #80b4ff;
  --link-hover: #a5cbff;
  --max-width: 760px;
}

[data-theme="light"] {
  --bg: #f3f5f7;
  --surface: #e8edf3;
  --text: #1e242b;
  --muted: #5d6874;
  --border: #c8d1dc;
  --link: #0f549f;
  --link-hover: #0b4687;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

.container {
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid var(--border);
}

.nav-wrap {
  min-height: 3.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.menu {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  gap: 1rem;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.menu a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.96rem;
}

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

.theme-toggle {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  padding: 0.22rem 0.6rem;
  cursor: pointer;
}

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

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

h1,
h2,
h3 {
  font-family: "Lora", Georgia, serif;
  line-height: 1.25;
  margin: 0;
}

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

h2 {
  font-size: 1.25rem;
  margin-bottom: 0.8rem;
}

p {
  margin: 0;
}

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

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

.intro {
  margin-bottom: 2.2rem;
}

.lede {
  margin-top: 0.9rem;
  max-width: 68ch;
  color: var(--muted);
}

.link-row {
  margin-top: 0.95rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  color: var(--muted);
}

.link-row a {
  text-decoration: none;
}

.stack {
  margin-top: 2rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.section-head a {
  text-decoration: none;
  font-size: 0.95rem;
}

.writing-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

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

.writing-item a {
  text-decoration: none;
  font-weight: 500;
  color: var(--text);
}

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

.writing-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.writing-desc {
  color: var(--muted);
  margin-top: 0.25rem;
  max-width: 68ch;
}

.page-header {
  margin-bottom: 1.2rem;
}

.page-header h1 {
  margin-bottom: 0.5rem;
}

.page-header p {
  color: var(--muted);
}

.page-header > :not(:first-child) {
  margin-top: 0.6rem;
}

.prose {
  max-width: 72ch;
}

.meta {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0.5rem;
}

.prose > :not(:first-child) {
  margin-top: 1rem;
}

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

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

.prose code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.92em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.08rem 0.3rem;
}

.prose pre {
  margin: 1rem 0;
}

.prose pre code {
  display: block;
  background: var(--surface);
  border-radius: 8px;
  padding: 0.8rem;
  overflow-x: auto;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2.2rem;
}

.footer-wrap {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.footer-links {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  align-items: center;
}

.footer-links a {
  color: var(--muted);
}

.social-icons {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.icon-link {
  width: 1.5rem;
  height: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
}

.icon-link:hover {
  color: var(--text);
  border-color: var(--muted);
}

.icon-link svg {
  width: 0.84rem;
  height: 0.84rem;
  fill: currentColor;
}

@media (max-width: 760px) {
  .nav-wrap {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.8rem 0;
  }

  .menu {
    gap: 0.8rem;
    flex-wrap: wrap;
  }

  .nav-controls {
    width: 100%;
    justify-content: space-between;
  }

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

  .footer-wrap {
    flex-direction: column;
  }
}
