/* ============================================================
   BLACKGRID — BASE.CSS
   Shared variables, reset, ambient layers, and the universal
   drop-page template. One file. No duplication.
   ============================================================ */

:root {
  --black: #0a0a0a;
  --black-deep: #050505;
  --bone: #f2f2f0;
  --white: #f2f2f0;
  --green: #39ff7a;
  --green-dim: #1f8f49;
  --red: #c9381f;
  --red-dark: #5a1c12;
  --grey: #6a6660;
  --grey-dim: #3a3733;
  /* Per-page accent — overridden in each page <style> block */
  --accent: #39ff7a;
  --accent-dim: #1f8f49;
  --glow: rgba(57,255,122,0.4);
  --glow-soft: rgba(57,255,122,0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--black-deep);
  color: var(--grey);
  font-family: 'Courier New', monospace;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--black-deep); }

/* ── Grain layer ── */
#grain-layer {
  position: fixed; inset: 0; z-index: 40; pointer-events: none;
  opacity: 0.22; mix-blend-mode: soft-light;
  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='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Status bar ── */
#status-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: var(--black-deep); border-bottom: 1px solid var(--grey-dim);
  padding: 10px 16px; display: flex; justify-content: space-between;
  align-items: center; font-size: 10px; letter-spacing: 1.5px;
}
.back-link { color: var(--grey); text-decoration: none; font-size: 10px; letter-spacing: 1px; }
.status-mark { color: var(--bone); font-weight: bold; }

/* ── Page transition ── */
#page-transition {
  position: fixed; inset: 0; background: #000; z-index: 8888;
  display: none; pointer-events: none; align-items: center;
  padding: 40px 32px; font-family: 'Courier New', monospace;
  font-size: 10px; letter-spacing: 2px;
}
#page-transition.go { display: flex; pointer-events: all; }
#pt-span { color: var(--accent); }

/* ── Escrow overlay ── */
#escrow-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(5,5,5,0.95);
  display: none; align-items: center; justify-content: center; padding: 30px;
}
#escrow-overlay.active { display: flex; }
#escrow-panel {
  width: 100%; max-width: 320px; border: 1px solid var(--accent-dim);
  background: var(--black); padding: 28px 22px; text-align: center;
}
.escrow-line {
  font-family: 'Courier New', monospace; font-size: 13px;
  letter-spacing: 2px; color: var(--accent); text-shadow: 0 0 10px var(--glow);
}
.escrow-line.small { font-size: 9px; color: var(--grey); letter-spacing: 1.5px; margin-top: 14px; text-shadow: none; }
.escrow-bar { width: 100%; height: 3px; background: var(--grey-dim); margin: 18px 0 0; overflow: hidden; }
.escrow-bar-fill { width: 0%; height: 100%; background: var(--accent); transition: width 1.6s linear; }
.escrow-bar-fill.fill { width: 100%; }

/* ============================================================
   UNIVERSAL DROP PAGE — works for every signal / release
   ============================================================ */

/* ── CASE HEADER ── */
#case-header {
  margin-top: 41px;
  padding: 28px 20px 22px;
  border-bottom: 1px solid var(--grey-dim);
  position: relative;
  overflow: hidden;
}
#case-header::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent); box-shadow: 0 0 14px var(--glow);
  animation: headerPulse 3s ease-in-out infinite;
}
@keyframes headerPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--glow); }
  50%       { opacity: 0.55; box-shadow: 0 0 28px var(--glow); }
}

.case-eyebrow {
  font-size: 9px; letter-spacing: 2.5px; color: var(--accent);
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.case-eyebrow-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 6px var(--glow);
  animation: dotPulse 1.6s ease-in-out infinite; flex-shrink: 0;
}
@keyframes dotPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.case-title {
  font-family: 'Arial Black', sans-serif;
  font-weight: 900; font-style: italic;
  font-size: 68px; line-height: 0.88;
  color: var(--bone); letter-spacing: -2px;
  animation: titleGlow 4s ease-in-out infinite;
}
@keyframes titleGlow {
  0%, 100% { text-shadow: 3px 3px 0 var(--accent), 0 0 20px var(--glow-soft); }
  50%       { text-shadow: 3px 3px 0 var(--accent), 0 0 44px var(--glow); }
}

