/* Carte de Chine interactive — styles autonomes (design tokens + carte).
   Palette accordée au site « Un zeste de Chine » : vert profond, papier
   crème, sceau vermillon, calligraphie Ma Shan Zheng.
   Aucune dépendance externe hormis Google Fonts. */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Lato:wght@400;700&family=Ma+Shan+Zheng&display=swap');

html, body { height: 100%; margin: 0; }

.czm-root {
  /* — encres & papiers — */
  --czm-ink: #14352c;          /* vert profond des titres du site */
  --czm-ink-soft: #4a6b5d;     /* texte secondaire */
  --czm-ink-faint: #7d9488;    /* légendes, méta */
  --czm-green: #6ab04c;        /* vert vif (le filet du site) */
  --czm-seal: #b8412f;         /* vermillon des sceaux chinois */
  --czm-paper: #ffffff;
  --czm-paper-warm: #faf7f0;

  /* — teintes de la carte — */
  --czm-sea: #e6f0f2;          /* mer, lavis bleuté */
  --czm-sea-deep: #dbe9ed;
  --czm-land: #f1ece1;         /* province sans lieu : papier */
  --czm-land-active: #dde9cd;  /* province avec lieux : vert d'eau */
  --czm-land-selected: #b9d29b;/* province ouverte */

  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Lato', system-ui, sans-serif;
  --font-zh: 'Ma Shan Zheng', 'Playfair Display', serif;

  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-lg: 0 14px 40px rgba(20, 53, 44, .18);

  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--czm-ink);
  background: var(--czm-paper);
  overflow: hidden;
  box-sizing: border-box;
}
.czm-root *, .czm-root *::before, .czm-root *::after { box-sizing: border-box; }
.czm-root a { color: var(--czm-ink); text-decoration: none; }

