/* =========================================================
   Cinematic home page: opening title and 3D globe.
   Used only by index.html (on top of style.css). Motion is in js/cinema.js and js/globe.js.
   ========================================================= */

/* ---------- Opening title ---------- */
.cine-hero {
  min-height: calc(100svh - 64px);
  display: flex; flex-direction: column; justify-content: flex-end;
  isolation: isolate;
}
/* subtle film grain */
.cine-hero::before {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0.09; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.cine-hero .hero-inner { width: 100%; flex: 1; display: grid; }
.cine-hero .hero-copy { align-self: center; padding-bottom: clamp(4rem, 9vw, 7rem); }
.embers { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

/* headline lines slide up from behind a mask */
.cine-title .line { display: block; overflow: hidden; padding-bottom: 0.06em; }
.cine-title .line > span { display: inline-block; }

/* black bars that slide open like a movie starting */
.letterbox { position: absolute; left: 0; right: 0; height: 50.5%; background: #000; z-index: 3; pointer-events: none; transform-origin: top; }
.letterbox-top { top: 0; }
.letterbox-bottom { bottom: 0; transform-origin: bottom; }

/* before the intro plays (only when JS + motion are on) */
.js-cinema .cine-title .line > span { transform: translateY(110%); }
.js-cinema .cine-in, .js-cinema .hero-cutout { opacity: 0; }
html:not(.js-cinema) .letterbox { display: none; }

/* depth on scroll and mouse (values set by js/cinema.js) */
.cine-hero .hero-copy { translate: 0 calc(var(--p, 0) * -60px); opacity: calc(1 - var(--p, 0) * 1.1); }
.cine-hero .hero-cutout { translate: calc(var(--mx, 0) * -16px) calc(var(--p, 0) * 90px + var(--my, 0) * -8px); }

.scroll-cue {
  position: absolute; left: 50%; bottom: 1.4rem; z-index: 4; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  color: var(--muted); text-decoration: none; font-size: 0.7rem; letter-spacing: 0.3em; text-transform: uppercase;
}
.scroll-cue i { display: block; width: 1px; height: 42px; background: linear-gradient(var(--accent-2), transparent); animation: cue 2s ease-in-out infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- Globe ---------- */
.globe-section { display: grid; grid-template-columns: 1fr 1.15fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.globe-copy p.muted { max-width: 460px; margin: 0.8rem 0 0; }
.globe-copy .stats { margin: 2.2rem 0 2.2rem; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem 1rem; }
.globe-stage { position: relative; aspect-ratio: 1; width: 100%; max-width: 640px; justify-self: center; }
.globe-stage::before { /* atmosphere glow */
  content: ""; position: absolute; inset: -6%; border-radius: 50%; z-index: -1;
  background: radial-gradient(closest-side, rgba(217, 84, 43, 0.35), rgba(217, 84, 43, 0.12) 75%, transparent);
}
#globe-canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; scroll-margin-top: 80px; }
#globe-canvas.dragging { cursor: grabbing; }
.globe-card {
  position: absolute; left: 50%; bottom: 2%; transform: translateX(-50%); width: min(320px, 92%);
  background: rgba(34, 30, 26, 0.94); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.globe-card[hidden] { display: none; }
.globe-card .thumb { aspect-ratio: 2 / 1; }
.globe-card-body { padding: 0.7rem 0.9rem 0.85rem; }
.globe-card-body h4 { font-size: 0.95rem; margin: 0.2rem 0 0.5rem; }
.globe-card-actions { display: flex; gap: 1rem; align-items: center; }
.globe-card-close { position: absolute; top: 6px; right: 6px; z-index: 2; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.globe-list { max-height: 118px; }
.globe-card.has-list .thumb { aspect-ratio: 3 / 1; }
.globe-list img { width: 64px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: #000; }

/* ---------- Full map pop-up ---------- */
.map-modal { z-index: 2500; padding: clamp(8px, 3vw, 32px); }
.map-modal-body { width: min(1280px, 100%); height: min(860px, 100%); display: flex; flex-direction: column; padding: clamp(0.9rem, 2.5vw, 1.4rem); gap: 0.8rem; }
.map-modal-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.map-modal-head h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.map-modal-head .eyebrow { margin-bottom: 0.2rem; }
.map-modal .map-controls { align-items: center; flex-wrap: nowrap; }
.map-modal .map-close { position: static; flex-shrink: 0; }
.map-modal .map-wrap { flex: 1; min-height: 0; }
.map-modal #world-map { height: 100%; aspect-ratio: auto; }
.map-modal .legend { margin-top: 0; }
#video-modal { z-index: 3000; } /* a video opened from the map plays on top of it */

/* ---------- Gentle reveal for the rest of the page ---------- */
.js-cinema .reveal { opacity: 0; transform: translateY(28px); }

/* ---------- Phones and tablets ---------- */
@media (max-width: 900px) {
  .cine-hero { min-height: 0; }
  .cine-hero .hero-copy { padding-bottom: 1rem; }
  /* depth on scroll and mouse (values set by js/cinema.js) */
.cine-hero .hero-copy { translate: 0 calc(var(--p, 0) * -60px); opacity: calc(1 - var(--p, 0) * 1.1); }
.cine-hero .hero-cutout { translate: calc(var(--mx, 0) * -16px) calc(var(--p, 0) * 90px + var(--my, 0) * -8px); }

.scroll-cue { display: none; }

  .map-modal { padding: 0; }
  .map-modal-body { height: 100%; border-radius: 0; }
  .map-modal .legend { font-size: 0.75rem; gap: 0.3rem 0.9rem; }
  .globe-section { grid-template-columns: 1fr; }
  /* on phones the video card sits under the globe instead of covering it */
  .globe-stage { max-width: 520px; aspect-ratio: auto; }
  .globe-stage::before { bottom: auto; aspect-ratio: 1; }
  #globe-canvas { height: auto; aspect-ratio: 1; }
  .globe-card { position: relative; left: auto; bottom: auto; transform: none; width: 100%; margin-top: 0.8rem; display: grid; grid-template-columns: 42% 1fr; }
  .globe-card .thumb, .globe-card.has-list .thumb { aspect-ratio: auto; height: 100%; min-height: 96px; }
  .globe-list { max-height: none; }
  .globe-card .play-badge { width: 40px; height: 40px; margin: -20px 0 0 -20px; }
  .globe-card .play-badge svg { width: 18px; height: 18px; }
  .globe-card-body h4 { font-size: 0.88rem; }
  .globe-card-actions { gap: 0.8rem; flex-wrap: wrap; }
  .globe-card .globe-list { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .js-cinema .cine-title .line > span { transform: none; }
  .js-cinema .cine-in, .js-cinema .hero-cutout, .js-cinema .reveal { opacity: 1; transform: none; }
  .letterbox, .embers { display: none; }
}
