/* Region badge — THE shared atlas-badge component (MAP_EXPERIENCE_SPEC §1.5).
   One entity: consumed by the explore map (P1.4) AND the admin live preview
   (P1.3). Glass circle + slideshow + grain + hairline ring + A10 wake. */

.omtb-rbadge {
  --rb-size: 92px;
  position: relative;
  width: var(--rb-size);
  height: var(--rb-size);
  border-radius: 50%;
  cursor: pointer;
  background: rgba(10, 12, 16, 0.55);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
  outline: none;
  border: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.omtb-rbadge__disc {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  overflow: hidden;
  transform: translateZ(0);
}
.omtb-rbadge__slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.4s ease;
  filter: saturate(0.82) contrast(1.04) brightness(0.92);
}
.omtb-rbadge__slide.is-on { opacity: 1; }
/* film grain over the photo, under the type */
.omtb-rbadge__disc::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='96' height='96'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix type='saturate' values='0'/></filter><rect width='96' height='96' filter='url(%23n)' opacity='0.16'/></svg>");
  border-radius: 50%;
  pointer-events: none;
  mix-blend-mode: overlay;
}
/* darkening floor so the count stays legible on hot photos */
.omtb-rbadge__scrim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 78%, rgba(6, 8, 11, 0.66), rgba(6, 8, 11, 0.12) 58%, rgba(6, 8, 11, 0.05));
  pointer-events: none;
}
/* hairline ring */
.omtb-rbadge::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(246, 243, 236, 0.28);
  pointer-events: none;
}
/* A10 wake — conic light sweeping the circumference on hover/focus */
.omtb-rbadge__wake {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  padding: 2px;
  background: conic-gradient(from 0deg,
    transparent 0deg, rgba(255, 138, 74, 0.0) 40deg,
    rgba(255, 138, 74, 0.9) 92deg, rgba(64, 150, 170, 0.55) 150deg,
    transparent 210deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.omtb-rbadge:hover .omtb-rbadge__wake,
.omtb-rbadge:focus-visible .omtb-rbadge__wake,
.omtb-rbadge.is-expanded .omtb-rbadge__wake {
  opacity: 1;
  animation: omtb-rbadge-sweep 2.8s linear infinite;
}
@keyframes omtb-rbadge-sweep {
  to { transform: rotate(360deg); }
}
/* soft aura bloom behind, revealed on wake */
.omtb-rbadge__aura {
  position: absolute;
  inset: -26%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 65%, rgba(255, 107, 53, 0.30), transparent 55%),
    radial-gradient(circle at 72% 30%, rgba(64, 150, 170, 0.22), transparent 60%);
  filter: blur(10px);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  z-index: -1;
}
.omtb-rbadge:hover .omtb-rbadge__aura,
.omtb-rbadge:focus-visible .omtb-rbadge__aura,
.omtb-rbadge.is-expanded .omtb-rbadge__aura { opacity: 1; }
.omtb-rbadge:hover, .omtb-rbadge:focus-visible { transform: scale(1.06); }
.omtb-rbadge { transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1); }

.omtb-rbadge__count {
  position: absolute;
  left: 0; right: 0;
  bottom: 14%;
  text-align: center;
  font: 800 clamp(15px, calc(var(--rb-size) * 0.2), 22px)/1 "Hanken Grotesk", "Inter", sans-serif;
  color: #F6F3EC;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}
.omtb-rbadge__name {
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font: 600 10px/1.2 "Geist Mono", ui-monospace, monospace;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(246, 243, 236, 0.85);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}
/* mini variant (declutter collapse) */
.omtb-rbadge--mini { --rb-size: 44px; }
.omtb-rbadge--mini .omtb-rbadge__name { display: none; }

/* orbit activity icons (revealed on wake/expand) */
.omtb-rbadge__orbit {
  position: absolute;
  left: 50%; top: 50%;
  width: 0; height: 0;
  pointer-events: none;
}
.omtb-rbadge__icon {
  position: absolute;
  left: 0; top: 0;
  width: 30px; height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 16, 0.82);
  border: 1px solid rgba(246, 243, 236, 0.22);
  color: #F6F3EC;
  font-size: 14px;
  opacity: 0;
  transform: translate(0, 0) scale(0.4);
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  pointer-events: auto;
}
.omtb-rbadge:hover .omtb-rbadge__icon,
.omtb-rbadge:focus-visible .omtb-rbadge__icon,
.omtb-rbadge.is-expanded .omtb-rbadge__icon {
  opacity: 1;
  transform: translate(var(--ox), var(--oy)) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .omtb-rbadge__slide { transition: none; }
  .omtb-rbadge:hover .omtb-rbadge__wake,
  .omtb-rbadge:focus-visible .omtb-rbadge__wake { animation: none; }
  .omtb-rbadge, .omtb-rbadge__icon { transition-duration: 0.01s; }
}

/* --- atlas-band frontend states (map-regions.js) --- */
.omtb-rbadge--map { z-index: 30; }
/* MapLibre 4.x writes inline opacity on Marker roots (occlusion handling) —
   root-level opacity classes LOSE. Fade the badge's CHILDREN instead
   (same landmine family as "never set position on a Marker root"). */
.omtb-rbadge--map > * { transition: opacity 0.55s ease; }
.omtb-rbadge.is-off > *, .omtb-rbadge.is-culled > * {
  opacity: 0 !important;
}
.omtb-rbadge.is-off, .omtb-rbadge.is-culled {
  pointer-events: none;
  background: transparent;
  box-shadow: none;
}
.omtb-rbadge.is-off::before, .omtb-rbadge.is-culled::before { opacity: 0; }
.omtb-rbadge--map::before { transition: opacity 0.55s ease; }
.omtb-rbadge--map { transition: transform 0.35s cubic-bezier(0.16,1,0.3,1), background 0.55s ease, box-shadow 0.55s ease; }
/* Bands A/B: the atlas owns the map — legacy marker soup dissolves out */
body.omtb-atlas-band .mtb-route-thumb-marker,
body.omtb-atlas-band .mtb-cluster-marker,
body.omtb-atlas-band .mtb-post-marker {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.5s ease;
}
