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

/* ─── Theme Variables (Gruvbox) ─────────────────────────── */
:root {
  /* Gruvbox Light */
  --bg:      #fbf1c7;
  --fg:      #3c3836;
  --muted:   #7c6f64;
  --border:  #d5c4a1;
  --code-bg: #f2e5bc;
  --link:    #076678;
}

html.dark {
  /* Gruvbox Dark */
  --bg:      #282828;
  --fg:      #ebdbb2;
  --muted:   #a89984;
  --border:  #504945;
  --code-bg: #32302f;
  --link:    #83a598;
}

/* ─── Base ──────────────────────────────────────────────── */
html {
  overflow-y: scroll;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.875rem;
  line-height: 1.65;
  padding: 2rem 1rem;
  max-width: 760px;
  margin: 0 auto;
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* ─── Typography ────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.3;
}

h1 { font-size: 1.15rem; margin-bottom: 1rem; }
h2 { font-size: 1rem; margin-top: 2.5rem; margin-bottom: 0.75rem; }
h3 { font-size: 0.875rem; margin-top: 1.5rem; margin-bottom: 0.5rem; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

ul, ol {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

li { margin-bottom: 0.25rem; }

/* ─── Links ─────────────────────────────────────────────── */
a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover { opacity: 0.6; }

/* ─── Navigation ────────────────────────────────────────── */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links li { margin: 0; }

.nav-links a {
  text-decoration: none;
  opacity: 0.4;
  transition: opacity 0.15s;
}

.nav-links a:hover { opacity: 0.65; }
.nav-links a.active { opacity: 1; }

/* ─── Theme Toggle ──────────────────────────────────────── */
#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg);
  font-family: inherit;
  font-size: 0.875rem;
  opacity: 0.4;
  transition: opacity 0.15s;
  padding: 0;
}

#theme-toggle:hover { opacity: 0.65; }

/* ─── Main Content ──────────────────────────────────────── */
main {
  min-height: 60vh;
}

section {
  margin-bottom: 2.5rem;
}

/* ─── Post / Article ────────────────────────────────────── */
article header {
  margin-bottom: 1.5rem;
}

article header h1 {
  margin-bottom: 0.35rem;
}

article header time {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ─── Post list ─────────────────────────────────────────── */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.post-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.post-list li:first-child {
  border-top: 1px solid var(--border);
}

.post-list a {
  text-decoration: none;
}

.post-list a:hover { opacity: 0.6; }

.post-list time {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ─── Tags ──────────────────────────────────────────────── */
.tags {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.tags li {
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.1rem 0.4rem;
  margin: 0;
}

/* ─── Code ──────────────────────────────────────────────── */
code {
  font-family: "JetBrains Mono", "Fira Mono", ui-monospace, monospace;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  font-size: 0.85em;
}

pre {
  background: var(--code-bg);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

pre code {
  background: none;
  padding: 0;
}

/* ─── Blockquote ────────────────────────────────────────── */
blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  color: var(--muted);
  margin: 1.5rem 0;
}

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

/* ─── Footer ────────────────────────────────────────────── */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-links {
  display: flex;
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links a {
  text-decoration: none;
  color: var(--muted);
}

.footer-links a:hover { opacity: 0.6; }

/* ─── Utilities ─────────────────────────────────────────── */
.muted { color: var(--muted); }

.view-all {
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
}

.view-all:hover { opacity: 0.6; }

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 480px) {
  nav { flex-wrap: wrap; gap: 0.75rem; }
  footer { flex-direction: column; align-items: flex-start; }
}
