:root {
  --background: #fbfaf6;
  --text: #1a1917;
  --muted: #6b655b;
  --faint: #a7a093;
  --line: rgba(26, 25, 23, 0.12);
  --hairline: rgba(26, 25, 23, 0.08);
  --accent: #8a5a3b;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: "Inter", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --mono: "SFMono-Regular", "SF Mono", "IBM Plex Mono", monospace;
  --measure: 38rem;
}

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

html {
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: var(--serif);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(138, 90, 59, 0.4);
  text-underline-offset: 0.22em;
  transition: text-decoration-color 120ms ease, color 120ms ease;
}

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

p,
ul,
ol,
h1,
h2,
h3,
h4 {
  margin: 0;
}

.page-shell {
  width: min(52rem, calc(100vw - 2.5rem));
  margin: 0 auto;
  padding: 2.5rem 0 5rem;
}

/* Header / nav */

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

.site-title {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
}

.site-nav a {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.88rem;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
}

/* Main layout */

.page-main {
  display: block;
}

.hero,
.page-intro,
.section-block {
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.hero {
  margin-bottom: 4.5rem;
}

.page-intro {
  margin-bottom: 3.5rem;
}

.section-block + .section-block {
  margin-top: 3.5rem;
}

/* Headlines */

.hero h1,
.page-intro h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 4.4vw, 3.1rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin-bottom: 1.25rem;
  max-width: 22ch;
}

