:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --accent: #2563eb;
  --border: #e4e7ec;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --surface: #182027;
    --text: #e6e9ee;
    --muted: #9aa5b1;
    --accent: #60a5fa;
    --border: #2a343d;
  }
}

* { box-sizing: border-box; }

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

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

/* Header and centered nav */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-inner {
  width: 100%;
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.site-nav a {
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover {
  background: var(--border);
  color: var(--text);
}

.site-nav a.active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: #fff;
}

.header-contact {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}

.header-contact a { color: var(--muted); }
.header-contact a:hover { color: var(--accent); }

.contact-links { display: flex; gap: 0.9rem; align-items: center; }
.icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  display: block;
}
a.icon[aria-label="X"] svg {
  width: 16px;
  height: 16px;
}

a.icon[aria-label="Bluesky"] svg {
  width: 22px;
  height: 22px;
}

.icon svg[fill="none"] { fill: none; }
.contact-links a { color: var(--muted); }
.contact-links a:hover { color: var(--accent); }

@media (max-width: 720px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Layout */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 0.5rem; }

.prose { margin-bottom: 2rem; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
.prose pre {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
}
.prose img { max-width: 100%; height: auto; }

.meta, time { color: var(--muted); font-size: 0.9rem; }
.back { margin: 0 0 1rem; font-size: 0.95rem; }

/* Home page cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.card {
  display: block;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  transition: transform 0.15s, border-color 0.15s;
}

.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card h2 { margin: 0 0 0.25rem; font-size: 1.15rem; color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* Section item list */
.item-list { list-style: none; margin: 0; padding: 0; }

.item-list li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.item-list li > a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.item-title { font-size: 1.1rem; font-weight: 600; }
.item-list li > a:hover .item-title { text-decoration: underline; }
.item-list p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.95rem; }

.prose img,
.hero {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

.hero {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  margin-bottom: 1.5rem;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container { width: 100%; flex: 1; }

.site-footer {
  padding: 0.6rem 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.site-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

.not-found {
  text-align: center;
  padding: 4rem 0;
}

.not-found .code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 4rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
  line-height: 1;
}

.not-found h1 { margin: 0.5rem 0 1rem; }
.not-found p { color: var(--muted); }
