:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --muted: #666666;
  --border: #e5e5e5;
  --accent: #333333;
  --max-width: 34rem;
  --space-m: 1.5rem;
  --space-l: 2.5rem;
  --space-xl: 4rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --text: #e8e8e8;
    --muted: #9a9a9a;
    --border: #2a2a2a;
    --accent: #cfcfcf;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 0.9375rem/1.65 "Inter", system-ui, sans-serif;
}

@supports (font-variation-settings: normal) {
  body { font-family: "Inter var", system-ui, sans-serif; }
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

figure {
  margin: var(--space-m) 0;
}

figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-shell {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
  padding: 1.5rem 0;
}

.site-header .site-shell {
  padding: 2.5rem 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-footer .site-shell {
  color: var(--muted);
  padding: 0 0 2.5rem;
}

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

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

.footer-links a:hover {
  color: var(--text);
}

.site-branding a {
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 500;
  text-decoration: none;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav .is-active a {
  color: var(--text);
}

.site-main {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
  padding: var(--space-xl) 0;
}

.hero {
  margin-bottom: var(--space-xl);
}

.hero h1 {
  font-size: clamp(1.5rem, 4vw, 1.75rem);
  margin: 0;
}

.hero-tagline {
  color: var(--muted);
  font-size: 1.05rem;
  margin-top: 0.5rem;
}

.hero-tagline > :first-child { margin-top: 0; }
.hero-tagline > :last-child { margin-bottom: 0; }

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: var(--space-m) 0 0;
  padding: 0;
}

.post-tags li {
  background: var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
}

.post-tags li,
.post-tags a {
  color: var(--muted);
}

.post-tags a {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  text-decoration: none;
}

.post-tags li:not(:has(a)) {
  padding: 0.15rem 0.6rem;
}

.post-tags a:hover {
  color: var(--text);
}

.tag-filter {
  margin-bottom: var(--space-xl);
}

.tag-filter ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tag-filter a {
  background: var(--border);
  border-radius: 999px;
  color: var(--muted);
  display: inline-block;
  font-size: 0.85rem;
  padding: 0.2rem 0.7rem;
  text-decoration: none;
}

.tag-filter .is-active a {
  background: var(--text);
  color: var(--bg);
}

.tag-filter li:not(.is-active) a:hover {
  color: var(--text);
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.25rem 0 0;
}

.page-header {
  margin-bottom: var(--space-m);
}

h1, h2, h3, h4 {
  font-weight: 500;
  letter-spacing: -0.01em;
}

.page-header h1,
.post h2 {
  line-height: 1.25;
  margin: 0;
}

.page-intro {
  font-size: 1.125rem;
  color: var(--muted);
}

.post h2 a {
  color: var(--text);
  text-decoration: none;
}

.post h2 a:hover {
  text-decoration: underline;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
}

.post > * + *,
.content-flow > * + * {
  margin-top: 1rem;
}

.pagination {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: var(--space-l);
}

.pagination a {
  text-decoration: none;
}

.pagination span {
  color: var(--muted);
}

#htmx-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent, #3b82f6);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease-out, opacity 0.2s ease-out;
  opacity: 0;
  z-index: 9999;
  pointer-events: none;
}

body.htmx-request #htmx-loader {
  opacity: 1;
  transform: scaleX(0.7);
  transition: transform 8s cubic-bezier(0.1, 0.8, 0.2, 1), opacity 0.1s;
}
