/* ==========================================================================
   201 — World Map Styles
   Générateur de cartes du monde stylisées (lowpoly, dots, radial, réseau,
   binaire, pays) rendues en SVG currentColor depuis l'asset world-map.svg.
   Menu radio en pills, révélation en vague radiale (délais --wms-d posés
   inline par anim.js), bouton d'export SVG du style courant.
   ========================================================================== */

.wms {
  --wms-ink: var(--ml-accent, #7c8cff);

  position: relative;
  width: min(100%, 340px);
  font-family: inherit;
  color: var(--ml-fg, #e8eaf2);
}

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

.wms__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.wms__title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ml-muted, #8b91a3);
}

.wms__export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid color-mix(in oklab, var(--ml-muted, #8b91a3) 35%, transparent);
  border-radius: 6px;
  background: transparent;
  color: var(--ml-muted, #8b91a3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.wms__export:hover,
.wms__export:focus-visible {
  color: var(--ml-fg, #e8eaf2);
  border-color: var(--ml-muted, #8b91a3);
}

.wms__export:focus-visible {
  outline: 2px solid var(--ml-accent, #7c8cff);
  outline-offset: 2px;
}

.wms__export:active { transform: scale(0.95); }

.wms__export-icon {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Menu de styles (pills radio) ------------------------------------------ */

.wms__menu {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.wms__opt input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.wms__opt span {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid color-mix(in oklab, var(--ml-muted, #8b91a3) 30%, transparent);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 550;
  color: var(--ml-muted, #8b91a3);
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease,
              background-color 0.16s ease, transform 0.16s ease;
}

.wms__opt:hover span {
  color: var(--ml-fg, #e8eaf2);
  border-color: var(--ml-muted, #8b91a3);
}

.wms__opt input:checked + span {
  color: var(--ml-bg, #0d1017);
  background: var(--ml-accent, #7c8cff);
  border-color: var(--ml-accent, #7c8cff);
}

.wms__opt input:focus-visible + span {
  outline: 2px solid var(--ml-accent, #7c8cff);
  outline-offset: 2px;
}

.wms__opt input:checked + span { transform: scale(1.04); }

/* --- Scène ------------------------------------------------------------------ */

.wms__stage {
  position: relative;
  aspect-ratio: 1000 / 435.1; /* ratio du viewBox de world-map.svg */
  color: var(--wms-ink);       /* currentColor des rendus + de l'export */
}

.wms__stage svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* révélation en vague radiale : chaque .wms-el porte son délai --wms-d */
.wms__stage svg.is-wave .wms-el {
  animation: wms-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
  animation-delay: var(--wms-d, 0ms);
}

@keyframes wms-in {
  from { opacity: 0; transform: scale(0.4); transform-origin: center; transform-box: fill-box; }
  to   { opacity: 1; transform: scale(1);   transform-origin: center; transform-box: fill-box; }
}

/* les lignes (lowpoly, réseau) apparaissent en fondu simple : un scale
   par arête déformerait le maillage */
.wms__stage svg.is-wave line.wms-el {
  animation-name: wms-fade;
}

@keyframes wms-fade {
  from { opacity: 0; }
}

/* --- Fallback ----------------------------------------------------------------- */

.wms__fallback {
  display: grid;
  place-items: center;
  height: 100%;
  border: 1px dashed color-mix(in oklab, var(--ml-muted, #8b91a3) 40%, transparent);
  border-radius: 8px;
  color: var(--ml-muted, #8b91a3);
  font-size: 11px;
  text-align: center;
  padding: 12px;
}

/* --- Reduced motion ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .wms__stage svg.is-wave .wms-el {
    animation: none;
  }
  .wms__opt input:checked + span {
    transform: none;
  }
}
