:root {
  color-scheme: light;
  --font-serif:
    "source-han-serif-sc", "Source Han Serif SC", "Source Han Serif CN",
    "Source Han Serif TC", "Source Han Serif TW", "Source Han Serif",
    "PingFang SC", "Hiragino Sans GB", "Songti SC", "Microsoft YaHei", serif;
  --font-sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", Consolas, "Liberation Mono", Menlo, Courier, monospace;
  --color-text: #333;
  --color-text-soft: hsl(0, 0%, 30%);
  --color-muted: #828282;
  --color-border: #e8e8e8;
  --color-rule: #d8d8d8;
  --color-bg: #fff;
  --color-surface: #f7f7f7;
  --content-width: 800px;
  --article-width: 700px;
  --space: 40px;
  --space-half: 20px;
  --space-rhythm: 26.6666666667px;
  --font-base: 17px;
  --font-meta: 11.9px;
  --font-chart: 11px;
  --font-data: 1.28rem;
  --heat-0: #f7f7f7;
  --heat-1: #e8e8e8;
  --heat-2: #cfcfcf;
  --heat-3: #9a9a9a;
  --heat-4: #555;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-serif);
  font-size: var(--font-base);
  font-feature-settings: "kern" 1;
  font-kerning: normal;
  line-height: 2;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

body,
h1,
h2,
h3,
p,
dl,
dt,
dd,
figure {
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--color-bg);
}

.running-page {
  width: min(var(--article-width), calc(100% - var(--space) * 2));
  margin: 0 auto;
  padding: 48px 0 84px;
}

.section {
  padding: 36px 0;
  border-top: 1px solid var(--color-border);
}

.section:first-child {
  border-top: 0;
}

.eyebrow,
.activity-type-summary,
.heatmap-summary,
.section-note,
.metric-label,
.peak-item dt,
.route-meta,
.route-stats,
.route-tags span,
.signal-main p,
.signal-primary small,
.signal-metrics dt {
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: var(--font-meta);
  line-height: 1.55;
}

.eyebrow {
  color: var(--color-muted);
  margin: 0 0 8px;
}

.eyebrow a {
  padding-right: 2px;
  color: var(--color-muted);
  text-decoration: none;
}

.eyebrow a:hover,
.eyebrow a:focus-visible {
  color: var(--color-text-soft);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.hero {
  min-height: auto;
  padding-top: 0;
}

.hero h1 {
  margin-bottom: 10px;
  font-size: 1.82em;
  font-weight: 700;
  line-height: 1.4;
}

.lede {
  max-width: 34em;
  margin-bottom: 22px;
  color: var(--color-text-soft);
  font-size: 1em;
}

.hero-metrics,
.peaks-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px 24px;
  padding: 14px 0;
}

.metric,
.metric-item {
  min-width: 0;
  background: var(--color-bg);
}

.metric-value {
  display: flex;
  gap: 0.18em;
  align-items: baseline;
  font-family: var(--font-sans);
  font-size: var(--font-data);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.metric-unit {
  color: var(--color-muted);
  font-size: 0.62em;
  font-weight: 400;
}

.metric-label {
  display: block;
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.peak-item {
  min-width: 0;
}

.peak-item dd {
  margin-top: 4px;
  min-width: 0;
}

.activity-type-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  align-items: baseline;
  margin-top: 10px;
}

.activity-type-summary[hidden] {
  display: none;
}

.activity-context-label {
  flex: 0 0 auto;
  color: inherit;
}

.activity-context-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 0;
  min-width: 0;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.activity-context-item {
  display: inline-flex;
  gap: 4px;
  align-items: baseline;
  min-width: 0;
  white-space: nowrap;
}

.activity-context-item + .activity-context-item::before {
  content: "·";
  margin: 0 8px;
  color: var(--color-muted);
}

.activity-context-item dt {
  flex: 0 0 auto;
  overflow: hidden;
  color: inherit;
  text-overflow: ellipsis;
}

.activity-context-item dd {
  flex: 0 0 auto;
  margin: 0;
  overflow: hidden;
  color: var(--color-text-soft);
  text-overflow: ellipsis;
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.22em;
  font-weight: 700;
  line-height: 1.6;
}

.section-heading.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(12em, 18em);
  gap: 16px;
  align-items: start;
}

.section-note {
  margin: 0;
}

.section-heading > .section-note {
  margin-top: 8px;
}

.running-signals {
  display: grid;
  gap: 0;
}

.signal-card {
  display: grid;
  grid-template-columns: minmax(8em, 1fr) minmax(7em, 0.65fr) minmax(12em, 1.1fr) minmax(6.5em, 0.55fr);
  gap: var(--space-half);
  align-items: center;
  padding: 16px 0;
}

.signal-card + .signal-card {
  border-top: 1px solid var(--color-border);
}

.signal-main h3 {
  margin-bottom: 3px;
  font-size: 1.125em;
  line-height: 1.55;
}

.signal-main p {
  max-width: 22em;
}

.signal-primary-value {
  display: block;
  font-family: var(--font-sans);
  font-size: var(--font-data);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.signal-primary small {
  display: block;
  margin-top: 4px;
}

.signal-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
}

