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

:root {
  --ink:    #1a1a18;
  --muted:  #888880;
  --rule:   #e0ddd6;
  --paper:  #faf9f6;
  --accent: #0066cc;
  --max-w:  660px;
}

html { font-size: 18px; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'IBM Plex Mono', Georgia, serif;
  line-height: 1.75;
  padding: 0 1.5rem;
  opacity: 0;
  animation: fadein 0.6s ease forwards;
}

@keyframes fadein { to { opacity: 1; } }

/* ── Layout Shell ─────────────────────────────────────────────── */
.site-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
}

/* ── Header ───────────────────────────────────────────────────── */
header {
  padding: 3.5rem 0 2rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 3rem;
}

.site-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}

.site-title:hover { color: var(--accent); }

nav {
  margin-top: 1rem;
  display: flex;
  gap: 1.5rem;
}

nav a {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

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

/* ── Tags ─────────────────────────────────────────────────────── */
.tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--rule);
  padding: 0.1em 0.45em;
  border-radius: 2px;
  transition: color 0.2s, border-color 0.2s;
}

.tag:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Post List ────────────────────────────────────────────────── */
.post-list {
  list-style: none;
}

.post-item {
  padding: 2rem 0;
  border-bottom: 1px solid var(--rule);
  animation: slidein 0.5s ease both;
}

.post-item:nth-child(1) { animation-delay: 0.05s; }
.post-item:nth-child(2) { animation-delay: 0.10s; }
.post-item:nth-child(3) { animation-delay: 0.15s; }
.post-item:nth-child(4) { animation-delay: 0.20s; }
.post-item:nth-child(n+5) { animation-delay: 0.25s; }

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

.post-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.post-title {
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.65rem;
}

.post-title a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.post-title a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.post-excerpt {
  font-size: 0.9rem;
  color: #4a4a47;
  line-height: 1.7;
}

.read-more {
  display: inline-block;
  margin-top: 0.75rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--accent);
  text-decoration: none;
  text-transform: uppercase;
}

.read-more:hover { text-decoration: underline; }

/* ── Single Post ──────────────────────────────────────────────── */
.post-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.5rem;
}

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

.post-header h1 {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
}

/* ── Post Body ────────────────────────────────────────────────── */
.post-body p {
  margin-bottom: 1.4rem;
}

/* .post-body p:first-of-type::first-letter { */
/*   float: left; */
/*   font-size: 2rem; */
/*   line-height: 0.85; */
/*   margin: 0.05em 0.1em 0 0; */
/*   color: var(--ink); */
/*   font-weight: 300; */
/* } */

.post-body h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2.5rem 0 0.75rem;
}

.post-body h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 2rem 0 0.5rem;
  color: var(--muted);
}

.post-body blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.25rem;
  margin: 2rem 0;
  font-style: italic;
  color: #4a4a47;
}

/* blockquotes that contain math shouldn't be italic */
.post-body blockquote .katex { font-style: normal; }

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

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

.post-body code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82em;
  background: #f0ede6;
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.post-body pre {
  background: #f0ede6;
  padding: 1.25rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.75rem 0;
}

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

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

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

/* ── Post Navigation ──────────────────────────────────────────── */
.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  gap: 1rem;
}

.post-nav-link {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.2s;
  max-width: 45%;
}

.post-nav-link:hover { color: var(--accent); }
.post-nav-next { text-align: right; margin-left: auto; }

/* ── KaTeX ────────────────────────────────────────────────────── */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem 0;
  margin: 1.75rem 0;
}

.katex { font-size: 1.05em; }

/* ── Footer ───────────────────────────────────────────────────── */
footer {
  padding: 2.5rem 0 3rem;
  margin-top: 4rem;
  border-top: 1px solid var(--rule);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--accent); }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  html { font-size: 16px; }
  header { padding: 2rem 0 1.5rem; }
  .post-header h1 { font-size: 1.6rem; }
  .post-nav { flex-direction: column; }
  .post-nav-next { text-align: left; margin-left: 0; }
}
