/* ---------- Design tokens ---------- */

:root {
  --bg: #fcfbf8;
  --surface: #f3f0ea;
  --text: #1c1a16;
  --muted: #5f5b53;
  --faint: #9a9489;
  --line: #e7e2d9;
  --accent: #3b6ed8;

  --c-txt: #3a3630;
  --c-kw: #8a5cc4;
  --c-fn: #2f6ad0;
  --c-typ: #1f8a6b;
  --c-str: #3f8f4f;
  --c-num: #c0763f;
  --c-com: #a39c8f;
}

[data-theme="dark"] {
  --bg: #181711;
  --surface: #211f18;
  --text: #e9e4da;
  --muted: #a8a194;
  --faint: #6f695d;
  --line: #2c2a22;
  --accent: #7fa8ef;

  --c-txt: #cfc9bd;
  --c-kw: #c39be8;
  --c-fn: #86b3f5;
  --c-typ: #6fcfa8;
  --c-str: #9bd187;
  --c-num: #e0a06f;
  --c-com: #6f695d;
}

/* ---------- Reset & base ---------- */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Newsreader', Georgia, serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background .3s ease, color .3s ease;
}

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

button {
  font-family: inherit;
}

::selection {
  background: var(--accent);
  color: #fff;
}

[data-body="serif"] {
  font-family: 'Newsreader', Georgia, serif;
}

[data-body="sans"] {
  font-family: Helvetica, "Helvetica Neue", system-ui, -apple-system, sans-serif;
}

main {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 17px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--text);
  cursor: pointer;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-nav a {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.site-nav a:hover {
  color: var(--accent);
}

#theme-toggle {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--text);
  border-radius: 50%;
  background: linear-gradient(90deg, var(--text) 0 50%, transparent 50% 100%);
  cursor: pointer;
  transition: transform .3s ease;
}

#theme-toggle:hover {
  transform: rotate(180deg);
}

/* ---------- Home / post list ---------- */

.home {
  padding: 0 0 40px;
}

.masthead {
  padding: 74px 0 30px;
}

.eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 20px;
}

.headline {
  font-size: 40px;
  line-height: 1.16;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.012em;
  max-width: 560px;
}

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

.post-item {
  display: block;
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.post-meta {
  display: flex;
  gap: 16px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--faint);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 13px;
}

.post-title {
  margin: 0 0 11px;
  font-size: 25px;
  font-weight: 500;
  line-height: 1.24;
  letter-spacing: -0.006em;
  color: var(--text);
  transition: color .15s ease;
}

.post-item:hover .post-title {
  color: var(--accent);
}

.post-excerpt {
  margin: 0;
  font-size: 17.5px;
  line-height: 1.58;
  color: var(--muted);
  max-width: 560px;
}

/* ---------- Individual post ---------- */

.post {
  padding: 52px 0 84px;
}

.post-back {
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 34px;
}

.post-heading {
  font-size: 40px;
  line-height: 1.16;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.016em;
}

.post-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--faint);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-top: 18px;
}

.post-body {
  margin-top: 38px;
  border-top: 1px solid var(--line);
  padding-top: 36px;
}

.post-body p {
  font-size: 19px;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 26px;
}

.post-body h2 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 46px 0 18px;
}

.post-body blockquote {
  margin: 34px 0;
  padding: 2px 0 2px 22px;
  border-left: 2px solid var(--accent);
  font-style: italic;
  font-size: 21px;
  line-height: 1.5;
  color: var(--muted);
}

.post-footer {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.post-footer-line {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 18px;
}

.post-footer-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.post-footer-socials a {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
  color: var(--faint);
}

.post-footer-socials a:hover {
  color: var(--accent);
}

/* ---------- About ---------- */

.about {
  padding: 64px 0 84px;
}

.about-heading {
  font-size: 34px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.012em;
  margin: 0 0 30px;
}

.about-body p {
  font-size: 19px;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 26px;
  max-width: 600px;
}

.about-body p:last-of-type {
  color: var(--muted);
  margin-bottom: 8px;
}

.about-elsewhere-heading {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--faint);
  margin: 52px 0 4px;
}

.about-elsewhere-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  color: var(--text);
}

.about-elsewhere-row:hover {
  color: var(--accent);
}

.about-elsewhere-handle {
  color: var(--faint);
}

/* ---------- Code blocks ---------- */

.code-block {
  margin: 30px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.code-lang {
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--faint);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.chroma {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: var(--surface);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre;
  color: var(--c-txt);
}

.chroma code {
  color: inherit;
}

/* Chroma class -> design token map (see design.md) */
.chroma .n, .chroma .nx, .chroma .p, .chroma .o { color: var(--c-txt); }
.chroma .k, .chroma .kc, .chroma .kd, .chroma .kn, .chroma .kp, .chroma .kr { color: var(--c-kw); }
.chroma .nf, .chroma .fm, .chroma .nb { color: var(--c-fn); }
.chroma .kt, .chroma .nc, .chroma .nn { color: var(--c-typ); }
.chroma .s, .chroma .sa, .chroma .sb, .chroma .sc, .chroma .dl, .chroma .sd, .chroma .se, .chroma .sh, .chroma .si, .chroma .sr, .chroma .s1, .chroma .s2, .chroma .ss, .chroma .sx { color: var(--c-str); }
.chroma .m, .chroma .mi, .chroma .mf, .chroma .mh, .chroma .mo, .chroma .mb, .chroma .il { color: var(--c-num); }
.chroma .c, .chroma .ch, .chroma .cm, .chroma .cp, .chroma .cpf, .chroma .c1, .chroma .cs { color: var(--c-com); }

/* ---------- Footer ---------- */

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

.footer-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 30px 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--faint);
}
