/* Ecrito — carnet de voyage */

:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --ink: #1d1b18;
  --muted: #6f675d;
  --line: #ebe4d8;
  --accent: #c8553d;
  --header-h: 64px;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(40, 30, 20, .06), 0 8px 24px rgba(40, 30, 20, .08);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 56px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 650; letter-spacing: -.015em; line-height: 1.15; }

.kicker {
  margin: 0 0 .75rem;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* --- En-tête ------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 clamp(16px, 3vw, 32px);
  background: rgba(251, 248, 243, .86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand__logo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line); }
.brand__name { font: 650 1.4rem/1 var(--serif); letter-spacing: -.02em; }
.brand__tag { color: var(--muted); font-size: .85rem; padding-left: 12px; border-left: 1px solid var(--line); }

.site-nav a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .2s;
}
.site-nav a:hover { background: var(--line); }

/* --- Mise en page : contenu à gauche, carte à droite --------------------- */

.split { display: grid; align-items: start; }
.split--home { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.split--post { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }

.split__content { min-width: 0; padding: clamp(28px, 4vw, 56px) clamp(20px, 4vw, 64px) 0; }

.split__map {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
}

.map {
  position: absolute;
  inset: 14px 14px 14px 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #e9e5dd;
  box-shadow: var(--shadow);
}

/* --- Accueil ------------------------------------------------------------ */

.intro { max-width: 640px; margin-bottom: 48px; }
.intro__title { margin: 0 0 1rem; font-size: clamp(2.3rem, 4.2vw, 3.6rem); line-height: 1.02; letter-spacing: -.025em; }
.intro__lead { margin: 0 0 2rem; color: var(--muted); font-size: 1.15rem; }

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  margin: 0;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stats div { flex: 1 1 96px; padding: 14px 16px; background: var(--surface); }
.stats dt { color: var(--muted); font-size: .75rem; line-height: 1.3; }
.stats dd { margin: 4px 0 0; font: 650 1.6rem/1 var(--serif); white-space: nowrap; }

.chapter { margin-bottom: 28px; }
.chapter__title {
  position: sticky;
  top: var(--header-h);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 14px 0 10px;
  background: var(--bg);
  font-size: 1.45rem;
}
.chapter__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 20%, transparent); }
.chapter__meta { margin-left: auto; color: var(--muted); font: 500 .8rem var(--sans); letter-spacing: 0; }

.stages {
  list-style: none;
  margin: 0 0 0 5px;
  padding: 4px 0 4px 17px;
  border-left: 2px solid color-mix(in srgb, var(--c) 35%, transparent);
}

.stage-card {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin: 0 -10px;
  padding: 10px;
  border-radius: 16px;
  text-decoration: none;
  transition: background .2s, box-shadow .2s;
}
.stage-card:hover, .stage-card:focus-visible, .stage-card.is-active { background: var(--surface); box-shadow: var(--shadow); }

.stage-card__img { display: block; width: 116px; height: 88px; border-radius: 12px; object-fit: cover; background: var(--line); }
.stage-card__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stage-card__meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .8rem; }
.stage-card__n {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--c);
  color: #fff;
  font-size: .7rem;
  font-weight: 600;
}
.stage-card__title { font: 650 1.12rem/1.25 var(--serif); }
.stage-card__excerpt {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.map-legend {
  position: absolute;
  left: 14px;
  bottom: 28px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  max-width: calc(100% - 140px);
  margin: 0 0 0 14px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
  font-size: .75rem;
  font-weight: 500;
}
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend span::before { content: ""; width: 14px; height: 4px; border-radius: 2px; background: var(--c); }
.map-legend__flight::before { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 7px) !important; }

/* --- Article ------------------------------------------------------------ */

.post { max-width: 760px; margin: 0 auto; }

.back { display: inline-block; margin-bottom: 24px; color: var(--muted); font-size: .9rem; text-decoration: none; }
.back:hover { color: var(--ink); }

