@font-face {
  font-family: "Helvetica";
  src: url("fonts/Helvetica.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Helvetica";
  src: url("fonts/Helvetica-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0a0a;
  --ink: #f2ead7;
  --ink-dim: #8a8578;
  --rule: #1f1f1f;
  --accent: #c9302c;
  --sans: "Helvetica", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); overflow-x: hidden; }
html { scrollbar-width: none; }
html::-webkit-scrollbar { width: 0; height: 0; display: none; }
body::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* ---------- cinematic intro: blur + fade on first load (no shift) ---------- */
/* fill-mode is 'backwards' only, so the filter is dropped after the intro — */
/* otherwise it leaves body as a containing block and breaks sticky nav + scroll. */
body {
  animation: page-reveal 2.6s cubic-bezier(0.2, 0.7, 0.15, 1) backwards;
}
@keyframes page-reveal {
  0% {
    filter: blur(28px) brightness(0.25) saturate(0.5);
    opacity: 0;
  }
  40% { opacity: 1; }
  100% {
    filter: blur(0) brightness(1) saturate(1);
    opacity: 1;
  }
}

/* ---------- persistent film grain ---------- */
/* Attached to html (not body) so body's intro filter doesn't capture it as a containing block. */
html::before {
  content: "";
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.14;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch' seed='7'/><feColorMatrix values='0 0 0 0 0.8  0 0 0 0 0.78  0 0 0 0 0.72  0 0 0 0.9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
  animation: grain-shift 0.8s steps(6) infinite;
  will-change: transform;
}
@keyframes grain-shift {
  0%   { transform: translate( 0%,  0%); }
  16%  { transform: translate(-8%,  4%); }
  33%  { transform: translate( 6%, -10%); }
  50%  { transform: translate(-4%,  8%); }
  66%  { transform: translate(10%,  2%); }
  83%  { transform: translate(-6%, -6%); }
  100% { transform: translate( 0%,  0%); }
}

@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
  html::before { animation: none; }
}
body {
  font-family: var(--sans);
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 32px;
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
}
.nav .mark { font-weight: 700; }
.nav nav a { margin-left: 28px; color: var(--ink-dim); transition: color .2s; }
.nav nav a:hover { color: var(--ink); }

/* ---------- hero / title card ---------- */
.hero {
  min-height: calc(100vh - 58px);
  display: grid; grid-template-rows: 1fr auto;
  padding: 48px 48px 32px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.hero > .titlecard,
.hero > .hero-meta { position: relative; z-index: 2; }

.hero-bg {
  position: absolute; inset: 0;
  z-index: 0;
  overflow: hidden;
}
.hero-bg img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(20%) contrast(1.05) brightness(0.72);
  transform: translateX(100%);
  animation: hero-slide 80s infinite;
  animation-fill-mode: backwards;
  animation-timing-function: cubic-bezier(0.6, 0.02, 0.2, 1);
  will-change: transform;
}
.hero-bg::after {
  /* darkening + vignette + subtle red wash so title stays legible */
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(10,10,10,0.55) 0%, rgba(10,10,10,0.25) 40%, rgba(10,10,10,0.75) 100%),
    radial-gradient(ellipse at 70% 40%, rgba(255,255,255,0.04), transparent 60%),
    radial-gradient(ellipse at 10% 90%, rgba(201,48,44,0.08), transparent 55%);
  pointer-events: none;
  z-index: 1;
}

/* 10 slides over 80s = 8s each. Image 1 uses -1.6s delay so it's already in place at load (doesn't slide in on first cycle). */
.hero-bg img:nth-child(1)  { animation-delay: -1.6s; }
.hero-bg img:nth-child(2)  { animation-delay:  6.4s; }
.hero-bg img:nth-child(3)  { animation-delay: 14.4s; }
.hero-bg img:nth-child(4)  { animation-delay: 22.4s; }
.hero-bg img:nth-child(5)  { animation-delay: 30.4s; }
.hero-bg img:nth-child(6)  { animation-delay: 38.4s; }
.hero-bg img:nth-child(7)  { animation-delay: 46.4s; }
.hero-bg img:nth-child(8)  { animation-delay: 54.4s; }
.hero-bg img:nth-child(9)  { animation-delay: 62.4s; }
.hero-bg img:nth-child(10) { animation-delay: 70.4s; }

