/* ---------------------------------------------------------
   Design tokens
--------------------------------------------------------- */
:root {
  --ink: #171512;
  --ink-soft: #3a352c;
  --paper: #E7E9E2;
  --paper-raise: #f2f3ee;
  --accent: #b5701f;
  --accent-strong: #94570f;
  --pine: #204b3b;
  --signal: #a13327;
  --line: #cac6b7;
  --muted: #6b6659;

  --bg: var(--paper);
  --bg-raise: var(--paper-raise);
  --fg: var(--ink);
  --fg-soft: var(--ink-soft);
  --border: var(--line);
  --text-muted: var(--muted);

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Work Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --rail-w: 15rem;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --max: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #efece2;
    --ink-soft: #cbc6b6;
    --paper: #17150f;
    --paper-raise: #1e1c15;
    --accent: #e0a03f;
    --accent-strong: #f0b658;
    --pine: #6fae95;
    --signal: #d97a68;
    --line: #38352a;
    --muted: #948d78;

    --bg: var(--paper);
    --bg-raise: var(--paper-raise);
    --fg: var(--ink);
    --fg-soft: var(--ink-soft);
    --border: var(--line);
    --text-muted: var(--muted);
  }
}

/* ---------------------------------------------------------
   Reset / base
--------------------------------------------------------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

.skip-link {
  position: absolute; left: -999px; top: 0;
}
.skip-link:focus {
  left: 1rem; top: 1rem; z-index: 100;
  background: var(--accent); color: var(--paper);
  padding: 0.5rem 1rem; border-radius: 4px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* faint paper grain, purely decorative */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  opacity: 0.035; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { .grain { opacity: 0.06; mix-blend-mode: overlay; } }

/* ---------------------------------------------------------
   Rail (sidebar nav)
--------------------------------------------------------- */
.rail {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--rail-w);
  padding: 2.5rem 1.75rem;
  display: flex;
  z-index: 10;
  border-right: 1px solid var(--border);
}

.rail-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.rail-mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  text-decoration: none;
  color: var(--fg);
  border: 1px solid var(--border);
  width: 2.6rem; height: 2.6rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}

.rail-nav {
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.rail-nav a {
  text-decoration: none;
  font-size: 0.92rem;
  color: var(--text-muted);
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  transition: color 0.15s ease;
}

.rail-nav a:hover,
.rail-nav a:focus-visible,
.rail-nav a.is-active { color: var(--accent); }

.rail-nav a.is-active .n { color: var(--accent); }

.rail-nav .n {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--border);
}

.rail-stats {
  margin: auto 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-top: 2rem;
}

.rail-stats div {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border-bottom: 1px dotted var(--border);
  padding-bottom: 0.35rem;
}

.rail-stats dt { color: var(--text-muted); margin: 0; font-weight: 400; }
.rail-stats dd { margin: 0; color: var(--accent); font-variant-numeric: tabular-nums; }

.rail-foot {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.rail-foot a {
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--fg-soft);
}
.rail-foot a:hover { color: var(--accent); }

/* ---------------------------------------------------------
   Main / sections
--------------------------------------------------------- */
main {
  margin-left: var(--rail-w);
  position: relative;
  z-index: 2;
}

.section {
  padding: 6rem var(--gutter) 3rem;
  max-width: 64rem;
  border-top: 1px solid var(--border);
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  margin: 0 0 1.75rem;
}
.section-label .n { color: var(--text-muted); }

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
}

.section-heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
  line-height: 1.08;
  margin: 0;
  text-wrap: balance;
}

.section-body { max-width: var(--max); }

.section-body p {
  margin: 0 0 1.1rem;
  color: var(--fg-soft);
  max-width: 38rem;
}
.section-body p:last-child { margin-bottom: 0; }
.section-body strong { color: var(--fg); font-weight: 600; }
.section-body em { color: var(--pine); font-style: normal; font-weight: 600; }

/* ---------------------------------------------------------
   Hero
--------------------------------------------------------- */
.hero {
  padding: 7rem var(--gutter) 4rem;
  max-width: 64rem;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3.2rem, 9vw, 6.4rem);
  line-height: 0.98;
  margin: 0 0 2rem;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.hero-dot { color: var(--accent); }

