.leak {
  position: relative;
  overflow: hidden;
  background: var(--bg-deep);
  padding: var(--space-6) var(--space-2);
}

/* ===== background: static tactical map image + scanning sweep ===== */
.leak__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #030507;
}
.leak__map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* a single slow radar-style sweep drifting down the map — the only
   "scanning" motion, everything else on this layer stays still */
.leak__scan {
  position: absolute;
  inset: -20% 0 auto 0;
  height: 14rem;
  background: linear-gradient(180deg, transparent 0%, rgba(20,230,230,0.1) 45%, rgba(20,230,230,0.16) 50%, rgba(20,230,230,0.1) 55%, transparent 100%);
  mix-blend-mode: screen;
  animation: leak-scan 9s linear infinite;
  pointer-events: none;
}
@keyframes leak-scan {
  0% { transform: translateY(-10%); }
  100% { transform: translateY(750%); }
}
@media (prefers-reduced-motion: reduce) {
  .leak__scan { display: none; }
}

.leak__texture {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse 65% 55% at 28% 18%, rgba(20,40,70,0.16), transparent 60%),
    linear-gradient(180deg, rgba(5,6,9,0.45) 0%, rgba(5,6,9,0.08) 28%, rgba(5,6,9,0.18) 68%, rgba(5,6,9,0.82) 100%),
    linear-gradient(105deg, rgba(4,8,14,0.5) 0%, rgba(4,8,14,0.05) 45%, rgba(4,8,14,0.45) 100%),
    repeating-linear-gradient(0deg, rgba(20,230,230,0.045) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(90deg, rgba(20,230,230,0.045) 0 1px, transparent 1px 48px);
}

/* ===== HUD markers: idle radar pings over the map, aligned to the glow
   points baked into assets/leak/leak-map-bg.jpg ===== */
.hud {
  position: absolute;
  inset: 0;
  z-index: 2;
}
.hud__marker {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
}

.hud__marker-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(20,230,230,0.9);
  transform: translate(-50%, -50%) scale(0.4);
  opacity: 0;
  animation: hud-radar 3.2s ease-out infinite;
}
.hud__marker-ring--b { animation-delay: 1.6s; }

.hud__marker-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d8fbfa;
  box-shadow: 0 0 6px 1px rgba(20,230,230,0.9), 0 0 14px 3px rgba(20,230,230,0.35);
  transform: translate(-50%, -50%);
  animation: hud-core-breathe 3.2s ease-in-out infinite;
}

@keyframes hud-radar {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0.75; }
  100% { transform: translate(-50%, -50%) scale(4.2); opacity: 0; }
}
@keyframes hud-core-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.hud__marker-readout {
  position: absolute;
  left: 10px;
  top: -6px;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  white-space: nowrap;
  pointer-events: none;
}
.hud__marker--right .hud__marker-readout {
  left: auto;
  right: 10px;
  text-align: right;
}
.hud__marker-tag {
  font-size: 0.56rem;
  letter-spacing: 0.05em;
  color: rgba(210,245,245,0.75);
  text-shadow: 0 0 6px rgba(20,230,230,0.4);
}
.hud__marker-coords {
  font-size: 0.56rem;
  letter-spacing: 0.02em;
  color: rgba(20,230,230,0.65);
}
.hud__marker-coords::after {
  content: '_';
  animation: hud-blink 1.1s steps(1) infinite;
}

@keyframes hud-blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .hud__marker-ring { display: none; }
  .hud__marker-core { animation: none; }
  .hud__marker-coords::after { animation: none; }
}

@media (max-width: 640px) {
  .hud__marker-readout { display: none; }
}

/* ===== corner watermarks + faint crest ===== */
.leak__watermark {
  position: absolute;
  z-index: 3;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: rgba(150,225,225,0.4);
  pointer-events: none;
  white-space: nowrap;
}
.leak__watermark--tl { top: 1.15rem; left: 1.25rem; }
.leak__watermark--tr { top: 1.15rem; right: 1.25rem; }
.leak__watermark--bl { bottom: 1.15rem; left: 1.25rem; }

.leak__crest {
  position: absolute;
  z-index: 2;
  right: -1.5rem;
  bottom: -3rem;
  font-family: var(--font-display);
  font-size: 15rem;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255,32,121,0.16);
  pointer-events: none;
  user-select: none;
  transform: rotate(-4deg);
}

/* ===== foreground content ===== */
.leak__content {
  position: relative;
  z-index: 3;
  width: var(--container);
  max-width: 74rem;
  margin-inline: auto;
}

.leak__grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

@media (min-width: 960px) {
  .leak__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem);
    column-gap: var(--space-4);
    row-gap: var(--space-4);
    align-items: start;
  }
  .leak__intro { grid-column: 1; grid-row: 1; }
  .dash { grid-column: 2; grid-row: 1; }
  .terminal { grid-column: 1; grid-row: 2; }
}

