:root {
  --bg: oklch(0.985 0.002 250);
  --fg: oklch(0.2 0.006 250);
  --muted: oklch(0.52 0.008 250);
  --accent: oklch(0.55 0.1 195);
  --toggle-bg: oklch(0.94 0.004 250);
  --hover-bg: oklch(0.96 0.004 250);
}

[data-theme="dark"] {
  --bg: oklch(0.17 0.006 250);
  --fg: oklch(0.95 0.004 250);
  --muted: oklch(0.64 0.008 250);
  --accent: oklch(0.75 0.09 195);
  --toggle-bg: oklch(0.26 0.008 250);
  --hover-bg: oklch(0.22 0.008 250);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  transition: background 0.2s ease, color 0.2s ease;
  display: flex;
  flex-direction: column;
}

::selection { background: oklch(0.75 0.09 70 / 0.35); }

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px;
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 8px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-name {
  font-family: 'Newsreader', serif;
  font-weight: 500;
  font-size: 21px;
  letter-spacing: -0.01em;
  color: var(--fg);
  line-height: 1;
}

.brand-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

/* Theme toggle */
#theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--toggle-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--fg);
  padding: 0;
  transition: background 0.2s ease;
}

#theme-toggle svg { display: none; }
[data-theme="dark"] #theme-toggle .icon-sun { display: block; }
[data-theme="light"] #theme-toggle .icon-moon { display: block; }

/* Footer */
footer {
  padding: 22px 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
}

.copyright {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--muted);
}

footer nav {
  display: flex;
  gap: 18px;
}

footer nav a {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}

/* Home page — post list */
main { flex: 1; padding: 8px 0 80px; }

.intro {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 44px;
  max-width: 480px;
}

.post-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  margin: 0 -20px 4px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.post-row:hover { background: var(--hover-bg); }

.post-row h2 {
  font-family: 'Newsreader', serif;
  font-weight: 500;
  font-size: 21px;
  margin: 0;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.post-row .date {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Article page */
.back-link {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--accent);
  margin: 0 0 40px;
  font-weight: 500;
  text-decoration: none;
  width: fit-content;
}

article.post { animation: fadeIn 0.3s ease; }

.post-header { margin-bottom: 32px; }

.post-date {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
  display: block;
}

.post-title {
  font-family: 'Newsreader', serif;
  font-weight: 600;
  font-size: 38px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--fg);
}

.post-body {
  font-family: 'Newsreader', serif;
  font-size: 19px;
  line-height: 1.75;
  color: var(--fg);
}

.post-body p { margin: 0 0 22px; }

.post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: oklch(0.55 0.1 195 / 0.35);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.15s ease;
}

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

.post-body :not(pre) > code {
  font-family: 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--hover-bg);
  padding: 0.15em 0.4em;
  border-radius: 5px;
}

.post-body pre {
  font-family: 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  background: var(--toggle-bg);
  border-radius: 10px;
  padding: 18px 20px;
  margin: 0 0 22px;
  overflow-x: auto;
}

.post-body pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

/* Prism token colors */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata { color: var(--muted); }

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

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted { color: oklch(0.62 0.15 25); }

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted { color: oklch(0.62 0.12 145); }

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string { color: var(--muted); }

.token.atrule,
.token.attr-value,
.token.keyword { color: var(--accent); }

.token.function,
.token.class-name { color: oklch(0.62 0.14 300); }

.token.regex,
.token.important,
.token.variable { color: oklch(0.68 0.14 70); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
