/* ── Fonts ────────────────────────────────────── */

@font-face {
  font-family: "Geist";
  src: url("https://cdn.jsdelivr.net/npm/geist@1/dist/fonts/geist-sans/Geist-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src: url("https://cdn.jsdelivr.net/npm/geist@1/dist/fonts/geist-sans/Geist-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src: url("https://cdn.jsdelivr.net/npm/geist@1/dist/fonts/geist-sans/Geist-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ── Variables ────────────────────────────────── */

:root {
  --color-bg: #faf8f5;
  --color-text: #1a1a1a;
  --color-muted: #6b6b6b;
  --color-border: #e8e4df;
  --color-accent: #7ab82a;
  --font: "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
  --max-width: 980px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0d0b09;
    --color-text: #f0f0f0;
    --color-muted: #888888;
    --color-border: #2a2520;
    --color-accent: #95d43a;
  }
}

/* ── Reset ────────────────────────────────────── */

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

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.site-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* ── Header ───────────────────────────────────── */

header {
  padding: 2.5rem 0 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-name {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-accent);
  text-decoration: none;
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  align-items: baseline;
}

.site-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-muted);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: color 0.15s ease, background-size 0.2s ease;
}

.site-nav a:hover {
  color: var(--color-accent);
  background-size: 100% 1px;
}

.site-nav a.nav-active {
  color: var(--color-accent);
  background-size: 100% 1px;
}

/* ── Main ─────────────────────────────────────── */

main {
  flex: 1;
  padding: 2rem 0 4rem;
}

/* ── Post List ────────────────────────────────── */

.posts-list {
  padding: 0;
}

.list-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0;
}

.list-header h1 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.rss-link {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
  text-decoration: none;
  flex-shrink: 0;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: color 0.15s ease, background-size 0.2s ease;
}

.rss-link:hover {
  color: var(--color-accent);
  background-size: 100% 1px;
}

.post-item {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--color-border);
}

.post-item:first-of-type {
  border-top: 1px solid var(--color-border);
}

.post-item-title {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.post-item-title a {
  color: var(--color-text);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: color 0.15s ease, background-size 0.2s ease;
}

.post-item-title a:hover {
  color: var(--color-accent);
  background-size: 100% 1px;
}

.post-item-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--color-muted);
  flex-wrap: wrap;
}

.post-item-summary {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  color: var(--color-muted);
  line-height: 1.6;
}

/* ── Tags ─────────────────────────────────────── */

.post-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.post-tag {
  background: var(--color-border);
  color: var(--color-muted);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.post-tag:hover {
  background: var(--color-accent);
  color: #fff;
}

/* ── Tag Cloud (taxonomy page) ────────────────── */

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* ── Post Cover ───────────────────────────────── */

.post-cover {
  margin: -2rem -1.5rem 2.5rem;
}

.post-cover img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  display: block;
}

/* ── Post Header ──────────────────────────────── */

.post-header {
  margin-bottom: 2.5rem;
}

.post-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  flex-wrap: wrap;
}

/* ── Prose (post body) ────────────────────────── */

.post-body {
  font-size: 1rem;
  line-height: 1.8;
}

.post-body p {
  margin-bottom: 1.4rem;
  color: var(--color-text);
}

.post-body a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-body a:hover {
  opacity: 0.75;
}

.post-body h2,
.post-body h3,
.post-body h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--color-text);
}

.post-body h2 { font-size: 1.35rem; }
.post-body h3 { font-size: 1.15rem; }
.post-body h4 { font-size: 1rem; }

.post-body ul,
.post-body ol {
  margin-bottom: 1.4rem;
  padding-left: 1.5rem;
}

.post-body li {
  margin-bottom: 0.4rem;
  color: var(--color-text);
}

.post-body li > p {
  margin-bottom: 0.4rem;
}

.post-body blockquote {
  border-left: 3px solid var(--color-border);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  color: var(--color-muted);
  font-style: italic;
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-border);
  color: var(--color-text);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.post-body pre {
  background: var(--color-border);
  border-radius: 6px;
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.4rem;
}

.post-body pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

.post-body img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  margin: 1.5rem 0;
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2rem 0;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 1.4rem;
}

.post-body th,
.post-body td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.post-body th {
  font-weight: 600;
  color: var(--color-text);
}

.post-body strong {
  font-weight: 600;
}

/* ── Gallery (hugo-shortcode-gallery) ─────────── */

.post-body .justified-gallery {
  max-width: 100%;
  margin: 1.5rem 0;
}

/* ── Post Navigation ──────────────────────────── */

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.post-nav-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.post-nav-item.next {
  text-align: right;
}

.post-nav-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.post-nav-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.01em;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: color 0.15s ease, background-size 0.2s ease;
}

.post-nav-title:hover {
  color: var(--color-accent);
  background-size: 100% 1px;
}

/* ── Archives ─────────────────────────────────── */

.archives {
}

.archives .page-title {
  margin-bottom: 2rem;
}

.archive-group {
  margin-bottom: 2.5rem;
}

.archive-year {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-muted);
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.archive-list {
  list-style: none;
  padding: 0;
}

.archive-item {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.archive-date {
  font-size: 0.8rem;
  color: var(--color-muted);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.archive-item a {
  font-size: 0.95rem;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.01em;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: color 0.15s ease, background-size 0.2s ease;
}

.archive-item a:hover {
  color: var(--color-accent);
  background-size: 100% 1px;
}

/* ── Simple Page (about, trails, etc.) ────────── */

.page {
}

.page-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 2rem;
}

.page-content {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--color-muted);
}

.page-content p {
  margin-bottom: 1.25rem;
}

.page-content img {
  max-width: 240px;
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

.page-content a {
  color: var(--color-accent);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: color 0.15s ease, background-size 0.2s ease;
}

.page-content a:hover {
  background-size: 100% 1px;
}

/* ── Pagination ───────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 1rem;
}

.pagination-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-muted);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: color 0.15s ease, background-size 0.2s ease;
}

.pagination-link:hover {
  color: var(--color-accent);
  background-size: 100% 1px;
}

.pagination-disabled {
  opacity: 0.3;
  cursor: default;
}

.pagination-info {
  font-size: 0.8rem;
  color: var(--color-muted);
}

/* ── Footer ───────────────────────────────────── */

footer {
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 0 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.footer-tagline {
  font-size: 0.8rem;
  color: var(--color-muted);
  line-height: 1.6;
}

.footer-copyright {
  font-size: 0.75rem;
  color: var(--color-muted);
}

.footer-links {
  font-size: 0.8rem;
}

.footer-links a {
  color: var(--color-muted);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: color 0.15s ease, background-size 0.2s ease;
}

.footer-links a:hover {
  color: var(--color-accent);
  background-size: 100% 1px;
}

.footer-sep {
  color: var(--color-muted);
  margin: 0 0.35rem;
}

/* ── 404 ──────────────────────────────────────── */

.error-page {
  padding: 4rem 0;
}

.error-page h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

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

.error-page a {
  color: var(--color-text);
}

/* ── Responsive ───────────────────────────────── */

@media (max-width: 640px) {
  .site-name {
    font-size: 1.25rem;
  }

  .post-cover {
    margin: -2rem -1.5rem 2rem;
  }

  .post-nav {
    grid-template-columns: 1fr;
  }

  .post-nav-item.next {
    text-align: left;
  }

  .post-item-meta {
    flex-wrap: wrap;
  }
}

/* ── Reduced motion ───────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
