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

/* ─── Tokens ─────────────────────────────────────────────────── */
:root {
  --cream: #F8F6F1;
  --ink: #1C1A17;
  --ink-mid: #4A4640;
  --ink-light: #8C8680;
  --rule: #E2DDD6;
  --accent: #B5A99A;
  --tag-bg: #EDE9E2;
  --tag-color: #5C5650;

  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-editorial: "Merriweather", Georgia, serif;

  --max-w: 720px;
  --max-w-wide: 900px;
}

/* ─── Base ───────────────────────────────────────────────────── */
html {
  font-size: 18px;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.7;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ─── Nav ────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--cream) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.nav {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 1.1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-editorial);
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--ink);
  text-decoration: none;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  transition: background 0.15s, border-color 0.15s;
}

.nav-logo:hover {
  background: var(--tag-bg);
  border-color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mid);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-links a:hover { color: var(--ink); }

/* ─── Layout ─────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 4rem 2rem 6rem;
  width: 100%;
}

/* ─── About section ──────────────────────────────────────────── */
.about-section {
  margin-bottom: 4rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--rule);
}

.about-text {
  font-family: var(--font-editorial);
  font-size: 1.1rem;
  font-weight: 300;
  font-style: italic;
  line-height: 1.8;
  color: var(--ink-mid);
  max-width: 560px;
}

/* ─── Year headings ──────────────────────────────────────────── */
.year-heading {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 0.75rem;
  margin-top: 3rem;
}

.year-heading:first-of-type { margin-top: 0; }

/* ─── Tag page heading ───────────────────────────────────────── */
.tag-page-heading {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 400;
  color: var(--ink);
}

.tag-page-heading em {
  font-style: italic;
  color: var(--ink-mid);
}

/* ─── Post list ──────────────────────────────────────────────── */
.post-list {
  list-style: none;
  border-top: 1px solid var(--rule);
}

.post-item {
  border-bottom: 1px solid var(--rule);
}

.post-link {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 1.4rem 0;
  transition: opacity 0.15s;
}

.post-link:hover { opacity: 0.6; }

.post-item-inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2rem;
}

.post-item-left {
  flex: 1;
  min-width: 0;
}

.post-item-title {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.post-item-excerpt {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  flex-shrink: 0;
}

.post-item-date {
  font-size: 0.8rem;
  color: var(--ink-light);
  white-space: nowrap;
}

.post-item-read {
  font-size: 0.75rem;
  color: var(--accent);
}

.post-item-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ─── Tags ───────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 2rem;
  background: var(--tag-bg);
  color: var(--tag-color);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  text-decoration: none;
  transition: background 0.15s;
}

.tag:hover { background: #ddd8cf; }

/* ─── Post page ──────────────────────────────────────────────── */
.post {
  max-width: var(--max-w);
  margin: 0 auto;
}

.post-header {
  margin-bottom: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--ink-light);
  letter-spacing: 0.03em;
  margin-bottom: 1.25rem;
}

.meta-sep { color: var(--rule); }

.post-tags-inline { display: flex; gap: 0.35rem; }

.post-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.post-subtitle {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-style: italic;
  font-weight: 300;
  color: var(--ink-mid);
  line-height: 1.5;
}

/* ─── Post body ──────────────────────────────────────────────── */
.post-body {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--ink);
}

.post-body h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 500;
  margin: 2.5rem 0 0.75rem;
  line-height: 1.25;
}

.post-body h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 500;
  font-style: italic;
  margin: 2rem 0 0.5rem;
}

.post-body p { margin-bottom: 1.5rem; }
.post-body p:last-child { margin-bottom: 0; }

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

.post-body a:hover { text-decoration-color: var(--ink); }

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

.post-body em {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.05em;
}

.post-body blockquote {
  margin: 2rem 0;
  padding: 0 0 0 1.5rem;
  border-left: 2px solid var(--accent);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--ink-mid);
  line-height: 1.7;
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.5rem 1.4rem;
}

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

.post-body hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 3rem auto;
  width: 40%;
}

.post-body code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.875em;
  background: var(--tag-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.post-body pre {
  background: #1C1A17;
  color: #E8E4DC;
  padding: 1.5rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.8rem 0;
  font-size: 0.875rem;
  line-height: 1.7;
}

.post-body pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* ─── Media in posts ─────────────────────────────────────────── */
.post-body img,
.post-body video {
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 2rem 0;
  display: block;
}

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

.post-body figcaption {
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-light);
  margin-top: 0.6rem;
  font-style: italic;
}

/* embed: cloudflare R2 video */
.post-body video {
  background: #000;
}

/* ─── Post nav ───────────────────────────────────────────────── */
.post-nav {
  max-width: var(--max-w);
  margin: 3rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

.post-nav-back {
  font-size: 0.85rem;
  color: var(--ink-mid);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}

.post-nav-back:hover { color: var(--ink); }

/* ─── Page transitions (driven by JS) ───────────────────────── */

/* ─── Footer ─────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.5rem 2rem;
  text-align: center;
}

.footer-social {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
}

.social-link {
  color: var(--ink-light);
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.social-link:hover { color: var(--ink); }

.social-icon {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

/* ─── No posts ───────────────────────────────────────────────── */
.no-posts {
  color: var(--ink-light);
  font-style: italic;
  font-family: var(--font-serif);
  font-size: 1.1rem;
}

/* ─── About page ─────────────────────────────────────────────── */
.about-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5rem;
  align-items: start;
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding-top: 1rem;
}

.about-page-image img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 3px;
  display: block;
}

.about-page-heading {
  font-family: var(--font-editorial);
  font-size: 2.5rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin-bottom: 1.75rem;
}

.about-page-body {
  font-family: var(--font-editorial);
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.9;
  color: var(--ink-mid);
}

.about-page-body p { margin-bottom: 1.25rem; }
.about-page-body p:last-child { margin-bottom: 0; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  html { font-size: 16px; }

  .nav { padding: 1rem 1.25rem; }
  .main-content { padding: 2.5rem 1.25rem 4rem; }

  .post-item-inner {
    flex-direction: column;
    gap: 0.5rem;
  }

  .post-item-right {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .post-item-excerpt { display: none; }

  .post-item-right .post-item-tags { display: none; }

  .about-page {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .about-page-image img {
    aspect-ratio: 4 / 3;
  }
}