.hero-dek {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  max-width: 38rem;
  color: var(--fg-soft);
  margin: 0 0 2.5rem;
}
.hero-dek strong { color: var(--fg); font-weight: 600; }
.hero-dek em { color: var(--pine); font-style: normal; font-weight: 600; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-bottom: 4rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--accent);
  color: var(--paper);
}
.btn-primary:hover { background: var(--accent-strong); }

.btn-ghost {
  border-color: var(--border);
  color: var(--fg);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.telemetry {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1.5rem;
  margin: 0;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}

.telemetry-item { display: flex; flex-direction: column; gap: 0.3rem; }

.telemetry-item dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.telemetry-item dt {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 10rem;
}

/* ---------------------------------------------------------
   Timeline (Experience)
--------------------------------------------------------- */
.timeline {
  list-style: none;
  margin: 0 0 3rem;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.timeline-item {
  display: grid;
  grid-template-columns: minmax(0, 9rem) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}
.timeline-item:first-child { border-top: none; padding-top: 0; }

.timeline-when {
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  padding-top: 0.2rem;
}
.timeline-live { color: var(--pine); font-weight: 500; }

.timeline-body h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.timeline-org {
  font-size: 0.9rem;
  color: var(--accent);
  margin: 0 0 1rem;
}

.timeline-body ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--fg-soft);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.timeline-body li { max-width: 42rem; }
.timeline-body strong { color: var(--fg); }

.timeline-item--muted .timeline-org { color: var(--text-muted); }

.edu {
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}
.edu-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}
.edu p { margin: 0; color: var(--fg-soft); }
.edu strong { color: var(--fg); }

/* ---------------------------------------------------------
   Selected Writing (index list)
--------------------------------------------------------- */
.index-list {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
}

.index-list li {
  border-top: 1px solid var(--border);
  padding: 1.3rem 0;
}
.index-list li:last-child { border-bottom: 1px solid var(--border); }

.index-list a {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto auto;
  align-items: baseline;
  gap: 1rem;
  text-decoration: none;
  color: var(--fg);
}

.index-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.index-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.08rem;
  transition: color 0.15s ease;
}
.index-list a:hover .index-title,
.index-list a:focus-visible .index-title { color: var(--accent); }

.index-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--pine);
  white-space: nowrap;
}

.index-go {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.index-list a:hover .index-go,
.index-list a:focus-visible .index-go { opacity: 1; transform: translateX(0); }

.index-dek {
  margin: 0.5rem 0 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  max-width: 40rem;
}

.see-all {
  display: inline-block;
  margin-top: 2rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}
.see-all:hover { color: var(--accent-strong); }

/* ---------------------------------------------------------
   Podcast guest list
--------------------------------------------------------- */
.guest-list {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

.guest-list a {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.4rem;
  background: var(--bg);
  text-decoration: none;
  color: var(--fg);
  transition: background 0.15s ease;
}
.guest-list a:hover,
.guest-list a:focus-visible { background: var(--bg-raise); }

.guest-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}
.guest-list a:hover .guest-name { color: var(--accent); }

.guest-role {
  font-size: 0.82rem;
  color: var(--pine);
}

.guest-topic {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ---------------------------------------------------------
   Craft list
--------------------------------------------------------- */
.craft-list {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  color: var(--fg-soft);
  max-width: 40rem;
}
.craft-list strong { color: var(--fg); }

/* ---------------------------------------------------------
   Footer
--------------------------------------------------------- */
.footer {
  padding-bottom: 5rem;
}

.footer-heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin: 0 0 2.5rem;
  text-wrap: balance;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  margin-bottom: 2rem;
}

.footer-link {
  font-family: var(--font-mono);
  font-size: 1rem;
  text-decoration: none;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}
.footer-link:hover { color: var(--accent-strong); border-color: var(--accent-strong); }

.footer-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

/* ---------------------------------------------------------
   Responsive
--------------------------------------------------------- */
@media (max-width: 900px) {
  .rail { display: none; }
  main { margin-left: 0; }
  .section-grid { grid-template-columns: 1fr; }
  .guest-list { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .index-list a {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "date go"
      "title title";
  }
  .index-date { grid-area: date; }
  .index-go { grid-area: go; opacity: 1; transform: none; }
  .index-title { grid-area: title; }
  .index-tag { display: none; }
  .hero-actions { flex-direction: column; align-items: flex-start; }
}
