:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --code-bg: #f4f4f6;
  --text: #18181b;
  --muted: #52525b;
  --border: #e4e4e7;
  --accent: #0284c7;
  --accent-bg: #e0f2fe;

  /* Go syntax highlight palette (Light) */
  --tok-comment: #6e7781;
  --tok-keyword: #cf222e;
  --tok-builtin: #0550ae;
  --tok-function: #8250df;
  --tok-string: #0a3069;
  --tok-number: #0550ae;
  --tok-boolean: #953800;
  --tok-operator: #cf222e;
  --tok-punct: #24292f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #181b22;
    --code-bg: #13161d;
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --border: #27272a;
    --accent: #38bdf8;
    --accent-bg: #0c4a6e;

    /* Go syntax highlight palette (Dark) */
    --tok-comment: #8b949e;
    --tok-keyword: #ff7b72;
    --tok-builtin: #79c0ff;
    --tok-function: #d2a8ff;
    --tok-string: #a5d6ff;
    --tok-number: #79c0ff;
    --tok-boolean: #ffa657;
    --tok-operator: #ff7b72;
    --tok-punct: #c9d1d9;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem 0;
  margin-bottom: 2.5rem;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.intro h1 {
  margin: 0 0 0.35rem;
  font-size: 2rem;
  letter-spacing: -0.02em;
}

.intro p {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.tag-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.tag {
  display: inline-block;
  font-size: 0.82rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface);
}

.tag:hover {
  text-decoration: none;
  border-color: var(--accent);
  color: var(--accent);
}

.tag.active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}

.post-card h2 {
  margin: 0.4rem 0 0.6rem;
  font-size: 1.35rem;
  line-height: 1.3;
}

.post-card h2 a {
  color: var(--text);
}

.post-card h2 a:hover {
  color: var(--accent);
  text-decoration: none;
}

.summary {
  margin: 0 0 1rem;
  color: var(--muted);
}

.post-meta {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  margin: 0.5rem 0 1rem;
  font-size: 2.1rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.post-body p {
  margin: 0 0 1.25rem;
  font-size: 1.06rem;
}

.post-body h2 {
  margin: 2rem 0 0.75rem;
  font-size: 1.4rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.post-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.12rem 0.38rem;
}

.post-body pre {
  margin: 0 0 1.5rem;
  padding: 1.1rem 1.25rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.55;
  tab-size: 4;
}

.post-body pre code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 0.88rem;
}

/* Client-side PrismJS token colors */
.token.comment,
.token.prolog,
.token.cdata {
  color: var(--tok-comment);
  font-style: italic;
}

.token.keyword {
  color: var(--tok-keyword);
  font-weight: 500;
}

.token.builtin {
  color: var(--tok-builtin);
}

.token.function {
  color: var(--tok-function);
}

.token.string,
.token.char {
  color: var(--tok-string);
}

.token.number {
  color: var(--tok-number);
}

.token.boolean {
  color: var(--tok-boolean);
}

.token.operator {
  color: var(--tok-operator);
}

.token.punctuation {
  color: var(--tok-punct);
}

.site-footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
}
