:root {
  --bg-color: #0b0b0e;
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.72);
  /* Caution tape sizing */
  --tape-h: 34px;            /* investigate + news (base) */
  --tape-primary-h: 42px;    /* HUMANJUICES (red) */
}

html, body {
  height: 100%;
  margin: 0;
  /* Ensure cursor applies even when hovering fixed overlays */
  cursor: url('img/magcursor_cursor.png') 21 32, auto;
}

body {
  background-color: var(--bg-color);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  /* Custom cursor ONLY for the main page (this CSS is only used by /index.html) */
  cursor: url('img/magcursor_cursor.png') 21 32, auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 35%, rgba(0,0,0,0.08), rgba(0,0,0,0.55));
  pointer-events: none;
}

.poster {
  position: relative;
  min-height: 100dvh;
  display: block;
  padding: 0;
  box-sizing: border-box;
}

.poster__frame {
  margin: 0;
  position: fixed;
  inset: 0;
  /* Important: the background image should never intercept clicks/hover meant for UI on top. */
  pointer-events: none;
  z-index: 1;
  /* Ensure we still respect iOS safe areas, but keep full coverage */
  padding:
    env(safe-area-inset-top, 0px)
    env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
  box-sizing: border-box;
}

.poster__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover; /* fill the viewport */
  object-position: 50% 50%; /* JS overrides to keep flashing bbox visible */
  pointer-events: none;
}

.cop-btn {
  position: fixed;
  left: calc(env(safe-area-inset-left, 0px) + 6px);
  bottom: 0; /* JS will align this to the news banner bottom edge */
  z-index: 10000; /* above banners, below clickable hotspots */
  width: auto;
  height: auto;
  max-width: min(46vw, 520px);
  /* JS will size the inner image; keep the wrapper unconstrained */
  user-select: none;
  pointer-events: auto;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: url('img/magcursor_cursor.png') 21 32, pointer;
  filter: drop-shadow(0 10px 26px rgba(0,0,0,0.55));
}

@media (max-width: 520px) {
  .cop-btn {
    max-width: min(74vw, 560px);
  }
}

.cop-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 30vh; /* JS will increase/decrease this based on hotspots */
  user-select: none;
  pointer-events: none; /* clicks go to the button */
}

.cop-bubble {
  position: fixed; /* JS clamps this so it always stays on-screen */
  /* Safe default position in case JS hasn't positioned it yet */
  left: 16px;
  top: 16px;
  /* JS sets explicit left/top, so do NOT translate by -100%/-100% here (that would double-shift off-screen). */
  transform: scale(0.98);
  transform-origin: left top;
  /* Responsive sizing for longer copy */
  width: clamp(240px, 46vw, 520px);
  max-width: min(92vw, 520px);
  padding: clamp(10px, 1.6vw, 16px) clamp(12px, 2vw, 18px);
  border-radius: 18px;
  background: #ffffff;
  color: #0b1b3a;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: none;
  font-size: clamp(13px, 1.6vw, 16px);
  line-height: 1.3;
  box-shadow: none;
  border: 0;
  opacity: 0;
  pointer-events: none; /* JS enables this only while visible so links can be tapped */
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: pre-line; /* respect \n in JS textContent */
  z-index: 10020; /* above hotspots + cop */
}

.cop-bubble__name {
  font-weight: 900;
  animation: cop-name-flash 1.1s steps(1, end) infinite;
}

.cop-bubble__credit {
  margin-top: clamp(10px, 1.2vw, 14px);
  text-align: center;
  font-weight: 400;
  color: #6b7280; /* light-but-legible grey */
  font-size: clamp(11px, 1.2vw, 13px);
  line-height: 1.25;
}

