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

:root {
  --bg:         #f7f5f0;
  --fg:         #1c1b18;
  --muted:      #8a8480;
  --border:     #dedad3;
  --link:       #9b2315;
  --link-hover: #c0392b;
  --max-width:  680px;
  --display:    'Cormorant Garamond', Georgia, serif;
  --serif:      Georgia, 'Times New Roman', serif;
  --mono:       'DM Mono', 'Courier New', monospace;
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  line-height: 1.75;
  padding: 0 1.5rem;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ─── Layout ───────────────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ─── Animations ────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

header { animation: fadeUp 0.5s ease both; }
main   { animation: fadeUp 0.5s 0.07s ease both; }
footer { animation: fadeUp 0.5s 0.13s ease both; }

/* ─── Header ───────────────────────────────────────────────── */
header {
  padding: 4.5rem 0 3.5rem;
  margin-bottom: 0;
}

header a { text-decoration: none; color: inherit; }

.site-title {
  font-family: var(--display);
  font-size: 2.8rem;
  font-weight: 300;
  letter-spacing: 0.01em;
  line-height: 1.1;
  color: var(--fg);
}

.site-desc {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--muted);
  margin-top: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 300;
}

/* ─── Incipit ──────────────────────────────────────────────── */
.incipit {
  margin: 3.5rem 0 4.5rem;
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.incipit-text {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 300;
  font-style: italic;
  line-height: 1.65;
  color: var(--fg);
  margin: 0 0 1.1rem;
  padding: 0;
  border: none;
}

.incipit-link {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 300;
  transition: color 0.2s;
}

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

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

.post-list li {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  column-gap: 1.5rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--border);
}

.post-list li:first-child { padding-top: 1rem; }

.post-date {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 300;
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
  padding-top: 0.2em;
  display: block;
  margin-bottom: 0;
}

.post-list h2 {
  grid-column: 2;
  grid-row: 1;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: normal;
  line-height: 1.45;
}

.post-list h2 a {
  color: var(--fg);
  text-decoration: none;
  transition: color 0.15s;
}

.post-list h2 a:hover { color: var(--link-hover); }

.post-excerpt {
  grid-column: 2;
  grid-row: 2;
  font-size: 0.84rem;
  color: var(--muted);
  margin-top: 0.3rem;
  line-height: 1.55;
}

/* ─── Article ──────────────────────────────────────────────── */
article { padding-bottom: 4rem; }

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

.post-header h1 {
  font-family: var(--display);
  font-size: 2.5rem;
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: 0.01em;
  margin-bottom: 0.8rem;
}

.post-meta {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 300;
}

.post-body p { margin-bottom: 1.4em; text-align: justify; hyphens: auto; }

.post-body h2 {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 400;
  margin: 2em 0 0.75em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3em;
}

.post-body blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1.4rem;
  color: var(--muted);
  font-style: italic;
  margin: 1.5em 0;
  font-family: var(--display);
  font-size: 1.1rem;
  line-height: 1.6;
}

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

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

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

.post-body figure { margin: 2em 0; }

.post-body figcaption {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--muted);
  margin-top: 0.5rem;
  text-align: center;
  letter-spacing: 0.05em;
  font-weight: 300;
}

/* ─── Cover image ──────────────────────────────────────────── */
.post-cover { margin: 0 0 2.5rem; }

.post-cover img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  display: block;
  border-radius: 2px;
}

.post-cover figcaption {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--muted);
  margin-top: 0.5rem;
  text-align: right;
  letter-spacing: 0.05em;
  font-weight: 300;
}

.post-cover figcaption a { color: var(--muted); }

/* ─── Back link ────────────────────────────────────────────── */
.back {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 300;
  margin-bottom: 2rem;
  transition: color 0.15s;
}

.back:hover { color: var(--link-hover); }
.back::before { content: "← "; }

/* ─── Post navigation ───────────────────────────────────────── */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.post-nav-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
  overflow: hidden;
}

.post-nav-item:hover {
  border-color: var(--link-hover);
  background: #fff;
}

.post-nav-newer { grid-column: 2; }

.post-nav-label {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 300;
}

.post-nav-older .post-nav-label::before { content: "← "; }
.post-nav-newer .post-nav-label::after  { content: " →"; }
.post-nav-newer .post-nav-label         { text-align: right; }

.post-nav-title {
  font-family: var(--serif);
  font-size: 0.88rem;
  color: var(--fg);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-nav-newer .post-nav-title { text-align: right; }
.post-nav-item:hover .post-nav-title { color: var(--link-hover); }

/* ─── Footer ───────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 3rem;
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 300;
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  html { font-size: 17px; }
  header { padding: 3rem 0 2rem; }
  .site-title { font-size: 2.4rem; }
  .post-header h1 { font-size: 2rem; }
}

@media (max-width: 480px) {
  html { font-size: 16px; }
  body { padding: 0 1rem; }
  header { padding: 2rem 0 1.5rem; }
  .site-title { font-size: 2rem; }
  .post-header h1 { font-size: 1.65rem; }
  .post-list li { grid-template-columns: 4.5rem 1fr; column-gap: 1rem; }
  .post-body { overflow-wrap: break-word; word-break: break-word; }
  .back { margin-bottom: 1.25rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-newer { grid-column: 1; }
  .post-nav-newer .post-nav-label,
  .post-nav-newer .post-nav-title { text-align: left; }
  .post-nav-newer .post-nav-label::after  { content: ""; }
  .post-nav-newer .post-nav-label::before { content: "→ "; }
}