.post__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 1rem; color: var(--muted); font-size: .88rem; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 12%, var(--surface));
  color: color-mix(in srgb, var(--c) 70%, var(--ink));
  font-weight: 600;
}
.pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

.post__title { margin: 0 0 1rem; font-size: clamp(2.1rem, 4vw, 3.2rem); line-height: 1.05; letter-spacing: -.025em; }
.post__lead { margin: 0 0 1.5rem; color: var(--muted); font-size: 1.2rem; }

.post__cover { display: block; margin: 28px 0 8px; overflow: hidden; border-radius: var(--radius); box-shadow: var(--shadow); }
.post__cover img { display: block; width: 100%; max-height: 72vh; object-fit: cover; transition: transform .6s ease; }
.post__cover:hover img { transform: scale(1.02); }

.post__map-mobile { display: none; }

.prose { margin-top: 32px; font-size: 1.08rem; line-height: 1.78; }
.prose > * { max-width: 68ch; }
.prose p { margin: 0 0 1.25em; }
.prose h2 { margin: 2.2em 0 .6em; font-size: 1.7rem; }
.prose h3 { margin: 1.8em 0 .5em; font-size: 1.3rem; }
.prose a { color: var(--accent); text-underline-offset: 3px; overflow-wrap: anywhere; }

.figure { max-width: none !important; margin: 2em 0; }
.figure a { display: block; }
.figure img { display: block; width: auto; max-width: 100%; max-height: 78vh; margin: 0 auto; border-radius: 14px; box-shadow: var(--shadow); }
.figure figcaption { margin-top: .6em; color: var(--muted); font-size: .85rem; text-align: center; }

.video { position: relative; max-width: none !important; margin: 2em 0; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 14px; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.gallery-section { margin-top: 48px; }
.gallery-section__title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 16px; font-size: 1.5rem; }
.gallery-section__title span { color: var(--muted); font: 500 .9rem var(--sans); }

/* Grille « justifiée » : chaque photo garde ses proportions, les lignes ont la même hauteur. */
.gallery { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery::after { content: ""; flex: 999 1 0; }
.gallery a {
  flex: var(--r) 1 calc(var(--r) * 140px);
  aspect-ratio: var(--r);
  overflow: hidden;
  border-radius: 10px;
  background: var(--line);
}
.gallery img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease, opacity .2s; }
.gallery a:hover img { transform: scale(1.04); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 56px 0 0; }
.pager__link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  text-decoration: none;
  transition: box-shadow .2s, border-color .2s;
}
.pager__link:hover { border-color: transparent; box-shadow: var(--shadow); }
.pager__link--next { grid-column: 2; text-align: right; }
.pager__dir { color: var(--muted); font-size: .8rem; }
.pager__title { font: 650 1.05rem/1.3 var(--serif); }

.site-footer { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 64px; padding: 28px 0 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.site-footer img { border-radius: 50%; }
.site-footer p { margin: 0; }

/* --- 404 ---------------------------------------------------------------- */

.notfound { max-width: 560px; margin: 0 auto; padding: 18vh 24px; text-align: center; }
.notfound h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 .5em; }
.button { display: inline-block; margin-top: 1.5rem; padding: 12px 22px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 600; text-decoration: none; }

/* --- Carte : pins et étiquettes ------------------------------------------ */