.case-meta-row {
  display: flex; gap: 14px; margin-top: 12px;
  font-size: 9px; letter-spacing: 1.5px; align-items: center;
}
.case-id { color: var(--grey-dim); }
.case-status {
  color: var(--accent); font-weight: bold;
  border: 1px solid var(--accent-dim); padding: 2px 8px;
  animation: statusFlicker 5s step-end infinite;
}
@keyframes statusFlicker {
  0%, 88%, 90%, 92%, 100% { opacity: 1; }
  89%, 91% { opacity: 0.3; }
}

/* ── PROGRESSION TICKER ── */
/* Scrolls through investigation stages as user reads down the page */
#signal-progression {
  border-bottom: 1px solid var(--grey-dim);
  padding: 10px 20px;
  background: var(--black);
  display: flex; align-items: center; gap: 10px;
  font-size: 8px; letter-spacing: 2px; color: var(--grey-dim);
  overflow: hidden; white-space: nowrap;
}
#signal-progression::before {
  content: 'ROUTE:';
  color: var(--accent); flex-shrink: 0;
}
#progression-track {
  display: flex; gap: 0; align-items: center;
}
.prog-stage {
  padding: 0 10px;
  opacity: 0.3;
  transition: opacity 0.6s ease, color 0.6s ease;
  border-right: 1px solid var(--grey-dim);
}
.prog-stage:last-child { border-right: none; }
.prog-stage.reached { opacity: 1; color: var(--accent); }
.prog-stage.current {
  opacity: 1; color: var(--accent);
  text-shadow: 0 0 8px var(--glow-soft);
  animation: currentStagePulse 1.8s ease-in-out infinite;
}
@keyframes currentStagePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ── EVIDENCE FRAME ── */
#evidence-frame {
  position: relative;
  background: var(--black);
  border-bottom: 1px solid var(--grey-dim);
  min-height: 360px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

/* Scan sweep — always running, even on placeholder */
#evidence-frame::after {
  content: '';
  position: absolute; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.45; animation: scanSweep 3.8s linear infinite;
  pointer-events: none; z-index: 4;
}
@keyframes scanSweep {
  0%   { top: -2px; opacity: 0; }
  4%   { opacity: 0.45; }
  96%  { opacity: 0.45; }
  100% { top: 100%; opacity: 0; }
}

/* Targeting brackets */
.ev-bracket {
  position: absolute; width: 24px; height: 24px;
  z-index: 5; pointer-events: none;
  transition: opacity 0.4s ease;
}
.ev-bracket::before, .ev-bracket::after {
  content: ''; position: absolute; background: var(--accent);
}
.ev-bracket::before { width: 100%; height: 2px; top: 0; }
.ev-bracket::after  { width: 2px; height: 100%; top: 0; }
.ev-tl { top: 16px; left: 16px; }
.ev-tr { top: 16px; right: 16px; transform: scaleX(-1); }
.ev-bl { bottom: 16px; left: 16px; transform: scaleY(-1); }
.ev-br { bottom: 16px; right: 16px; transform: scale(-1); }

/* Placeholder — shown when no artwork is loaded */
#evidence-placeholder {
  position: relative; z-index: 2;
  width: 100%; max-width: 320px;
  aspect-ratio: 3/4;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  border: 1px solid var(--grey-dim);
  background: rgba(10,10,10,0.6);
}
.ph-status {
  font-size: 9px; letter-spacing: 2.5px; color: var(--accent);
  text-align: center; line-height: 2;
  animation: phCycle 8s steps(1) infinite;
}
/* CSS-only cycling of placeholder text via opacity layers */
.ph-line {
  display: block; opacity: 0;
  position: absolute; left: 0; right: 0; text-align: center;
  animation: phLineCycle 8s steps(1) infinite;
}
.ph-line:nth-child(1) { animation-delay: 0s; }
.ph-line:nth-child(2) { animation-delay: 2s; }
.ph-line:nth-child(3) { animation-delay: 4s; }
.ph-line:nth-child(4) { animation-delay: 6s; }
@keyframes phLineCycle {
  0%, 25%, 100% { opacity: 0; }
  3%, 22%       { opacity: 1; }
}