/* slide in from right (0% -> 2%), hold (2% -> 10%), slide out left (10% -> 12%), stay off-screen */
@keyframes hero-slide {
  0%    { transform: translateX(100%); }
  2%    { transform: translateX(0); }
  10%   { transform: translateX(0); }
  12%   { transform: translateX(-100%); }
  100%  { transform: translateX(-100%); }
}

.titlecard {
  display: grid;
  grid-template-columns: max-content;
  align-content: start;
  row-gap: 0;
  font-family: var(--sans);
  color: var(--ink);
  text-shadow:
    0 0 1px rgba(242,234,215,0.9),
    0 0 22px rgba(242,234,215,0.18);
  line-height: 0.88;
}
.titlecard .line {
  display: block;
  font-weight: 700;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.titlecard .l1 { font-size: clamp(72px, 11vw, 168px); }
.titlecard .l2 { font-size: clamp(110px, 17vw, 260px); padding-left: 0.18em; }
.titlecard .l3 { font-size: clamp(130px, 20vw, 300px); padding-left: 0.62em; }
.titlecard .l3::after {
  content: "";
  display: inline;
  animation: title-dots 2.4s steps(1, end) infinite;
}
@keyframes title-dots {
  0%   { content: ""; }
  14%  { content: "."; }
  28%  { content: ".."; }
  42%  { content: "..."; }
  58%  { content: "..."; }
  72%  { content: ".."; }
  86%  { content: "."; }
  100% { content: ""; }
}
.titlecard .episode {
  margin-top: 0.5em;
  padding-left: 0.25em;
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: clamp(20px, 2.2vw, 32px);
  color: var(--ink);
}

.hero-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 1px solid var(--rule);
  padding-top: 14px;
  font-family: var(--sans);
  font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-dim);
}
.hero-meta .serial { color: var(--accent); font-weight: 700; }

/* ---------- intro ---------- */
.intro {
  max-width: 960px;
  margin: 0 auto;
  padding: 120px 48px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.intro .kicker {
  font-family: var(--sans);
  font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 18px;
}
.intro h2 {
  font-family: var(--sans); font-weight: 700;
  font-size: clamp(36px, 5.2vw, 68px);
  line-height: 1.0; margin: 0 0 28px;
  letter-spacing: -0.03em; text-transform: uppercase;
}
.intro .lede {
  font-family: var(--sans); font-weight: 400;
  font-size: 18px; line-height: 1.6;
  max-width: 62ch; color: var(--ink);
}

/* ---------- section heads ---------- */
.section-head {
  display: flex; align-items: baseline; gap: 24px;
  padding: 80px 48px 32px;
  border-top: 1px solid var(--rule);
}
.section-head .index {
  font-family: var(--sans); font-weight: 700;
  font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--accent);
}
.section-head h3 {
  font-family: var(--sans); font-weight: 700;
  font-size: clamp(28px, 4vw, 52px);
  margin: 0; line-height: 1;
  letter-spacing: -0.03em; text-transform: uppercase;
}

/* ---------- journal ---------- */
.journal { padding-bottom: 40px; }

.entry {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 40px;
  padding: 40px 48px;
  align-items: center;
  border-top: 1px solid var(--rule);
}
.entry.reverse { grid-template-columns: 1fr 1.25fr; }
.entry.reverse .entry-media { order: 2; }
.entry.reverse .entry-body  { order: 1; }

.entry-media {
  display: block;
  aspect-ratio: 4 / 3;
  background: #111;
  overflow: hidden;
  transition: transform .4s ease;
}
.entry-media:hover { transform: translateY(-2px); }

