:root {
  --bg: #fff;
  --fg: #000;
  --link: #000;
  --muted: #eee;
  --border: #ccc;
  --table-border: #666;
  --syn-kw: #007020;
  --syn-type: #902000;
  --syn-attr: #4070a0;
  --syn-class: #0e84b5;
  --syn-tag: #062873;
  --syn-fn: #06287e;
  --syn-builtin: #007020;
  --syn-var: #bb60d5;
  --syn-str: #4070a0;
  --syn-num: #40a070;
  --syn-op: #666;
  --syn-comment: #60a0b0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --fg: #ddd;
    --link: #ddd;
    --muted: #2a2a2a;
    --border: #555;
    --table-border: #888;
    --syn-kw: #ff79c6;
    --syn-type: #8be9fd;
    --syn-attr: #50fa7b;
    --syn-class: #50fa7b;
    --syn-tag: #ff79c6;
    --syn-fn: #50fa7b;
    --syn-builtin: #8be9fd;
    --syn-var: #8be9fd;
    --syn-str: #f1fa8c;
    --syn-num: #bd93f9;
    --syn-op: #ff79c6;
    --syn-comment: #6272a4;
  }
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --fg: #ddd;
  --link: #ddd;
  --muted: #2a2a2a;
  --border: #555;
  --table-border: #888;
  --syn-kw: #ff79c6;
  --syn-type: #8be9fd;
  --syn-attr: #50fa7b;
  --syn-class: #50fa7b;
  --syn-tag: #ff79c6;
  --syn-fn: #50fa7b;
  --syn-builtin: #8be9fd;
  --syn-var: #8be9fd;
  --syn-str: #f1fa8c;
  --syn-num: #bd93f9;
  --syn-op: #ff79c6;
  --syn-comment: #6272a4;
}

[data-theme="light"] {
  --bg: #fff;
  --fg: #000;
  --link: #000;
  --muted: #eee;
  --border: #ccc;
  --table-border: #666;
  --syn-kw: #007020;
  --syn-type: #902000;
  --syn-attr: #4070a0;
  --syn-class: #0e84b5;
  --syn-tag: #062873;
  --syn-fn: #06287e;
  --syn-builtin: #007020;
  --syn-var: #bb60d5;
  --syn-str: #4070a0;
  --syn-num: #40a070;
  --syn-op: #666;
  --syn-comment: #60a0b0;
}

body {
  max-width: 800px;
  margin: auto;
  padding: 1em;
  line-height: 1.5;
  font-family: monospace;
  background: var(--bg);
  color: var(--fg);
}

a {
  color: var(--link);
}

nav { display: flex; align-items: center; }

.nav-spacer { min-width: 3em; }

.menu { padding: 0; margin: 0; flex: 1; display: flex; justify-content: center; gap: 0.5em; }
.menu li { display: inline-block; }

.article-meta, .menu a {
  text-decoration: none;
  background: var(--muted);
  padding: 5px;
}

.article-meta, footer { text-align: center; }

#theme-toggle {
  text-decoration: none;
  white-space: nowrap;
  min-width: 3em;
  text-align: right;
}

.title { font-size: 1.1em; }

footer a { text-decoration: none; }

hr {
  border: none;
  border-top: 1px solid var(--muted);
}

pre {
  padding: 1em;
  overflow-x: auto;
  background: var(--muted);
}
code {
  background: var(--muted);
  padding: 0.1em 0.3em;
}
pre code { background: none; border: none; padding: 0; }

img, iframe, video { max-width: 100%; }
main { hyphens: auto; }
blockquote {
  background: var(--muted);
  border-left: 5px solid var(--border);
  padding: 3px 1em 3px;
}

table {
  margin: auto;
  border-top: 1px solid var(--table-border);
  border-bottom: 1px solid var(--table-border);
}
table thead th { border-bottom: 1px solid var(--border); }
th, td { padding: 5px; }
thead, tfoot, tr:nth-child(even) { background: var(--muted); }

.social-links {
  list-style: none;
  display: flex;
  gap: 0.75rem;
  padding: 0;
  margin: 0;
  justify-content: center;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: #333;
}

.social-links img {
  width: 15px;
  height: 15px;
}

/* Timeline */
.timeline {
  list-style: none;
  padding: 0;
  margin-left: 0.5em;
  border-left: 2px solid var(--border);
}

.timeline li {
  position: relative;
  padding: 0.35em 0 0.35em 1.5em;
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  flex-wrap: wrap;
}

.timeline li::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.15s;
}

.timeline li:hover::before {
  background: var(--fg);
}

.timeline .date {
  opacity: 0.6;
  white-space: nowrap;
  font-size: 0.85em;
}

.timeline .sep {
  opacity: 0.35;
  font-size: 0.85em;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  margin-top: 0.5em;
  justify-content: center;
}

.tag {
  background: var(--muted);
  padding: 1px 6px;
  font-size: 0.8em;
  text-decoration: none;
  opacity: 0.85;
}

.tag:hover { opacity: 1; }

.post-meta .tags { justify-content: flex-start; }

.timeline .tag {
  font-size: 0.75em;
  padding: 0 5px;
}

/* Syntax highlighting */
.chroma { background: var(--muted); }
.chroma .k,.chroma .kc,.chroma .kd,.chroma .kn,.chroma .kr { color:var(--syn-kw);font-weight:bold }
.chroma .kp { color:var(--syn-kw) }
.chroma .ow { color:var(--syn-kw);font-weight:bold }
.chroma .kt { color:var(--syn-type) }
.chroma .na { color:var(--syn-attr) }
.chroma .nc { color:var(--syn-class);font-weight:bold }
.chroma .nt { color:var(--syn-tag);font-weight:bold }
.chroma .nf,.chroma .fm { color:var(--syn-fn) }
.chroma .nb,.chroma .bp,.chroma .ne { color:var(--syn-builtin) }
.chroma .nv,.chroma .vc,.chroma .vg,.chroma .vi,.chroma .vm { color:var(--syn-var) }
.chroma .s,.chroma .sa,.chroma .sb,.chroma .sc,.chroma .dl,.chroma .sd,.chroma .s2,.chroma .se,.chroma .sh,.chroma .si,.chroma .sx,.chroma .sr,.chroma .s1,.chroma .ss { color:var(--syn-str) }
.chroma .m,.chroma .mb,.chroma .mf,.chroma .mh,.chroma .mi,.chroma .il,.chroma .mo { color:var(--syn-num) }
.chroma .o { color:var(--syn-op) }
.chroma .c,.chroma .ch,.chroma .cm,.chroma .c1,.chroma .cs,.chroma .cp,.chroma .cpf { color:var(--syn-comment);font-style:italic }
.chroma .gd { color:#a00000 }
.chroma .gi { color:#00a000 }
.chroma .ge { font-style:italic }
.chroma .gs { font-weight:bold }
