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

:root {
  --text: #2d2d2d;
  --text-secondary: #6b6b6b;
  --bg: #fafafa;
  --accent: #3a7a55;
  --border: #e0e0e0;
  --max-width: 680px;
}

body {
  font-family: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 18px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: underline;
}

a:hover {
  text-decoration: underline;
}

/* === Layout === */
header, main, footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* === Header / Nav === */
header {
  padding-top: 2.5rem;
  padding-bottom: 1rem;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.site-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  letter-spacing: -0.01em;
}

.site-name:hover {
  text-decoration: none;
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  font-size: 0.95rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* === Homepage === */
.intro {
  margin-top: 2.5rem;
  margin-bottom: 3rem;
}

.intro h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.intro p {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 0.3rem;
}

.posts h2 {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.post-item {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.post-item time {
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 5.5rem;
  flex-shrink: 0;
}

.post-item a {
  font-weight: 500;
}

.post-summary {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* === Post === */
.post-header {
  margin-top: 2.5rem;
  margin-bottom: 2rem;
}

.post-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.4rem;
}

.post-header time {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.post-content {
  margin-bottom: 4rem;
}

.post-content h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 0.8rem;
}

.post-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
}

.post-content p {
  margin-bottom: 1.2rem;
}

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

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

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

.post-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85em;
  background: #f0f0f0;
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.post-content pre {
  background: #f0f0f0;
  padding: 1rem 1.2rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.post-content figure {
  margin: 1.5rem 0;
}

.post-content figure a {
  display: block;
  cursor: zoom-in;
}

.post-content figure a:hover img {
  opacity: 0.9;
}

.post-content figcaption {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
  line-height: 1.4;
  font-style: italic;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

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

.post-content th {
  background: #f0f0f0;
  font-weight: 600;
}

/* === 404 === */
.not-found {
  margin-top: 4rem;
  text-align: center;
}

.not-found h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* === Footer === */
footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.easter-egg {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.easter-egg a {
  color: var(--text-secondary);
  opacity: 0.6;
  transition: opacity 0.2s;
}

.easter-egg a:hover {
  opacity: 1;
}

/* === Responsive === */
@media (max-width: 600px) {
  body {
    font-size: 16px;
  }

  .post-item {
    flex-direction: column;
    gap: 0.1rem;
    margin-bottom: 1rem;
  }

  .post-header h1 {
    font-size: 1.5rem;
  }

  .post-summary {
    display: none;
  }
}
