/* Carnet de voyage — 4 thèmes commutables (Magazine / Immersif / Carte / Minimal).
   Palette pilotée par variables ; structure ajustée par thème via [data-ct].
   Lightbox : gallery.css (chargé à part). */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body.jv-page {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    background: var(--bg);
    color: var(--ink);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== Palettes par thème ===== */
[data-ct="editorial"] {
    --bg: #f5efe3; --card: #fffdf9; --ink: #2b2018; --muted: #8a7d6d; --accent: #c0532f;
    --line: #e7ddcd; --serif: 'Fraunces', Georgia, serif; --hero-bg: #f5efe3; --hero-ink: #2b2018;
}
[data-ct="immersif"] {
    --bg: #08080a; --card: #111118; --ink: #f3f3f7; --muted: #9aa0b0; --accent: #ffb878;
    --line: #20212c; --serif: 'Fraunces', Georgia, serif; --hero-bg: #08080a; --hero-ink: #fff;
}
[data-ct="carte"] {
    --bg: #eef2f5; --card: #ffffff; --ink: #1f2733; --muted: #6b7a8a; --accent: #c0532f;
    --line: #e2e8ef; --serif: 'Fraunces', Georgia, serif; --hero-bg: #ffffff; --hero-ink: #1f2733;
}
[data-ct="minimal"] {
    --bg: #ffffff; --card: #ffffff; --ink: #141414; --muted: #9a9a9a; --accent: #141414;
    --line: #efefef; --serif: 'Inter', sans-serif; --hero-bg: #ffffff; --hero-ink: #141414;
}

/* ===== Barre de progression ===== */
.jv-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); z-index: 60; transition: width 0.1s linear; }

/* ===== Barre supérieure + sélecteur ===== */
.jv-topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap;
    padding: 0.6rem 1rem;
    background: color-mix(in srgb, var(--card) 86%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}
.jv-topbar-brand { font-weight: 700; font-size: 0.98rem; display: flex; align-items: center; gap: 0.4rem; }
.jv-theme { display: flex; gap: 0.25rem; background: color-mix(in srgb, var(--ink) 7%, transparent); padding: 0.2rem; border-radius: 999px; }
.jv-theme-btn {
    border: 0; cursor: pointer; font: inherit; font-size: 0.76rem; font-weight: 600;
    color: var(--muted); background: transparent; padding: 0.32rem 0.62rem; border-radius: 999px;
    transition: background-color 0.15s, color 0.15s;
}
.jv-theme-btn:hover { color: var(--ink); }
.jv-theme-btn.is-active { background: var(--accent); color: #fff; }
.jv-prive-btn {
    display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.4rem 0.8rem;
    font-size: 0.8rem; font-weight: 600; color: var(--muted); text-decoration: none;
    border: 1px solid var(--line); border-radius: 999px; background: var(--bg); white-space: nowrap;
}
.jv-prive-btn:hover { color: var(--ink); border-color: var(--accent); }

/* ===== Hero ===== */
.jv-hero { position: relative; overflow: hidden; text-align: center; padding: 3rem 1.4rem 2.6rem; background: var(--hero-bg); color: var(--hero-ink); }
.jv-hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2.1rem, 6vw, 3.2rem); line-height: 1.05; margin: 0.3rem 0 0.4rem; letter-spacing: -0.01em; }
.jv-hero p { margin: 0 auto; max-width: 34rem; font-size: clamp(0.98rem, 2.4vw, 1.15rem); color: var(--muted); }
.jv-hero-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 1.2rem; }
.jv-chip { font-size: 0.78rem; font-weight: 600; padding: 0.32rem 0.74rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: color-mix(in srgb, var(--ink) 4%, transparent); }
.jv-scrollcue { position: absolute; left: 50%; bottom: 0.5rem; transform: translateX(-50%); font-size: 1.4rem; opacity: 0.7; animation: jv-bounce 1.8s ease-in-out infinite; pointer-events: none; }
@keyframes jv-bounce { 0%,100% { transform: translate(-50%,0); } 50% { transform: translate(-50%,7px); } }

/* ===== Fil des jours ===== */
.jv-main { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 2rem 1rem 3.5rem; }