.ph-integrity {
  width: 80%; height: 2px; background: var(--grey-dim); position: relative; overflow: hidden;
}
.ph-integrity-fill {
  height: 100%; background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  animation: integrityPulse 3s ease-in-out infinite;
}
@keyframes integrityPulse {
  0%, 100% { width: 60%; }
  50%       { width: 72%; }
}

.ph-label {
  font-size: 8px; letter-spacing: 2px; color: var(--grey-dim); text-align: center;
}

/* Real artwork — hidden until image is placed */
#evidence-img {
  display: none; /* swap to block when artwork is ready */
  width: 100%; max-width: 320px; aspect-ratio: 3/4;
  object-fit: cover; position: relative; z-index: 2;
}
#evidence-img.loaded { display: block; }

/* Evidence reveal toggle — tap to lift blur from placeholder or real img */
#evidence-reveal {
  position: absolute; inset: 0; z-index: 6;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 18px; cursor: pointer;
}
.ev-reveal-label {
  font-size: 8px; letter-spacing: 3px; color: var(--accent);
  border: 1px solid var(--accent-dim); padding: 4px 12px;
  animation: revealPulse 2s ease-in-out infinite;
}
@keyframes revealPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
#evidence-reveal.done { display: none; }

/* Record ID caption — echoes the archival-system HUD text printed on the physical
   garment mockups themselves, so the web viewer and the actual print speak the same
   visual language. */
#evidence-record-id {
  position: absolute; left: 12px; bottom: 10px; z-index: 6;
  font-family: 'Courier New', monospace; font-size: 8px; letter-spacing: 1.5px;
  color: var(--accent); opacity: 0.85;
  text-shadow: 0 0 6px var(--glow-soft);
  pointer-events: none;
}

/* Brief "re-scan" flicker fired when the evidence image is swapped for a new
   variant — reads as the archive re-verifying the file, not a UI glitch. */
@keyframes evidenceRescan {
  0%   { opacity: 1; filter: brightness(1); }
  15%  { opacity: 0.15; filter: brightness(2.2); }
  30%  { opacity: 1; filter: brightness(1); }
  45%  { opacity: 0.35; filter: brightness(1.8); }
  60%  { opacity: 1; filter: brightness(1); }
  100% { opacity: 1; filter: brightness(1); }
}
#evidence-img.rescanning { animation: evidenceRescan 0.5s steps(2, end); }

/* ── VARIANT TABS ── */
#variant-tabs {
  display: flex; border-bottom: 1px solid var(--grey-dim);
}
.vtab {
  flex: 1; padding: 13px 4px; text-align: center;
  font-family: 'Courier New', monospace; font-size: 9px; letter-spacing: 1.5px;
  color: var(--grey); background: transparent; border: none;
  border-right: 1px solid var(--grey-dim); cursor: pointer;
  transition: color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.vtab:last-child { border-right: none; }
.vtab.active { color: var(--accent); background: rgba(0,0,0,0.5); position: relative; }
.vtab.active::before {
  content: ''; position: absolute; top: 4px; left: 4px;
  width: 6px; height: 6px;
  border-top: 1px solid var(--accent); border-left: 1px solid var(--accent);
  opacity: 0.7;
}
.vtab.active::after {
  content: ''; position: absolute; bottom: 4px; right: 4px;
  width: 6px; height: 6px;
  border-bottom: 1px solid var(--accent); border-right: 1px solid var(--accent);
  opacity: 0.7;
}
.vtab-price { display: block; margin-top: 3px; font-size: 12px; font-weight: bold; color: var(--accent); }
.vtab:not(.active) .vtab-price { color: var(--grey-dim); }

/* ── INTEL STRIP ── */
#intel-strip {
  display: grid; grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--grey-dim);
}
.intel-cell {
  padding: 14px 16px;
  border-right: 1px solid var(--grey-dim);
  border-bottom: 1px solid var(--grey-dim);
  position: relative; overflow: hidden;
}
.intel-cell:nth-child(even) { border-right: none; }
.intel-cell:nth-last-child(-n+2) { border-bottom: none; }
.intel-cell.glitch-flash { animation: cellGlitch 0.1s steps(2); }
@keyframes cellGlitch {
  0%   { background: transparent; }
  50%  { background: var(--glow-soft); }
  100% { background: transparent; }
}
.intel-label { font-size: 8px; letter-spacing: 2px; color: var(--grey-dim); margin-bottom: 6px; }
.intel-value { font-size: 11px; color: var(--bone); letter-spacing: 0.5px; }
.intel-value.hot { color: var(--accent); text-shadow: 0 0 8px var(--glow-soft); }

