/* =========================================================
   CSBC26 — Mapa Page Stylesheet
   Extends: ../main-page/index.css (base design system)
   Galeria de mapas com partículas orbitando (mesmo conceito
   do avatar principal do chat) e parallax seguindo o mouse.
   ========================================================= */

/* ---------------------------------------------------------
   0. PAGE LAYOUT
   --------------------------------------------------------- */
.mapa-page {
  overflow-x: hidden;
  overflow-y: auto;
}

.mapa-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: var(--sp-lg) var(--sp-lg) var(--sp-2xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-lg);
  /* Fill the remaining space between header and footer instead of
     forcing its own min-height — that used to push the footer just
     past the viewport on desktop, requiring a scroll even though
     there was room to spare. The body is already a flex column
     (see index.css), so flex: 1 here lets it share space correctly
     while still centering the gallery vertically when there's slack. */
  flex: 1;
  min-height: 0;
}

/* ---------------------------------------------------------
   1. HEADER TWEAKS (matches other sub-pages)
   --------------------------------------------------------- */
.header-inner--gamificacao {
  max-width: 960px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  padding: 8px 16px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.back-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ---------------------------------------------------------
   2. INTRO
   --------------------------------------------------------- */
.mapa-intro {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  margin-top: var(--sp-sm);
}

.mapa-page-title {
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-primary);
}

.mapa-page-title .highlight {
  background: linear-gradient(135deg, var(--azul-claro) 0%, var(--verde) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mapa-page-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---------------------------------------------------------
   3. GALLERY
   --------------------------------------------------------- */
.mapa-gallery {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 760px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  /* Radius scale for the orbiting particles — shrinks on smaller
     screens so the "bolinhas" stay near the image */
  --orbit-scale: 1;
  /* Soft brand glow behind the whole stage */
  perspective: 1200px;
}

.mapa-gallery::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90%;
  height: 90%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(59, 78, 226, 0.22) 0%, transparent 68%);
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
}

/* ── Orbiting particles (same idea as .bot-avatar__particle) ──
   z-index sits BELOW the framed image (.mapa-stage is z-index: 2)
   so the particles fly behind the map instead of over it. */
.mapa-orbits {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1;
}

.mapa-particle {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  margin: -3px 0 0 -3px;
  will-change: transform;
}

.mp1 {
  width: 8px;
  height: 8px;
  background: var(--azul-claro);
  box-shadow: 0 0 12px var(--azul-claro);
  --r: 300px;
  animation: mapa-orbit 18s linear infinite;
}

.mp2 {
  width: 5px;
  height: 5px;
  background: var(--verde);
  box-shadow: 0 0 10px var(--verde);
  --r: 342px;
  animation: mapa-orbit 26s linear infinite reverse;
}

.mp3 {
  width: 6px;
  height: 6px;
  background: var(--laranja);
  box-shadow: 0 0 10px var(--laranja);
  --r: 262px;
  animation: mapa-orbit 21s linear infinite;
}

.mp4 {
  width: 4px;
  height: 4px;
  background: var(--azul-claro);
  box-shadow: 0 0 8px var(--azul-claro);
  --r: 322px;
  animation: mapa-orbit 30s linear infinite reverse;
}

.mp5 {
  width: 7px;
  height: 7px;
  background: var(--verde);
  box-shadow: 0 0 12px var(--verde);
  --r: 288px;
  animation: mapa-orbit 16s linear infinite;
}

.mp6 {
  width: 5px;
  height: 5px;
  background: var(--laranja);
  box-shadow: 0 0 10px var(--laranja);
  --r: 350px;
  animation: mapa-orbit 24s linear infinite reverse;
}

/* Stagger the starting angles so they don't all line up */
.mp2 { animation-delay: -4s; }
.mp3 { animation-delay: -9s; }
.mp4 { animation-delay: -14s; }
.mp5 { animation-delay: -2s; }
.mp6 { animation-delay: -11s; }

@keyframes mapa-orbit {
  from {
    transform: rotate(0deg) translateX(calc(var(--r) * var(--orbit-scale))) rotate(0deg);
  }
  to {
    transform: rotate(360deg) translateX(calc(var(--r) * var(--orbit-scale))) rotate(-360deg);
  }
}

/* ── Stage / framed image ── */
.mapa-stage {
  position: relative;
  z-index: 2;
  flex: 1;
  min-width: 0;
  max-width: 640px;
  transform-style: preserve-3d;
  will-change: transform;
}

.mapa-figure {
  position: relative;
  margin: 0;
  width: 100%;
  aspect-ratio: 16 / 10;
  /* No rounded corners — the map images read better with a crisp,
     technical/blueprint edge */
  border-radius: 0;
  overflow: hidden;
  background: rgba(11, 15, 59, 0.55);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.mapa-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 10px;
  will-change: transform, opacity;
}

.mapa-figure__glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, rgba(59, 78, 226, 0.15) 0%, transparent 60%);
}

