:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1d1f;
  --muted: #5d6168;
  --border: #e4e2dc;
  --accent: #2f6fdb;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121315;
    --surface: #1a1c1f;
    --text: #e8e6e1;
    --muted: #9a9ea6;
    --border: #2a2d31;
    --accent: #7aa7ff;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

.wrap {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem;
}

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

.site-header { padding-top: 2rem; padding-bottom: 2rem; }

.brand {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
}
.brand:hover .dim { color: var(--accent); }
.dim { color: var(--muted); }

.intro { padding: 4rem 0 3rem; }

.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--muted);
}

h1 {
  margin: 0.25rem 0 1.25rem;
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.lede {
  margin: 0;
  max-width: 36rem;
  font-size: 1.15rem;
  color: var(--muted);
}

.block { padding: 2rem 0; border-top: 1px solid var(--border); }

h2 {
  margin: 0 0 1.25rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.cards li {
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

h3 { margin: 0 0 0.35rem; font-size: 1rem; }

.cards p { margin: 0; font-size: 0.95rem; color: var(--muted); }

.empty { margin: 0; color: var(--muted); }

.site-footer {
  padding-top: 2rem;
  padding-bottom: 2.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.site-footer p { margin: 0; }

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.nav { display: flex; gap: 1.25rem; font-size: 0.95rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover,
.nav a[aria-current="page"] { color: var(--text); }

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.25rem;
  border-left: 2px solid var(--border);
}
.timeline li { position: relative; padding-bottom: 1.5rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: calc(-1.25rem - 8px);
  top: 0.45rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--muted);
}
.timeline li:first-child::before { border-color: var(--accent); background: var(--accent); }
.timeline p { margin: 0; color: var(--muted); }

.prose p { margin: 0 0 1rem; }
.prose p:last-child { margin-bottom: 0; }

.avatar {
  display: block;
  flex: none;
  width: 112px;
  height: 112px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid var(--border);
}
.avatar-lg { width: 160px; height: 160px; border-radius: 24px; }

.intro-photo {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 36rem) {
  .intro-photo { flex-direction: row; align-items: center; gap: 2rem; }
}

.post-header { padding: 3rem 0 2rem; }

.post figure { margin: 2rem 0; }
.post figure img {
  display: block;
  width: 100%;
  height: auto;
}

.parallax {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}

/* With JS, the image is 20% taller than its frame and drifts by --shift. */
.has-parallax .parallax img {
  position: absolute;
  top: -10%;
  left: 0;
  width: 100%;
  height: 120%;
  object-fit: cover;
  transform: translate3d(0, var(--shift, 0px), 0);
  will-change: transform;
}
.post figcaption { margin-top: 0.6rem; font-size: 0.875rem; color: var(--muted); }

.prose h2 {
  margin: 2.25rem 0 0.75rem;
  font-family: var(--sans);
  font-size: 1.35rem;
  font-weight: 650;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--text);
}
.prose ul { margin: 0 0 1rem; padding-left: 1.25rem; }
.prose li { margin-bottom: 0.4rem; }

.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; padding: 0.6rem 0; }
.post-list a { font-weight: 600; text-decoration: none; }
.post-list a:hover { text-decoration: underline; }
.post-list time { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); }

/* Scroll reveal: hidden only when JS is running, shown by main.js. */
.js .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

.js .cards .reveal:nth-child(2) { transition-delay: 0.08s; }
.js .cards .reveal:nth-child(3) { transition-delay: 0.16s; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* Story chapters */
.chapter { margin: 3rem 0 1rem; }
.chapter .prose h2 { margin-top: 0.5rem; }
.chapter-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.chapter-label::before {
  content: "";
  width: 1.75rem;
  height: 2px;
  background: currentColor;
}

.coming-soon {
  margin: 3rem 0 1rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
}
.coming-soon .chapter-label { justify-content: center; margin-bottom: 0.5rem; }
.coming-soon .chapter-label::before { display: none; }
.coming-soon p:last-child { margin: 0; }

/* Reading progress bar, filled by main.js */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  width: 100%;
  height: 3px;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(var(--read, 0));
}

/* Tall photos get a narrower, centered frame so they don't fill the screen. */
.post .figure-portrait { max-width: 30rem; margin-left: auto; margin-right: auto; }
