:root {
  --cream: #f7f2ea;
  --paper: #fffdf9;
  --ink: #2b2620;
  --ink-soft: #6b6053;
  --terracotta: #b8562f;
  --terracotta-dark: #93411f;
  --olive: #6b7a4f;
  --line: #e6ddce;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.55;
}

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.4em;
}

a { color: var(--terracotta-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--terracotta); font-size: 1.4rem; }
.site-header nav a {
  color: var(--ink-soft);
  font-weight: 500;
  margin-left: 20px;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, #e9dcc8, var(--cream));
  padding: 64px 0 48px;
  border-bottom: 1px solid var(--line);
}
.hero h1 { font-size: 2.4rem; max-width: 720px; }
.hero-sub { color: var(--ink-soft); font-size: 1.1rem; max-width: 560px; }

.empty { color: var(--ink-soft); padding: 48px 0; }

/* Ride grid / cards */
.ride-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 48px 0;
}
.ride-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ride-card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(43, 38, 32, 0.08);
}
.ride-card-photo {
  height: 170px;
  background-size: cover;
  background-position: center;
  background-color: #ddd2bd;
}
.ride-card-photo--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  color: var(--olive);
}
.ride-card-body { padding: 18px 20px 22px; }
.ride-card-body h2 { font-size: 1.2rem; }
.ride-card-date { color: var(--ink-soft); font-size: 0.9rem; margin: 0 0 10px; }

.ride-stats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 10px;
  padding: 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.ride-stats li:not(:last-child)::after {
  content: '·';
  margin-left: 14px;
  color: var(--line);
}
.ride-stats--big {
  font-size: 1.05rem;
  margin: 14px 0 6px;
}

