/* ── Design tokens (extracted from the original mockup) ───────────── */
:root {
  --bg:          #FAF8F3;
  --surface:     #F5F5F2;
  --ink:         #141414;
  --body:        #33322E;
  --muted:       #57574F;
  --faint:       #9A9A98;
  --line:        #E7E7E5;
  --line-strong: #141414;
  --chip-bg:     #141414;
  --chip-fg:     #FCFCFC;
  --chip-border: #E0E0DE;

  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --sans:  system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --measure: 860px;
}

/* Dark mode: same warm palette, inverted (follows the OS setting) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #171614;
    --surface:     #201F1C;
    --ink:         #F2F0EB;
    --body:        #CDCBC4;
    --muted:       #A3A199;
    --faint:       #6E6D66;
    --line:        #2C2B27;
    --line-strong: #F2F0EB;
    --chip-bg:     #F2F0EB;
    --chip-fg:     #171614;
    --chip-border: #3A3934;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--mono);          /* small/body text is mono; only headlines are serif */
  font-size: 15px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 24px;
}

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

/* ── Nav ──────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(120%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.nav-links { display: flex; gap: 26px; }
.nav-links a {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  transition: color .15s ease;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--ink); }

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero { padding: 84px 0 64px; }
.eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--faint);
  margin: 0 0 22px;
}
.hero-headline {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(34px, 6vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 24px;
  max-width: 15ch;
}
.hero-blurb {
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0;
  max-width: 56ch;
}

/* Section header with a "more →" link (homepage) */
.block-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 26px; }
.block-head .block-label { margin: 0; }
.block-more { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.block-more:hover { color: var(--ink); }

/* Standalone pages (About, etc.) */
.page { border-top: none; padding-top: 48px; }
.page-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(30px, 5vw, 42px);
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 32px;
}

/* ── Section blocks ───────────────────────────────────────────────── */
.block { padding: 40px 0; border-top: 1px solid var(--line); }
.block-label {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 26px;
}

/* ── Tag filter chips ─────────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 26px; }
.chip {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--chip-border);
  border-radius: 2px;
  padding: 5px 13px;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.chip:not(.chip-active):hover { border-color: var(--line-strong); color: var(--ink); }
.chip-active {
  background: var(--chip-bg);
  color: var(--chip-fg);
  border-color: var(--chip-bg);
}

/* ── Writing list ─────────────────────────────────────────────────── */
.post-list, .project-list { list-style: none; margin: 0; padding: 0; }
.post-item { border-top: 1px solid var(--line); }
.post-item:first-child { border-top: none; }
.post-link {
  display: grid;
  grid-template-columns: 116px 1fr;   /* date column | content */
  column-gap: 28px;
  padding: 22px 0;
  transition: opacity .15s ease;
}
.post-link:hover { opacity: .62; }
.post-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  padding-top: 5px;                    /* nudge to align with the title baseline */
}
.post-title {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 8px;
}
.post-blurb { color: var(--muted); margin: 0 0 10px; max-width: 58ch; }
.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}
.post-empty { padding: 22px 0; color: var(--faint); }
.tag { color: var(--muted); }
.dot { color: var(--faint); }

/* ── Projects (cards) ─────────────────────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.project-card {
  display: block;
  padding: 22px 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .15s ease, transform .15s ease;
}
a.project-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.project-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.project-name {
  display: block;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  color: var(--ink);
}
.project-meta {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  text-align: right;
  flex-shrink: 0;
}
.project-desc { color: var(--muted); margin: 12px 0 0; }

@media (max-width: 560px) {
  .project-grid { grid-template-columns: 1fr; }
}

/* ── About ────────────────────────────────────────────────────────── */
.about-body { max-width: 60ch; }
.about-body p { margin: 0 0 16px; color: var(--muted); }

/* ── Post page ────────────────────────────────────────────────────── */
.post { padding: 40px 0 72px; }
.back-link {
  display: inline-block;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 32px;
}
.back-link:hover { color: var(--ink); }
.back-bottom { margin: 48px 0 0; }
.post-head { border-bottom: 1px solid var(--line); padding-bottom: 24px; margin-bottom: 32px; }
.post-headline {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.14;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 14px 0 0;
}

/* ── Prose (rendered markdown) ────────────────────────────────────── */
.prose { font-size: 15px; line-height: 1.78; }
.prose > * { max-width: 95ch; }
.prose h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 44px 0 14px;
}
.prose h3 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  color: var(--ink);
  margin: 32px 0 10px;
}
.prose p { margin: 0 0 20px; }
.prose a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 20px; }
.prose li { margin: 6px 0; }
.prose blockquote {
  margin: 24px 0;
  padding: 4px 0 4px 20px;
  border-left: 2px solid var(--line-strong);
  color: var(--muted);
  font-style: italic;
}
.prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--surface);
  padding: 2px 5px;
  border-radius: 4px;
}
.prose pre {
  background: var(--surface) !important; /* beat Shiki's inline theme background */
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 24px;
}
.prose pre code { background: none; padding: 0; font-size: 13.5px; line-height: 1.6; }
/* Shiki dual themes: swap token colors to the dark set in dark mode */
@media (prefers-color-scheme: dark) {
  .astro-code span { color: var(--shiki-dark) !important; }
}
.prose img { max-width: 100%; height: auto; border-radius: 8px; }

/* ── Footer ───────────────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--line); margin-top: 40px; }
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 72px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}
.footer-social { display: flex; gap: 18px; }
.footer-social a:hover { color: var(--ink); }

/* ── Small screens ────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .nav-links { gap: 16px; }
  .hero { padding: 56px 0 44px; }
  .post-link { grid-template-columns: 1fr; column-gap: 0; }
  .post-date { padding-top: 0; margin-bottom: 6px; }
}

/* ── PipelineReplay demo ─────────────────────────────────────────── */
.replay {
  margin: 32px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 16px;
}
.replay-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.replay-btn {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--chip-bg);
  color: var(--chip-fg);
  cursor: pointer;
  white-space: nowrap;
}
.replay-scrub { flex: 1; accent-color: var(--ink); min-width: 0; }
.replay-clock {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.replay-svg { width: 100%; height: auto; display: block; }
.replay-edge { stroke: var(--line); stroke-width: 1.5; }
.replay-edge.is-conditional { stroke-dasharray: 5 4; }
.replay-edge.is-active { stroke: var(--ink); }
.replay-terminal { fill: var(--faint); }
.replay-terminal.is-done { fill: var(--ink); }
.replay-terminal-label { fill: var(--muted); font-size: 12.5px; text-anchor: middle; }
.replay-node { cursor: pointer; }
.replay-node rect { fill: var(--bg); stroke: var(--line); stroke-width: 1.5; transition: fill 0.2s, stroke 0.2s; }
.replay-node text { fill: var(--muted); font-size: 14px; text-anchor: middle; transition: fill 0.2s; }
.replay-node.is-running rect { fill: var(--chip-bg); stroke: var(--line-strong); }
.replay-node.is-running text { fill: var(--chip-fg); }
.replay-node.is-done rect { stroke: var(--ink); }
.replay-node.is-done text { fill: var(--ink); }
.replay-node.is-selected rect { stroke: var(--ink); stroke-width: 2.5; }
.replay-node .replay-llm-tag { font-size: 11.5px; fill: var(--faint); }
.replay-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  min-height: 3.2em;
}
.replay-panel-node { font-size: 0.95rem; color: var(--ink); font-weight: 500; }
.replay-panel-time { color: var(--muted); font-weight: 400; }
.replay-panel-summary { margin: 4px 0 0; font-size: 0.95rem; color: var(--body); }