.entry-body .ep {
  font-family: var(--sans); font-weight: 700;
  font-size: 14px; letter-spacing: 0.22em;
  color: var(--accent);
}
.entry-body h4 {
  font-family: var(--sans); font-weight: 700;
  font-size: clamp(26px, 3vw, 44px);
  line-height: 1.0; margin: 12px 0 16px;
  letter-spacing: -0.03em; text-transform: uppercase;
}
.entry-body p {
  font-family: var(--sans); font-weight: 400;
  font-size: 17px; line-height: 1.55;
  max-width: 46ch; margin: 0 0 18px;
  color: var(--ink);
}
.entry-body .meta {
  font-family: var(--sans); font-weight: 700;
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-dim);
}

/* ---------- route / gpx viewer ---------- */
.route {
  padding: 0 48px 60px;
  border-top: 1px solid var(--rule);
}
.route-head {
  display: flex; align-items: baseline; gap: 20px;
  padding: 32px 0 20px;
}
.route-head .ep {
  font-family: var(--sans); font-weight: 700;
  font-size: 12px; letter-spacing: 0.22em;
  color: var(--accent);
}
.route-head h5 {
  font-family: var(--sans); font-weight: 700;
  font-size: clamp(22px, 2.6vw, 34px);
  line-height: 1; margin: 0;
  letter-spacing: -0.03em; text-transform: uppercase;
}
.route-map {
  width: 100%;
  height: clamp(360px, 62vh, 640px);
  background: #0f0f0f;
  border: 1px solid var(--rule);
}
/* floating live tooltip that follows cursor along the route on the map */
.route-map-tip {
  position: absolute;
  z-index: 1000;
  transform: translate(14px, -50%);
  padding: 7px 10px;
  background: rgba(10,10,10,0.94);
  border: 1px solid var(--ink-dim);
  border-left: 2px solid var(--accent);
  font-family: var(--sans); font-weight: 700;
  font-size: 10px; letter-spacing: 0.2em;
  color: var(--ink);
  white-space: nowrap;
  pointer-events: none;
  display: grid; gap: 3px;
}
.route-map-tip[hidden] { display: none; }
.route-map-tip__dist  { color: var(--ink-dim); }
.route-map-tip__ele   { color: var(--accent); font-size: 13px; }
.route-map-tip__grade { color: var(--ink); }

/* route line gets a thicker cursor target so hover is forgiving */
.leaflet-interactive { cursor: crosshair; }

.route-chart {
  position: relative;
  width: 100%;
  height: 160px;
  background: #0a0a0a;
  border: 1px solid var(--rule);
  border-top: 0;
  overflow: hidden;
  cursor: crosshair;
}
.route-chart .chart-svg {
  width: 100%; height: 100%;
  display: block;
}
.route-chart .chart-area  { fill: rgba(201, 48, 44, 0.22); stroke: none; }
.route-chart .chart-line  { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.route-chart .chart-crosshair {
  stroke: var(--ink);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.chart-axis {
  position: absolute;
  font-family: var(--sans); font-weight: 700;
  font-size: 10px; letter-spacing: 0.22em;
  color: var(--ink-dim);
  pointer-events: none;
  padding: 4px 8px;
  background: rgba(10,10,10,0.5);
}
.chart-axis--tl { top: 6px; left: 8px; }
.chart-axis--bl { bottom: 6px; left: 8px; }
.chart-axis--br { bottom: 6px; right: 8px; }
.chart-tooltip {
  position: absolute;
  top: 8px;
  transform: translateX(-50%);
  padding: 6px 10px;
  background: rgba(10,10,10,0.92);
  border: 1px solid var(--rule);
  font-family: var(--sans); font-weight: 700;
  font-size: 10px; letter-spacing: 0.2em;
  color: var(--ink);
  pointer-events: none;
  display: grid; gap: 3px;
  white-space: nowrap;
  z-index: 2;
}
.chart-tooltip [data-tip="ele"] { color: var(--accent); }
.chart-tooltip[hidden] { display: none; }

.route-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 0;
  border: 1px solid var(--rule);
  border-top: 0;
}
.route-stats > div {
  padding: 18px 20px;
  border-right: 1px solid var(--rule);
  display: grid; gap: 6px;
}
.route-stats > div:last-child { border-right: 0; }
.route-stats dt {
  font-family: var(--sans);
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-dim); font-weight: 700;
}
.route-stats dd {
  margin: 0;
  font-family: var(--sans); font-weight: 700;
  font-size: clamp(18px, 2vw, 26px); letter-spacing: -0.01em;
  color: var(--ink);
}
/* tactical waypoint markers — small, mil-spec feel */
.tac-mark {
  background: transparent !important;
  border: 0 !important;
  overflow: visible !important;
}
.tac-mark__ring {
  position: absolute;
  top: 4px; left: 4px;
  width: 10px; height: 10px;
  border: 1.5px solid var(--ink);
  background: rgba(10,10,10,0.9);
  border-radius: 50%;
  display: grid; place-items: center;
}
.tac-mark__ring::before,
.tac-mark__ring::after {
  content: "";
  position: absolute;
  background: var(--ink);
}
.tac-mark__ring::before { top: -5px; bottom: -5px; left: 50%; width: 1px; transform: translateX(-50%); }
.tac-mark__ring::after  { left: -5px; right: -5px;  top: 50%;  height: 1px; transform: translateY(-50%); }
.tac-mark__dot {
  width: 3px; height: 3px;
  background: var(--accent);
  border-radius: 50%;
}
.tac-mark--end .tac-mark__ring {
  background: var(--accent);
  border-color: var(--ink);
}
.tac-mark--end .tac-mark__dot { background: var(--ink); }
.tac-mark__label {
  position: absolute;
  top: 3px; left: 22px;
  padding: 2px 6px;
  font-family: var(--sans); font-weight: 700;
  font-size: 9px; letter-spacing: 0.22em;
  color: var(--ink);
  background: rgba(10,10,10,0.88);
  white-space: nowrap;
  pointer-events: none;
}

