/* =========================================================
   Wayfarer Log — palette carnet d'explorateur / carte nocturne
   ========================================================= */

:root {
  --bg: #12211f;
  --bg-elevated: #1a2e2a;
  --bg-elevated-2: #223a35;
  --hairline: #375349;
  --ink: #ede6d6;
  --ink-dim: #b9c4bd;
  --ink-faint: #7f9088;
  --gold: #d9a441;
  --gold-dim: #a67f38;
  --sage: #8fbfb2;

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --content-width: 1100px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

a { color: inherit; }

img { max-width: 100%; display: block; }

.wrap {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- Header ---------- */

.site-header {
  padding: 28px 0 22px;
  border-bottom: 1px solid var(--hairline);
}

.site-header .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.site-title {
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--ink);
}

.site-title em {
  color: var(--gold);
  font-style: italic;
}

.site-tagline {
  color: var(--ink-faint);
  font-size: 0.92rem;
  max-width: 34ch;
}

.back-link {
  text-decoration: none;
  color: var(--sage);
  font-size: 0.9rem;
  white-space: nowrap;
}
.back-link:hover { color: var(--gold); }

/* ---------- Homepage hero ---------- */

.hero {
  position: relative;
  border-bottom: 1px solid var(--hairline);
}

.hero-map {
  height: 46vh;
  min-height: 320px;
  width: 100%;
  background: var(--bg-elevated);
}

.hero-caption {
  padding: 22px 0 30px;
}

.hero-caption h1 {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  font-weight: 500;
  margin: 0 0 10px;
  max-width: 20ch;
}

.hero-caption p {
  color: var(--ink-dim);
  max-width: 60ch;
  margin: 0;
}

.hero-stats {
  display: flex;
  gap: 28px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.hero-stat .num {
  font-family: var(--serif);
  font-size: 1.6rem;
  color: var(--gold);
  display: block;
  line-height: 1.1;
}

.hero-stat .label {
  color: var(--ink-faint);
  font-size: 0.82rem;
}

/* ---------- Trip grid ---------- */

.trip-grid {
  padding: 36px 0 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 26px;
}

.trip-card {
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--hairline);
  background: var(--bg-elevated);
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.trip-card:hover { border-color: var(--gold-dim); }

.trip-card .cover {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-elevated-2);
}
.trip-card .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trip-card .body { padding: 16px 18px 20px; }

.trip-card .dates {
  font-size: 0.78rem;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

.trip-card h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.3rem;
  margin: 6px 0 8px;
}

.trip-card .summary {
  color: var(--ink-dim);
  font-size: 0.92rem;
  margin: 0 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.trip-card .meta {
  display: flex;
  gap: 14px;
  font-size: 0.8rem;
  color: var(--sage);
  border-top: 1px solid var(--hairline);
  padding-top: 12px;
}

/* ---------- Trip detail page ---------- */

.trip-header {
  padding: 26px 0 22px;
  border-bottom: 1px solid var(--hairline);
}

.trip-header .dates {
  color: var(--ink-faint);
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.trip-header h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.9rem, 3.6vw, 2.7rem);
  margin: 0 0 10px;
}

.trip-header .summary {
  color: var(--ink-dim);
  max-width: 68ch;
  margin: 0 0 16px;
}

.trip-stats {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
}
.trip-stats .num { color: var(--gold); font-family: var(--serif); font-size: 1.25rem; }
.trip-stats .label { color: var(--ink-faint); font-size: 0.78rem; }

.trip-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 0;
  align-items: start;
}

.trip-map-col {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--hairline);
}

#trip-map {
  height: 100%;
  width: 100%;
  background: var(--bg-elevated);
}

.timeline {
  padding: 30px 30px 80px;
}

.step {
  padding: 26px 0;
  border-bottom: 1px solid var(--hairline);
  scroll-margin-top: 20px;
}
.step:first-child { padding-top: 0; }
.step:last-child { border-bottom: none; }

.step.is-active .step-name { color: var(--gold); }

.step-meta {
  display: flex;
  gap: 12px;
  align-items: baseline;
  color: var(--ink-faint);
  font-size: 0.8rem;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.step-name {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 500;
  margin: 0 0 6px;
}

.step-place { color: var(--sage); }

.step-desc {
  color: var(--ink-dim);
  margin: 8px 0 14px;
  max-width: 70ch;
  white-space: pre-line;
}

.step-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}

.step-photos button {
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  aspect-ratio: 1;
  overflow: hidden;
}
.step-photos img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}
.step-photos button:hover img { transform: scale(1.04); }

.step-video {
  margin-top: 10px;
  max-width: 360px;
}
.step-video video { width: 100%; border: 1px solid var(--hairline); }

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 15, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.lightbox.is-open { display: flex; }

