/* Styles communs à tous les prototypes : carte, rideau, messages, documents. */
:root {
  --paper: #f6f1e7;
  --card: #fffdf7;
  --ink: #26221c;
  --muted: #645b4f;
  --accent: #a8432a;
  --accent-dark: #7d2f1c;
  --night: #201c17;
  --gold: #e3b04b;
  --shadow: 0 6px 22px rgba(20, 14, 6, .28);
  --ui: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--ink);
  font: 16px/1.45 var(--ui); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
#map { position: absolute; inset: 0; background: #d9d2c3; }
.leaflet-container { font: inherit; background: #d9d2c3; }
/* Le passage d'une vue à l'autre se fait en fondu. */
.leaflet-tile-pane .leaflet-layer { transition: opacity .7s ease; }
/* Le trait fin des plans devient gris pâle quand le plan est réduit à l'écran. Ce réglage
   fonce les gris sans toucher au blanc du papier : le trait reste noir et lisible.
   Les deux nombres vont ensemble : le blanc reste blanc tant que (brightness - 0.5) x contrast = 0.5. */
.vt-plan { mix-blend-mode: multiply; filter: brightness(.667) contrast(3); }
/* Sous un plan de l'atlas, la photo de gauche pâlit : le trait noir du plan se lit mieux. */
.leaflet-tile-pane .leaflet-layer { transition: opacity .7s ease, filter .5s ease; }
.vt-plans-on .vt-side-left.vt-kind-photo { filter: brightness(1.5) contrast(.5) saturate(.6); }
.leaflet-control-attribution { font-size: 11px; }

/* Boutons */
.vt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 42px; padding: 0 16px; border: 0; border-radius: 10px; background: var(--card);
  color: var(--ink); font-size: 16px; font-weight: 600; box-shadow: var(--shadow);
  white-space: nowrap; }
