/* Race-detail page. Uses the shared tokens/theme variables (light + dark). */

.rd-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 24px 96px;
}

.rd-back {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  margin-right: 18px;
  margin-bottom: 18px;
}
.rd-back:hover { color: var(--accent); }

/* Sport colours keyed on the data's sport value (localization-safe). */
[data-sport="road_running"]  { --sport: var(--sport-road_running); }
[data-sport="trail_running"] { --sport: var(--sport-trail_running); }
[data-sport="cycling"]       { --sport: var(--sport-cycling); }
[data-sport="hiking"]        { --sport: var(--sport-hiking); }

.rd-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sport, var(--sport-other));
  margin-bottom: 8px;
}
.rd-eyebrow-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--sport, var(--sport-other)) 16%, transparent);
}
.rd-eyebrow-icon svg { width: 15px; height: 15px; display: block; }

.rd-title {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 14px;
}

.rd-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 22px;
}
.rd-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.98rem;
  color: var(--text-secondary);
}
.rd-meta-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
}
.rd-meta-ico svg { width: 15px; height: 15px; display: block; }

/* ---- Map (Leaflet + CARTO Positron/Dark Matter) -------------------------- */
.rd-map {
  height: 320px;
  margin: 0 0 26px;
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
  z-index: 0; /* keep tiles/controls under the sticky site header */
}
/* Marker: our own SVG pin — strip Leaflet's default white divIcon chrome. */
.rd-pin {
  background: transparent;
  border: 0;
}
.rd-pin svg {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}
.leaflet-container { font: inherit; }
/* Let the attribution sit directly on the map (drop Leaflet's white box). */
.leaflet-container .leaflet-control-attribution {
  background: transparent;
}

/* ---- Sections ------------------------------------------------------------ */
.rd-section {
  padding: 20px 0;
  border-top: 1px solid var(--border-light);
}
.rd-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.rd-dists {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.rd-dist {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-primary);
}

.rd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
  padding: 6px 0;
}
.rd-row-key { color: var(--text-secondary); }

.rd-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.rd-badge--open { background: var(--isard-green); color: var(--on-accent); }
.rd-badge--closed { background: var(--surface-2); color: var(--text-muted); }
.rd-badge--sold_out { background: var(--surface-2); color: #ff5a4d; }

/* ---- Links --------------------------------------------------------------- */
.rd-links {
  display: flex;
  flex-direction: column;
}
.rd-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 4px;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--accent); /* brand lime (dark-ink on light theme via --link) */
  text-decoration: none;
  border-bottom: 1px solid var(--border-light);
}
/* Underline just the label, not the trailing ↗ arrow. */
.rd-link > span:first-child { text-decoration: underline; text-underline-offset: 3px; }
.rd-link:last-child { border-bottom: none; }
.rd-link:hover { opacity: 0.8; }
.rd-link-arrow { color: var(--accent); font-size: 0.9rem; }

/* Internal links up to the distance hub(s) this race belongs to. */
.rd-hublinks { display: flex; flex-wrap: wrap; gap: 10px; }
.rd-hublink {
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
}
.rd-hublink:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 600px) {
  .rd-main { padding: 20px 16px 72px; }
  .rd-title { font-size: 1.5rem; }
  .rd-map { height: 240px; }
}