.ride-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.tag {
  background: #efe6d4;
  color: var(--terracotta-dark);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Ride detail */
.ride { padding: 48px 0 64px; }
.back { margin-bottom: 8px; }
.back a { color: var(--ink-soft); font-size: 0.92rem; }
.ride h1 { font-size: 2.1rem; margin-top: 4px; }

.ride-map {
  height: 420px;
  border-radius: var(--radius);
  margin: 24px 0;
  border: 1px solid var(--line);
}

.gpx-download { margin-top: -10px; }

/* Profil altimétrique */
.elevation-wrap { margin: 24px 0; }
.elevation-title { font-size: 1.1rem; margin-bottom: 10px; }
.elevation-profile {
  width: 100%;
  height: auto;
  display: block;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.elevation-axis { stroke: var(--line); stroke-width: 1; }
.elevation-area { fill: rgba(184, 86, 47, 0.16); }
.elevation-line { stroke: var(--terracotta); stroke-width: 2; }
.elevation-label {
  font-size: 10px;
  fill: var(--ink-soft);
  font-family: 'Inter', system-ui, sans-serif;
}
.elevation-label--km { text-anchor: middle; }
.elevation-label--end { text-anchor: end; }
.elevation-marker { stroke: var(--paper); stroke-width: 1.5; cursor: pointer; }
.elevation-marker--water     { fill: #3d7ea6; }
.elevation-marker--food      { fill: #b8562f; }
.elevation-marker--danger    { fill: #b5342a; }
.elevation-marker--viewpoint { fill: var(--olive); }
.elevation-marker--generic   { fill: var(--terracotta); }

.ride-body { max-width: 720px; margin-top: 24px; }
.ride-body h2 { font-size: 1.4rem; margin-top: 1.4em; }
.ride-body p { margin: 0 0 1em; }
.ride-body ul { padding-left: 1.2em; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 32px;
}
.gallery-item img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0 48px;
  margin-top: 32px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.site-footer a { color: var(--ink-soft); text-decoration: underline; }
.site-footer p { margin: 0 0 0.6em; }
.footer-legal-nav {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}

/* Bandeau d'avertissement sur les pages de sortie */
.disclaimer {
  background: #fbf1de;
  border: 1px solid #e7cd9a;
  color: #6b4e1f;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 0.9rem;
  margin: 20px 0;
}
.disclaimer a { color: #6b4e1f; text-decoration: underline; }

/* Bloc de partage */
.share-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 18px 0;
}
.share-label {
  color: var(--ink-soft);
  font-size: 0.88rem;
  margin-right: 4px;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.share-btn:hover { text-decoration: none; }
.share-btn--fb:hover   { background: #1877f2; border-color: #1877f2; color: #fff; }
.share-btn--wa:hover   { background: #25d366; border-color: #25d366; color: #fff; }
.share-btn--x:hover    { background: #14171a; border-color: #14171a; color: #fff; }
.share-btn--mail:hover { background: var(--olive); border-color: var(--olive); color: #fff; }
.share-btn--copy:hover { background: var(--terracotta); border-color: var(--terracotta); color: #fff; }
.share-btn--copied     { background: var(--olive); border-color: var(--olive); color: #fff; }

/* Page Mentions légales */
.legal { padding: 48px 0 64px; max-width: 760px; }
.legal-body h2 { font-size: 1.3rem; margin-top: 1.6em; }
.legal-body p { margin: 0 0 1em; }
.legal-body ul { padding-left: 1.2em; }
.legal-body li { margin-bottom: 0.4em; }

/* Synthèse ravitaillement (points d'eau / boulangeries) */
.supplies {
  max-width: 720px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.supplies h2 { font-size: 1.25rem; }
.supplies-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.supplies-item {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.92rem;
}
.supplies-icon::before { font-size: 1rem; }
.supplies-item--water .supplies-icon::before { content: '💧'; }
.supplies-item--food  .supplies-icon::before { content: '🥐'; }
.supplies-km {
  font-weight: 600;
  color: var(--terracotta-dark);
  white-space: nowrap;
}
.supplies-label { font-weight: 500; }
.supplies-note {
  color: var(--ink-soft);
  font-size: 0.88rem;
  flex-basis: 100%;
}

@media (max-width: 600px) {
  .hero { padding: 44px 0 32px; }
  .hero h1 { font-size: 1.8rem; }
  .ride-map { height: 300px; }
}

/* Marqueurs carte (POI, photo, panoramax) */
.gm-marker {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid var(--paper);
  box-shadow: 0 2px 6px rgba(43, 38, 32, 0.35);
  background: var(--terracotta);
  display: flex;
  align-items: center;
  justify-content: center;
}
.gm-marker::after {
  content: '📍';
  display: block;
  font-size: 13px;
  line-height: 1;
  transform: rotate(45deg);
}
.gm-marker--generic { background: var(--terracotta); }
.gm-marker--water    { background: #3d7ea6; }
.gm-marker--water::after     { content: '💧'; }
.gm-marker--food     { background: #b8562f; }
.gm-marker--food::after      { content: '🥐'; }
.gm-marker--danger   { background: #b5342a; }
.gm-marker--danger::after    { content: '⚠️'; }
.gm-marker--viewpoint{ background: var(--olive); }
.gm-marker--viewpoint::after { content: '👁️'; }
.gm-marker--photo    { background: #4a4238; }
.gm-marker--photo::after     { content: '📷'; }
.gm-marker--panoramax{ background: #6b3fa0; }
.gm-marker--panoramax::after { content: '🧭'; }
.gm-marker--start        { background: #3f8f4f; }
.gm-marker--start::after     { content: '🚩'; }
.gm-marker--finish       { background: #b5342a; }
.gm-marker--finish::after    { content: '🏁'; }
.gm-marker--start-finish { background: #3f8f4f; }
.gm-marker--start-finish::after { content: '🚩'; }

/* Modale générique (photo / panoramax) */
.gm-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
}
.gm-modal--open { display: block; }
.gm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 17, 13, 0.82);
}
.gm-modal-body {
  position: relative;
  z-index: 1;
  max-width: min(920px, 92vw);
  max-height: 88vh;
  margin: 6vh auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gm-modal-close {
  position: absolute;
  top: 18px;
  right: 24px;
  z-index: 2;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}
body.gm-modal-lock { overflow: hidden; }

.gm-lightbox { text-align: center; }
.gm-lightbox img {
  max-width: 92vw;
  max-height: 78vh;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}
.gm-lightbox-caption {
  color: #f2ece0;
  margin-top: 12px;
  font-size: 0.95rem;
}

.gm-panoramax {
  width: min(880px, 90vw);
  height: min(560px, 70vh);
}
.gm-panoramax pnx-photo-viewer {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 8px;
  overflow: hidden;
}
