/* 国旗世界 — app-specific styles.
   Shared chrome (header / explore dropdown / footer / paper-grain) comes from
   packages/brand: tokens.css + brand.css, linked BEFORE this file. */

/* ====== Globe stage ====== */
.globe-shell {
  position: relative;
  z-index: 5;
}

.globe-stage {
  position: relative;
  width: 100%;
  /* Fill the viewport below the header; footer floats over the bottom. */
  height: calc(100dvh - 74px);
  min-height: 420px;
  overflow: hidden;
  cursor: grab;
}
.globe-stage:active { cursor: grabbing; }

#globe-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none; /* let OrbitControls own drag + pinch */
}

.globe-hint {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(255, 250, 240, .8);
  border: 1.5px solid rgba(42, 53, 84, .12);
  font-family: var(--font-cn);
  font-size: 15px;
  color: var(--ink-2);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity .4s ease;
}
.globe-hint.is-hidden { opacity: 0; }

/* ====== Country card ======
   Floating card that appears when a flag-pin is tapped. Centered on desktop,
   bottom-sheet on narrow screens. */
.country-card {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  width: min(340px, calc(100vw - 32px));
  background: var(--paper-card);
  border: 1.5px solid var(--ink);
  border-radius: 22px;
  padding: 22px 22px 20px;
  box-shadow: 0 14px 40px rgba(42, 53, 84, .22);
  text-align: center;
}
.country-card:not([hidden]) { animation: card-in .42s cubic-bezier(.2, .9, .3, 1.15); }

@keyframes card-in {
  from { opacity: 0; transform: translate(-50%, 24px) scale(.94); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.card-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(42, 53, 84, .06);
  font-size: 22px;
  line-height: 1;
  color: var(--ink-2);
  cursor: pointer;
}
.card-close:hover { background: rgba(42, 53, 84, .12); }

.card-flag-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 12px;
}
.card-flag {
  width: 160px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(42, 53, 84, .18);
  box-shadow: 0 4px 14px rgba(42, 53, 84, .14);
  background: #fff;
}
.card-emoji {
  position: absolute;
  right: -14px;
  bottom: -12px;
  font-size: 34px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .2));
}

.card-names {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 0 auto 14px;
  padding: 6px 14px;
  border: none;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
}
.card-names:hover { background: rgba(42, 53, 84, .05); }
.card-zh {
  font-family: var(--font-cn-display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
}
.card-en {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: .3px;
}
.card-speaker { font-size: 15px; margin-top: 2px; opacity: .7; }

.card-facts {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.card-facts .fact {
  background: rgba(42, 53, 84, .05);
  border-radius: 12px;
  padding: 8px 14px;
  min-width: 92px;
}
.card-facts dt {
  font-family: var(--font-cn-body);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 3px;
}
.card-facts dd {
  font-family: var(--font-cn);
  font-size: 16px;
  color: var(--ink);
}
.card-facts .fact-en {
  display: block;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--ink-3);
}

@media (max-width: 480px) {
  .globe-stage { height: calc(100dvh - 64px); }
  .country-card { bottom: 16px; }
  .card-zh { font-size: 26px; }
}

/* ====== Delight layer: momentary, replayable, no state ====== */
.sparkle-burst {
  position: absolute;
  z-index: 20;
  width: 1px;
  height: 1px;
  pointer-events: none;
  animation: sparkle-life .7s ease-out both;
}
.sparkle {
  --angle: 0deg;
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: #ffe070;
  box-shadow: 0 0 10px rgba(255, 224, 112, .9);
  transform: rotate(var(--angle)) translateX(12px) rotate(45deg);
  animation: sparkle-fly .7s ease-out both;
}

@keyframes sparkle-life {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes sparkle-fly {
  from { transform: rotate(var(--angle)) translateX(8px) rotate(45deg) scale(.3); }
  to { transform: rotate(var(--angle)) translateX(58px) rotate(135deg) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .country-card:not([hidden]), .sparkle-burst, .sparkle { animation-duration: .01ms; }
}