/* ── ACQUIRE BLOCK ── */
#acquire-block {
  padding: 22px 20px 26px;
  border-bottom: 1px solid var(--grey-dim);
}
.acquire-price-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 18px;
}
.acquire-label { font-size: 8px; letter-spacing: 2px; color: var(--grey); margin-bottom: 4px; }
.acquire-variant { font-size: 9px; color: var(--grey-dim); letter-spacing: 1px; }
.acquire-price {
  font-size: 28px; color: var(--accent); font-weight: bold;
  font-family: 'Arial Black', sans-serif;
  text-shadow: 0 0 16px var(--glow-soft);
}

.acquire-btn {
  display: block; width: 100%; padding: 18px;
  background: transparent; border: 1px solid var(--accent);
  color: var(--bone); font-family: 'Courier New', monospace;
  font-size: 11px; letter-spacing: 3px; text-align: center;
  cursor: pointer; transition: background 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative; overflow: hidden;
}
.acquire-btn:not(:disabled)::before {
  content: '';
  position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, var(--glow-soft), transparent);
}
.acquire-btn:not(:disabled):active::before { left: 100%; transition: left 0.4s ease; }
.acquire-btn:not(:disabled):active { background: var(--glow-soft); box-shadow: 0 0 24px var(--glow-soft); }
.acquire-btn:disabled { opacity: 0.35; cursor: not-allowed; border-color: var(--grey-dim); color: var(--grey); }
.acquire-note { margin-top: 12px; font-size: 8px; color: var(--grey-dim); text-align: center; letter-spacing: 1.5px; }

/* ── CASE FILE — collapsible ── */
#case-file { border-bottom: 1px solid var(--grey-dim); }

.cf-toggle {
  width: 100%; padding: 16px 20px;
  background: var(--black); border: none;
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'Courier New', monospace; font-size: 9px; letter-spacing: 2px;
  color: var(--grey); cursor: pointer; -webkit-tap-highlight-color: transparent;
  border-bottom: 1px solid transparent; transition: border-color 0.2s;
}
.cf-toggle.open { border-bottom-color: var(--grey-dim); }
.cf-toggle-ref { color: var(--accent); }
.cf-arrow { font-size: 9px; color: var(--accent); transition: transform 0.3s ease; display: inline-block; }
.cf-toggle.open .cf-arrow { transform: rotate(180deg); }

.cf-body { max-height: 0; overflow: hidden; transition: max-height 0.45s ease; background: var(--black-deep); }
.cf-body.open { max-height: 900px; }

.cf-section { padding: 18px 20px; border-bottom: 1px solid var(--grey-dim); }
.cf-section:last-child { border-bottom: none; }
.cf-section-label { font-size: 8px; letter-spacing: 2px; color: var(--grey-dim); margin-bottom: 12px; }
.cf-text { font-size: 11px; color: var(--grey); line-height: 1.85; letter-spacing: 0.3px; }