.cop-bubble__credit-link,
.cop-bubble__credit-link:visited {
  color: #3b6fa8; /* blue similar brightness/saturation to the grey */
  font-weight: 400;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.cop-bubble__credit-link:hover,
.cop-bubble__credit-link:focus-visible {
  color: #2b5f98;
}

@keyframes cop-name-flash {
  0%   { color: #ff0000; } /* true red */
  25%  { color: #00a3ff; } /* electric blue */
  50%  { color: #ff5a00; } /* neon orange */
  75%  { color: #39ff14; } /* neon green */
  100% { color: #ff0000; }
}

@media (prefers-reduced-motion: reduce) {
  .cop-bubble__name {
    animation: none;
  }
}

.cop-bubble-tail {
  position: fixed;
  left: 0;
  top: 0;
  height: 120px; /* JS overrides */
  width: auto;
  opacity: 0; /* JS toggles */
  pointer-events: none;
  z-index: 10015; /* above cop/hotspots, below the bubble box */
  filter: none;
  transform-origin: top center;
  will-change: transform, left, top, height, opacity;
}

.cop-bubble::after {
  content: "";
  position: absolute;
  top: 58%;
  width: 0;
  height: 0;
  border: 10px solid transparent;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,0.25));
  display: none; /* replaced by bubbletail.png */
}

.cop-bubble[data-side="left"]::after {
  right: -10px;
  border-left-color: rgba(255,255,255,0.95);
}

.cop-bubble[data-side="right"]::after {
  left: -10px;
  border-right-color: rgba(255,255,255,0.95);
}

/* Bubble visibility is controlled by JS (hover on desktop, tap on mobile). */

.hotspots {
  position: fixed;
  inset: 0;
  z-index: 10010; /* ensure hotspots stay clickable even if cop overlaps */
  pointer-events: none; /* allow only hotspots to receive clicks */
}

.hotspot {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: auto;
  cursor: url('img/magcursor_cursor.png') 21 32, pointer;
  background: transparent;
  /* invisible by default */
  outline: none;
}

.hotspot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--ring-size, 0px);
  height: var(--ring-size, 0px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 5px solid rgba(255, 0, 0, 0.95);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.25), 0 0 18px rgba(255, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;
}

.hotspot:hover::after,
.hotspot:focus-visible::after {
  opacity: 1;
}

/* ---- Animated caution tape banner ---- */
.caution-tape {
  --tape-bg: #ffd400;
  --tape-fg: #000;
  --tape-text-y: 0px;
  /* Font sizing: aim to nearly touch the tape edges without clipping */
  --tape-font: calc(var(--tape-h) - 10px);
  position: fixed;
  left: 50%;
  top: calc(16px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%) rotate(-2.2deg);
  width: 130vw; /* feel like it extends past the viewport */
  height: var(--tape-h); /* investigate/base height */
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 10px 26px rgba(0,0,0,0.55);
  border-radius: 2px;
  overflow: hidden;
  /* yellow tape + faint diagonal striping */
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(0,0,0,0.10) 0px,
      rgba(0,0,0,0.10) 8px,
      rgba(0,0,0,0.00) 8px,
      rgba(0,0,0,0.00) 16px
    ),
    var(--tape-bg);
}

.caution-tape--red {
  --tape-bg: #d61c1c;
  --tape-fg: #fff;
  height: var(--tape-primary-h);
  /* Impact sits a bit high visually; nudge down slightly for the thicker tape */
  --tape-text-y: -1px;
  --tape-font: calc(var(--tape-primary-h) - 12px);
}

.caution-tape--yellow {
  --tape-bg: #ffd400;
  --tape-fg: #000;
}

.caution-tape--secondary {
  /* Position relative to the primary tape height so they don't overlap */
  top: calc(16px + env(safe-area-inset-top, 0px) + var(--tape-primary-h) + 8px);
  /* ~10deg offset from the primary tape (-2.2deg) */
  transform: translateX(-50%) rotate(7.8deg);
  z-index: 19;
}

.caution-tape--news {
  /* broadcast-style lower third */
  --tape-bg: #f2f2f2; /* grey-ish white */
  --tape-fg: #0b1b3a; /* navy text */
  top: auto;
  /* Move up a bit from the bottom */
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  width: 150vw;
  transform: translateX(-50%) rotate(0deg);
  z-index: 18;
  /* Remove stripe pattern for this banner */
  background: var(--tape-bg);
  border-top: 4px solid #0b4aa2;
  border-bottom: 4px solid #0b4aa2;
  box-shadow: 0 10px 26px rgba(0,0,0,0.45);
}

.caution-tape__track {
  height: 100%;
  display: flex;
  align-items: center;
  width: max-content;
  will-change: transform;
  animation: tape-marquee 15s linear infinite;
}

.caution-tape__group {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding-right: 18px;
}

.caution-tape__word,
.caution-tape__sep {
  color: var(--tape-fg);
  font-family: Impact, Haettenschweiler, "Arial Black", "Franklin Gothic Heavy", sans-serif;
  font-size: var(--tape-font);
  letter-spacing: 0.08em;
  line-height: 0.92;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translateY(var(--tape-text-y));
}

.caution-tape__sep {
  font-size: calc(var(--tape-font) - 2px);
  opacity: 0.9;
}

/* Move left->right continuously by shifting one group width */
@keyframes tape-marquee {
  from { transform: translateX(var(--marquee-shift, -50%)); }
  to   { transform: translateX(0%); }
}

/* Move right->left (used by the news banner) */
@keyframes tape-marquee-rtl {
  from { transform: translateX(0%); }
  to   { transform: translateX(var(--marquee-shift, -50%)); }
}

.caution-tape--news .caution-tape__track {
  animation-name: tape-marquee-rtl;
}

@media (max-width: 520px) {
  :root {
    --tape-h: 30px;         /* investigate + news (base) */
    --tape-primary-h: 38px; /* HUMANJUICES */
  }

  .caution-tape--red {
    transform: translateX(-50%) rotate(-2deg);
  }
  .caution-tape--secondary {
    transform: translateX(-50%) rotate(8deg);
  }
  .caution-tape--news {
    transform: translateX(-50%) rotate(0deg);
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .caution-tape__word,
  .caution-tape__sep {
    letter-spacing: 0.06em;
  }
}

