:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #6b6b6b;
  --rule: #e6e6e6;
  --accent: #1f3a5f;
  --measure: 38rem;
  color-scheme: light;
}
/* Light by default. Dark only when chosen with the toggle (data-theme set by the inline head script). */
:root[data-theme="dark"] {
  --bg: #0b0b0b;
  --fg: #ededed;
  --muted: #9a9a9a;
  --rule: #262626;
  --accent: #9db7d9;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0 auto;
  max-width: calc(var(--measure) + 3rem);
  padding: 0 1.5rem;
  background: var(--bg);
  color: var(--fg);
  font: 400 1.0625rem/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: underline; text-decoration-color: var(--muted); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-color: var(--accent); color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; background: var(--bg); padding: 0.5rem 0.75rem; }

header.site {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
  justify-content: space-between; align-items: baseline;
  padding: 2.5rem 0 0;
  font-size: 0.9375rem;
}
header.site .name { font-weight: 600; text-decoration: none; letter-spacing: -0.01em; }
header.site nav { display: flex; gap: 1.25rem; }
header.site nav a { text-decoration: none; color: var(--muted); }
header.site nav a:hover, header.site nav a[aria-current="page"] { color: var(--fg); }
header.site nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--fg); }

main { padding: 5rem 0 4rem; flex: 1 0 auto; }

h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(2rem, 6vw, 2.75rem); margin-bottom: 2.5rem; }
.intro h1 { margin-bottom: 1rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }
p, ul, ol, dl { margin: 0 0 1rem; }

.lede { font-size: 1.25rem; line-height: 1.45; color: var(--fg); margin-bottom: 0; letter-spacing: -0.01em; }
.intro { margin-bottom: 4.5rem; }
section { margin-bottom: 3.5rem; }
.label {
  font-size: 0.8125rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin-bottom: 1rem;
}
.muted, .meta { color: var(--muted); }
.meta { font-size: 0.9375rem; margin: 0.35rem 0 1.25rem; }

.pairs { display: grid; grid-template-columns: 1fr; gap: 0.15rem 1.5rem; }
.pairs dt { font-weight: 600; }
.pairs dd { margin: 0 0 1rem; color: var(--fg); }
@media (min-width: 640px) {
  .pairs { grid-template-columns: 9rem 1fr; }
  .pairs dd { margin-bottom: 0.85rem; }
  .timeline { grid-template-columns: 7.5rem 1fr; }
}
.timeline dt { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }

.links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }

.project { padding-bottom: 2.5rem; margin-bottom: 2.75rem; border-bottom: 1px solid var(--rule); }
.project h2 { font-size: 1.375rem; }
.project h2 a { text-decoration: none; }
.project h2 a:hover { text-decoration: underline; }
.stack { font-size: 0.9375rem; color: var(--muted); margin: 1.25rem 0 0; }

.selected { margin-top: 1rem; }
.selected > h2 { margin-bottom: 1rem; }
.entry { margin-bottom: 2rem; }
.entry .meta { margin: 0.25rem 0 0.6rem; }
.entry ul, .prose ul, .prose ol { padding-left: 1.15rem; }
.entry li, .prose li { margin-bottom: 0.4rem; }
.entry li::marker { color: var(--muted); }

.posts { list-style: none; padding: 0; }
.posts li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.posts li:first-child { border-top: 1px solid var(--rule); }
.posts time { color: var(--muted); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.tag { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); border: 1px solid var(--rule); padding: 0.05rem 0.4rem; border-radius: 3px; margin-left: 0.4rem; vertical-align: 0.1em; }

.post header h1 { margin-bottom: 0; }
.post header .meta { margin-bottom: 2.5rem; }
.draft { font-size: 0.875rem; color: var(--muted); border: 1px dashed var(--muted); padding: 0.5rem 0.75rem; border-radius: 4px; margin-bottom: 2rem; }
.prose h2 { margin: 2.5rem 0 0.75rem; }
.prose h3 { margin: 2rem 0 0.5rem; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.875em; }
.prose pre { overflow-x: auto; padding: 1rem; border: 1px solid var(--rule); border-radius: 4px; font-size: 0.875rem; line-height: 1.5; margin: 0 0 1.25rem; }
.prose pre code { font-size: inherit; }
.prose blockquote { margin: 0 0 1rem; padding-left: 1rem; border-left: 2px solid var(--rule); color: var(--muted); }
.back { margin-top: 3rem; }

.button { display: inline-block; text-decoration: none; border: 1px solid var(--fg); padding: 0.5rem 1rem; border-radius: 4px; font-weight: 500; margin-right: 0.75rem; }
.button:hover { background: var(--fg); color: var(--bg); }

footer.site { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; padding: 1.5rem 0 3rem; border-top: 1px solid var(--rule); font-size: 0.875rem; color: var(--muted); }
footer.site a { text-decoration: none; }
footer.site a:hover { text-decoration: underline; }

@media (prefers-reduced-motion: no-preference) { a { transition: color 120ms ease, text-decoration-color 120ms ease; } }
@media print { header.site nav, footer.site, .theme-toggle { display: none; } main { padding-top: 1rem; } }

.sub { margin: -1.5rem 0 2rem; }
.actions { margin-bottom: 4rem; display: flex; align-items: center; gap: 0.75rem; }
.actions .button { margin-right: 0; }

/* Theme toggle: fixed bottom-left, "LIGHT / DARK", modeled on tradeplaybook.ai.
   Hidden unless the inline head script ran (no JS means light, no dead button). */
.theme-toggle {
  display: none;
  position: fixed; bottom: 1.15rem; left: 1.15rem; z-index: 55;
  align-items: center; gap: 0.4rem;
  margin: 0; padding: 0.4rem 0.65rem;
  font-family: inherit; font-size: 0.6875rem; font-weight: 500; line-height: 1;
  letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
  color: var(--muted); background: var(--bg);
  border: 1px solid var(--rule); border-radius: 2px;
  cursor: pointer;
}
:root[data-theme] .theme-toggle { display: inline-flex; }
.theme-toggle:hover { color: var(--fg); border-color: var(--muted); }
.theme-toggle:focus-visible { outline: 1px solid var(--muted); outline-offset: 2px; }
.theme-toggle-sep { color: var(--rule); font-weight: 400; }
.theme-toggle [data-theme-opt] { color: var(--muted); }
.theme-toggle [data-theme-opt].is-active { color: var(--fg); }
@media (prefers-reduced-motion: no-preference) { .theme-toggle, .theme-toggle [data-theme-opt] { transition: color 150ms ease, border-color 150ms ease; } }