/* ===== activity dashboard card (glassmorphism) ===== */
.dash {
  --chart-gang: var(--magenta);
  --chart-police: #4d7bff;
  --chart-civilian: #35e0a0;

  background: rgba(9,13,19,0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(20,230,230,0.22);
  border-radius: 8px;
  padding: 1rem 1.1rem 1.2rem;
  box-shadow: 0 24px 55px -22px rgba(0,0,0,0.65);
}

.dash__head {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.dash__title {
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  color: var(--cyan);
  opacity: 0.85;
}
.dash__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  font-size: 0.6rem;
  color: var(--muted);
}
.dash__legend li { display: flex; align-items: center; gap: 0.35rem; }
.dash__swatch { width: 7px; height: 7px; border-radius: 1.5px; display: inline-block; flex-shrink: 0; }
.dash__swatch--gang { background: var(--chart-gang); box-shadow: 0 0 6px var(--chart-gang); }
.dash__swatch--police { background: var(--chart-police); box-shadow: 0 0 6px var(--chart-police); }
.dash__swatch--civilian { background: var(--chart-civilian); box-shadow: 0 0 6px var(--chart-civilian); }

.dash__chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.4rem;
  height: 8rem;
}
.dash__group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
  height: 100%;
  justify-content: flex-end;
}
.dash__bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: 100%;
}
.dash__bar {
  position: relative;
  width: 5px;
  height: var(--v);
  border-radius: 2px 2px 0 0;
  cursor: default;
  transition: filter 0.15s ease, transform 0.15s ease;
  transform-origin: bottom;
}
.dash__bar--gang { background: var(--chart-gang); box-shadow: 0 0 9px var(--chart-gang); }
.dash__bar--police { background: var(--chart-police); box-shadow: 0 0 9px var(--chart-police); }
.dash__bar--civilian { background: var(--chart-civilian); box-shadow: 0 0 9px var(--chart-civilian); }
.dash__bar:hover { filter: brightness(1.4); transform: scaleY(1.03); }

.dash__bar::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #0a0e14;
  border: 1px solid rgba(255,255,255,0.16);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  white-space: nowrap;
  padding: 0.3em 0.55em;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 5;
}
.dash__bar:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

.dash__label {
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .dash__bar, .dash__bar::after { transition: none; }
}

/* ===== terminal window ===== */
.terminal {
  width: 100%;
  background: #030303;
  border: 1px solid rgba(20,230,230,0.18);
  box-shadow: 0 0 60px -20px rgba(20,230,230,0.15);
  border-radius: 3px;
  overflow: hidden;
}

.terminal__bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  background: #0c0c0e;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.72rem;
  color: var(--muted);
}
.terminal__bar span {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}
.terminal__bar span:nth-child(1) { background: var(--haiti-red); }
.terminal__bar span:nth-child(2) { background: var(--orange); }
.terminal__bar span:nth-child(3) { background: #7fe0a8; }

.terminal__body {
  margin: 0;
  padding: 1.4rem 1.2rem 1.6rem;
  font-size: clamp(0.72rem, 1.6vw, 0.88rem);
  line-height: 1.75;
  color: #7fe0a8;
  /* fixed, not min/max — the typewriter reveal (js/effects.js) fills this
     in a character at a time; a min/max range let the box visibly grow as
     it typed, reflowing everything below it. Sized for the 10 log lines +
     1 confirm line at the largest clamp step (11 × 0.88rem × 1.75 line-
     height ≈ 16.9rem) plus the block's own padding (3rem), with a little
     headroom — height never changes regardless of how much has typed. */
  height: 20.5rem;
  overflow: hidden;
  position: relative;
  background:
    repeating-linear-gradient(180deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 3px);
}

.terminal__body .hit { color: var(--magenta); font-weight: 700; }
.terminal__body .confirm { color: var(--cyan); }
.terminal__body .caret { color: var(--fg); animation: blink 1s steps(1) infinite; }
@media (prefers-reduced-motion: reduce) { .terminal__body .caret { animation: none; } }

/* ===== footer status bar ===== */
.leak__status {
  width: 100%;
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.2rem);
  background: rgba(8,10,14,0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 0.65rem 1.2rem;
  overflow-x: auto;
}
.leak__status-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.leak__status-item i {
  font-style: normal;
  color: var(--muted-dim);
  margin-left: 0.1rem;
}
.leak__status-tag {
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.18em 0.42em;
  border-radius: 3px;
  flex-shrink: 0;
}
.leak__status-tag--png { color: #c86bff; background: rgba(200,107,255,0.12); border: 1px solid rgba(200,107,255,0.4); }
.leak__status-tag--vcf { color: var(--orange); background: rgba(255,138,30,0.12); border: 1px solid rgba(255,138,30,0.4); }
.leak__status-tag--txt { color: #7fe0a8; background: rgba(127,224,168,0.12); border: 1px solid rgba(127,224,168,0.4); }

@media (max-width: 640px) {
  .leak__watermark { font-size: 0.52rem; }
  .leak__watermark--tr { display: none; }
  .leak__crest { font-size: 8rem; bottom: -1.5rem; }
  .dash__chart { height: 6.5rem; }
  /* the file-chip status bar (PNG/VCF/TXT) reads as broken at this width
     — cramped, cut off mid-item, scrollbar showing — desktop keeps it. */
  .leak__status { display: none; }
}
