/* ─────────────────────────────────────────────
   THE VAGABOND — style.css
   Dark-first, light mode via [data-theme="light"]
───────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;1,400;1,500&family=Cormorant+Garamond:ital,wght@0,300;0,400;1,300;1,400&family=Inter:wght@300;400&display=swap');

/* ── Tokens ── */
:root {
  --bg:           #0e0e0e;
  --bg-secondary: #161616;
  --border:       #2a2a2a;
  --text:         #e8e4dc;
  --text-muted:   #7a7570;
  --text-faint:   #3d3a36;
  --accent:       #c8b89a;
  --accent-hover: #e8d8b8;
  --link:         #e8e4dc;
  --link-hover:   #c8b89a;

  --font-serif:   'EB Garamond', 'Cormorant Garamond', Georgia, serif;
  --font-sans:    'Inter', system-ui, sans-serif;

  --max-w:        1200px;
  --post-w:       680px;
  --gap:          2rem;
  --section-gap:  5rem;

  --transition:   180ms ease;
}

[data-theme="light"] {
  --bg:           #f5f2ed;
  --bg-secondary: #edeae4;
  --border:       #d8d2c8;
  --text:         #1a1814;
  --text-muted:   #8a8278;
  --text-faint:   #c8c0b4;
  --accent:       #7a6a54;
  --accent-hover: #5a4a38;
  --link:         #1a1814;
  --link-hover:   #7a6a54;
}

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

html {
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.7;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--link-hover); }

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

/* ── Layout ── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
}

main { flex: 1; }

/* ── Header ── */
header {
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
  transition: background var(--transition), border-color var(--transition);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.site-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--text);
  white-space: nowrap;
}
.site-title:hover { color: var(--text); }

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

nav a {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}
nav a:hover { color: var(--text); }

/* Theme toggle */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0.2rem 0.3rem;
  transition: color var(--transition);
}
.theme-toggle:hover { color: var(--text); }

/* ── Hero ── */
.hero {
  padding: 6rem 0 5rem;
  border-bottom: 1px solid var(--border);
}

.hero-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.9rem, 4vw, 3.2rem);
  font-weight: 400;
  line-height: 1.0;
  color: var(--text);
  max-width: 900px;
  opacity: 0;
  animation: fadeUp 0.9s ease forwards 0.1s;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Section headings ── */
.section-label {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2.5rem;
}

/* ── Post Grid ── */
.posts-section {
  padding: var(--section-gap) 0;
}

.posts-section + .posts-section {
  border-top: 1px solid var(--border);
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2rem;
  border-top: 1px solid var(--border);
}

.post-card {
  padding: 2rem;
  border-right: none;
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
  transition: background var(--transition);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.post-card:nth-child(1) { animation-delay: 0.05s; }
.post-card:nth-child(2) { animation-delay: 0.12s; }
.post-card:nth-child(3) { animation-delay: 0.19s; }
.post-card:nth-child(4) { animation-delay: 0.26s; }

.post-meta {
  font-family: var(--font-sans);
  font-size: 0.58rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  gap: 0.75rem;
}

.post-meta .category {
  color: var(--accent);
}

.post-card h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.post-card h2 a {
  color: var(--text);
}
.post-card h2 a:hover {
  color: var(--accent-hover);
}

.post-excerpt {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ── Category page ── */
.page-header {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 400;
  line-height: 1.2;
}

.page-subtitle {
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 480px;
}

/* ── Post list (category page) ── */
.post-list {
  padding: var(--section-gap) 0;
}

.post-list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 2rem;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
}

.post-list-item:nth-child(1) { animation-delay: 0.05s; }
.post-list-item:nth-child(2) { animation-delay: 0.1s; }
.post-list-item:nth-child(3) { animation-delay: 0.15s; }
.post-list-item:nth-child(4) { animation-delay: 0.2s; }
.post-list-item:nth-child(5) { animation-delay: 0.25s; }

.post-list-item h2 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.post-list-item h2 a { color: var(--text); }
.post-list-item h2 a:hover { color: var(--accent-hover); }

.post-list-date {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 0.25rem;
}

/* ── Single Post ── */
.post-page {
  padding: 4rem 0 var(--section-gap);
}

.post-header {
  max-width: var(--post-w);
  margin: 0 auto 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.post-header .post-meta { margin-bottom: 1.25rem; }

.post-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.post-description {
  font-style: italic;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

.post-body {
  max-width: var(--post-w);
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.85;
}

.post-body p { margin-bottom: 1.6rem; line-height: 1.9; }
.post-body p:last-child { margin-bottom: 0; }

.post-body h2, .post-body h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  margin: 2.5rem 0 1rem;
}

.post-body h2 { font-size: 1.5rem; }
.post-body h3 { font-size: 1.2rem; font-style: italic; }

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

.post-body em { font-style: italic; }
.post-body strong { font-weight: 500; }

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

/* ── Back link ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 3rem;
}
.back-link:hover { color: var(--text); }

/* ── About ── */
.about-section {
  padding: var(--section-gap) 0;
}

.about-content {
  max-width: var(--post-w);
}

.about-content h1 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  margin-bottom: 2rem;
}

.about-content p {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  margin-top: auto;
  transition: border-color var(--transition);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-copy {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}

/* ── Social links ── */
.social-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.social-links a {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.75;
}
.social-links a:hover {
  color: var(--accent-hover);
  opacity: 1;
}

/* ── Loading / Empty states ── */
.loading {
  padding: 4rem 0;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.empty-state {
  padding: 4rem 0;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  html { font-size: 16px; }
  .container { padding: 0 1.25rem; }

  nav { gap: 1rem; }
  nav a { letter-spacing: 0.10em; font-size: 0.58rem; }

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

  .post-card {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
  }

  .post-list-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }

  .header-inner { gap: 1rem; }
}

.compass {
  font-size: 0.5em;
  vertical-align: middle;
  position: relative;
  top: -0.08em;
  margin-left: 6px;
  opacity: 0.65;
}

/* ─── Post body image / figure rules (moved inline above) ─── */

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

.post-body figure {
  margin: 2.5rem 0;
  text-align: center;
}

.post-body figure img {
  margin: 0 auto 0.75rem;
}

.post-body figcaption {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  opacity: 0.75;
  text-align: center;
  line-height: 1.5;
}

/* ── Post body h1 (section headings using # in markdown) ── */
.post-body h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 400;
  line-height: 1.25;
  margin: 3rem 0 1.25rem;
  color: var(--text);
}
.post-body h1:first-child {
  margin-top: 0;
}