.signal-metrics dd {
  font-family: var(--font-sans);
  font-size: 0.86rem;
  line-height: 1.45;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.signal-metrics dt {
  text-align: right;
  white-space: nowrap;
}

.signal-metric {
  cursor: help;
}

.signal-sparkline {
  display: block;
  width: 100%;
  height: auto;
  cursor: help;
}

.signal-sparkline polyline,
.signal-sparkline-empty line {
  fill: none;
  stroke: var(--color-text);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.signal-sparkline-empty line {
  stroke: var(--color-border);
}

.yearly-trend {
  padding-top: 4px;
}

.chart-frame {
  overflow-x: auto;
  padding-bottom: 6px;
}

.trend-svg {
  display: block;
  width: 100%;
  height: auto;
}

.trend-svg[data-scrollable="true"] {
  min-width: var(--chart-min-width);
}

.trend-axis,
.trend-grid {
  stroke: var(--color-border);
  stroke-width: 1;
}

.trend-bar {
  fill: var(--color-surface);
  stroke: var(--color-border);
  stroke-width: 1;
  transition: fill 140ms ease;
}

.trend-point {
  fill: var(--color-bg);
  stroke: var(--color-text);
  stroke-width: 1.5;
}

.trend-line {
  fill: none;
  stroke: var(--color-text);
  stroke-width: 1.5;
}

.trend-label,
.trend-value {
  fill: var(--color-muted);
  font-family: var(--font-sans);
  font-size: var(--font-chart);
}

.trend-value {
  fill: var(--color-text-soft);
}

.trend-year:hover .trend-bar,
.trend-year:focus-visible .trend-bar {
  fill: #eee;
}

.heatmap {
  overflow-x: auto;
  padding-bottom: 6px;
}

.heatmap-summary {
  margin-bottom: 10px;
}

.heatmap-shell {
  --heat-axis-gap: 7px;
  --heat-cell-gap: 2px;
  --heat-cell-size: 10px;
  --heat-day-width: 10px;
  width: max-content;
  min-width: 100%;
}

.heat-months {
  display: grid;
  grid-template-columns: repeat(var(--weeks), var(--heat-cell-size));
  column-gap: var(--heat-cell-gap);
  margin-left: calc(var(--heat-day-width) + var(--heat-axis-gap));
  margin-bottom: 7px;
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: var(--font-meta);
  line-height: 1.2;
}

.heatmap-body {
  display: flex;
  gap: var(--heat-axis-gap);
  align-items: start;
}

.heat-days {
  display: grid;
  grid-template-rows: repeat(7, var(--heat-cell-size));
  row-gap: var(--heat-cell-gap);
  width: var(--heat-day-width);
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: 10px;
  line-height: 1;
  text-align: center;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(var(--weeks), var(--heat-cell-size));
  grid-template-rows: repeat(7, var(--heat-cell-size));
  grid-auto-flow: column;
  gap: var(--heat-cell-gap);
  width: max-content;
}

.heat-cell {
  width: var(--heat-cell-size);
  height: var(--heat-cell-size);
  background: var(--heat-0);
  transition: outline-color 120ms ease;
}

.heat-cell[data-level="1"] {
  background: var(--heat-1);
}

.heat-cell[data-level="2"] {
  background: var(--heat-2);
}

.heat-cell[data-level="3"] {
  background: var(--heat-3);
}

.heat-cell[data-level="4"] {
  background: var(--heat-4);
}

.heat-cell:hover,
.heat-cell:focus-visible {
  outline: 2px solid var(--color-muted);
  outline-offset: 1px;
}

.heat-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: var(--font-meta);
  line-height: 1.2;
}

.heat-legend span:not(.legend-label) {
  width: var(--heat-cell-size);
  height: var(--heat-cell-size);
  border: 1px solid var(--color-border);
  background: var(--level);
}

.route-gallery {
  display: grid;
  gap: 18px;
}

.route-card {
  display: grid;
  grid-template-columns: 8em minmax(0, 1fr);
  gap: var(--space-half);
  padding: 18px 0;
  border-top: 1px solid var(--color-border);
}

.route-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.route-map {
  width: 100%;
  height: 86px;
}

.route-line {
  fill: none;
  stroke: var(--color-text);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-opacity: 0.32;
  stroke-width: 1.1;
}

.route-card-dense .route-line {
  stroke-opacity: 0.14;
  stroke-width: 0.58;
}

.route-card h3 {
  margin-bottom: 2px;
  font-size: 1.125em;
  font-weight: 700;
  line-height: 1.55;
}

.route-meta,
.route-description,
.route-stats {
  margin: 0;
}

.route-description {
  margin-top: 9px;
  color: var(--color-text-soft);
  line-height: 1.8;
}

.route-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
}

.route-stats span {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.route-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.route-tags span::before {
  content: "#";
}

.loading,
.loading-block {
  min-height: 104px;
}

.loading::after,
.loading-block::after {
  content: "Loading...";
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: var(--font-meta);
}

.error-panel {
  margin-bottom: var(--space-rhythm);
  padding: 12px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

@media screen and (max-width: 769px) {
  .running-page {
    width: min(calc(100% - var(--space)), calc(var(--content-width) - var(--space)));
    padding: var(--space-half) 0 4em;
  }

  .section {
    padding: 24px 0;
  }

  .hero h1 {
    font-size: 1.65em;
  }

  .hero-metrics,
  .peaks-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .running-signals,
  .section-heading.split {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .signal-card {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .signal-metrics {
    justify-content: start;
  }

  .signal-metrics dt,
  .signal-metrics dd {
    text-align: left;
  }

  .signal-sparkline {
    max-width: 12em;
  }

  .route-card {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .route-map {
    max-width: 10em;
  }
}

@media screen and (max-width: 480px) {
  .signal-metrics {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .metric-value,
  .peak-item .metric-value {
    font-size: 1.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
