/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: #1a1a1f;
  background: #fafaf7;
  -webkit-font-smoothing: antialiased;
}

:root {
  --accent: #c5341a;
  --accent-soft: #fbe9e4;
  --ink: #1a1a1f;
  --ink-soft: #555;
  --ink-mute: #8a8a93;
  --bg: #fafaf7;
  --bg-card: #ffffff;
  --border: #ececec;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.08), 0 16px 48px rgba(0,0,0,0.10);
  --radius: 14px;
  --serif: 'Fraunces', Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ececec;
    --ink-soft: #b4b4bd;
    --ink-mute: #74747d;
    --bg: #0f0f12;
    --bg-card: #18181d;
    --border: #2a2a31;
    --accent-soft: #3a1810;
    --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.5);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.5), 0 16px 48px rgba(0,0,0,0.7);
  }
  body { background: var(--bg); color: var(--ink); }
}

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

/* ---------- Layout ---------- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 28px;
}
.container--reading {
  max-width: 680px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
}
.site-title {
  font-family: var(--serif);
  font-weight: 800;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.site-title:hover { text-decoration: none; color: var(--accent); }
.site-header nav a {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
}

/* ---------- Hero ---------- */
.hero {
  padding: 88px 0 56px;
  text-align: center;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, var(--accent-soft) 0%, transparent 70%);
}
.hero-title {
  font-family: var(--serif);
  font-size: clamp(48px, 8vw, 88px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
  color: var(--ink);
}
.hero-subtitle {
  font-size: 20px;
  color: var(--ink-soft);
  margin: 0;
  max-width: 540px;
  margin-inline: auto;
}

/* ---------- Collections ---------- */
.collections {
  padding: 40px 0 96px;
}
.collection { margin-bottom: 64px; }
.collection-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.collection-icon {
  font-size: 36px;
  line-height: 1;
}
.collection-header h2 {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.collection-header p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
}
.collection-header > div { flex: 1; }
.collection-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-mute);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
}

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--ink);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  min-height: 160px;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
  text-decoration: none;
}
.card-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.card-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  flex: 1;
}
.card-arrow {
  margin-top: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-mute);
}
.card:hover .card-arrow { color: var(--accent); }

/* ---------- Reading view ---------- */
.post {
  padding: 56px 0 96px;
}
.post-card {
  background: var(--bg-card);
  border: 1px solid #1a1a1f;
  border-radius: var(--radius);
  padding: 56px 64px;
}
@media (prefers-color-scheme: dark) {
  .post-card { border-color: #ececec; }
}
@media (max-width: 600px) {
  .post-card { padding: 32px 24px; }
}
.back-link {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-mute);
  margin-bottom: 24px;
}
.back-link:last-child { margin-top: 56px; margin-bottom: 0; }
.post-title {
  font-family: var(--serif);
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 36px;
  color: var(--ink);
}
.post-content {
  font-size: 18px;
  line-height: 1.75;
  color: var(--ink);
}
.post-content h1,
.post-content h2,
.post-content h3 {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.25;
  margin-top: 2em;
}
.post-content h1 { font-size: 32px; }
.post-content h2 {
  font-size: 26px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.post-content h3 { font-size: 21px; }
.post-content p { margin: 1em 0; }
.post-content a { color: var(--accent); border-bottom: 1px solid transparent; transition: border-color 0.15s; }
.post-content a:hover { border-bottom-color: var(--accent); text-decoration: none; }
.post-content blockquote {
  margin: 1.5em 0;
  padding: 16px 24px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--ink);
}
.post-content blockquote p:first-child { margin-top: 0; }
.post-content blockquote p:last-child { margin-bottom: 0; }
.post-content code {
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
}
.post-content pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 18px;
  border-radius: 8px;
  overflow-x: auto;
}
.post-content pre code { background: none; padding: 0; }
.post-content ul, .post-content ol { padding-left: 1.4em; }
.post-content li { margin: 0.4em 0; }
.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}
.post-content img { max-width: 100%; border-radius: 8px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  font-size: 13px;
  color: var(--ink-mute);
  text-align: center;
}

@media (max-width: 600px) {
  .container { padding: 0 20px; }
  .hero { padding: 56px 0 32px; }
  .post { padding: 32px 0 64px; }
  .collection-header { flex-wrap: wrap; }
}