/* kill leaflet-gpx's default blue pin images (they're <img> tags, not DivIcons) */
img.leaflet-marker-icon { display: none !important; }
.leaflet-marker-shadow { display: none !important; }

/* ---------- polaroid photo pins ---------- */
.photo-pin {
  background: transparent !important;
  border: 0 !important;
  overflow: visible !important;
}
.photo-pin__dot {
  position: absolute;
  top: 0; left: 0;
  width: 14px; height: 14px;
  background: var(--ink);
  border: 2px solid var(--bg);
  box-shadow:
    0 0 0 1px var(--ink),
    0 3px 8px rgba(0,0,0,0.55);
  transform: rotate(45deg);
  transition: transform .18s ease;
}
.photo-pin:hover .photo-pin__dot {
  transform: rotate(45deg) scale(1.2);
}
.photo-pin__card {
  position: absolute !important;
  bottom: 16px; left: 50%;
  transform: translateX(-50%) translateY(4px) scale(0.7);
  transform-origin: bottom center;
  width: 120px !important;
  max-width: 120px !important;
  margin: 0;
  padding: 5px 5px 18px;
  background: var(--ink);
  box-shadow:
    0 4px 10px rgba(0,0,0,0.6),
    0 0 0 1px rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition:
    transform .2s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity .16s ease;
}
.photo-pin__card img {
  display: block !important;
  width: 110px !important;
  height: 138px !important;
  max-width: 110px !important;
  object-fit: cover;
  background: var(--bg);
}
.photo-pin__card figcaption {
  position: absolute;
  bottom: 5px; left: 0; right: 0;
  text-align: center;
  font-family: var(--sans); font-weight: 700;
  font-size: 8px; letter-spacing: 0.22em;
  color: var(--bg);
  text-transform: uppercase;
}
.photo-pin__card::after {
  content: "";
  position: absolute;
  bottom: -7px; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border: 7px solid transparent;
  border-top-color: var(--ink);
}
.photo-pin:hover .photo-pin__card {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}
/* bring hovered photo marker above others */
.leaflet-marker-icon.photo-pin:hover { z-index: 10000 !important; }