/* ── Zoom trigger button, sits over the image ── */
.mapa-zoom-btn {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 15, 59, 0.65);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.mapa-zoom-btn:hover {
  background: rgba(59, 78, 226, 0.55);
  border-color: rgba(59, 78, 226, 0.7);
  transform: scale(1.08);
}

.mapa-zoom-btn:active {
  transform: scale(0.94);
}

.mapa-zoom-btn svg {
  width: 18px;
  height: 18px;
}

/* ── Nav arrows ── */
.mapa-nav {
  position: relative;
  z-index: 4;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 25, 100, 0.4);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.mapa-nav:hover {
  background: rgba(59, 78, 226, 0.35);
  border-color: rgba(59, 78, 226, 0.5);
  color: var(--text-primary);
  transform: scale(1.08);
}

.mapa-nav:active {
  transform: scale(0.94);
}

.mapa-nav svg {
  width: 22px;
  height: 22px;
}

/* ---------------------------------------------------------
   4. CAPTION
   --------------------------------------------------------- */
.mapa-caption {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.mapa-caption__index {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--laranja);
  text-transform: uppercase;
}

.mapa-caption__title {
  font-size: clamp(1.3rem, 5vw, 1.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.15;
  white-space: nowrap;
}

.mapa-caption__desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 460px;
  line-height: 1.5;
}

/* ---------------------------------------------------------
   5. TITLE + THUMBNAILS ROW
   Mobile: title stacked above thumbnails, both centered.
   Desktop (see media query below): title sits beside the
   thumbnail row instead of above it.
   --------------------------------------------------------- */
.mapa-bottom-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-sm);
  width: 100%;
}

.mapa-thumbs {
  display: flex;
  gap: var(--sp-sm);
  flex-wrap: wrap;
  justify-content: center;
}

.mapa-thumb {
  position: relative;
  width: 92px;
  height: 60px;
  border-radius: 0;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  background: rgba(20, 25, 100, 0.35);
  border: 1px solid var(--glass-border);
  transition: border-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.mapa-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.mapa-thumb:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 78, 226, 0.4);
}

.mapa-thumb:hover img {
  opacity: 0.85;
}

.mapa-thumb.is-active {
  border-color: rgba(251, 126, 77, 0.7);
  box-shadow: 0 0 0 2px rgba(251, 126, 77, 0.25), 0 8px 20px rgba(0, 0, 0, 0.35);
}

.mapa-thumb.is-active img {
  opacity: 1;
}

.mapa-thumb__label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 4px 3px;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  text-align: center;
  background: linear-gradient(180deg, transparent 0%, rgba(11, 15, 59, 0.85) 100%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------
   6. RESPONSIVE
   --------------------------------------------------------- */
@media (max-width: 720px) {
  .mapa-gallery {
    --orbit-scale: 0.62;
    gap: 2px;
  }

  .mapa-nav {
    width: 38px;
    height: 38px;
  }

  .mapa-nav svg {
    width: 18px;
    height: 18px;
  }

  .mapa-figure {
    aspect-ratio: 4 / 3;
  }

  .mapa-thumb {
    width: 78px;
    height: 52px;
  }
}

@media (max-width: 420px) {
  .mapa-gallery {
    --orbit-scale: 0.5;
  }

  .mapa-shell {
    padding: var(--sp-md) var(--sp-sm) var(--sp-xl);
  }
}

@media (min-width: 900px) {
  .mapa-gallery {
    --orbit-scale: 1.1;
  }

  /* Title sits to the side of the thumbnail row instead of above it */
  .mapa-bottom-row {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: var(--sp-lg);
  }

  .mapa-caption__title {
    flex-shrink: 0;
  }
}

/* ---------------------------------------------------------
   7. LIGHTBOX / ZOOM
   Fullscreen overlay with pinch/scroll-to-zoom and drag-to-pan,
   handled via GSAP in mapa.js.
   --------------------------------------------------------- */
.mapa-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 32, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out);
}

.mapa-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mapa-lightbox__viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
}

.mapa-lightbox__viewport.is-dragging {
  cursor: grabbing;
}

.mapa-lightbox__img {
  max-width: 92vw;
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}

.mapa-lightbox__close {
  position: absolute;
  top: var(--sp-lg);
  right: var(--sp-lg);
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 25, 100, 0.5);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.mapa-lightbox__close:hover {
  background: rgba(251, 126, 77, 0.4);
  transform: scale(1.08);
}

.mapa-lightbox__close svg {
  width: 20px;
  height: 20px;
}

.mapa-lightbox__hint {
  position: absolute;
  bottom: var(--sp-lg);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(20, 25, 100, 0.45);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  padding: 6px 16px;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}

@media (max-width: 600px) {
  .mapa-lightbox__hint {
    font-size: 0.68rem;
    padding: 5px 12px;
  }
}

/* ---------------------------------------------------------
   8. REDUCED MOTION
   --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .mapa-particle {
    animation: none;
    display: none;
  }
}