.leaflet-container { font-family: var(--sans); background: #e9e5dd; }
/* Fond de carte adouci pour que le tracé ressorte. */
.leaflet-tile-pane { filter: saturate(.55) brightness(1.05) contrast(.9); }
.leaflet-control-attribution { font-size: 10px; }

.pin-icon { background: none; border: 0; }
.pin { position: relative; display: block; width: 24px; height: 24px; text-decoration: none; color: var(--ink); }
.pin__dot {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  transition: transform .2s;
}
.pin__label {
  position: absolute;
  top: 50%;
  left: 28px;
  max-width: 190px;
  overflow: hidden;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  text-overflow: ellipsis;
  transform: translateY(-50%);
  transition: opacity .15s;
}
.pin--left .pin__label { left: auto; right: 28px; }
.pin__label.is-hidden { opacity: 0; pointer-events: none; }
.pin:hover .pin__dot, .pin.is-active .pin__dot { transform: scale(1.25); }
.pin:hover .pin__label, .pin.is-active .pin__label { opacity: 1; pointer-events: auto; z-index: 2; background: var(--ink); color: #fff; }

.pin.is-current .pin__dot { transform: scale(1.35); box-shadow: 0 0 0 6px color-mix(in srgb, var(--c) 30%, transparent), 0 2px 6px rgba(0, 0, 0, .35); }
.pin.is-current .pin__label { left: 32px; padding: 4px 10px; font-size: 13px; background: var(--ink); color: #fff; }
.pin.is-current.pin--left .pin__label { left: auto; right: 32px; }
.pin.is-current::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--c);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse { from { transform: scale(.8); opacity: .9; } to { transform: scale(2.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pin.is-current::after { animation: none; } }

.leaflet-tooltip.pin-tip {
  width: 220px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  box-shadow: var(--shadow);
  white-space: normal;
}
.pin-tip img { display: block; width: 100%; height: 130px; object-fit: cover; background: var(--line); }
.pin-tip__body { display: block; padding: 8px 12px 10px; }
.pin-tip__date { display: block; color: var(--muted); font-size: 11px; }
.pin-tip__title { display: block; font: 650 14px/1.3 var(--serif); }

.map-toggle {
  padding: 8px 12px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, .95) !important;
  box-shadow: var(--shadow) !important;
  color: var(--ink);
  font: 600 12px var(--sans);
  cursor: pointer;
}
.leaflet-touch .leaflet-bar { border: 0; box-shadow: var(--shadow); border-radius: 10px; overflow: hidden; }

/* --- Visionneuse photo -------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: rgba(12, 11, 10, .94);
  color: #fff;
  touch-action: pan-y;
}
.lightbox[hidden] { display: none; }
.lightbox__img { max-width: 94vw; max-height: 88vh; max-height: 88dvh; border-radius: 6px; object-fit: contain; user-select: none; }
.lightbox button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s;
}
.lightbox button:hover { background: rgba(255, 255, 255, .25); }
.lightbox__close { top: 16px; right: 16px; }
.lightbox__prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 16px; top: 50%; transform: translateY(-50%); }
.lightbox__count { position: absolute; bottom: 16px; left: 0; right: 0; margin: 0; color: rgba(255, 255, 255, .7); font-size: .85rem; text-align: center; }

/* --- Mobile & tablette -------------------------------------------------- */

@media (max-width: 1180px) {
  .brand__tag { display: none; }
}

@media (max-width: 959px) {
  .split { display: flex; flex-direction: column; }
  .split__content { width: 100%; padding: 28px 16px 0; }
  .split__map { position: relative; top: 0; width: 100%; height: 56vh; order: -1; }
  .split__map .map { inset: 12px 16px 0; }
  .map-legend { left: 16px; bottom: 12px; gap: 2px 10px; margin: 0 8px; padding: 6px 10px; max-width: calc(100% - 48px); font-size: .68rem; }
  .map-legend span::before { width: 10px; }
  .split--post .split__map { display: none; }
  .post__map-mobile { position: relative; display: block; height: 280px; margin: 28px 0 0; }
  .post__map-mobile .map { inset: 0; }
  .chapter__title { font-size: 1.3rem; }
  .stage-card { grid-template-columns: 92px minmax(0, 1fr); gap: 12px; }
  .stage-card__img { width: 92px; height: 76px; }
  .gallery a { flex-basis: calc(var(--r) * 110px); }
  .lightbox__prev, .lightbox__next { display: none !important; }
}

@media (max-width: 520px) {
  .pager { grid-template-columns: 1fr; }
  .pager__link--next { grid-column: 1; }
}
