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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #888888;
  --accent: #6c9fff;
  --accent-hover: #89b4ff;
  --font: 'Georgia', serif;
  --mono: 'Courier New', monospace;
  --max-w: 720px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --surface: #f5f5f5;
    --border: #e0e0e0;
    --text: #1a1a1a;
    --muted: #666666;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.7;
  min-height: 100vh;
}

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

/* ── Layout ── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1.2rem 0;
}
.site-header .inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--text);
  letter-spacing: 0.02em;
}
.site-title:hover { color: var(--accent-hover); text-decoration: none; }

nav { display: flex; gap: 1.5rem; }
nav a { font-family: sans-serif; font-size: 0.9rem; color: var(--muted); }
nav a:hover { color: var(--text); text-decoration: none; }
nav a.active { color: var(--text); }

main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 2rem 1.5rem;
  font-family: sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Home / post list ── */
.page-title {
  font-size: 1rem;
  font-family: sans-serif;
  color: var(--muted);
  margin-bottom: 2.5rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.post-list { list-style: none; }
.post-list li + li { border-top: 1px solid var(--border); }

.post-item {
  padding: 1.6rem 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
}
.post-item a {
  font-size: 1.15rem;
  color: var(--text);
  font-weight: bold;
  line-height: 1.3;
}
.post-item a:hover { color: var(--accent-hover); text-decoration: none; }
.post-item .excerpt {
  grid-column: 1;
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
.post-item time {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Tags ── */
.tag {
  display: inline-block;
  font-family: sans-serif;
  font-size: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.15rem 0.55rem;
  border-radius: 3px;
}

/* ── Article / post page ── */
.post-header { margin-bottom: 2.5rem; }
.post-header h1 {
  font-size: 2rem;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}
.post-meta {
  font-family: sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}
.post-meta .tags { display: flex; gap: 0.4rem; }

.post-body h2 { font-size: 1.4rem; margin: 2.2rem 0 0.8rem; }
.post-body h3 { font-size: 1.1rem; margin: 1.8rem 0 0.6rem; }
.post-body p { margin-bottom: 1.2rem; }
.post-body ul, .post-body ol { margin: 0 0 1.2rem 1.5rem; }
.post-body li { margin-bottom: 0.3rem; }
.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.4rem 0 0.4rem 1.2rem;
  color: var(--muted);
  margin: 1.5rem 0;
  font-style: italic;
}
.post-body code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: #444;
}
.post-body pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.2rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}
.post-body pre code { background: none; padding: 0; font-size: 0.9rem; }
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.post-body a { text-decoration: underline; }
.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1.5rem 0;
  display: block;
  cursor: zoom-in;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-family: sans-serif;
  font-size: 0.9rem;
  gap: 1rem;
}
.post-nav span { color: var(--muted); }

/* ── About page ── */
.about-body h2 { font-size: 1.4rem; margin: 2rem 0 0.7rem; }
.about-body p { margin-bottom: 1.2rem; }
.about-body ul { margin: 0 0 1.2rem 1.5rem; }
.about-body li { margin-bottom: 0.3rem; }

/* ── 404 ── */
.not-found {
  text-align: center;
  padding: 5rem 1rem;
}
.not-found h1 { font-size: 5rem; color: var(--border); margin-bottom: 1rem; }
.not-found p { color: var(--muted); font-size: 1.1rem; }

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  cursor: zoom-out;
  padding: 1rem;
  animation: lb-fade 0.15s ease;
}
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.6);
  cursor: default;
  margin: 0;
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .post-item { grid-template-columns: 1fr; }
  .post-item time { grid-row: unset; }
  .post-header h1 { font-size: 1.6rem; }
}