.lightbox img {
  max-width: 90vw;
  max-height: 86vh;
  object-fit: contain;
}

.lightbox-close, .lightbox-prev, .lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: var(--ink);
  font-size: 2rem;
  cursor: pointer;
  padding: 10px 16px;
}
.lightbox-close { top: 10px; right: 14px; }
.lightbox-prev { left: 6px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 6px; top: 50%; transform: translateY(-50%); }
.lightbox-count {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--ink-faint);
  font-size: 0.85rem;
}

/* ---------- Leaflet tweaks ---------- */

.leaflet-container { background: var(--bg-elevated); font-family: var(--sans); }

/* Tuiles OpenStreetMap standard (gratuites, sans clé) assombries en CSS
   pour retrouver l'esprit "carte de nuit" sans dépendre d'un fournisseur
   de fond de carte tiers qui pourrait un jour devenir payant. */
.leaflet-tile-pane {
  filter: invert(1) hue-rotate(170deg) brightness(0.92) contrast(0.88) saturate(0.7);
}

.leaflet-control-attribution {
  background: rgba(18, 33, 31, 0.75) !important;
  color: var(--ink-faint) !important;
}
.leaflet-control-attribution a { color: var(--sage) !important; }
.trip-pin {
  background: var(--gold);
  border: 2px solid var(--bg);
  border-radius: 50%;
  width: 10px;
  height: 10px;
}
.trip-pin.active { background: var(--sage); }

/* ---------- Footer ---------- */

.site-footer {
  padding: 30px 0 50px;
  color: var(--ink-faint);
  font-size: 0.82rem;
  border-top: 1px solid var(--hairline);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .trip-layout { grid-template-columns: 1fr; }
  .trip-map-col {
    position: sticky;
    top: 0;
    z-index: 5;
    height: 40vh;
    min-height: 280px;
    border-right: none;
    border-bottom: 1px solid var(--hairline);
  }
  .timeline { padding: 24px 20px 60px; }
}

/* ---------- Ajouts : visibilité, filtres, diaporama, admin ---------- */
.visibility-badge { display:inline-block; padding:2px 10px; border-radius:999px; font-size:.75rem; background:#d9a441; color:#12211f; margin-left:8px; vertical-align:middle; }
.step-locate { background:none; border:1px solid var(--hairline); border-radius:999px; padding:4px 10px; cursor:pointer; color:inherit; font:inherit; font-size:.8rem; margin-top:8px; }
.step-locate:hover { border-color:#d9a441; }
.lightbox-play { position:absolute; top:10px; right:64px; background:none; border:none; color:#fff; font-size:1.4rem; cursor:pointer; padding:8px 12px; }
.filters { display:flex; flex-wrap:wrap; gap:10px; margin:0 0 20px; }
.filters[hidden] { display:none; }
.filters input, .filters select { padding:8px 12px; border:1px solid var(--hairline); border-radius:8px; background:transparent; color:inherit; font:inherit; }
.filters input { flex:1; min-width:180px; }
.admin { max-width:960px; margin:0 auto; padding:24px 16px 80px; }
.admin h1, .admin h2 { margin-top:1.5em; }
.admin .card { border:1px solid var(--hairline); border-radius:12px; padding:16px; margin:12px 0; }
.admin .row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.admin input[type=text], .admin input[type=password], .admin input[type=date], .admin textarea, .admin select { padding:8px 10px; border:1px solid var(--hairline); border-radius:8px; background:transparent; color:inherit; font:inherit; width:100%; box-sizing:border-box; }
.admin textarea { min-height:90px; }
.admin button, .admin .btn { padding:8px 14px; border-radius:8px; border:1px solid var(--hairline); background:#d9a441; color:#12211f; cursor:pointer; font:inherit; font-weight:600; }
.admin button.secondary { background:transparent; color:inherit; }
.admin button.danger { background:#b3392f; color:#fff; border-color:#b3392f; }
.admin progress { width:100%; }
.admin .log { font-family:monospace; font-size:.8rem; max-height:200px; overflow:auto; white-space:pre-wrap; opacity:.8; }
.admin .thumbs { display:grid; grid-template-columns:repeat(auto-fill,minmax(110px,1fr)); gap:8px; }
.admin .thumbs figure { margin:0; position:relative; }
.admin .thumbs img { width:100%; aspect-ratio:1; object-fit:cover; border-radius:8px; }
.admin .thumbs .hidden-item img { opacity:.35; }
.admin .thumbs .tools { display:flex; gap:4px; margin-top:4px; }
.admin .thumbs .tools button { padding:2px 6px; font-size:.7rem; }