:root {
  --bg: #fbfbfa;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e6e6e3;
  --code-bg: #f2f2ef;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --fg: #e8e8e6;
    --muted: #9a9a96;
    --line: #2a2a2a;
    --code-bg: #1c1c1c;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121212;
  --fg: #e8e8e6;
  --muted: #9a9a96;
  --line: #2a2a2a;
  --code-bg: #1c1c1c;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

.page {
  max-width: 620px;
  margin: 0 auto;
  padding: 40px 20px 96px;
}

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 72px;
  font-size: 15px;
}

header .home { font-weight: 600; margin-right: auto; }
header a:not(.home) { color: var(--muted); }
header a:not(.home):hover { color: var(--fg); }

#theme {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  padding: 4px;
}
#theme:hover { color: var(--fg); }

/* ── Home ── */
.intro h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.01em; }
.intro p { color: var(--muted); margin-top: 6px; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 20px;
  font-size: 15px;
}
.links a { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.links a:hover { text-decoration-color: currentColor; }
/* Plain text, not a link: one click selects the whole address to copy. */
.links .sep { color: var(--muted); }
@media (max-width: 400px) { .links { gap: 6px 7px; font-size: 14px; } }
.links .email { user-select: all; -webkit-user-select: all; cursor: text; }

.label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 72px 0 12px;
}
main > .label:first-child { margin-top: 0; }

/* ── Post list ── */
.posts { list-style: none; }

.posts a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.posts li:first-child a { border-top: 1px solid var(--line); }
.posts a:hover { text-decoration: none; }
.posts a:hover .title { text-decoration: underline; text-underline-offset: 3px; }

.posts .desc { display: block; color: var(--muted); font-size: 15px; margin-top: 2px; }
.posts .time { color: var(--muted); font-size: 14px; white-space: nowrap; }


/* ── Post ── */
.prose h1 { font-size: 30px; line-height: 1.25; font-weight: 600; letter-spacing: -0.015em; }
.prose .meta { color: var(--muted); font-size: 14px; margin: 8px 0 40px; }
.prose h2 { font-size: 21px; font-weight: 600; margin: 48px 0 12px; }
.prose h3 { font-size: 18px; font-weight: 600; margin: 32px 0 8px; }
.prose h4, .prose h5, .prose h6 { font-size: 17px; font-weight: 600; margin: 24px 0 8px; }
.prose p, .prose ul, .prose ol, .prose pre, .prose table, .prose blockquote { margin-bottom: 20px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose li::marker { color: var(--muted); }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose strong { font-weight: 600; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.prose img { max-width: 100%; height: auto; display: block; margin: 24px 0; }
.prose blockquote { border-left: 2px solid var(--line); padding-left: 18px; color: var(--muted); }

.prose table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; font-size: 15px; }
.prose th, .prose td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 600; }

.prose code { font: 0.86em/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.prose :not(pre) > code { background: var(--code-bg); padding: 2px 5px; border-radius: 4px; }
.prose pre { background: var(--code-bg); padding: 16px 18px; border-radius: 6px; overflow-x: auto; font-size: 14.5px; line-height: 1.6; }
.prose pre code { font-size: inherit; }
/* Fences with no language are pseudocode: wrap them rather than scroll. */
.prose pre > code:not([class*="language-"]) { white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 420px) {
  .prose pre { padding: 14px 12px; font-size: 12px; }
}

/* Code highlighting: one quiet scale of greys, no rainbow. */
.prose .token.comment, .prose .token.prolog, .prose .token.punctuation { color: var(--muted); }
.prose .token.comment { font-style: italic; }
.prose .token.keyword, .prose .token.builtin, .prose .token.important { font-weight: 600; }

mjx-container[jax="SVG"][display="true"] { overflow-x: auto; overflow-y: hidden; margin: 24px 0 !important; }

.back { display: inline-block; margin-top: 56px; color: var(--muted); font-size: 15px; }
.back:hover { color: var(--fg); }