.pretext-display-fallback {
  font-family: var(--serif);
  font-size: clamp(2rem, 4.4vw, 3.1rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin: 0 0 1.25rem;
  max-width: 22ch;
}

.pretext-display-line {
  display: block;
  font-family: var(--serif);
  font-size: clamp(2rem, 4.4vw, 3.1rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 600;
}

/* Copy */

.hero-copy,
.page-intro p,
.section-block p,
.prose-block p,
.about-note-card p {
  max-width: var(--measure);
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

.page-summary {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
  line-height: 1.6;
  max-width: var(--measure);
  margin-top: 0.75rem;
}

.editorial-flow-fallback p {
  max-width: var(--measure);
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
  margin: 0;
}

.editorial-flow-line {
  display: block;
  max-width: var(--measure);
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.prose-block p + p {
  margin-top: 1.1rem;
}

/* Eyebrows & meta */

.eyebrow,
.card-meta,
.section-label,
.timeline-period,
.publication-meta {
  color: var(--faint);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 0.9rem;
}

.card-meta {
  margin-bottom: 0.35rem;
}

.section-heading {
  margin-bottom: 1.75rem;
}

.section-heading h2 {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 0.6rem;
}

/* Hero meta + links */

.hero-meta,
.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin-top: 1.6rem;
}

.hero-meta:empty,
.hero-links:empty {
  display: none;
}

.hero-meta span,
.hero-meta a,
.hero-links a {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.9rem;
}

.hero-links a {
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 1px;
}

.hero-links a:hover {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.text-link {
  font-family: var(--sans);
  font-size: 0.95rem;
}

/* Intro / timeline label on home */

.intro-block {
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.intro-block p {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Timeline (home) */

.timeline-rail {
  display: block;
  margin-top: 0.5rem;
}

.timeline-row {
  position: relative;
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1.75rem;
  align-items: baseline;
  padding: 1.25rem 0;
  border-top: 1px solid var(--hairline);
}

.timeline-row:last-child {
  border-bottom: 1px solid var(--hairline);
}

.timeline-row.is-raised {
  z-index: 8;
}

.timeline-row.is-minor {
  opacity: 0.85;
}

.timeline-date-column {
  padding-top: 0;
}

.timeline-date-column .timeline-period {
  margin: 0;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}

.timeline-marker-column {
  display: none;
}

.timeline-entry-link {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  background: none;
  text-decoration: none;
  color: var(--text);
}

.timeline-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.55rem;
  align-items: baseline;
}

.timeline-title-row strong {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease;
}

.timeline-title-row span {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.02rem;
}

.timeline-entry-link:hover .timeline-title-row strong {
  border-bottom-color: var(--accent);
}

/* Timeline summary (inline below title) */

.timeline-summary {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 0.9rem;
  line-height: 1.55;
  max-width: 40rem;
}

/* Collection lists (posts, publications, projects, resources) */

.stack-list,
.publication-list,
.resource-list {
  display: block;
}

.stack-item,
.publication-item,
.resource-item,
.year-group-item {
  padding: 1.5rem 0;
  border-top: 1px solid var(--hairline);
  background: none;
  border-radius: 0;
  box-shadow: none;
  border-left: 0;
  padding-left: 0;
}

.stack-list .stack-item:last-child,
.publication-list .publication-item:last-child,
.resource-list .resource-item:last-child {
  border-bottom: 1px solid var(--hairline);
}

.stack-item h2,
.publication-item h2,
.year-group-item h2 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.005em;
  margin-bottom: 0.45rem;
}

.stack-item p,
.publication-item p,
.year-group-item p {
  color: var(--muted);
  font-size: 0.98rem;
}

.resource-item h2 {
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
  margin-bottom: 0.25rem;
}

.resource-item p {
  color: var(--muted);
  font-size: 0.85rem;
}

.resource-item .card-meta {
  font-size: 0.68rem;
  margin-bottom: 0.2rem;
}

.resource-item {
  padding: 1rem 0;
}

.resource-list .section-heading {
  margin-bottom: 1rem;
}

.publication-meta {
  margin-bottom: 0.45rem;
}

/* Year groups (posts) */

.year-group-list {
  display: block;
}

.year-group {
  background: none;
  border: 0;
  border-top: 1px solid var(--hairline);
  border-radius: 0;
  overflow: visible;
}

.year-group:last-child {
  border-bottom: 1px solid var(--hairline);
}

.year-group[open] {
  background: none;
}

.year-group-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
  cursor: pointer;
  list-style: none;
}

.year-group-summary::-webkit-details-marker {
  display: none;
}

.year-group-year {
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.year-group-count {
  color: var(--faint);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.year-group-items {
  display: block;
  padding: 0 0 0.75rem;
}

.year-group-item {
  border-top: 0;
  border-left: 2px solid var(--hairline);
  padding: 0.9rem 0 0.9rem 1.1rem;
}

.year-group-items .year-group-item:last-child {
  border-bottom: 0;
}

/* Facts / lists */

.detail-list,
.fact-list {
  margin: 1.25rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.fact-list li + li {
  margin-top: 0.35rem;
}

/* About personal notes */

.about-note-grid {
  display: grid;
  gap: 2.5rem;
  grid-template-columns: 1fr;
}

.about-note-card {
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--hairline);
  padding-top: 1.75rem;
}

.about-note-card h2 {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.9rem;
}

.about-note-card p + p {
  margin-top: 0.9rem;
}

/* Running progress */

.run-progress-section .section-heading h2 {
  font-size: 1.65rem;
}

.run-progress-layout {
  display: grid;
  gap: 1.75rem;
  grid-template-columns: minmax(0, 1.5fr) minmax(16rem, 1fr);
  align-items: start;
}

.run-progress-chart {
  position: relative;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: none;
}

.run-progress-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.run-progress-gridline {
  stroke: var(--hairline);
  stroke-width: 1;
}

.run-progress-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.run-progress-trend {
  fill: none;
  stroke: rgba(138, 90, 59, 0.35);
  stroke-width: 1.25;
  stroke-dasharray: 4 6;
  stroke-linecap: round;
}

.run-progress-area {
  fill: url(#run-progress-fill);
}

.run-progress-axis-label,
.run-progress-year-label {
  fill: var(--faint);
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.run-progress-axis-label {
  fill: var(--muted);
}

.run-progress-year-tick {
  stroke: var(--line);
  stroke-width: 1;
}

.run-progress-year-label {
  fill: var(--muted);
  font-size: 11px;
}

.run-progress-summary {
  display: grid;
  gap: 1.1rem;
}

.run-progress-highlights {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.run-progress-highlight {
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--hairline);
  padding-top: 0.85rem;
}

.run-progress-highlight .card-meta {
  margin-bottom: 0.45rem;
}

.run-progress-highlight-value {
  margin-bottom: 0.2rem;
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.run-progress-highlight-copy,
.run-progress-copy,
.run-progress-footnote {
  margin-bottom: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.88rem;
  line-height: 1.55;
}

.run-progress-footnote {
  color: var(--faint);
}

/* Hover points on chart */

.run-progress-hover-layer {
  position: absolute;
  inset: 0;
}

.run-progress-hover-point {
  --run-progress-card-shift: 0px;
  position: absolute;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translate(-50%, -50%);
  cursor: pointer;
  overflow: visible;
}

.run-progress-hover-point:focus-visible {
  outline: none;
}

.run-progress-hover-point:focus-visible .run-progress-hover-dot {
  box-shadow:
    0 0 0 3px var(--background),
    0 0 0 6px rgba(138, 90, 59, 0.22);
}

.run-progress-hover-dot {
  display: block;
  width: 0.65rem;
  height: 0.65rem;
  margin: 0.175rem;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: var(--background);
  box-shadow: 0 0 0 3px var(--background);
}

.run-progress-hover-card {
  position: absolute;
  z-index: 2;
  min-width: 12rem;
  max-width: min(17rem, calc(100vw - 4rem));
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 12px 30px rgba(26, 25, 23, 0.12);
  left: 50%;
  bottom: calc(100% + 10px);
  display: grid;
  gap: 0.28rem;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateX(var(--run-progress-card-shift)) translateY(4px);
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    visibility 140ms ease;
  text-align: left;
}

.run-progress-hover-point:hover .run-progress-hover-card,
.run-progress-hover-point.is-open .run-progress-hover-card,
.run-progress-hover-point:focus-visible .run-progress-hover-card,
.run-progress-hover-point:focus .run-progress-hover-card {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateX(var(--run-progress-card-shift)) translateY(0);
}

.run-progress-hover-point.is-below .run-progress-hover-card {
  top: calc(100% + 10px);
  bottom: auto;
}

.run-progress-hover-time,
.run-progress-hover-race,
.run-progress-hover-pace,
.run-progress-hover-note {
  margin-bottom: 0;
}

.run-progress-hover-time {
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.run-progress-hover-race {
  margin-top: 0.3rem;
  color: var(--text);
  font-family: var(--serif);
  font-size: 0.98rem;
}

.run-progress-hover-pace {
  margin-top: 0.2rem;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.run-progress-hover-note {
  margin-top: 0.4rem;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 0.9rem;
}

/* Strava panel */

.run-strava-panel {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--hairline);
  grid-column: 1 / -1;
}

.run-strava-panel h3 {
  margin-bottom: 0.55rem;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.run-strava-stats {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}

.run-strava-stat {
  padding: 0.9rem 0 0;
  border: 0;
  border-top: 1px solid var(--hairline);
  border-radius: 0;
  background: none;
}

.run-strava-stat-value {
  margin-bottom: 0.2rem;
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.run-strava-stat-copy {
  margin-bottom: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.85rem;
}

.run-volume-chart {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  min-height: 12rem;
}

.run-volume-month {
  display: grid;
  gap: 0.55rem;
  justify-items: center;
}

.run-volume-bar-shell {
  display: flex;
  align-items: flex-end;
  width: 100%;
  min-height: 9rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--hairline);
}

.run-volume-bar {
  display: block;
  width: 100%;
  border-radius: 0;
  background: var(--accent);
}

.run-volume-bar.is-partial {
  background: rgba(138, 90, 59, 0.45);
}

.run-volume-mileage,
.run-volume-month-label {
  color: var(--faint);
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}

.run-volume-mileage {
  color: var(--text);
}

/* Photo gallery */

.photo-gallery-section {
  max-width: none;
  margin: 0;
}

.photo-gallery-grid {
  column-width: 14rem;
  column-gap: 1rem;
}

.gallery-item {
  display: inline-block;
  width: 100%;
  overflow: hidden;
  margin: 0 0 1rem;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  padding: 0;
  break-inside: avoid;
  text-decoration: none;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
}

/* Footer */

.site-footer {
  display: block;
  margin-top: 5rem;
  padding: 2rem 0 0;
  border: 0;
  border-top: 1px solid var(--hairline);
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.85rem;
}

.site-footer p {
  margin-bottom: 0.25rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
}

.site-footer a:hover {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* Pretext enhancement hooks (unchanged behaviour) */

.pretext-display-lines,
.editorial-flow-lines {
  display: none;
}

.pretext-display.is-enhanced .pretext-display-lines,
.editorial-flow-stage.is-enhanced .editorial-flow-lines {
  display: block;
}

.pretext-display.is-enhanced .pretext-display-fallback,
.editorial-flow-stage.is-enhanced .editorial-flow-fallback {
  display: none;
}

/* Responsive */

@media (max-width: 820px) {
  .run-progress-layout {
    grid-template-columns: 1fr;
  }

  .run-progress-highlights {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  html {
    font-size: 16px;
  }

  .page-shell {
    width: calc(100vw - 1.75rem);
    padding: 1.75rem 0 3.5rem;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 2.25rem;
  }

  .site-nav {
    gap: 1rem;
  }

  .hero {
    margin-bottom: 3rem;
  }

  .section-block + .section-block {
    margin-top: 2.5rem;
  }

  .timeline-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
    padding: 1rem 0;
  }

  .timeline-date-column {
    order: -1;
  }

  .run-progress-highlights {
    grid-template-columns: 1fr;
  }

  .run-volume-chart {
    gap: 0.4rem;
  }

  .run-volume-bar-shell {
    min-height: 7rem;
  }

  .photo-gallery-grid {
    column-width: 10rem;
  }
}
