/* brahms.run — design system */

/* ——— Entrance animations ——— */
@keyframes fadeUp   { from { opacity:0; transform:translateY(22px); } to { opacity:1; transform:none; } }
@keyframes fadeRight{ from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:none; } }

/* Hero — fires on page load */
.hero-meta    { animation: fadeUp    0.6s cubic-bezier(0.22,1,0.36,1)  0ms   both; }
.hero-left h1 { animation: fadeUp    0.7s cubic-bezier(0.22,1,0.36,1)  90ms  both; }
.hero-lede    { animation: fadeUp    0.6s cubic-bezier(0.22,1,0.36,1)  230ms both; }
.hero-actions { animation: fadeUp    0.6s cubic-bezier(0.22,1,0.36,1)  390ms both; }
.hero-portrait{ animation: fadeRight 0.8s cubic-bezier(0.22,1,0.36,1)  160ms both; }

/* Scroll-triggered */
.scroll-fade {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.22,1,0.36,1),
              transform 0.6s cubic-bezier(0.22,1,0.36,1);
}
.scroll-fade.in-view { opacity: 1; transform: none; }

:root {
  --orange: #FC4C02;          /* Strava-inspired signal orange */
  --orange-dim: #D43E00;
  --orange-wash: rgba(252,76,2,0.08);

  /* LIGHT (default) */
  --bg: #FAF7F2;
  --bg-elev: #FFFFFF;
  --bg-sunken: #F1EBDF;
  --ink: #1A1A1A;
  --ink-2: #3D3A36;
  --muted: #7A736A;
  --hair: rgba(26,26,26,0.09);
  --hair-strong: rgba(26,26,26,0.18);
  --grid-line: rgba(26,26,26,0.05);

  --easy: #6B8E6B;
  --workout: var(--orange);
  --long: #3A5A8C;
  --race: #B91C1C;

  --ff-sans: "IBM Plex Sans", system-ui, sans-serif;
  --ff-mono: "IBM Plex Mono", ui-monospace, monospace;
  --ff-serif: "Instrument Serif", Georgia, serif;

  --maxw: 1180px;
  --pad: clamp(16px, 3vw, 32px);
}

[data-theme="dark"] {
  --bg: #0E0E0E;
  --bg-elev: #171716;
  --bg-sunken: #080808;
  --ink: #F2EDE3;
  --ink-2: #C9C2B3;
  --muted: #8A8278;
  --hair: rgba(242,237,227,0.09);
  --hair-strong: rgba(242,237,227,0.22);
  --grid-line: rgba(242,237,227,0.05);

  --orange: #FF5A1F;
  --orange-wash: rgba(255,90,31,0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ff-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s ease, color 0.4s ease;
}

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

/* ——— Grain overlay ——— */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
  background-image:
    radial-gradient(circle at 20% 10%, var(--orange-wash), transparent 55%),
    radial-gradient(circle at 90% 90%, var(--orange-wash), transparent 45%);
}
[data-theme="dark"] body::before { opacity: 0.7; }

