/* Rock-steady globe — Stripe-quiet HUD over cobe sphere */
.casan-globe {
  --casan-globe-ink: rgba(8, 28, 24, 0.82);
  --casan-globe-line: rgba(255, 255, 255, 0.1);
  --casan-globe-text: rgba(232, 240, 236, 0.78);
  --casan-globe-strong: #f4faf7;
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: transparent;
  transition: opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  /* Size the WebGL square from the shorter side (mobile host is ~220vw tall). */
  container-type: size;
}

.casan-globe.is-on {
  opacity: 1;
}

/*
 * cobe wraps the canvas in a relative div. Keep a true square — stretching
 * width+height to the tall mobile host was rendering an oval globe.
 */
.casan-globe > div:has(> canvas.casan-globe__canvas) {
  position: absolute !important;
  inset: auto !important;
  top: 50% !important;
  left: 50% !important;
  translate: -50% -50%;
  width: 100cqmin !important;
  height: 100cqmin !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: 1 / 1;
  z-index: 1;
  background: transparent !important;
}

@supports not (width: 100cqmin) {
  .casan-globe > div:has(> canvas.casan-globe__canvas) {
    width: 100% !important;
    height: auto !important;
    max-height: 100% !important;
    aspect-ratio: 1 / 1;
  }
}

.casan-globe__canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: transparent;
}

.casan-globe__hud {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: min(220px, 40%);
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid var(--casan-globe-line);
  background: var(--casan-globe-ink);
  color: var(--casan-globe-text);
  font-family: inherit;
  font-size: clamp(0.6875rem, 1vw, 0.75rem);
  font-weight: 450;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-transform: none;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 8px 24px -12px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
}

.casan-globe__hud-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.casan-globe__hud-sub {
  font-size: 0.9em;
  font-weight: 400;
  letter-spacing: 0;
  color: inherit;
  opacity: 0.72;
}

.casan-globe__hud--main {
  top: 46%;
  left: 50%;
  transform: translate(-8%, -50%);
}

.casan-globe__hud--rail {
  top: 28%;
  left: 18%;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  max-width: none;
  padding: 0.55rem 0.35rem;
  font-size: clamp(0.5625rem, 0.9vw, 0.625rem);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.55;
  box-shadow: none;
  background: transparent;
  border-color: transparent;
  backdrop-filter: none;
}

@media (min-width: 640px) {
  .casan-globe__hud--main {
    left: 48%;
  }

  .casan-globe__hud--rail {
    left: 22%;
  }
}

.casan-globe__flag {
  flex: 0 0 auto;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background-color: #c8102e;
  background-image:
    linear-gradient(#ffffff, #ffffff),
    linear-gradient(#ffffff, #ffffff);
  background-size: 100% 18%, 18% 100%;
  background-position: center, 35% center;
  background-repeat: no-repeat;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.casan-globe__hud strong {
  font-weight: 560;
  color: var(--casan-globe-strong);
  letter-spacing: -0.015em;
}

/* `/v2/light` — paper chip + indigo atmosphere */
.casan-globe--light,
body.v2-light .casan-globe,
html.v2-light .casan-globe {
  --casan-globe-ink: rgba(255, 255, 255, 0.92);
  --casan-globe-line: rgba(14, 22, 21, 0.08);
  --casan-globe-text: #5c6563;
  --casan-globe-strong: #0e1615;
}

.casan-globe--light .casan-globe__hud,
body.v2-light .casan-globe__hud,
html.v2-light .casan-globe__hud {
  box-shadow:
    0 1px 1px rgba(14, 22, 21, 0.03),
    0 10px 28px -14px rgba(14, 22, 21, 0.18);
}

/*
 * Subtle indigo bloom behind the sphere — kept close to the globe
 * so the section stays mostly paper (#F7F8F7).
 */
.casan-globe--light::before,
body.v2-light .casan-globe::before,
html.v2-light .casan-globe::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 48%;
  width: 72%;
  height: 72%;
  translate: -50% -50%;
  border-radius: 50%;
  background:
    radial-gradient(
      circle at 34% 28%,
      rgba(255, 255, 255, 0.45) 0%,
      rgba(255, 255, 255, 0.1) 20%,
      transparent 42%
    ),
    radial-gradient(
      circle at 50% 52%,
      rgba(87, 68, 255, 0.28) 0%,
      rgba(67, 47, 218, 0.12) 36%,
      rgba(67, 47, 218, 0.03) 55%,
      transparent 70%
    );
  pointer-events: none;
  z-index: 0;
  filter: blur(8px);
  mask-image: radial-gradient(circle, #000 34%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle, #000 34%, transparent 72%);
}

/* Soft ambient wash — low opacity so it doesn’t tint the whole section */
.casan-globe--light::after,
body.v2-light .casan-globe::after,
html.v2-light .casan-globe::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(87, 68, 255, 0.07) 0%,
    rgba(67, 47, 218, 0.025) 40%,
    transparent 62%
  );
  pointer-events: none;
  z-index: 0;
  filter: blur(22px);
}

/*
 * Light canvas polish — no mask on the WebGL layer. An aggressive radial mask
 * was punching through the lower hemisphere and showing the indigo ::before bloom
 * as flat royal blue; rim dissolve is handled by cobe glowColor instead.
 */
.casan-globe--light .casan-globe__canvas,
body.v2-light .casan-globe__canvas,
html.v2-light .casan-globe__canvas {
  filter: brightness(1.04) contrast(1.04) saturate(1.12);
}

.casan-globe--light .casan-globe__hud--rail,
body.v2-light .casan-globe__hud--rail,
html.v2-light .casan-globe__hud--rail {
  color: rgba(14, 22, 21, 0.45);
  opacity: 0.85;
}

.casan-globe--light .casan-globe__flag,
body.v2-light .casan-globe__flag,
html.v2-light .casan-globe__flag {
  border-color: rgba(14, 22, 21, 0.08);
}

@media (max-width: 639px) {
  .casan-globe__hud--main {
    top: auto;
    bottom: 16%;
    left: 50%;
    transform: translateX(-50%);
    max-width: 86%;
  }

  .casan-globe__hud--rail {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .casan-globe {
    transition: none;
  }
}
