/* ==========================================================================
   Two Meridian — "Field Atlas" Map Styles
   Hairline Rules, Warm Brass Illuminations & Crisp Cartographic Boundaries
   ========================================================================== */

/* ---- Base SVG ---- */
.map-wrapper svg {
  width: 100%;
  height: 100%;
}

/* ---- Base Country Paths & Microstate Circles ---- */
.map-wrapper svg path,
.map-wrapper svg g path,
.map-wrapper svg polygon,
.map-wrapper svg circle.country-marker {
  fill: var(--map-fill, #141210);
  stroke: var(--map-stroke, rgba(238, 206, 126, 0.75));
  stroke-width: 0.8px;
  stroke-linejoin: round;
  stroke-linecap: round;
  paint-order: stroke fill;
  cursor: pointer;
  transition: fill 0.35s ease, stroke 0.35s ease;
  vector-effect: non-scaling-stroke;
  shape-rendering: geometricPrecision;
}

.map-wrapper svg circle.country-marker {
  r: 1.6;
}

/* Hover state — clean hairline brightening */
.map-wrapper svg path:hover,
.map-wrapper svg g path:hover,
.map-wrapper svg polygon:hover,
.map-wrapper svg circle.country-marker:hover {
  fill: var(--map-fill-hover, #1E1B18);
  stroke: var(--map-stroke-hover, #FFF0C2);
  stroke-width: 1.2px;
  paint-order: stroke fill;
}

/* ---- Discovery Soft Glow Fade-In (Mode-Aware, No Harsh Flash) ---- */
.map-wrapper svg .just-discovered.guessed-casual {
  animation: countryRevealCasual 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.map-wrapper svg .just-discovered.guessed-speed {
  animation: countryRevealSpeed 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.map-wrapper svg .just-discovered.guessed-reverse {
  animation: countryRevealReverse 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* ---- Guessed country highlights (Mode-Consistent Cartographic Glow) ---- */

/* Casual mode (Radiant Brass / Gold) */
.map-wrapper svg path.guessed-casual,
.map-wrapper svg g.guessed-casual path {
  fill: var(--casual-highlight);
  stroke: var(--casual-highlight-light);
  stroke-width: 1.0px;
  filter: drop-shadow(0 0 2px rgba(197, 155, 39, 0.20));
}

.map-wrapper svg circle.guessed-casual {
  fill: var(--casual-highlight);
  stroke: var(--casual-highlight-light);
  stroke-width: 1.1px;
  r: 2.2;
  opacity: 1;
  filter: drop-shadow(0 0 3px rgba(197, 155, 39, 0.45));
}

/* Passive highlight for clicked countries in Casual Mode */
.map-wrapper svg path.passive-active,
.map-wrapper svg g.passive-active path {
  fill: rgba(197, 155, 39, 0.45);
  stroke: var(--casual-highlight-light);
  stroke-width: 1.0px;
}

.map-wrapper svg circle.passive-active {
  fill: var(--casual-highlight);
  stroke: var(--casual-highlight-light);
  stroke-width: 1.1px;
  r: 2.2;
}

/* Speed mode (Antique Malachite / Verdigris) */
.map-wrapper svg path.guessed-speed,
.map-wrapper svg g.guessed-speed path {
  fill: var(--speed-highlight);
  stroke: var(--speed-highlight-light);
  stroke-width: 1.0px;
  filter: drop-shadow(0 0 2px rgba(45, 127, 103, 0.20));
}

.map-wrapper svg circle.guessed-speed {
  fill: var(--speed-highlight);
  stroke: #B5F0DB;
  stroke-width: 1.1px;
  r: 2.2;
  opacity: 1;
  filter: drop-shadow(0 0 3px rgba(45, 127, 103, 0.45));
}

/* Reverse mode (Terracotta / Crimson) */
.map-wrapper svg path.guessed-reverse,
.map-wrapper svg g.guessed-reverse path {
  fill: var(--reverse-highlight);
  stroke: var(--reverse-highlight-light);
  stroke-width: 0.95px;
  filter: drop-shadow(0 0 1px rgba(184, 58, 46, 0.15));
}

.map-wrapper svg circle.guessed-reverse {
  fill: var(--reverse-highlight);
  stroke: #FFC0B5;
  stroke-width: 1.0px;
  r: 2.0;
  opacity: 1;
  filter: drop-shadow(0 0 2px rgba(184, 58, 46, 0.25));
}

/* When Reverse Mode expedition is actively running, reduce inactive world borders to 0.60 opacity */
#map-container[data-reverse-active="true"] .map-wrapper svg path:not(.reverse-active):not(.guessed-reverse),
#map-container[data-reverse-active="true"] .map-wrapper svg circle.country-marker:not(.reverse-active):not(.guessed-reverse),
#map-container.reverse-active-game .map-wrapper svg path:not(.reverse-active):not(.guessed-reverse),
#map-container.reverse-active-game .map-wrapper svg circle.country-marker:not(.reverse-active):not(.guessed-reverse) {
  stroke: rgba(228, 195, 115, 0.60);
  transition: stroke 0.4s ease;
}

/* Active highlight in reverse mode (mystery territory) */
.map-wrapper svg path.reverse-active,
.map-wrapper svg g.reverse-active path {
  fill: var(--reverse-highlight);
  stroke: var(--reverse-highlight-light);
  stroke-width: 1.2px;
  filter: drop-shadow(0 0 4px rgba(184, 58, 46, 0.35));
  animation: islandRadarPulse 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.map-wrapper svg circle.reverse-active {
  fill: var(--reverse-highlight);
  stroke: #FFC0B5;
  stroke-width: 1.1px;
  r: 2.2;
  opacity: 1;
  animation: microstateRadarPing 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Already-guessed countries hover states */
.map-wrapper svg g.guessed-casual path:hover,
.map-wrapper svg path.guessed-casual:hover {
  fill: var(--casual-highlight-light);
}

.map-wrapper svg g.guessed-speed path:hover,
.map-wrapper svg path.guessed-speed:hover {
  fill: var(--speed-highlight-light);
}

.map-wrapper svg g.guessed-reverse path:hover,
.map-wrapper svg path.guessed-reverse:hover {
  fill: var(--reverse-highlight-light);
}

/* Completed Continent Blur */
.map-wrapper svg path.continent-blurred,
.map-wrapper svg g.continent-blurred path {
  opacity: 0.22;
  filter: blur(1.5px);
  pointer-events: none;
  transition: opacity 1.2s ease, filter 1.2s ease;
}
