:root {
  --bg: #fdfdfc;
  --fg: #0a0a0a;
  --muted: #6b6b76;
  --faint: #a0a0a8;
  --border: #ececec;
  --accent: #0a0a0a;
  --accent-soft: #f5f5f4;
  --code-bg: #f5f5f4;
  --max: 36rem;
  --syn-comment: #94a3b8;
  --syn-keyword: #6f3cb6;
  --syn-string:  #0d6f4a;
  --syn-number:  #b5651d;
  --syn-name:    #1e40af;
  --syn-tag:     #1e40af;
  --syn-attr:    #6f3cb6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0c;
    --fg: #ededec;
    --muted: #8a8a92;
    --faint: #5a5a62;
    --border: #1c1c1e;
    --accent: #ededec;
    --accent-soft: #161617;
    --code-bg: #141415;
    --syn-comment: #5b6473;
    --syn-keyword: #c8a8ff;
    --syn-string:  #7ee2b8;
    --syn-number:  #f1c595;
    --syn-name:    #9bbcff;
    --syn-tag:     #9bbcff;
    --syn-attr:    #c8a8ff;
  }
}

@supports (font-variation-settings: normal) {
  :root { --font-sans: "InterVariable", "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
}
:root {
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, "Menlo", "Consolas", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4rem;
  font-size: 0.875rem;
}

.site-name {
  color: var(--fg);
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 120ms ease;
}

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

.content { flex: 1; }

.site-footer {
  margin-top: 6rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}
.site-footer a:hover { color: var(--fg); }
.site-footer .dot { color: var(--faint); }

/* Typography */
h1, h2, h3, h4 {
  color: var(--fg);
  letter-spacing: -0.02em;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.75rem;
}

h1 { font-size: 1.75rem; letter-spacing: -0.03em; }
h2 { font-size: 1.25rem; margin-top: 2.5rem; }
h3 { font-size: 1.0625rem; margin-top: 2rem; }

p { margin: 0 0 1rem; color: var(--fg); }

a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 120ms ease;
}
a:hover { text-decoration-color: var(--fg); }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

ul, ol { padding-left: 1.25rem; }
li { margin-bottom: 0.25rem; }

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.125rem;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.55;
  margin: 1.25rem 0;
}

pre code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: inherit;
}

blockquote {
  border-left: 2px solid var(--border);
  margin: 1.25rem 0;
  padding: 0.25rem 0 0.25rem 1rem;
  color: var(--muted);
}

img { max-width: 100%; height: auto; border-radius: 6px; }

/* Home page */
.hero { margin-bottom: 3rem; }

.hero h1 {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.25rem;
}

.sparkle {
  color: var(--faint);
  font-size: 0.75em;
  font-weight: 400;
  display: inline-block;
  transform: translateY(-0.15em);
  flex-shrink: 0;
  transition: color 220ms ease, transform 220ms ease;
}

h1:hover .sparkle {
  color: var(--fg);
  transform: translateY(-0.15em) rotate(90deg);
}

.hero .lead {
  color: var(--muted);
  font-size: 1rem;
  margin: 0;
}

.section {
  margin-top: 3rem;
}

.section-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
  margin-bottom: 1rem;
}

.row-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.row-list li {
  margin: 0;
  border-bottom: 1px solid var(--border);
}
.row-list li:first-child { border-top: 1px solid var(--border); }

.row-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.875rem 0;
  text-decoration: none;
  color: var(--fg);
  transition: padding 160ms ease, color 120ms ease;
}
.row-list a:hover {
  color: var(--fg);
  padding-left: 0.375rem;
  padding-right: 0.375rem;
}

.row-title {
  font-weight: 450;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-meta {
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.now-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.now-list li {
  display: flex;
  gap: 0.875rem;
  padding: 0.25rem 0;
  color: var(--fg);
}

.now-list li::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--faint);
  margin-top: 0.625rem;
  flex-shrink: 0;
}

.more-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 120ms ease, transform 120ms ease;
}
.more-link:hover {
  color: var(--fg);
}
.more-link .arrow {
  display: inline-block;
  transition: transform 160ms ease;
}
.more-link:hover .arrow { transform: translateX(2px); }

/* Post page */
.post-header {
  margin-bottom: 2.5rem;
}
.post-header h1 {
  margin-bottom: 0.5rem;
}
.post-meta {
  font-size: 0.8125rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.post-body h1 { font-size: 1.375rem; margin-top: 2.5rem; }
.post-body h2 { font-size: 1.125rem; margin-top: 2.25rem; }
.post-body h3 { font-size: 1rem; margin-top: 1.75rem; }

.post-body p,
.post-body li {
  color: var(--fg);
}

/* Writing index */
.year-group {
  margin-bottom: 2.5rem;
}
.year-label {
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* 404 */
.notfound {
  text-align: center;
  padding: 4rem 0;
}
.notfound h1 {
  font-size: 4rem;
  letter-spacing: -0.04em;
  margin-bottom: 0.5rem;
}
.notfound p { color: var(--muted); }

/* Wider container on article pages — clamps so it stays sane on big monitors */
body.layout-post .page {
  max-width: clamp(36rem, 38vw, 52rem);
}

/* Syntax highlighting (Rouge token classes) */
.highlight, figure.highlight {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 1.25rem 0;
  overflow: hidden;
}
.highlight pre, figure.highlight pre {
  background: transparent;
  border: 0;
  border-radius: 0;
  margin: 0;
  padding: 1rem 1.125rem;
}
.highlight code { background: transparent; border: 0; padding: 0; }

.highlight .c, .highlight .ch, .highlight .cm, .highlight .cp, .highlight .cpf,
.highlight .c1, .highlight .cs { color: var(--syn-comment); font-style: italic; }

.highlight .k, .highlight .kc, .highlight .kd, .highlight .kn, .highlight .kp,
.highlight .kr, .highlight .kt, .highlight .kv { color: var(--syn-keyword); font-weight: 500; }

.highlight .s, .highlight .sa, .highlight .sb, .highlight .sc, .highlight .dl,
.highlight .sd, .highlight .s2, .highlight .se, .highlight .sh, .highlight .si,
.highlight .sx, .highlight .sr, .highlight .s1, .highlight .ss { color: var(--syn-string); }

.highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi,
.highlight .il, .highlight .mo, .highlight .mx { color: var(--syn-number); }

.highlight .nb, .highlight .nf, .highlight .nc, .highlight .nn, .highlight .nd,
.highlight .ne, .highlight .ni, .highlight .nl, .highlight .py { color: var(--syn-name); }

.highlight .nt { color: var(--syn-tag); }
.highlight .na { color: var(--syn-attr); }

.highlight .o, .highlight .ow { color: var(--muted); }
.highlight .p, .highlight .pi { color: var(--fg); }
.highlight .err { color: inherit; background: transparent; }

.highlight .gd { color: #b00020; background: rgba(176, 0, 32, 0.06); }
.highlight .gi { color: #0d6f4a; background: rgba(13, 111, 74, 0.06); }
.highlight .gh, .highlight .gu { color: var(--syn-name); font-weight: 500; }
.highlight .gp { color: var(--muted); }
.highlight .ge { font-style: italic; }
.highlight .gs { font-weight: 600; }

.highlight .lineno {
  color: var(--faint);
  user-select: none;
  padding-right: 0.75rem;
}

@media (max-width: 480px) {
  html, body { font-size: 15px; }
  .page { padding: 2.5rem 1.25rem 4rem; }
  .site-header { margin-bottom: 3rem; }
  h1 { font-size: 1.5rem; }
}
