@font-face {
  font-family: "Hanken Grotesk";
  src: url("/fonts/hanken-grotesk-400.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("/fonts/hanken-grotesk-600.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Bodoni Moda";
  src: url("/fonts/bodoni-moda-italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

:root {
  --paper: #faf5e9;
  --surface: #fffaf0;
  --ink: #1c2450;
  --muted: #575a75;
  --rule: #c8c5cf;
  --soft: #efe8da;
  --accent: #203cb7;
  --track-blue: #203cb7;
  --track-deep: #172d8d;
  --track-paper: #faf5e9;
  --track-muted: #e0e6ff;
  --track-rule: #8090db;
  --orange: #ff7956;
  --heading: "Hanken Grotesk", sans-serif;
  --serif: "Bodoni Moda", Georgia, serif;
  --gutter: clamp(20px, 5vw, 76px);
  --section-space: clamp(65px, 8vw, 112px);
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #15182e;
  --surface: #202544;
  --ink: #f9f1df;
  --muted: #c3c7e1;
  --rule: #515a85;
  --soft: #242946;
  --accent: #aebfff;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-color: var(--accent) var(--paper); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--heading);
}
::selection { background: var(--orange); color: #1c2450; }
h1, h2, h3, h4, p, figure { margin: 0; }
h1, h2, h3, h4 { font-weight: 600; }
h1, h2 { letter-spacing: -.04em; line-height: .99; }
h1 { font-size: clamp(3.15rem, 7.5vw, 6rem); }
h2 { font-size: clamp(2.75rem, 5.6vw, 5.1rem); }
h1 em, h2 em {
  color: var(--accent);
  font: italic 400 1em/.96 var(--serif);
}
a { color: inherit; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
img { display: block; max-width: 100%; }
button { color: inherit; font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
main:focus { outline: none; }
.wrap { width: min(1256px, calc(100% - 2 * var(--gutter))); margin-inline: auto; }
.section { padding-block: var(--section-space); }
section[id], .side-projects { scroll-margin-top: 24px; }
.skip-link { position: fixed; z-index: 5; top: 10px; left: 10px; padding: 10px 15px; background: var(--surface); clip-path: inset(50%); }
.skip-link:focus { clip-path: none; }

.site-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 26px;
  min-height: 86px;
  border-bottom: 1px solid var(--rule);
  z-index: 2;
}
.identity {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.monogram {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--track-blue);
  color: var(--track-paper);
  font-size: 14px;
  font-weight: 600;
  font-style: italic;
  letter-spacing: -.03em;
}
.site-header nav { display: flex; align-items: center; gap: clamp(15px, 2.3vw, 35px); margin-left: auto; }
.site-header nav a { text-decoration: none; font-size: 14px; font-weight: 600; padding: 10px 0; }
.site-header nav a:hover, .site-header nav [aria-current] { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  transition: background .2s ease, color .2s ease;
}
.icon-button:hover { background: var(--soft); color: var(--accent); }
.icon-button svg { display: block; width: 20px; height: 20px; }
.theme-toggle .sun, [data-theme="dark"] .theme-toggle .moon, .menu-toggle { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }

.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(32px, 5vw, 78px);
  align-items: center;
  padding-block: clamp(32px, 4vw, 60px) clamp(48px, 6vw, 80px);
}
.hero-copy h1 { margin: 0 0 26px; font-size: clamp(3.05rem, 7.25vw, 6rem); }
.hero-copy p { max-width: 43ch; font-size: clamp(1.05rem, 1.55vw, 1.25rem); text-wrap: pretty; }
.hero-copy p a, .prose a:not(.button) { color: var(--accent); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 22px; margin-top: 26px; }
.button, .text-link {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: fit-content;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.button {
  min-height: 50px;
  padding: 10px 15px;
  background: var(--track-blue);
  color: var(--track-paper);
  transition: background .2s ease;
}
.button:hover { background: var(--track-deep); }
.button:focus-visible { outline-color: var(--accent); }
.text-link { text-decoration: underline; text-decoration-thickness: 1px; }
.button svg, .text-link svg, .race-bib svg, .footer-links svg { width: 17px; height: 17px; flex: none; transition: transform .25s var(--ease); }
.button:hover svg, .text-link:hover svg, .footer-links a:hover svg { transform: translate(2px, -2px); }

.hero-photo { position: relative; }
.photo-window { position: relative; aspect-ratio: 1.06; overflow: hidden; background: var(--soft); }
.photo-window img {
  position: absolute;
  inset: auto 0 0;
  width: 100%;
  height: 116%;
  object-fit: cover;
  object-position: 53% center;
}
.hero-photo-credit { margin-top: 8px; color: var(--muted); font-size: 12px; text-align: right; }
.race-bib {
  position: absolute;
  bottom: 22px;
  left: -19px;
  display: block;
  min-width: 190px;
  padding: 10px 14px 12px;
  background: var(--track-paper);
  color: var(--track-blue);
  box-shadow: 0 6px 24px #3816093b;
  text-decoration: none;
  transform: rotate(-6deg);
  transition: transform .3s var(--ease);
}
.race-bib:hover, .race-bib:focus-visible { transform: rotate(0) translateY(-3px); }
.race-bib:focus-visible { outline-color: var(--track-paper); }
.bib-label { display: flex; gap: 13px; align-items: center; justify-content: space-between; padding-bottom: 5px; border-bottom: 1px dashed currentColor; font-size: 12px; font-weight: 600; }
.race-bib strong { display: block; margin-top: 4px; font-size: 48px; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.race-bib small { font-size: .39em; letter-spacing: 0; }

.running-section {
  --ink: var(--track-paper);
  --accent: var(--orange);
  --muted: var(--track-muted);
  --rule: var(--track-rule);
  background: var(--track-blue);
  color: var(--ink);
}
.running-overview { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.35fr); gap: clamp(32px, 5vw, 72px); align-items: center; padding-block: clamp(58px, 6.2vw, 92px); }
.running-story p { max-width: 31ch; color: var(--muted); margin-top: 16px; }
.running-totals { display: flex; flex-wrap: wrap; gap: 12px 26px; margin-block: 24px 11px; }
.running-totals > div, .running-page-stats > div { display: grid; gap: 4px; }
.running-totals strong { font-size: clamp(30px, 3.2vw, 44px); line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.running-totals strong small, .running-page-stats strong small { font-size: .46em; letter-spacing: 0; }
.running-totals > div > span, .running-page-stats > div > span { color: var(--muted); font-size: 13px; }
.data-note { display: flex; align-items: baseline; gap: 7px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.status-dot { width: 7px; height: 7px; flex: none; background: var(--accent); border-radius: 50%; }

.chart-panel {
  --plot-surface: var(--surface);
  --bar: var(--accent);
  --bar-active: var(--ink);
  min-width: 0;
  padding: clamp(14px, 2.6vw, 32px);
  border: 1px solid var(--rule);
  background: var(--plot-surface);
}
.running-section .chart-panel { --plot-surface: var(--track-deep); --bar: var(--track-paper); --bar-active: var(--orange); }
.chart-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.segmented { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--rule); border-radius: 3px; }
.segmented button { min-height: 40px; padding: 0 clamp(8px, 1.05vw, 15px); border: 0; border-radius: 2px; background: transparent; color: var(--ink); font-size: 13px; font-weight: 600; }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--plot-surface); }
.segmented button:hover:not([aria-pressed="true"]) { text-decoration: underline; }
.segmented button:disabled { opacity: .65; cursor: default; text-decoration: none; }
.segmented button:focus-visible { outline-color: var(--ink); outline-offset: 2px; }
.distance-chart { height: clamp(190px, 18vw, 246px); margin-top: 26px; }
.inner-page .distance-chart { height: clamp(218px, 30vw, 310px); }
.chart-placeholder { color: var(--muted); }
.chart-plot { display: flex; gap: 10px; height: 100%; }
.chart-y-axis {
  display: flex;
  flex-direction: column;
  align-items: end;
  justify-content: space-between;
  min-width: 26px;
  height: calc(100% - 24px);
  color: var(--muted);
  font: 11px/1 ui-monospace, monospace;
  white-space: nowrap;
}
.chart-bars {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
  gap: clamp(3px, 1vw, 14px);
  flex: 1;
  min-width: 0;
}
.chart-bars::before {
  position: absolute;
  inset: 0 0 24px;
  border-block: 1px solid var(--rule);
  background: linear-gradient(var(--rule), var(--rule)) center / 100% 1px no-repeat;
  content: "";
}
.chart-column { display: grid; grid-template-rows: minmax(0, 1fr) 24px; min-width: 0; }
.chart-track { display: flex; align-items: end; justify-content: center; position: relative; }
.chart-bar {
  position: relative;
  display: grid;
  place-items: end stretch;
  width: 100%;
  height: 100%;
  max-width: 64px;
  padding: 0;
  border: 0;
  background: transparent;
}
.chart-bar::before { content: ""; display: block; height: var(--height); min-height: 2px; border-radius: 2px 2px 0 0; background: var(--bar); transform-origin: bottom; }
.chart-bar.current::before, .chart-bar:hover::before, .chart-bar:focus-visible::before { background: var(--bar-active); }
.chart-bar:focus-visible { outline-offset: 1px; z-index: 2; }
.chart-x-label { justify-self: center; align-self: end; font-size: 11px; line-height: 1.15; color: var(--muted); white-space: nowrap; }
.chart-tooltip {
  display: none;
  position: absolute;
  bottom: calc(var(--height) + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 3px 7px;
  background: var(--ink);
  color: var(--plot-surface);
  white-space: nowrap;
  font-size: 12px;
}
.chart-bar:hover .chart-tooltip, .chart-bar:focus-visible .chart-tooltip { display: block; }
.chart-column:first-child .chart-tooltip { left: 0; transform: none; }
.chart-column:last-child .chart-tooltip { left: auto; right: 0; transform: none; }
.chart-caption { display: flex; justify-content: space-between; gap: 12px; min-height: 2.5em; margin-top: 12px; color: var(--muted); font-size: 12px; }
.chart-caption > span:last-child { text-align: right; }
.chart-error { display: grid; align-items: center; color: var(--muted); }

.section-heading { margin-bottom: clamp(28px, 4vw, 48px); }
.list-heading { padding-block: 0 9px; color: var(--accent); font-size: 14px; }
.side-projects { margin-top: clamp(30px, 5vw, 56px); }
.work-entry, .writing-row {
  display: grid;
  grid-template-columns: minmax(0, .78fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  border-block: 1px solid var(--rule);
  padding: 22px 0;
  text-decoration: none;
}
.work-entry + .work-entry, .writing-row + .writing-row { border-top: 0; }
.work-entry h4 { font-size: clamp(31px, 4vw, 53px); line-height: 1.02; letter-spacing: -.04em; }
.work-entry p, .writing-row p { max-width: 53ch; color: var(--muted); }
.project-role, .writing-type, .writing-credit { font-size: 13px; color: var(--muted); }
.project-role { display: block; margin-top: 5px; }
.entry-arrow {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--accent);
  transition: background .25s var(--ease), color .25s var(--ease);
}
.entry-arrow svg { width: 20px; height: 20px; }
.work-entry:hover .entry-arrow, .writing-row:hover .entry-arrow { background: var(--track-blue); color: var(--track-paper); border-color: var(--track-blue); }
.work-entry:hover h4, .writing-row:hover h3 { color: var(--accent); }
.notes-section { background: var(--soft); }
.writing-row { grid-template-columns: minmax(115px, .38fr) minmax(0, 1fr) auto; align-items: start; }
.writing-row h3 { margin-bottom: 4px; font-size: clamp(22px, 2.6vw, 32px); line-height: 1.1; letter-spacing: -.025em; }
.writing-credit { display: block; margin-top: 6px; }
.contact-section { background: var(--orange); color: #1c2450; }
.contact-section::before {
  display: block;
  height: 16px;
  background: conic-gradient(from 90deg, var(--orange) 25%, #1c2450 0 50%, var(--orange) 0 75%, #1c2450 0) 0 0 / 16px 16px;
  content: "";
}
.contact-layout { display: grid; grid-template-columns: 1.25fr .75fr; gap: 30px; align-items: center; padding-block: clamp(50px, 7vw, 92px); }
.contact-layout h2 em { color: inherit; }
.contact-layout p { max-width: 31ch; margin-bottom: 16px; }
.contact-layout .button { background: #1c2450; }
.contact-layout .button:hover { background: var(--track-deep); }
.contact-layout .button:focus-visible { outline-color: #1c2450; }

.page-intro { padding-block: clamp(34px, 6vw, 74px) clamp(42px, 6vw, 70px); }
.back-link { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 14px; color: var(--accent); font-size: 14px; }
.page-intro p { max-width: 56ch; margin-top: 18px; font-size: clamp(17px, 1.8vw, 20px); }
.running-intro-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 20px; margin-top: 10px; }
.running-intro-meta .data-note { margin-top: 0; }
.page-intro > .button { margin-top: 22px; }
.running-page-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--rule); }
.running-page-stats > div { padding: clamp(14px, 3vw, 35px); }
.running-page-stats > div + div { border-left: 1px solid var(--rule); }
.running-page-stats strong { color: var(--accent); font-size: clamp(27px, 5.5vw, 72px); line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.data-table-details { margin-top: 20px; }
summary { width: fit-content; padding-block: 10px; cursor: pointer; color: var(--accent); font-weight: 600; }
table { width: 100%; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
caption { margin: 10px 0; color: var(--muted); text-align: left; }
th, td { padding: 9px 7px; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; }
.race-list { border-bottom: 1px solid var(--rule); }
.race-list article { display: grid; grid-template-columns: minmax(130px, .52fr) minmax(0, 1.25fr) 128px; align-items: baseline; gap: 14px; padding: 20px 0; border-top: 1px solid var(--rule); }
.race-list article > span { text-align: right; }
.race-list h3 { font-size: clamp(22px, 2.75vw, 35px); line-height: 1.1; }
.race-list p, .race-list time, .race-list article > span, .small-print { color: var(--muted); font-size: 14px; }
.race-list p { margin-top: 4px; }
.small-print { margin-top: 16px; }
.running-footnote, .about-bio { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(26px, 6vw, 85px); }
.running-footnote p + p, .prose p + p { margin-top: 15px; }
.about-details { padding-top: 0; }
.about-bio { border-top: 1px solid var(--rule); padding-top: clamp(24px, 4vw, 44px); }
.about-bio h2 { font-size: clamp(2.6rem, 4.6vw, 4rem); }
.about-social-links { display: flex; gap: inherit; }
.about-photo { margin-top: clamp(36px, 5vw, 70px); }
.about-photo img { width: 100%; height: auto; aspect-ratio: 2.4; object-fit: cover; object-position: center 62%; }
.about-photo figcaption { margin-top: 7px; color: var(--muted); font-size: 13px; }
.prose p { max-width: 65ch; }

.site-footer { display: flex; flex-wrap: wrap; gap: 18px 30px; align-items: center; justify-content: space-between; padding-block: 26px; }
.footer-links, .footer-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; font-size: 14px; }
.footer-links a { display: inline-flex; align-items: center; gap: 3px; min-height: 44px; }
.footer-bottom { color: var(--muted); }
[data-local-time] { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: no-preference) {
  .photo-window img { animation: photo-reveal .85s var(--ease) both; }
  .race-bib { animation: bib-settle .8s .12s var(--ease) backwards; }
  .chart-animate .chart-bar::before { animation: chart-rise .52s var(--ease) backwards; }
  @keyframes photo-reveal {
    from { transform: scale(1.045); clip-path: inset(0 0 4% 0); }
    to { transform: scale(1); clip-path: inset(0); }
  }
  @keyframes bib-settle {
    from { transform: translateY(9px) rotate(-10deg); }
    to { transform: translateY(0) rotate(-6deg); }
  }
  @keyframes chart-rise { from { transform: scaleY(.25); } }
}

@media (max-width: 850px) {
  .hero { gap: 30px; }
  .hero-copy h1 { font-size: clamp(2.8rem, 7.6vw, 4.6rem); }
  .hero-actions { gap: 8px 14px; }
  .running-overview { grid-template-columns: 1fr; }
  .running-story h2 br { display: none; }
  .running-story p { max-width: 50ch; }
  .chart-panel { max-width: none; }
}
@media (max-width: 700px) {
  .site-header { min-height: 68px; justify-content: space-between; gap: 10px; }
  .menu-toggle { display: grid; }
  .site-header nav {
    display: none;
    position: absolute;
    inset: calc(100% + 1px) 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--rule);
    box-shadow: 0 10px 24px #1c245026;
  }
  .site-header nav.is-open { display: flex; }
  .site-header nav a { padding: 11px 7px; }
  .site-header nav a + a { border-top: 1px solid var(--rule); }
  .hero { grid-template-columns: 1fr; gap: 29px; }
  .hero-copy h1 { font-size: clamp(2.85rem, 11.4vw, 5.1rem); margin-bottom: 16px; }
  .hero-actions { margin-top: 18px; }
  .photo-window { aspect-ratio: 1.14; }
  .race-bib { bottom: 14px; left: -7px; min-width: 139px; padding: 7px 10px 8px; }
  .race-bib strong { font-size: 36px; }
  .bib-label { font-size: 11px; }
  .work-entry { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .work-entry p { grid-column: 1; grid-row: 2; }
  .work-entry .entry-arrow { grid-column: 2; grid-row: 1 / span 2; }
  .writing-row { grid-template-columns: 1fr auto; gap: 5px 12px; }
  .writing-row > div { grid-column: 1; grid-row: 2; }
  .writing-row .entry-arrow { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .contact-layout, .about-bio, .running-footnote { grid-template-columns: 1fr; gap: 22px; }
  .about-bio .hero-actions { column-gap: 10px; }
  .about-photo img { aspect-ratio: 1.7; object-position: center 65%; }
  .running-page-stats > div { padding-inline: 8px; }
  .race-list article { grid-template-columns: 1fr auto; gap: 4px 8px; }
  .race-list article div { grid-column: 1 / -1; grid-row: 2; }
  .race-list article > span { grid-column: 2; grid-row: 1; }
}
@media (max-width: 560px) {
  .chart-x-label { font-size: 10px; }
  .chart-plot[data-period="weeks"] .chart-column:nth-child(even) .chart-x-label { visibility: hidden; }
}
@media (max-width: 380px) {
  .chart-plot[data-period="months"] .chart-column:nth-child(even) .chart-x-label { visibility: hidden; }
  .chart-panel { padding-inline: 10px; }
  .chart-plot { gap: 4px; }
  .chart-y-axis { min-width: 20px; font-size: 10px; }
  .segmented button { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