.cf-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 9px 0; border-bottom: 1px solid var(--grey-dim);
  font-size: 10px; gap: 12px;
}
.cf-row:last-child { border-bottom: none; }
.cf-key { color: var(--grey); letter-spacing: 1px; flex-shrink: 0; }
.cf-val { color: var(--bone); text-align: right; }
.cf-val.hot { color: var(--accent); }

/* ── ARCHIVE LOG — scrolling transmission history ── */
#archive-log {
  border-bottom: 1px solid var(--grey-dim);
  background: var(--black);
}
.archive-log-header {
  padding: 12px 20px; border-bottom: 1px solid var(--grey-dim);
  font-size: 8px; letter-spacing: 2px; color: var(--grey-dim);
  display: flex; justify-content: space-between; align-items: center;
}
.archive-log-live {
  font-size: 8px; letter-spacing: 1.5px; color: var(--accent);
  animation: dotPulse 1.6s ease-in-out infinite;
}
.archive-entry {
  padding: 10px 20px; border-bottom: 1px solid var(--grey-dim);
  display: flex; gap: 14px; align-items: flex-start;
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.archive-entry.in-view { opacity: 1; transform: translateY(0); }
.archive-entry:last-child { border-bottom: none; }
.archive-ts { font-size: 8px; color: var(--grey-dim); letter-spacing: 1px; flex-shrink: 0; min-width: 48px; padding-top: 2px; }
.archive-msg { font-size: 10px; color: var(--grey); letter-spacing: 0.5px; line-height: 1.5; }
.archive-msg.hot { color: var(--accent); }

/* ── MINI PLAYER — fixed bottom ── */
#mini-player {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100; height: 58px;
  background: rgba(5,5,5,0.97); border-top: 1px solid var(--accent-dim);
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 18px; gap: 6px;
}
#mp-row-top { display: flex; justify-content: space-between; align-items: center; }
#mp-track { font-size: 9px; letter-spacing: 1.5px; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 72%; }
#mp-time { font-size: 9px; color: var(--grey-dim); }
#mp-row-bottom { display: flex; align-items: center; gap: 12px; }
#mp-play {
  background: none; border: 1px solid var(--accent-dim); color: var(--accent);
  font-size: 12px; cursor: pointer; padding: 4px 8px; flex-shrink: 0; line-height: 1;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background 0.15s;
}
#mp-play:active { background: var(--glow-soft); }
#mp-progress-track { flex: 1; height: 2px; background: var(--grey-dim); cursor: pointer; }
#mp-progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.4s linear; box-shadow: 0 0 4px var(--accent); }

/* ── Corrupted artwork (non-active drops) ── */
#artwork {
  padding: 0; border-bottom: 1px solid var(--grey-dim);
  background: var(--black); aspect-ratio: 4/5;
  display: flex; align-items: center; justify-content: center;
  color: var(--grey-dim); font-size: 10px; letter-spacing: 2px;
  position: relative; filter: blur(8px); opacity: 0.4;
  animation: corruptedBreathe 5s ease-in-out infinite;
}
@keyframes corruptedBreathe { 0%, 100% { opacity: 0.3; filter: blur(10px); } 50% { opacity: 0.5; filter: blur(6px); } }

/* ── Footer ── */
#footer { padding: 30px 20px 80px; font-size: 9px; color: var(--grey-dim); letter-spacing: 1px; text-align: center; }

/* ── Desktop ── */
@media (min-width: 768px) {
  #case-header { padding: 40px 40px 28px; max-width: 1200px; margin: 41px auto 0; }
  .case-title { font-size: 96px; }
  #signal-progression { padding: 10px 40px; max-width: 1200px; margin: 0 auto; }
  #evidence-frame { max-width: 1200px; margin: 0 auto; min-height: 500px; }
  #evidence-placeholder, #evidence-img { max-width: 420px; }
  #variant-tabs, #intel-strip, #acquire-block, #case-file, #archive-log { max-width: 1200px; margin: 0 auto; }
  .acquire-btn { font-size: 12px; padding: 20px; }
}
