/* Site theme — edit freely. Light/dark follows the visitor's system setting. */
:root {
  --bg: #ffffff;
  --surface: #f6f6f7;
  --border: #e6e6ea;
  --text: #1a1a1e;
  --muted: #6a6a75;
  --accent: #4f46e5;
  --code-bg: #f4f4f6;
  --max: 720px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111114;
    --surface: #18181c;
    --border: #2a2a31;
    --text: #e9e9ee;
    --muted: #9a9aa6;
    --accent: #8b93ff;
    --code-bg: #1b1b21;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.7 var(--sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; width: 100%; }
main.wrap { flex: 1; padding-top: 48px; padding-bottom: 72px; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

/* header / footer */
.site-header { border-bottom: 1px solid var(--border); position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.6) blur(10px); z-index: 10; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; }
.site-title { font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.site-nav { display: flex; gap: 4px; overflow-x: auto; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 15px; white-space: nowrap; }
.site-nav a:hover { color: var(--text); background: var(--surface); }
.site-nav a[aria-current="page"] { color: var(--text); font-weight: 500; }
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 24px; padding-bottom: 32px; }

/* typography */
.prose > :first-child { margin-top: 0; }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.02em; margin: 2em 0 .6em; }
h1 { font-size: clamp(30px, 5vw, 40px); margin-top: 0; }
h2 { font-size: 26px; }
h3 { font-size: 20px; }
p, ul, ol, blockquote, pre, table, figure { margin: 0 0 1.2em; }
ul, ol { padding-left: 1.4em; }
li + li { margin-top: .3em; }
img, video { max-width: 100%; height: auto; border-radius: 10px; }
hr { border: none; border-top: 1px solid var(--border); margin: 2.5em 0; }
blockquote { margin-left: 0; padding: .2em 0 .2em 1.1em; border-left: 3px solid var(--accent); color: var(--muted); }
code { font-family: var(--mono); font-size: .86em; background: var(--code-bg); padding: .15em .4em; border-radius: 5px; }
pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; overflow-x: auto; line-height: 1.55; }
pre code { background: none; padding: 0; font-size: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; display: block; overflow-x: auto; }
th, td { border-bottom: 1px solid var(--border); padding: 8px 12px; text-align: left; }
th { font-weight: 600; }
.prose h2[id], .prose h3[id] { scroll-margin-top: 80px; }

/* home + lists */
.hero { margin-bottom: 56px; }
.hero h1 { font-size: clamp(34px, 6vw, 48px); }
.hero p { font-size: 19px; color: var(--muted); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.section-head h2 { margin: 0; font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.section-head a { font-size: 15px; text-decoration: none; }
.page-header { margin-bottom: 32px; }
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--border); margin: 0; }
.post-list a { text-decoration: none; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.post-list .title { color: var(--text); font-weight: 600; font-size: 18px; }
.post-list a:hover .title { color: var(--accent); }
.post-list .desc { color: var(--muted); font-size: 15px; line-height: 1.5; }
.post-list time { color: var(--muted); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.post-list .empty { color: var(--muted); }

/* posts */
.post-header { margin-bottom: 36px; }
.post-header h1 { margin-bottom: 10px; }
.meta { color: var(--muted); font-size: 15px; margin: 0; }
.tags { margin: 10px 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
.tags a { font-size: 14px; text-decoration: none; background: var(--surface); border: 1px solid var(--border); padding: 2px 10px; border-radius: 999px; color: var(--muted); }
.tags a:hover { color: var(--accent); }
.badge { background: #fef3c7; color: #92400e; padding: 1px 8px; border-radius: 6px; font-size: 13px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 64px; }
.pager a { display: flex; flex-direction: column; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: var(--text); font-weight: 500; }
.pager a:hover { border-color: var(--accent); }
.pager small { color: var(--muted); font-weight: 400; font-size: 13px; }
.pager .next { text-align: right; grid-column: 2; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  main.wrap { padding-top: 32px; }
  .post-list li { flex-direction: column; gap: 4px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}

/* syntax highlighting (highlight.js tokens) */
.hljs-comment, .hljs-quote { color: #8a8a96; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-name { color: #7c3aed; }
.hljs-string, .hljs-attr, .hljs-template-tag, .hljs-addition { color: #059669; }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet { color: #d97706; }
.hljs-title, .hljs-section, .hljs-function .hljs-title { color: #2563eb; }
.hljs-type, .hljs-class .hljs-title, .hljs-variable { color: #db2777; }
.hljs-deletion { color: #dc2626; }
@media (prefers-color-scheme: dark) {
  .hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-name { color: #c4b5fd; }
  .hljs-string, .hljs-attr, .hljs-template-tag, .hljs-addition { color: #6ee7b7; }
  .hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet { color: #fcd34d; }
  .hljs-title, .hljs-section, .hljs-function .hljs-title { color: #93c5fd; }
  .hljs-type, .hljs-class .hljs-title, .hljs-variable { color: #f9a8d4; }
}