.page {
  position: relative;
  z-index: 2;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* ——— Top chrome ——— */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 16px;
  border-bottom: 1px solid var(--hair);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--ff-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
}
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-wash);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.75; }
}
.nav {
  display: flex; gap: 22px;
  font-family: var(--ff-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.nav a { transition: color 0.2s; position: relative; }
.nav a:hover { color: var(--orange); }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -6px;
  height: 1px; background: var(--orange);
  transition: right 0.3s ease;
}
.nav a:hover::after { right: 0; }

.theme-toggle {
  background: none; border: 1px solid var(--hair-strong);
  color: var(--ink); padding: 6px 10px;
  font-family: var(--ff-mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer; border-radius: 999px;
  transition: all 0.2s;
}
.theme-toggle:hover { border-color: var(--orange); color: var(--orange); }

/* ——— Hero ——— */
.hero {
  display: grid;
  grid-template-columns: 1.8fr 0.6fr;
  gap: 40px;
  padding: 56px 0 40px;
  align-items: center;
}
.hero-meta {
  font-family: var(--ff-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.hero-meta .tag { color: var(--orange); }
.hero-meta .tag::before { content: "● "; }

.hero h1 {
  font-family: var(--ff-serif);
  font-weight: 400;
  font-size: clamp(56px, 9vw, 120px);
  line-height: 0.92;
  letter-spacing: -0.02em;
  margin: 0 0 28px;
}
.hero h1 em {
  font-style: italic;
  color: var(--orange);
}
.hero-lede {
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 48ch;
  margin: 0 0 32px;
  text-wrap: pretty;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--hair-strong);
  border-radius: 999px;
  font-family: var(--ff-mono); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.1em;
  background: var(--bg-elev);
  cursor: pointer; transition: all 0.2s;
}
.btn:hover { border-color: var(--orange); color: var(--orange); transform: translateY(-1px); }
.btn.primary {
  background: var(--orange); color: white; border-color: var(--orange);
}
.btn.primary:hover { background: var(--orange-dim); color: white; }
.btn .arrow { transition: transform 0.2s; }
.btn:hover .arrow { transform: translate(2px, -2px); }

.hero-portrait {
  position: relative;
}
.hero-portrait img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  border-radius: 2px;
  filter: saturate(0.95);
  transition: filter 0.3s;
}
.hero-portrait:hover img { filter: saturate(1.1); }
.hero-portrait .frame-mark {
  position: absolute; top: -12px; left: -12px;
  font-family: var(--ff-mono); font-size: 10px;
  letter-spacing: 0.2em; color: var(--muted);
  text-transform: uppercase;
}
.hero-portrait .frame-num {
  position: absolute; bottom: -12px; left: 0; right: 0;
  font-family: var(--ff-mono); font-size: 10px;
  letter-spacing: 0.2em; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ——— Section scaffolding ——— */
.section {
  padding: 60px 0;
  border-top: 1px solid var(--hair);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-family: var(--ff-serif);
  font-weight: 400;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1;
  margin: 0;
  letter-spacing: -0.01em;
}
.section-head .tag {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-head .tag b { color: var(--orange); font-weight: 400; }

/* ——— Totals ——— */
.totals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--hair);
  border-radius: 2px;
  overflow: hidden;
}
.total-cell {
  padding: 26px 24px;
  border-right: 1px solid var(--hair);
  position: relative;
  background: var(--bg-elev);
  transition: background 0.25s, opacity 0.6s cubic-bezier(0.22,1,0.36,1), transform 0.6s cubic-bezier(0.22,1,0.36,1);
  opacity: 0;
  transform: translateY(22px);
}
.totals.in-view .total-cell { opacity: 1; transform: none; }
.totals.in-view .total-cell:nth-child(1) { transition-delay: 0ms; }
.totals.in-view .total-cell:nth-child(2) { transition-delay: 80ms; }
.totals.in-view .total-cell:nth-child(3) { transition-delay: 160ms; }
.totals.in-view .total-cell:nth-child(4) { transition-delay: 240ms; }
.total-cell:last-child { border-right: none; }
.total-cell:hover { background: var(--orange-wash); }
.total-cell .label {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.total-cell .val {
  font-family: var(--ff-serif);
  font-size: 46px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.total-cell .unit {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--muted);
  margin-left: 6px;
}
.total-cell .sub {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 10px;
  letter-spacing: 0.04em;
}

/* Goal progress bar */
.goal-row { margin-top: 24px; display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; }
.goal-bar {
  height: 8px; background: var(--bg-sunken);
  border: 1px solid var(--hair);
  position: relative; overflow: hidden; border-radius: 999px;
}
.goal-bar .fill {
  position: absolute; inset: 0 auto 0 0;
  background: var(--orange);
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.goal-bar .tick {
  position: absolute; top: -4px; bottom: -4px; width: 1px;
  background: var(--hair-strong);
}
.goal-label {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}
.goal-label b { color: var(--ink); font-weight: 600; }

/* ——— Recent runs ——— */
.runs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--hair);
  background: var(--bg-elev);
}
.run {
  padding: 20px 22px;
  border-right: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  display: grid;
  grid-template-columns: 72px 1fr 88px;
  gap: 16px;
  align-items: center;
  position: relative;
  transition: background 0.2s;
  cursor: pointer;
}
.run:nth-child(2n) { border-right: none; }
.run:hover { background: var(--bg-sunken); }
.run .map-thumb {
  width: 72px; height: 72px;
  background: var(--bg-sunken);
  border: 1px solid var(--hair);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.run .map-thumb svg { display: block; width: 100%; height: 100%; }
.run .map-thumb path {
  fill: none; stroke: var(--orange); stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 600; stroke-dashoffset: 600;
  animation: draw 1.4s ease forwards;
}
.run:hover .map-thumb path { stroke-width: 2.4; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.run .run-meta {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.run .run-date {
  font-family: var(--ff-mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
  display: flex; gap: 10px; align-items: center;
}
.run .run-date .badge {
  display: inline-block; padding: 2px 6px;
  border: 1px solid var(--hair-strong);
  border-radius: 2px; font-size: 9px;
}
.run .run-date .badge.workout { border-color: var(--orange); color: var(--orange); }
.run .run-date .badge.long { border-color: var(--long); color: var(--long); }
.run .run-date .badge.easy { border-color: var(--easy); color: var(--easy); }
.run .run-name {
  font-family: var(--ff-serif);
  font-size: 20px; line-height: 1.1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.run .run-nums {
  font-family: var(--ff-mono); font-size: 11px;
  color: var(--muted); letter-spacing: 0.02em;
}
.run .run-nums b { color: var(--ink); font-weight: 500; }
.run .run-kudos {
  text-align: right;
  font-family: var(--ff-mono); font-size: 11px;
  color: var(--muted);
  display: flex; flex-direction: column; gap: 4px;
  align-items: flex-end;
}
.run .run-kudos .big {
  font-family: var(--ff-serif); font-size: 28px;
  color: var(--ink); line-height: 1;
}

/* ——— Weekly chart ——— */
.chart-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--hair);
  padding: 28px 28px 16px;
  position: relative;
}
.chart {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 8px;
  align-items: end;
  height: 240px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--hair);
  position: relative;
}
.chart .gridline {
  position: absolute; left: 0; right: 0;
  border-top: 1px dashed var(--grid-line);
  pointer-events: none;
  font-family: var(--ff-mono); font-size: 9px; color: var(--muted);
}
.chart .gridline span { position: absolute; left: -28px; top: -6px; }
.bar {
  position: relative;
  background: var(--orange-wash);
  border-top: 2px solid var(--orange);
  transition: all 0.25s;
  cursor: pointer;
}
.bar:hover { background: var(--orange); }
.bar:hover .bar-val { opacity: 1; transform: translateY(-4px); }
.bar-val {
  position: absolute; top: -18px; left: 50%;
  transform: translate(-50%, 0);
  font-family: var(--ff-mono); font-size: 10px;
  color: var(--ink); opacity: 0;
  transition: all 0.2s;
  pointer-events: none;
  white-space: nowrap;
}
.chart-x {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 8px;
  padding-top: 10px;
  font-family: var(--ff-mono); font-size: 10px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.04em;
}

/* ——— Heatmap / map ——— */
.map-card {
  background: var(--bg-elev);
  border: 1px solid var(--hair);
  position: relative;
  overflow: hidden;
  height: 560px;
}
.map-card .overlay {
  position: absolute; left: 18px; top: 18px;
  font-family: var(--ff-mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
  z-index: 1000;
}
.map-card .overlay b { color: var(--orange); }
.map-card .coord {
  position: absolute; right: 18px; bottom: 40px;
  font-family: var(--ff-mono); font-size: 10px;
  color: var(--muted); text-align: right;
  z-index: 1000;
}
.map-shoe-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px;
  background: var(--bg-elev);
  border-top: 1px solid var(--hair);
  font-family: var(--ff-mono); font-size: 11px;
  letter-spacing: 0.08em;
  z-index: 1000;
  overflow: hidden;
}
.shoe-label {
  flex-shrink: 0;
  text-transform: uppercase; letter-spacing: 0.16em;
  font-size: 10px; color: var(--muted);
}
.shoe-ticker-wrap {
  flex: 1; overflow: hidden;
}
.shoe-ticker {
  display: inline-flex; gap: 40px; white-space: nowrap;
}
.shoe-ticker.scrolling {
  animation: shoe-scroll 18s linear infinite;
}
@keyframes shoe-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.shoe-item { color: var(--ink); }
.shoe-mi { color: var(--orange); margin-left: 10px; }

/* ——— Race filter ——— */
.race-filters {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 20px;
}
.race-filter {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.race-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px;
  font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--hair); border-radius: 2px;
  background: transparent; color: var(--muted);
  cursor: pointer; transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.race-tab:hover { color: var(--ink); border-color: var(--ink); }
.race-tab.active {
  background: var(--orange); border-color: var(--orange); color: #fff;
}
.race-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 15px; padding: 0 3px;
  font-size: 9px; border-radius: 2px; line-height: 1;
  background: rgba(0,0,0,0.12);
}
.race-tab:not(.active) .race-tab-count { background: var(--bg-sunken); }

/* ——— Races ——— */
.race-table tbody tr.race-hidden { display: none; }
.race-table tbody tr.race-entering {
  animation: raceIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes raceIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}
.race-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.race-table th {
  text-align: left;
  font-family: var(--ff-mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-weight: 500;
  padding: 10px 14px; border-bottom: 1px solid var(--hair);
  background: var(--bg-sunken);
}
.race-table td {
  padding: 16px 14px;
  border-bottom: 1px solid var(--hair);
  font-family: var(--ff-mono); font-size: 13px;
  vertical-align: middle;
  transition: background 0.2s;
}
.race-table tbody tr { cursor: pointer; transition: background 0.2s; }
.race-table tbody tr:hover td { background: var(--bg-sunken); }
.race-table .race-name {
  font-family: var(--ff-serif); font-size: 20px;
  letter-spacing: -0.01em;
}
.race-table .race-name.pr::after {
  content: "PR";
  display: inline-block; margin-left: 8px;
  padding: 2px 6px; font-family: var(--ff-mono); font-size: 9px;
  letter-spacing: 0.14em;
  background: var(--orange); color: white;
  border-radius: 2px; vertical-align: 3px;
}
.race-table .time { font-weight: 500; color: var(--ink); }
.dist-pill {
  display: inline-block; padding: 3px 8px;
  border: 1px solid var(--hair-strong); border-radius: 2px;
  font-size: 10px; letter-spacing: 0.12em;
}

.upcoming {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0;
  border: 1px solid var(--hair);
  border-left: 3px solid var(--orange);
  background: var(--bg-elev);
  margin-top: 18px;
  overflow: hidden;
  position: relative;
}
.upcoming::after {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, var(--orange), transparent 60%);
  opacity: 0.5;
}
.upcoming-item {
  padding: 22px;
  border-right: 1px solid var(--hair);
  position: relative;
  transition: background 0.2s;
  animation: upcomingIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes upcomingIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.upcoming-item:last-child { border-right: none; }
.upcoming-item:hover { background: var(--orange-wash); }
.upcoming-item .countdown {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--ff-mono); font-size: 10px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--orange);
  margin-bottom: 12px;
}
.countdown-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--orange); flex-shrink: 0;
  animation: pulseDot 2s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.35; transform: scale(0.7); }
}
.countdown-days {
  font-size: 28px; font-family: var(--ff-mono); font-weight: 600;
  letter-spacing: -0.02em; color: var(--orange); line-height: 1;
  display: block; margin-bottom: 4px;
}
.upcoming-item .name {
  font-family: var(--ff-serif); font-size: 22px; line-height: 1.1;
  margin-bottom: 8px;
}
.upcoming-item .meta {
  font-family: var(--ff-mono); font-size: 11px; color: var(--muted);
}
.upcoming-item .goal {
  margin-top: 14px; font-family: var(--ff-mono); font-size: 11px;
  padding-top: 10px; border-top: 1px dashed var(--hair-strong);
}
.upcoming-item .goal b { color: var(--orange); font-weight: 500; }