/* Carte (cachée hors thème carte) */
#jv-map { display: none; margin-bottom: 2rem; }
.jvm-head { text-align: center; margin-bottom: 0.6rem; }
.jvm-head h2 { font-family: var(--serif); font-weight: 600; font-size: 1.5rem; margin: 0; }
.jvm-head p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.9rem; }
.jvm-leaflet { position: relative; height: 380px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 12px 30px -22px rgba(0,0,0,.45); background: #e8edf0; }
.jvm-inset { position: absolute; right: 10px; top: 10px; width: 148px; z-index: 500; border-radius: 10px; overflow: hidden; border: 2px solid #fff; box-shadow: 0 5px 16px rgba(0,0,0,.4); background: #e8edf0; }
.jvm-inset-lbl { font: 700 10px 'Inter', sans-serif; color: var(--accent); background: #fff; padding: 4px 6px; text-align: center; letter-spacing: 0.02em; }
.jvm-inset-map { height: 104px; }
.jvm-leaflet .leaflet-control-attribution { font-size: 9px; }
.jvm-mk span { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); color: var(--accent); font: 700 12px 'Inter', sans-serif; box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: transform 0.12s; }
.jvm-mk:hover span { transform: scale(1.12); }
.jvm-mk.act span { background: var(--accent); color: #fff; }
.jvm-frame { background: linear-gradient(160deg, #f3efe4, #e9efe6); border: 1px solid #e0ddd0; border-radius: 16px; overflow: hidden; box-shadow: inset 0 1px 0 #fff, 0 12px 30px -22px rgba(0,0,0,.45); }
.jvm-frame svg { display: block; width: 100%; height: auto; }
.jvm-route { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; opacity: 0.85; }
.jvm-fly { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: 3 4; opacity: 0.7; }
.jvm-pin circle { fill: #fff; stroke: var(--accent); stroke-width: 2; cursor: pointer; transition: r 0.15s; }
.jvm-pin text { font: 700 9px 'Inter', sans-serif; fill: var(--accent); text-anchor: middle; pointer-events: none; }
.jvm-pin .jvm-lbl { font: 600 8.5px 'Inter', sans-serif; fill: #5b6b7d; }
.jvm-pin.act circle { fill: var(--accent); }
.jvm-pin.act text { fill: #fff; }
.jvm-pin.act .jvm-lbl { fill: var(--accent); }
.jvm-pin:hover circle, .jvm-pin:focus circle { r: 11; outline: none; }

/* ===== Carte d'un jour (structure commune) ===== */
.d {
    background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
    margin: 0 0 2rem; box-shadow: 0 16px 38px -24px rgba(15,23,42,.4), 0 2px 8px rgba(15,23,42,.05);
    opacity: 0; transform: translateY(22px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16,1,0.3,1);
}
.d.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .d { opacity: 1; transform: none; transition: none; } }

.d-media { position: relative; }
.d-cover-empty { position: relative; overflow: hidden; min-height: clamp(180px, 36vw, 250px); background-size: cover; background-position: center; }
.d-cover-empty::after { content: attr(data-emoji); position: absolute; right: -0.12em; bottom: -0.28em; font-size: clamp(6rem, 22vw, 10rem); line-height: 1; opacity: 0.2; pointer-events: none; }
.d-cover-gal { margin: 0; display: block; }
.d-cover-item { position: relative; margin: 0; overflow: hidden; }
.d .gallery-item img { display: block; width: 100%; opacity: 0; transition: opacity 0.5s ease, transform 0.5s ease; }
.d .gallery-item img.gallery-img-loaded { opacity: 1; }
.d-cover-item img { aspect-ratio: 16/9; object-fit: cover; cursor: pointer; }
.d-cover-item:hover img { transform: scale(1.03); }

.d-head { position: absolute; inset: auto 0 0 0; z-index: 1; padding: 1.6rem 1.3rem 1.1rem; display: flex; flex-direction: column; gap: 0.28rem; color: #fff; background: linear-gradient(to top, rgba(0,0,0,.72) 0%, rgba(0,0,0,.5) 28%, rgba(0,0,0,.24) 55%, rgba(0,0,0,.08) 78%, transparent 100%); pointer-events: none; }
.d-chip { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; opacity: 0.92; }
.d-draft { align-self: flex-start; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: #fff; background: #d97706; border-radius: 999px; padding: 0.18rem 0.6rem; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.d-title { font-family: var(--serif); font-weight: 600; font-size: clamp(1.4rem, 3.6vw, 2rem); line-height: 1.08; margin: 0; text-shadow: 0 2px 16px rgba(0,0,0,.4); }
.d-loc { font-size: 0.85rem; font-weight: 500; opacity: 0.96; }

.d-body { padding: 1.4rem 1.6rem 1.5rem; }
.d-recit { font-size: 1.05rem; line-height: 1.78; color: var(--muted); }
.d-recit p { margin: 0 0 0.85rem; } .d-recit p:last-child { margin-bottom: 0; }
.d-recit strong { color: var(--ink); }
.d-extra { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 4px; margin-top: 1.1rem; }
.d-extra .gallery-item { position: relative; margin: 0; overflow: hidden; border-radius: 6px; background: var(--line); }
.d-extra .gallery-item img { aspect-ratio: 1/1; object-fit: cover; cursor: pointer; }
.d-extra .gallery-item:hover img { transform: scale(1.06); }
.d-extra figcaption { position: absolute; inset: auto 0 0 0; padding: 0.6rem 0.5rem 0.35rem; font-size: 0.72rem; color: #fff; background: linear-gradient(to top, rgba(0,0,0,.65), transparent); opacity: 0; transition: opacity 0.2s; }
.d-extra .gallery-item:hover figcaption { opacity: 1; }

/* ===== ÉDITORIAL : lettrine ===== */
[data-ct="editorial"] .jv-hero::before { content: ""; position: absolute; left: 50%; bottom: 1.4rem; transform: translateX(-50%); width: 54px; height: 3px; background: var(--accent); border-radius: 2px; }
[data-ct="editorial"] .d-recit p:first-of-type::first-letter { font-family: var(--serif); font-weight: 600; font-size: 3.1em; line-height: 0.78; float: left; margin: 0.04em 0.1em 0 0; color: var(--accent); }

/* ===== MINIMAL : titre au-dessus, sans scrim ===== */
[data-ct="minimal"] .d { border: 0; box-shadow: none; border-radius: 0; margin-bottom: 3.4rem; background: transparent; }
[data-ct="minimal"] .d-media { display: flex; flex-direction: column; }
[data-ct="minimal"] .d-head { position: static; order: -1; color: var(--ink); background: none; padding: 0 0 0.9rem; gap: 0.15rem; }
[data-ct="minimal"] .d-chip { color: var(--ink); opacity: 1; }
[data-ct="minimal"] .d-title { font-family: 'Inter', sans-serif; font-weight: 600; letter-spacing: -0.01em; text-shadow: none; font-size: 1.5rem; }
[data-ct="minimal"] .d-loc { color: var(--muted); }
[data-ct="minimal"] .d-cover-item img, [data-ct="minimal"] .d-cover-empty { border-radius: 3px; aspect-ratio: 3/2; }
[data-ct="minimal"] .d-cover-empty { min-height: 0; }
[data-ct="minimal"] .d-body { padding: 1.1rem 0 0; }
[data-ct="minimal"] .d-extra { border-radius: 0; }

/* ===== CARTE : afficher la carte ===== */
[data-ct="carte"] #jv-map { display: block; }

/* ===== IMMERSIF : scènes plein écran ===== */
[data-ct="immersif"] body, [data-ct="immersif"] .jv-main { max-width: none; }
[data-ct="immersif"] .jv-main { max-width: none; padding: 0; }
[data-ct="immersif"] .jv-hero { min-height: 78vh; display: flex; flex-direction: column; justify-content: center; background: radial-gradient(1200px 700px at 50% 30%, #3b2d6e, #08080a); }
[data-ct="immersif"] .d { border: 0; border-radius: 0; margin: 0; box-shadow: none; background: #08080a; }
/* Immersif : la scène est visible d'emblée ; l'apparition se fait via le fondu du voile noir sur le média. */
[data-ct="immersif"] .d { opacity: 1; transform: none; transition: none; }
[data-ct="immersif"] .d-media { height: 86vh; min-height: 520px; }
/* Fondu du noir vers l'image quand la scène entre à l'écran (voile sur sa propre couche GPU). */
[data-ct="immersif"] .d-media::after { content: ""; position: absolute; inset: 0; background: #08080a; opacity: 1; transition: opacity 0.9s ease-in-out; pointer-events: none; z-index: 2; will-change: opacity; }
[data-ct="immersif"] .d.is-in .d-media::after { opacity: 0; }
[data-ct="immersif"] .d-cover-gal, [data-ct="immersif"] .d-cover-item { height: 100%; }
[data-ct="immersif"] .d-cover-item img { height: 100%; aspect-ratio: auto; }
[data-ct="immersif"] .d-cover-empty { height: 86vh; min-height: 520px; }
[data-ct="immersif"] .d-head { padding: 1.6rem 1.5rem 2rem; }
[data-ct="immersif"] .d-title { font-size: clamp(2rem, 7vw, 3.2rem); }
[data-ct="immersif"] .d-body { max-width: 680px; margin: 0 auto; color: var(--ink); padding: 1.8rem 1.5rem 3rem; }
[data-ct="immersif"] .d-recit { color: #cfd2dd; }

/* ===== États ===== */
.jv-vide, .jv-erreur { text-align: center; padding: 3.5rem 1rem; color: var(--muted); }
.jv-vide-emoji { font-size: 3.4rem; margin-bottom: 0.6rem; }
.jv-vide-titre { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; color: var(--ink); margin: 0 0 0.4rem; }
.jv-vide-texte { margin: 0 auto; max-width: 26rem; line-height: 1.6; }
.jv-footer { text-align: center; padding: 1.6rem 1rem 2.6rem; font-size: 0.82rem; color: var(--muted); }
[data-ct="immersif"] .jv-footer { background: #08080a; }

@media (max-width: 480px) {
    .d-body { padding: 1.1rem 1.1rem 1.2rem; }
    .d-extra { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .jv-theme-btn { padding: 0.3rem 0.5rem; font-size: 0.72rem; }
}
