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

/* ── Theme variables ── */
:root {
  --bg:        #0d0d0d;
  --fg:        #c9c9c9;
  --fg-strong: #fff;
  --fg-muted:  #555;
  --border:    #1e1e1e;
  --accent:    #a78bfa;
}

[data-theme="light"] {
  --bg:        #fafafa;
  --fg:        #333;
  --fg-strong: #000;
  --fg-muted:  #999;
  --border:    #e5e5e5;
}

/* ── Base ── */
body {
  background: var(--bg);
  color: var(--fg);
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace;
  font-size: 14px;
  line-height: 1.6;
  padding: 3rem 2rem;
  max-width: 640px;
  margin: 0 auto;
  transition: background 0.2s, color 0.2s;
}

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

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

/* ── Header ── */
header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 3rem;
}

.site-title {
  color: var(--fg-strong);
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.site-title:hover { color: var(--fg-strong); }

nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

nav a {
  color: var(--fg-muted);
  font-size: 0.85rem;
}

nav a:hover,
nav a.active { color: var(--accent); }

/* ── Theme toggle ── */
.theme-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-muted);
  padding: 0;
  line-height: 1;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
}

.theme-btn:hover { color: var(--accent); }

.icon-sun,
.icon-moon { display: none; }

[data-theme="dark"]  .icon-moon { display: inline-flex; }
[data-theme="light"] .icon-sun  { display: inline-flex; }

/* ── Post list (home + archives) ── */
ul.post-list {
  list-style: none;
}

ul.post-list li,
.archive-list li {
  display: flex;
  gap: 1.5rem;
  align-items: baseline;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}

.archive-list { list-style: none; }
.archive-list li[hidden] { display: none; }

.post-date {
  color: var(--fg-muted);
  white-space: nowrap;
  flex-shrink: 0;
  width: 7rem;
}

ul.post-list a:hover,
.archive-list a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── About page ── */
.about-body h2 {
  color: var(--fg-strong);
  font-size: 0.9rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  letter-spacing: 0.03em;
}

.about-body h2:first-child { margin-top: 0; }

.about-body p { margin-bottom: 0.75rem; }

.about-body a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pillars { list-style: none; margin-top: 0.5rem; }

.pillars li {
  display: flex;
  gap: 1.25rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.pillar-num {
  color: var(--fg-muted);
  flex-shrink: 0;
  width: 2rem;
}

.pillar-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pillar-text strong {
  color: var(--fg-strong);
  font-weight: 600;
}

/* ── Archives layout ── */
.archives-wrap {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
}

/* Override body max-width for archives two-column layout */
.archives-wrap ~ footer,
.archives-wrap { max-width: none; }

aside {
  width: 180px;
  flex-shrink: 0;
  position: sticky;
  top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.filter-group-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 0.25rem;
}

.tag {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--fg-muted);
  padding: 0;
  text-align: left;
  display: block;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.12s;
}

.tag:hover { color: var(--accent); }
.tag.active { color: var(--fg-strong); }

.archive-main { flex: 1; min-width: 0; }

.search-input {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--fg);
  outline: none;
  transition: border-color 0.15s;
  margin-bottom: 1.5rem;
}

.search-input::placeholder { color: var(--fg-muted); }
.search-input:focus { border-color: var(--fg-muted); }

.no-results {
  font-size: 0.85rem;
  color: var(--fg-muted);
  display: none;
  padding: 0.75rem 0;
}

.no-results.visible { display: block; }

/* ── Blog post ── */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-title {
  color: var(--fg-strong);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: baseline;
  font-size: 0.82rem;
  color: var(--fg-muted);
}

.post-tag::before { content: '#'; }

.post-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-body h2 {
  color: var(--fg-strong);
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 1rem;
}

.post-body a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-body blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  color: var(--fg-muted);
}

.post-body pre {
  background: var(--border);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.82rem;
}

.post-body code { font-size: 0.82rem; }

.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.post-nav a { color: var(--fg-muted); }
.post-nav a:hover { color: var(--accent); }

/* ── Footer ── */
footer {
  margin-top: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

footer a {
  color: var(--fg-muted);
  font-size: 0.85rem;
}

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

/* ── 404 ── */
.error-code {
  font-size: 4rem;
  font-weight: 600;
  color: var(--fg-muted);
  line-height: 1;
  margin-bottom: 1rem;
}

.error-msg { color: var(--fg-muted); margin-bottom: 1.5rem; }

body.archives { max-width: 900px; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .archives-wrap { flex-direction: column; }
  aside { width: 100%; position: static; flex-direction: row; flex-wrap: wrap; gap: 1rem; }
  .filter-group { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
}
