/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Tokens ── */
:root {
  --bg: #ffffff;
  --surface: #f8f8f6;
  --border: #e8e8e4;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --code-bg: #f3f3f0;
  --max-width: 720px;
  --font-body: "Inter", "Noto Sans TC", system-ui, sans-serif;
  --font-mono: "Fira Code", "Cascadia Code", ui-monospace, monospace;
}

/* ── Base ── */
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Layout ── */
header, main, footer {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

header {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

main {
  flex: 1;
  padding-top: 2.5rem;
  padding-bottom: 3rem;
}

footer {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

/* ── Nav ── */
nav { display: flex; align-items: center; }

.site-name {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-name:hover { color: var(--accent); }

/* ── Typography ── */
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

h1 { font-size: 1.875rem; margin-top: 0; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }

p { margin-bottom: 1.25rem; }

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

/* ── Article ── */
article h1 { border-bottom: 2px solid var(--border); padding-bottom: 0.5rem; }

/* ── Code ── */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

pre code { background: none; border: none; padding: 0; font-size: 0.875rem; }

/* ── Blockquote ── */
blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5rem 0;
  padding: 0.5rem 1.25rem;
  color: var(--muted);
  background: var(--surface);
  border-radius: 0 6px 6px 0;
}

/* ── Lists ── */
ul, ol { padding-left: 1.5rem; margin-bottom: 1.25rem; }
li { margin-bottom: 0.35rem; }

/* ── HR ── */
hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ── Notes index ── */
.tagline {
  font-size: 1.05rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.notes-list ul {
  list-style: none;
  padding: 0;
}

.notes-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.notes-list li:last-child { border-bottom: none; }

.notes-list a {
  font-weight: 500;
  font-size: 1.05rem;
}

/* ── Tags ── */
.tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.tag {
  font-size: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1em 0.65em;
  color: var(--muted);
}

/* ── Dead wikilink ── */
a.invalid-wikilink {
  color: var(--muted);
  text-decoration: line-through;
  cursor: not-allowed;
}

/* ── Images ── */
img { max-width: 100%; border-radius: 6px; }

/* ── Responsive ── */
@media (max-width: 600px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }
}