/* — boutons — */
.czm-root .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-body); font-weight: 700;
  font-size: 13.5px; letter-spacing: .02em; line-height: 1.2; color: var(--czm-ink);
  background: transparent; border: 1px solid transparent;
  padding: 10px 18px; border-radius: 999px;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.czm-root .btn-primary { background: var(--czm-ink); color: #fff; }
.czm-root .btn-primary:hover { background: var(--czm-green); }
.czm-root .btn-ghost { color: var(--czm-ink-soft); padding-inline: 10px; border-color: transparent; }
.czm-root .btn-ghost:hover { color: var(--czm-ink); background: rgba(106, 176, 76, .12); }
.czm-root .btn-icon {
  width: 34px; height: 34px; padding: 0; font-size: 15px;
  background: rgba(255, 255, 255, .92); color: var(--czm-ink);
  box-shadow: 0 2px 8px rgba(20, 53, 44, .16);
}
.czm-root .btn-icon:hover { background: #fff; }
.czm-root .btn-block { width: 100%; margin-top: 4px; }

/* — tags — */
.czm-root .tag {
  display: inline-flex; align-items: center; font-size: 11.5px;
  letter-spacing: .04em; padding: 4px 12px; border-radius: 999px;
}
/* nom chinois : calligraphie, comme les citations du site */
.czm-root .tag-accent {
  font-family: var(--font-zh); font-size: 17px; line-height: 1.1;
  padding: 3px 13px 5px;
  background: rgba(184, 65, 47, .09); color: var(--czm-seal);
}
.czm-root .tag-accent-2 {
  background: rgba(106, 176, 76, .14); color: #3f6b30;
  text-transform: uppercase; font-weight: 700; font-size: 10.5px; letter-spacing: .08em;
}

/* — carte : en-tête — */
.czm-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; padding: 30px 34px 16px; flex-wrap: wrap;
}
.czm-header h2 {
  font-family: var(--font-heading); font-weight: 700; font-size: 34px;
  margin: 0 0 8px; color: var(--czm-ink); letter-spacing: -0.015em;
}
/* filet vert, écho du séparateur du site */
.czm-header h2::after {
  content: ''; display: block; width: 46px; height: 3px;
  background: var(--czm-green); border-radius: 2px; margin-top: 12px;
}
.czm-header p { margin: 0; font-size: 15px; color: var(--czm-ink-soft); max-width: 520px; }

/* — corps : carte + panneau — */
.czm-body { display: flex; flex: 1 1 auto; min-height: 0; align-items: stretch; }
.czm-map-col { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }

.czm-map-wrap {
  position: relative; width: 100%; flex: 1 1 auto; min-height: 0;
  /* lavis d'aquarelle : la mer, avec deux voiles diffus */
  background:
    radial-gradient(ellipse 60% 50% at 78% 82%, rgba(106, 176, 76, .07), transparent 70%),
    radial-gradient(ellipse 55% 45% at 20% 15%, rgba(255, 255, 255, .8), transparent 70%),
    linear-gradient(165deg, var(--czm-sea-deep), var(--czm-sea) 45%, #f2f8f9);
  padding: 8px 8px 16px; display: flex; justify-content: center;
}
.czm-map-box {
  position: relative; width: 100%; height: 100%;
  border-radius: var(--radius-lg); overflow: hidden;
}
.czm-map-box svg { width: 100%; height: 100%; display: block; }
.czm-map-g { transform-origin: 0 0; transition: transform .6s cubic-bezier(.22,1,.36,1); }

.czm-prov { cursor: pointer; transition: fill .3s ease, filter .15s ease; }
.czm-prov:hover:not(.czm-prov--selected) { filter: brightness(0.94) saturate(1.2); }
.czm-label {
  font-family: var(--font-body); fill: var(--czm-ink-faint);
  pointer-events: none; user-select: none;
}

/* — points d'intérêt : pastille « sceau » vermillon (repli sans icône) — */
.czm-pin {
  cursor: pointer; padding: 0;
  position: absolute; transform: translate(-50%, -50%);
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--czm-seal); border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(20, 53, 44, .35);
  transition: left .6s cubic-bezier(.22,1,.36,1), top .6s cubic-bezier(.22,1,.36,1), transform .18s ease;
}
.czm-pin:hover { transform: translate(-50%, -50%) scale(1.25); }

/* — variante avec icône de type (ville / culture / nature) — badge plus
   grand, fond clair, pour que l'icône reste lisible — même halo animé — */
.czm-pin--icon {
  width: 30px; height: 30px;
  background: #fff; border: 2px solid var(--czm-seal);
  display: flex; align-items: center; justify-content: center;
}
.czm-pin-icon { width: 17px; height: 17px; object-fit: contain; pointer-events: none; }

.czm-ring {
  position: absolute; inset: -7px; border-radius: 50%;
  border: 2px solid var(--czm-seal);
  animation: czm-pulse 2.6s ease-out infinite;
}
.czm-pin--icon .czm-ring { inset: -6px; }
@keyframes czm-pulse { 0%{opacity:.55;transform:scale(.4)} 70%{opacity:0;transform:scale(1.9)} 100%{opacity:0;transform:scale(1.9)} }

/* — grandes villes — */
.czm-city {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; padding: 0; cursor: pointer;
}
.czm-city-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--czm-ink); border: 1.5px solid #fff;
  box-shadow: 0 1px 3px rgba(20, 53, 44, .35);
  transition: background .2s ease, transform .2s ease;
}
.czm-city-label {
  font-family: var(--font-body); font-size: 11px; font-weight: 700;
  letter-spacing: .03em; color: var(--czm-ink);
  background: rgba(255, 255, 255, .9); padding: 2px 8px; border-radius: 999px;
  white-space: nowrap; box-shadow: 0 1px 3px rgba(20, 53, 44, .14);
  transition: color .2s ease, background .2s ease;
}
.czm-city:hover .czm-city-dot { background: var(--czm-seal); transform: scale(1.25); }
.czm-city:hover .czm-city-label { color: var(--czm-seal); background: #fff; }

/* — info-bulle au survol d'une région (desktop uniquement) — */
.czm-tooltip {
  position: absolute; z-index: 50; pointer-events: none;
  width: 268px; background: #fff; border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(4px) scale(.98);
  transition: opacity .15s ease, transform .15s ease;
}
.czm-tooltip.czm-tooltip--visible { opacity: 1; transform: translateY(0) scale(1); }
/* marge tout autour de la photo : sans ça elle touche les bords arrondis
   de la bulle et son haut/bas paraît "mangé" par le cadre */
.czm-tooltip-media { padding: 10px 10px 0; }
.czm-tooltip-media img {
  width: 100%; height: 136px; object-fit: cover; display: block;
  border-radius: calc(var(--radius-md) - 4px);
}
.czm-tooltip-body { padding: 14px 16px 16px; }
.czm-tooltip-title { display: flex; align-items: baseline; gap: 8px; margin-bottom: 9px; flex-wrap: wrap; }
.czm-tooltip-title .tag-accent { font-size: 14px; padding: 2px 10px 4px; }
.czm-tooltip-title h4 {
  font-family: var(--font-heading); font-weight: 700; font-size: 15px;
  margin: 0; color: var(--czm-ink);
}
.czm-tooltip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.czm-tooltip-list li {
  font-size: 12.5px; color: var(--czm-ink-soft); line-height: 1.35;
  display: flex; gap: 7px; align-items: flex-start;
}
.czm-tooltip-list li::before {
  content: ''; width: 4px; height: 4px; border-radius: 50%; flex-shrink: 0;
  background: var(--czm-seal); margin-top: 6px;
}
.czm-tooltip-more { font-size: 11px; color: var(--czm-ink-faint); margin-top: 7px; }
.czm-tooltip-empty { font-size: 12.5px; color: var(--czm-ink-faint); font-style: italic; }

/* pas de survol tactile fiable : l'info-bulle est réservée aux pointeurs
   fins (souris/trackpad), voir HAS_HOVER dans app.js */

.czm-fadein { animation: czm-fadein .35s ease both; }
@keyframes czm-fadein { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.czm-backdrop { animation: czm-bdin .2s ease both; }
@keyframes czm-bdin { from{opacity:0} to{opacity:1} }

/* — barre de région sous la carte — */
.czm-region-bar {
  padding: 8px 34px 22px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.czm-region-bar h3 {
  font-family: var(--font-heading); font-weight: 600; font-size: 21px;
  margin: 0; color: var(--czm-ink);
}
.czm-no-pois { font-size: 13.5px; color: var(--czm-ink-faint); font-style: italic; }

/* — panneau de détail : docké à côté de la carte sur desktop,
     overlay plein écran sur mobile (media query plus bas) — */
.czm-poi-panel {
  flex: 0 0 auto; width: 0; overflow: hidden;
  border-left: 1px solid rgba(20, 53, 44, .1);
  transition: width .32s cubic-bezier(.22,1,.36,1);
}
.czm-poi-panel.czm-poi-panel--open { width: min(400px, 40vw); overflow-y: auto; }
.czm-poi-panel--open .dialog { border-radius: 0; box-shadow: none; }

.czm-root .dialog { background: var(--czm-paper); border-radius: var(--radius-lg); }
.czm-root .elev-lg { box-shadow: var(--shadow-lg); }
.czm-dialog { max-height: 88vh; overflow: auto; padding: 0; }
.czm-poi-panel--open .czm-dialog { width: 100%; height: 100%; max-height: none; }

.czm-dialog-media { position: relative; }
.czm-dialog-media img, .czm-dialog-media .czm-noimg {
  width: 100%; height: 250px; display: block; object-fit: cover;
}
.czm-dialog-media .czm-noimg {
  background: var(--czm-paper-warm); color: var(--czm-ink-faint);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-style: italic;
}
.czm-dialog-body { padding: 22px 26px 28px; }
.czm-dialog-body h3 {
  font-family: var(--font-heading); font-weight: 700; font-size: 25px;
  margin: 10px 0 10px; color: var(--czm-ink); line-height: 1.2;
}
.czm-dialog-body p {
  margin: 0 0 22px; font-size: 14.5px; color: var(--czm-ink-soft); line-height: 1.6;
}

.czm-meta-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; margin-bottom: 26px;
  padding-top: 20px; border-top: 1px solid rgba(20, 53, 44, .1);
}
.czm-meta-item { display: flex; gap: 10px; align-items: flex-start; }
.czm-meta-item svg { flex-shrink: 0; margin-top: 2px; }
.czm-meta-label {
  font-size: 10px; color: var(--czm-ink-faint); text-transform: uppercase;
  letter-spacing: .07em; font-weight: 700; margin-bottom: 2px;
}
.czm-meta-value { font-size: 13.5px; font-weight: 700; color: var(--czm-ink); line-height: 1.35; }

@media (max-width: 760px) {
  .czm-header { padding: 20px 18px 12px; }
  .czm-header h2 { font-size: 26px; }
  .czm-header h2::after { margin-top: 9px; }
  .czm-region-bar { padding: 6px 18px 18px; }
  .czm-meta-grid { grid-template-columns: 1fr; }

  /* sous 760px le panneau redevient un overlay par-dessus la carte */
  .czm-poi-panel { border-left: none; }
  .czm-poi-panel.czm-poi-panel--open {
    position: fixed; inset: 0; width: auto; z-index: 1000;
    display: flex; align-items: center; justify-content: center; padding: 16px;
    background: rgba(20, 53, 44, .55);
  }
  .czm-poi-panel--open .dialog { border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
  .czm-poi-panel--open .czm-dialog { width: 94vw; height: auto; max-height: 88vh; }
  .czm-dialog-media img, .czm-dialog-media .czm-noimg {
    height: 190px; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}