/* leaflet overrides to match site */
.leaflet-container {
  background: #0a0a0a;
  font-family: var(--sans);
  font-weight: 400;
}
.leaflet-control-zoom a {
  background: #111 !important;
  color: var(--ink) !important;
  border-color: var(--rule) !important;
}
.leaflet-control-zoom a:hover { background: #1a1a1a !important; }
.leaflet-control-attribution {
  background: rgba(10,10,10,0.7) !important;
  color: var(--ink-dim) !important;
  font-size: 10px !important;
  letter-spacing: 0.06em;
}
.leaflet-control-attribution a { color: var(--ink) !important; }

@media (max-width: 860px) {
  .route { padding: 0 24px 40px; }
  .route-stats { grid-template-columns: repeat(2, 1fr); }
  .route-stats > div:nth-child(2) { border-right: 0; }
  .route-stats > div:nth-child(1),
  .route-stats > div:nth-child(2) { border-bottom: 1px solid var(--rule); }
}

/* ---------- bike ---------- */
.bike-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
  padding: 0 48px 80px;
  align-items: start;
}
.specs { margin: 0; padding: 0; display: grid; gap: 2px; border-top: 1px solid var(--rule); }
.specs > div {
  display: grid; grid-template-columns: 160px 1fr;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 13px; letter-spacing: 0.08em;
}
.specs dt { color: var(--ink-dim); text-transform: uppercase; font-weight: 700; }
.specs dd { margin: 0; font-weight: 700; }

/* ---------- about ---------- */
.about { padding: 0 48px 120px; max-width: 960px; margin: 0 auto; }
.about .section-head { padding-left: 0; padding-right: 0; }
.about .lede {
  font-family: var(--sans); font-weight: 400;
  font-size: 20px; line-height: 1.6;
  max-width: 60ch;
}

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--rule);
  padding: 80px 48px 60px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  align-items: end;
}
.foot-title {
  font-family: var(--sans);
  line-height: 0.88;
  text-shadow: 0 0 18px rgba(242,234,215,0.15);
}
.foot-title .line { display: block; font-weight: 700; letter-spacing: -0.04em; text-transform: uppercase; }
.foot-title .l1 { font-size: clamp(44px, 6vw, 88px); }
.foot-title .l2 { font-size: clamp(64px, 9vw, 132px); padding-left: 0.18em; }
.foot-title .l3 { font-size: clamp(72px, 10vw, 152px); padding-left: 0.55em; }

.foot-meta {
  display: grid; gap: 14px;
  font-family: var(--sans); font-size: 13px;
  letter-spacing: 0.14em; text-transform: uppercase;
}
.foot-meta a { color: var(--ink); border-bottom: 1px solid var(--rule); padding-bottom: 6px; width: max-content; }
.foot-meta a:hover { border-color: var(--accent); color: var(--accent); }
.foot-meta .fine { color: var(--ink-dim); font-size: 11px; letter-spacing: 0.2em; margin-top: 12px; }

/* ---------- placeholder cells ---------- */
.placeholder {
  width: 100%; height: 100%;
  background:
    repeating-linear-gradient(45deg, #151515 0 12px, #101010 12px 24px);
  border: 1px solid var(--rule);
  display: grid; place-items: center;
  color: var(--ink-dim);
  font-family: var(--sans); font-weight: 700;
  letter-spacing: 0.3em; font-size: 14px;
  position: relative;
}
.placeholder::before { content: attr(data-label); }
.placeholder.tall { aspect-ratio: 3 / 4; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .nav { padding: 14px 20px; }
  .nav nav a { margin-left: 16px; }
  .hero { padding: 32px 24px 24px; }
  .intro, .about { padding-left: 24px; padding-right: 24px; }
  .section-head { padding: 56px 24px 24px; }
  .entry, .entry.reverse {
    grid-template-columns: 1fr;
    padding: 32px 24px;
  }
  .entry.reverse .entry-media { order: 0; }
  .entry.reverse .entry-body  { order: 0; }
  .bike-grid { grid-template-columns: 1fr; padding: 0 24px 60px; }
  .foot { grid-template-columns: 1fr; padding: 60px 24px 40px; }
  .titlecard .l3 { padding-left: 0.3em; }
}