/* ——— PRs strip ——— */
.prs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--hair); background: var(--bg-elev); }
.pr { padding: 22px 24px; border-right: 1px solid var(--hair); transition: background 0.2s; }
.pr:last-child { border-right: none; }
.pr:hover { background: var(--orange-wash); }
.pr .d { font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.pr-medal { font-size: 18px; margin-bottom: 6px; transition: transform 0.2s; }
.pr:hover .pr-medal { transform: scale(1.2) rotate(-8deg); }
.pr .t { font-family: var(--ff-serif); font-size: 38px; line-height: 1; letter-spacing: -0.02em; }
.pr .w { font-family: var(--ff-mono); font-size: 11px; color: var(--muted); margin-top: 8px; }

/* ——— Segment PRs ——— */
.seg-prs {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--hair);
  background: var(--bg-elev);
}
.seg-pr {
  display: grid;
  grid-template-columns: 260px 1fr;
  border-bottom: 1px solid var(--hair);
  transition: background 0.2s;
  min-height: 220px;
}
.seg-pr:last-child { border-bottom: none; }
.seg-pr:hover { background: var(--orange-wash); }
.seg-map-wrap {
  border-right: 1px solid var(--hair);
  overflow: hidden;
  position: relative;
}
.seg-map {
  width: 100%;
  height: 100%;
  min-height: 180px;
}
.seg-body {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}
.seg-header { display: flex; flex-direction: column; gap: 4px; }
.seg-name {
  font-family: var(--ff-serif);
  font-size: 22px;
  line-height: 1.1;
  color: var(--fg);
}
.seg-location {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.seg-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--hair);
  flex: 1;
}
.seg-stat {
  padding: 14px 16px;
  border-right: 1px solid var(--hair);
}
.seg-stat:last-child { border-right: none; }
.seg-stat-label {
  font-family: var(--ff-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.seg-stat-val {
  font-family: var(--ff-serif);
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.seg-stat-unit {
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0;
}
.seg-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-badge {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 2px;
}
.seg-badge.legend { background: var(--orange); color: #fff; }
.seg-badge.efforts { background: var(--hair); color: var(--muted); }
.seg-badge.date { background: var(--hair); color: var(--muted); }
@media (max-width: 700px) {
  .seg-pr { grid-template-columns: 1fr; }
  .seg-map-wrap { border-right: none; border-bottom: 1px solid var(--hair); }
  .seg-map { min-height: 200px; }
}

/* ——— Affiliations strip ——— */
.affiliations {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  border: 1px solid var(--hair);
  background: var(--bg-elev);
}
.affil-item {
  padding: 20px 20px;
  border-right: 1px solid var(--hair);
  position: relative; overflow: hidden;
  transition: background 0.2s, transform 0.22s, box-shadow 0.22s;
  animation: affilin 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.affil-item:nth-child(1) { animation-delay: 0ms; }
.affil-item:nth-child(2) { animation-delay: 60ms; }
.affil-item:nth-child(3) { animation-delay: 120ms; }
.affil-item:nth-child(4) { animation-delay: 180ms; }
.affil-item:nth-child(5) { animation-delay: 240ms; }
@keyframes affilin {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.affil-item:last-child { border-right: none; }
.affil-item:hover {
  background: var(--orange-wash);
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  z-index: 1;
}
.affil-num-bg {
  position: absolute; right: 10px; bottom: -6px;
  font-size: 68px; font-family: var(--ff-mono); font-weight: 600;
  color: var(--orange); opacity: 0.06; line-height: 1;
  pointer-events: none; user-select: none;
  transition: opacity 0.3s, transform 0.3s;
}
.affil-item:hover .affil-num-bg { opacity: 0.12; transform: scale(1.06); }
.affil-logo {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover; display: block; margin-bottom: 12px;
  border: 1px solid var(--hair);
  transition: transform 0.2s, box-shadow 0.2s;
}
.affil-item:hover .affil-logo {
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.affil-num {
  font-family: var(--ff-mono);
  font-size: 10px; letter-spacing: 0.16em;
  color: var(--muted); margin-bottom: 8px;
}
.affil-name {
  font-family: var(--ff-serif);
  font-size: 18px; line-height: 1.15;
  margin-bottom: 6px; letter-spacing: -0.01em;
}
body.variant-dashboard .affil-name {
  font-family: var(--ff-sans); font-weight: 600;
  font-size: 14px; letter-spacing: -0.01em;
}
.affil-note {
  font-family: var(--ff-mono);
  font-size: 11px; color: var(--muted); line-height: 1.5;
}
@media (max-width: 900px) {
  .affiliations { grid-template-columns: repeat(2, 1fr); }
  .affil-item:nth-child(2n) { border-right: none; }
  .affil-item { border-bottom: 1px solid var(--hair); }
}

/* ——— Journal / about ——— */
.journal {
  display: grid; grid-template-columns: 3fr 2fr; gap: 40px;
  padding: 60px 0;
  border-top: 1px solid var(--hair);
}
.journal h2 {
  font-family: var(--ff-serif); font-weight: 400;
  font-size: 40px; line-height: 1; margin: 0 0 24px;
  letter-spacing: -0.01em;
}
.journal p {
  font-size: 17px; line-height: 1.65; color: var(--ink-2);
  max-width: 58ch; margin: 0 0 20px;
  text-wrap: pretty;
}
.journal .sig {
  font-family: var(--ff-serif); font-style: italic;
  font-size: 24px; margin-top: 16px; color: var(--orange);
}
.quick-facts {
  font-family: var(--ff-mono); font-size: 13px;
  display: flex; flex-direction: column; gap: 0;
}
.qf-row {
  display: grid; grid-template-columns: 1fr 1fr;
  padding: 14px 0; border-bottom: 1px solid var(--hair);
  gap: 14px;
}
.qf-row:first-child { border-top: 1px solid var(--hair); }
.qf-row .k { color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.14em; }
.qf-row .v { text-align: right; color: var(--ink); }

/* ——— Footer ——— */
.foot {
  padding: 60px 0 40px;
  border-top: 1px solid var(--hair);
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 20px;
  font-family: var(--ff-mono); font-size: 11px;
  letter-spacing: 0.08em; color: var(--muted);
  text-transform: uppercase;
}
.foot .links { display: flex; gap: 20px; flex-wrap: wrap; }
.foot a:hover { color: var(--orange); }
.foot .wave { color: var(--orange); font-style: italic; text-transform: none; letter-spacing: 0; font-family: var(--ff-serif); font-size: 16px; }

/* ——— Tweaks panel ——— */
.tweaks {
  position: fixed; right: 20px; bottom: 20px;
  z-index: 30;
  background: var(--bg-elev);
  border: 1px solid var(--hair-strong);
  padding: 16px;
  width: 240px;
  font-family: var(--ff-mono); font-size: 11px;
  display: none;
  box-shadow: 0 18px 40px rgba(0,0,0,0.12);
}
.tweaks.open { display: block; }
.tweaks h4 {
  margin: 0 0 12px; font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
}
.tweaks label { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; cursor: pointer; }
.tweaks .opt-row { display: flex; gap: 6px; margin-top: 4px; }
.tweaks .opt-row button {
  flex: 1; padding: 6px 8px; border: 1px solid var(--hair-strong);
  background: var(--bg); color: var(--ink);
  font-family: var(--ff-mono); font-size: 10px;
  letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer; transition: all 0.15s;
}
.tweaks .opt-row button.active {
  background: var(--orange); color: white; border-color: var(--orange);
}

/* ——— Dashboard variant ——— */
body.variant-dashboard .hero h1 {
  font-family: var(--ff-sans);
  font-weight: 700;
  font-size: clamp(48px, 7vw, 88px);
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
body.variant-dashboard .hero h1 em {
  font-style: normal; color: var(--orange);
}
body.variant-dashboard .section-head h2,
body.variant-dashboard .journal h2 {
  font-family: var(--ff-sans); font-weight: 700;
  letter-spacing: -0.02em; text-transform: uppercase;
  font-size: clamp(24px, 3.5vw, 38px);
}
body.variant-dashboard .run .run-name,
body.variant-dashboard .upcoming-item .name,
body.variant-dashboard .club .name,
body.variant-dashboard .race-table .race-name {
  font-family: var(--ff-sans); font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
}
body.variant-dashboard .total-cell .val,
body.variant-dashboard .pr .t,
body.variant-dashboard .journal p {
  font-family: var(--ff-sans);
}

/* ——— Easter egg ——— */
.runner-egg {
  position: fixed; bottom: 20px; left: -80px; z-index: 100;
  font-size: 48px; pointer-events: none;
  animation: run-across 6s linear forwards;
}
@keyframes run-across {
  0% { left: -80px; transform: translateY(0) scaleX(1); }
  50% { transform: translateY(-10px) scaleX(1); }
  100% { left: calc(100vw + 80px); transform: translateY(0) scaleX(1); }
}

/* ——— Sparks Easter egg ——— */
.sparks-flash {
  position: fixed; inset: 0; z-index: 9998;
  background: #fff;
  pointer-events: none;
  animation: flash-out 0.6s ease-out forwards;
}
@keyframes flash-out {
  0%   { opacity: 0.92; }
  100% { opacity: 0; }
}
.sparks-bolt {
  position: fixed; z-index: 9999;
  font-size: 140px; pointer-events: none;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: bolt-wild 1.4s ease-in-out forwards;
  filter: drop-shadow(0 0 40px #FFD700) drop-shadow(0 0 80px #FF8C00);
}
@keyframes bolt-wild {
  0%   { opacity: 0;    transform: translate(-50%, -50%) scale(0.2) rotate(-20deg); }
  10%  { opacity: 1;    transform: translate(-50%, -50%) scale(1.3) rotate(8deg); }
  20%  { transform: translate(-52%, -48%) scale(1.1) rotate(-6deg); }
  30%  { transform: translate(-48%, -52%) scale(1.4) rotate(10deg); }
  40%  { transform: translate(-50%, -50%) scale(1.0) rotate(-4deg); }
  55%  { transform: translate(-50%, -50%) scale(1.25) rotate(5deg); opacity: 1; }
  70%  { transform: translate(-50%, -50%) scale(0.9) rotate(-3deg); opacity: 0.9; }
  85%  { transform: translate(-50%, -50%) scale(1.1) rotate(2deg); opacity: 0.6; }
  100% { transform: translate(-50%, -50%) scale(0.5) rotate(0deg); opacity: 0; }
}
.sparks-label {
  position: fixed; z-index: 9999;
  bottom: 80px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.18em;
  color: var(--fg); text-transform: uppercase; pointer-events: none;
  animation: label-fade 2s ease forwards;
}
@keyframes label-fade {
  0%   { opacity: 0; transform: translateX(-50%) translateY(10px); }
  20%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ——— Responsive ——— */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-portrait { max-width: 320px; }
  .totals { grid-template-columns: repeat(2, 1fr); }
  .total-cell:nth-child(2) { border-right: none; }
  .total-cell:nth-child(1), .total-cell:nth-child(2) { border-bottom: 1px solid var(--hair); }
  .runs { grid-template-columns: 1fr; }
  .run { border-right: none; }
  .map-card { height: 420px; }
  .upcoming { grid-template-columns: 1fr; }
  .upcoming-item { border-right: none; border-bottom: 1px solid var(--hair); }
  .upcoming-item:last-child { border-bottom: none; }
  .prs { grid-template-columns: repeat(2, 1fr); }
  .pr:nth-child(2) { border-right: none; }
  .pr:nth-child(1), .pr:nth-child(2) { border-bottom: 1px solid var(--hair); }
  .clubs { grid-template-columns: 1fr; }
  .club { border-right: none; }
  .journal { grid-template-columns: 1fr; gap: 24px; }
  .race-table { font-size: 12px; }
  .race-table th, .race-table td { padding: 10px 8px; }
  .chart { height: 180px; }
}