.vt-btn:hover { background: #fff; }
.vt-btn:active { transform: translateY(1px); }
.vt-btn.primary { background: var(--accent); color: #fff; }
.vt-btn.primary:hover { background: var(--accent-dark); }
.vt-btn.dark { background: var(--night); color: #fff; }
.vt-btn.on { background: var(--ink); color: #fff; }
.vt-btn:focus-visible, .vt-zoom button:focus-visible { outline: 4px solid var(--gold); outline-offset: 2px; }
.vt-btn svg { flex: none; }

/* Boutons pour agrandir et réduire la carte */
.vt-zoom { position: absolute; z-index: 800; right: 16px; top: 16px; display: flex;
  flex-direction: column; gap: 8px; }
.vt-zoom button { width: 42px; height: 42px; border: 0; border-radius: 10px; background: var(--card);
  box-shadow: var(--shadow); font-size: 26px; line-height: 1; font-weight: 500; color: var(--ink); }
.vt-zoom button:hover { background: #fff; }
.vt-zoom button:disabled { opacity: .45; cursor: default; }

/* Le rideau : une barre verticale que l'on fait glisser. */
.vt-curtain { position: absolute; top: 0; bottom: 0; left: 50%; width: 0; z-index: 700; }
.vt-curtain[hidden] { display: none; }
.vt-curtain-line { position: absolute; top: 0; bottom: 0; left: -3px; width: 6px; background: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, .6); pointer-events: none; }
.vt-curtain-hit { position: absolute; top: 0; bottom: 0; left: -34px; width: 68px; cursor: ew-resize;
  touch-action: none; }
.vt-curtain-handle { position: absolute; top: var(--vt-handle-y, 50%); left: -28px; width: 56px; height: 56px;
  margin-top: -28px; border-radius: 50%; background: #fff; box-shadow: 0 3px 14px rgba(0, 0, 0, .5);
  display: flex; align-items: center; justify-content: center; pointer-events: none; color: var(--accent); }
.vt-curtain-hint { position: absolute; top: calc(var(--vt-handle-y, 50%) + 36px); left: -150px; width: 300px; text-align: center;
  pointer-events: none; }
.vt-curtain-hint span { display: inline-block; background: var(--night); color: #fff; font-size: 14px;
  font-weight: 600; padding: 6px 14px; border-radius: 10px; box-shadow: var(--shadow); }
.vt-chip { position: absolute; top: var(--vt-handle-y, 50%); transform: translateY(-50%); white-space: nowrap; background: var(--night); color: #fff;
  font-size: 18px; font-weight: 700; padding: 5px 12px; border-radius: 10px; box-shadow: var(--shadow);
  pointer-events: none; font-family: var(--serif); }
.vt-chip.left { right: 40px; }
.vt-chip.right { left: 40px; }
.vt-chip small { display: block; font: 600 11px/1.2 var(--ui); opacity: .8; letter-spacing: .02em; }

/* Message d'attente */
.vt-status { position: absolute; z-index: 850; left: 50%; top: 92px; transform: translateX(-50%);
  background: var(--night); color: #fff; font-size: 15px; font-weight: 600; padding: 8px 16px;
  border-radius: 12px; box-shadow: var(--shadow); pointer-events: none; opacity: 0;
  transition: opacity .25s; max-width: 80%; text-align: center; }
.vt-status.show { opacity: 1; }
.vt-status::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 10px;
  border-radius: 50%; background: var(--gold); animation: vt-pulse 1s infinite alternate; }
@keyframes vt-pulse { from { opacity: .3; } to { opacity: 1; } }

/* Vignette d'un document posée sur la carte */
.vt-docpin { background: none; border: 0; }
.vt-docpin button { display: block; width: 92px; padding: 4px 4px 2px; border: 0; border-radius: 6px;
  background: #fff; box-shadow: 0 3px 12px rgba(0, 0, 0, .55); text-align: center; transform: rotate(-2deg);
  transition: transform .15s; }
.vt-docpin:nth-child(even) button { transform: rotate(2deg); }
.vt-docpin button:hover { transform: scale(1.12); }
.vt-docpin img { display: block; width: 84px; height: 60px; object-fit: cover; border-radius: 3px; }
.vt-docpin span { display: block; font: 700 12px/18px var(--ui); color: var(--accent-dark); }

/* Nom d'un endroit posé sur la carte */
.vt-mark { background: none; border: 0; }
.vt-mark button { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); border: 0;
  background: var(--night); color: #fff; font: 700 13px/1 var(--ui); padding: 6px 10px; border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5); white-space: nowrap; }
.vt-mark button::after { content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -7px;
  border: 7px solid transparent; border-bottom: 0; border-top-color: var(--night); }
.vt-mark button:hover { background: var(--accent); }
.vt-mark button:hover::after { border-top-color: var(--accent); }
.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: var(--shadow); background: var(--card); }
.leaflet-popup-content { margin: 14px 18px; font-size: 15px; line-height: 1.4; color: var(--ink); }
.leaflet-popup-content b { display: block; font: 700 19px/1.2 var(--serif); margin-bottom: 6px; }
.leaflet-popup-content i { display: block; margin-top: 8px; font-size: 14px; color: var(--muted); font-style: normal; }
.leaflet-container a.leaflet-popup-close-button { width: 44px; height: 44px; font-size: 30px; line-height: 44px;
  color: var(--ink); top: 2px; right: 2px; }

/* Document ouvert en grand */
.vt-doc { position: fixed; inset: 0; z-index: 5000; background: #1b1713; display: flex;
  align-items: stretch; color: #fff; }
.vt-doc[hidden] { display: none; }
.vt-doc-figure { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center;
  padding: 28px 12px 28px 28px; overflow: auto; }
.vt-doc-figure img { max-width: 100%; max-height: 100%; border: 10px solid #fff; border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6); background: #fff; }
.vt-doc.big .vt-doc-figure { display: block; cursor: grab; touch-action: none; }
.vt-doc.big .vt-doc-figure:active { cursor: grabbing; }
.vt-doc-drag { display: none; position: sticky; left: 50%; bottom: 14px; width: 380px; margin: 14px 0 0 -190px; text-align: center;
  background: var(--gold); color: #2a2110; font-size: 18px; font-weight: 700; padding: 8px 14px; border-radius: 10px;
  box-shadow: var(--shadow); pointer-events: none; transform: translateX(calc(50vw - 370px)); }
.vt-doc.big .vt-doc-drag { display: block; position: fixed; left: 28px; bottom: 24px; margin: 0; transform: none; }
.vt-doc.big .vt-doc-figure img { max-width: none; max-height: none; width: 190%; }
.vt-doc-side { width: 370px; flex: none; padding: 28px 28px 24px 16px; display: flex; flex-direction: column;
  gap: 14px; overflow: auto; }
.vt-doc-kicker { font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.vt-doc-title { font: 700 26px/1.15 var(--serif); margin: 0; }
.vt-doc-caption { font: italic 18px/1.4 var(--serif); margin: 0; }
.vt-doc-caption small { display: block; font: 600 14px/1.3 var(--ui); font-style: normal; color: var(--gold);
  margin-bottom: 4px; }
.vt-doc-meta { font-size: 15px; margin: 0; color: #e9e1d2; }
.vt-doc-warn { font-size: 14px; margin: 0; padding: 10px 14px; border-radius: 10px; background: rgba(227, 176, 75, .18);
  color: #f6e3b5; }
.vt-doc-actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.vt-doc-actions .row { display: flex; gap: 10px; }
.vt-doc-actions .row .vt-btn { flex: 1; padding: 0 10px; font-size: 15px; }
.vt-doc-count { font-size: 15px; color: #cfc6b6; text-align: center; }

/* Pile de photos posée sur la carte : un seul bouton pour plusieurs documents */
.vt-stack { background: none; border: 0; }
.vt-stack button { position: relative; display: block; width: 108px; border: 0; background: none; padding: 0; }
.vt-stack .pile { position: relative; display: block; width: 80px; height: 58px; margin: 0 auto; }
.vt-stack .pile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 4px solid #fff;
  border-radius: 4px; box-shadow: 0 3px 10px rgba(0, 0, 0, .55); }
.vt-stack .pile img:nth-child(1) { transform: rotate(-7deg) translate(-8px, 2px); }
.vt-stack .pile img:nth-child(2) { transform: rotate(5deg) translate(8px, -2px); }
.vt-stack .pile img:nth-child(3) { transform: rotate(-1deg); }
.vt-stack .label { display: block; margin-top: 7px; background: var(--accent); color: #fff; font: 700 13px/1.2 var(--ui);
  padding: 5px 6px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.vt-stack button:hover .label { background: var(--accent-dark); }
.vt-stack button:hover .pile { transform: scale(1.06); }

/* Message quand une vue n'arrive pas : il reste affiché, sans point qui clignote. */
.vt-status.failed { background: var(--accent-dark); }
.vt-status.failed::before { animation: none; background: #fff; }

/* Avis court (par exemple : la carte est au bord) : sans point qui clignote. */
.vt-status.notice::before { display: none; }
/* Le relief de l'IGN est gris : une teinte chaude et un peu plus de contraste. */
.vt-kind-relief { filter: sepia(.3) contrast(1.22); }
/* Étiquette placée sous son point, pour deux endroits trop proches. */
.vt-mark.below button { transform: translate(-50%, 10px); }
.vt-mark.below button::after { bottom: auto; top: -7px; border: 7px solid transparent; border-top: 0; border-bottom-color: var(--night); }
.vt-mark.below button:hover::after { border-top-color: transparent; border-bottom-color: var(--accent); }
/* Repère d'un grand endroit du site : étiquette claire. */
.vt-mark.spot button { background: var(--card); color: var(--ink); font-size: 13px; }
.vt-mark.spot button::after { border-top-color: var(--card); }
.vt-mark.spot button:hover { background: var(--accent); color: #fff; }
.vt-mark.spot button:hover::after { border-top-color: var(--accent); }

/* Quand le plan de l'atlas est posé, ses propres noms d'endroits suffisent : les trois
   repères généraux sont cachés, pour que deux étiquettes ne se recouvrent pas. */
.vt-plans-on .vt-mark.spot { display: none; }

/* Flèches du rond de la barre de comparaison */
.vt-curtain-handle svg { width: 32px; height: 20px; }
