/* ============================================================
   THE TRUTH · declassified dossier
   cold, ominous frame  →  warm, sincere payoff
   ============================================================ */

:root {
  /* cold frame palette */
  --ink:        #0a0a0b;
  --ink-2:      #101012;
  --panel:      #131316;
  --line:       #2a2a30;
  --dim:        #6d6d78;
  --fog:        #a8a8b4;
  --alarm:      #ff3b30;   /* classified red */
  --alarm-glow: rgba(255, 59, 48, 0.55);

  /* warm payoff palette */
  --paper:      #efe7d2;
  --paper-2:    #e5dbc0;
  --paper-ink:  #23201a;
  --paper-fade: #6b6455;
  --seal:       #2f7d4f;   /* declassified green */

  --stamp-red:  #b4231f;

  --shadow: 0 30px 80px -20px rgba(0,0,0,0.9);
  --mono: 'Special Elite', 'Courier New', monospace;
  --stencil: 'Saira Stencil One', 'Impact', sans-serif;
}

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

/* `hidden` must win over any explicit display (e.g. .redacted is flex) */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 90% at 50% -10%, #1a1a20 0%, var(--ink) 55%, #050506 100%);
  color: var(--fog);
  font-family: var(--mono);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  cursor: crosshair;
}

/* ---------- atmospheric overlays ---------- */
.grain {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.6s steps(2) infinite;
}
@keyframes grain {
  0%,100% { transform: translate(0,0); }
  50%     { transform: translate(-4%, 3%); }
}

.scanlines {
  position: fixed; inset: 0; z-index: 49; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.03) 0px,
    rgba(255,255,255,0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.6;
}

.vignette {
  position: fixed; inset: 0; z-index: 48; pointer-events: none;
  background: radial-gradient(120% 100% at 50% 45%, transparent 55%, rgba(0,0,0,0.75) 100%);
}

/* ---------- surveillance corner brackets ---------- */
.frame { position: fixed; inset: 22px; z-index: 40; pointer-events: none; }
.bracket { position: absolute; width: 34px; height: 34px; border: 2px solid var(--dim); opacity: 0.5; }
.bracket.tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.bracket.tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.bracket.bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.bracket.br { bottom: 0; right: 0; border-left: 0; border-top: 0; }

/* ---------- stage ---------- */
.stage {
  position: relative; z-index: 10;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: space-between;
  padding: clamp(28px, 5vw, 60px) clamp(20px, 5vw, 64px);
  gap: 28px;
}

/* ---------- status bar ---------- */
.status {
  width: 100%; max-width: 720px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--dim);
  animation: fade-in 0.8s ease both;
}
.rec { display: inline-flex; align-items: center; gap: 8px; color: var(--alarm); }
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--alarm); box-shadow: 0 0 10px var(--alarm-glow);
  animation: blink 1.4s steps(1) infinite;
}
@keyframes blink { 0%,60% { opacity: 1; } 61%,100% { opacity: 0.15; } }
.status-mid { opacity: 0.7; display: none; }
.clock { font-variant-numeric: tabular-nums; }
@media (min-width: 620px) { .status-mid { display: inline; } }

/* ---------- dossier card ---------- */
.dossier {
  width: 100%; max-width: 620px;
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: clamp(26px, 4vw, 44px);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.04);
  position: relative;
  animation: rise 0.9s cubic-bezier(.2,.8,.2,1) both 0.1s;
}
.dossier::before {
  /* faint dept-of-nothing letterhead line */
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--alarm), transparent 60%);
  opacity: 0.6; border-radius: 4px 4px 0 0;
}

.dossier-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 26px;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
}
.classmark {
  color: var(--alarm);
  border: 1.5px solid var(--alarm);
  padding: 4px 10px; border-radius: 2px;
  font-weight: 700; letter-spacing: 0.3em;
  box-shadow: 0 0 18px -6px var(--alarm-glow);
}
.casefile { color: var(--dim); }
.casefile b { color: var(--fog); font-weight: 400; }

/* headline */
.kicker { text-align: center; margin-bottom: 30px; user-select: none; }
.kicker-sm {
  display: block; font-size: 13px; letter-spacing: 0.7em; color: var(--alarm);
  margin-bottom: 10px; padding-left: 0.7em;
}
.kicker-lg {
  display: block; font-family: var(--stencil);
  font-size: clamp(30px, 8vw, 56px); line-height: 0.98;
  color: #f2f0ea; letter-spacing: 0.01em;
  text-shadow: 0 2px 0 #000, 0 0 30px rgba(255,255,255,0.06);
}

/* redacted lines (pre-reveal) */
.redacted {
  display: flex; flex-direction: column; gap: 14px;
  align-items: center; margin: 8px 0 34px;
  min-height: 132px; justify-content: center;
}
.rbar {
  height: 18px; background: #000;
  border-radius: 1px; max-width: 100%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
  animation: flick 3s steps(1) infinite;
}
.rbar:nth-child(2) { animation-delay: .4s; }
.rbar:nth-child(3) { animation-delay: .9s; }
.rbar:nth-child(4) { animation-delay: 1.4s; }
.rbar:nth-child(5) { animation-delay: 1.9s; }
@keyframes flick { 0%,96% { opacity: 1; } 97%,100% { opacity: 0.72; } }
.redacted.wipe .rbar {
  animation: wipe 0.5s cubic-bezier(.7,0,.3,1) forwards;
  transform-origin: left;
}
.redacted.wipe .rbar:nth-child(2) { animation-delay: .06s; }
.redacted.wipe .rbar:nth-child(3) { animation-delay: .12s; }
.redacted.wipe .rbar:nth-child(4) { animation-delay: .18s; }
.redacted.wipe .rbar:nth-child(5) { animation-delay: .24s; }
@keyframes wipe { to { transform: scaleX(0); opacity: 0; } }

/* ---------- the warm paper payoff ---------- */
.paper {
  position: relative;
  margin: 4px 0 30px;
  padding: 38px 30px 30px;
  background:
    linear-gradient(180deg, var(--paper), var(--paper-2));
  color: var(--paper-ink);
  border-radius: 3px;
  box-shadow: 0 20px 50px -18px rgba(0,0,0,0.8), inset 0 0 60px rgba(120,100,60,0.12);
  transform: rotate(-0.6deg);
  animation: slam 0.55s cubic-bezier(.2,.9,.25,1.2) both;
}
.paper::after {
  /* torn/aged paper grain */
  content: ""; position: absolute; inset: 0; border-radius: 3px; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: multiply; opacity: 0.06;
}
.truth {
  font-size: clamp(20px, 3.4vw, 27px);
  line-height: 1.42; letter-spacing: 0.01em;
  min-height: 1.4em;
}
.truth::before { content: "“"; opacity: 0.35; margin-right: 2px; }
.truth::after  { content: "”"; opacity: 0.35; }
.truth.scrambling { color: var(--paper-fade); }

.paper-meta {
  margin-top: 22px; padding-top: 12px;
  border-top: 1px dashed rgba(60,50,30,0.35);
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--paper-fade);
}

/* the DECLASSIFIED stamp */
.stamp {
  position: absolute; top: 8px; right: -6px;
  font-family: var(--stencil); font-size: clamp(16px, 3vw, 22px);
  letter-spacing: 0.08em;
  color: var(--seal);
  border: 3px solid var(--seal); border-radius: 4px;
  padding: 5px 12px;
  transform: rotate(11deg) scale(2.4); opacity: 0;
  mix-blend-mode: multiply;
  box-shadow: inset 0 0 0 1px rgba(47,125,79,0.4);
}
.stamp.hit { animation: stamp 0.45s cubic-bezier(.3,1.4,.4,1) 0.32s forwards; }
@keyframes stamp {
  0%   { transform: rotate(11deg) scale(2.4); opacity: 0; }
  60%  { transform: rotate(11deg) scale(0.92); opacity: 0.95; }
  100% { transform: rotate(11deg) scale(1);    opacity: 0.85; }
}

/* ---------- controls ---------- */
.controls { display: flex; flex-direction: column; align-items: center; gap: 14px; }

.btn {
  font-family: var(--mono); cursor: pointer;
  border: none; border-radius: 3px;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: 2px solid var(--alarm); outline-offset: 3px; }

.btn.primary {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: var(--alarm); color: #140302;
  padding: 15px 40px; letter-spacing: 0.25em; font-weight: 700;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.1), 0 16px 40px -14px var(--alarm-glow);
}
.btn.primary:hover { box-shadow: 0 0 0 1px rgba(255,255,255,0.2), 0 20px 50px -12px var(--alarm-glow); transform: translateY(-1px); }
.btn.primary .btn-label { font-size: 15px; }
.btn.primary .btn-sub { font-size: 9px; letter-spacing: 0.3em; opacity: 0.7; text-transform: uppercase; }

.btn.ghost {
  background: transparent; color: var(--fog);
  border: 1px solid var(--line);
  padding: 11px 22px; font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
}
.btn.ghost:hover { border-color: var(--fog); color: #fff; background: rgba(255,255,255,0.03); }
.btn.ghost.copied { border-color: var(--seal); color: var(--seal); }

/* ---------- footer ---------- */
.foot {
  font-size: 11px; letter-spacing: 0.14em; color: var(--dim);
  text-align: center; text-transform: uppercase;
  animation: fade-in 1.2s ease both 0.5s;
}

/* ---------- entrance animations ---------- */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes slam { 0% { opacity: 0; transform: rotate(-0.6deg) translateY(-14px) scale(1.02); } 100% { opacity: 1; transform: rotate(-0.6deg); } }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; }
  .grain, .scanlines { display: none; }
}

/* Keep atmosphere behind content so official logos remain unaltered. */
.grain, .scanlines, .vignette { z-index: 1; }
.frame { z-index: 2; }
.dossier { animation-duration: .35s; animation-delay: 0s; }
.classmark.declassified { color: var(--seal); border-color: var(--seal); box-shadow: none; }
.redacted.wipe .rbar { animation-duration: .15s; }
.redacted.wipe .rbar:nth-child(2) { animation-delay: .015s; }
.redacted.wipe .rbar:nth-child(3) { animation-delay: .03s; }
.redacted.wipe .rbar:nth-child(4) { animation-delay: .045s; }
.redacted.wipe .rbar:nth-child(5) { animation-delay: .06s; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.paper-meta { flex-wrap: wrap; align-items: center; }
.paper { padding-top: 76px; }
.evidence { color: var(--paper-ink); text-underline-offset: 4px; padding: 10px 0; }
.evidence:focus-visible { outline: 2px solid var(--paper-ink); outline-offset: 4px; }
.share-tools { display: flex; justify-content: center; flex-wrap: wrap; align-items: center; gap: 10px; width: 100%; }
.share-tools .btn { min-height: 44px; }
.btn.social {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; padding: 12px; position: relative;
  background: var(--panel); flex-shrink: 0;
}
.social img { display: block; width: 22px; height: 22px; object-fit: contain; }
.share-tooltip {
  position: absolute; bottom: calc(100% + 8px); right: 0;
  background: var(--ink); border: 1px solid var(--fog); color: #fff;
  padding: 8px; font-size: 11px; letter-spacing: .02em; white-space: nowrap;
  pointer-events: none; opacity: 0; z-index: 3;
}
.social:hover .share-tooltip, .social:focus-visible .share-tooltip { opacity: 1; }
.share-status { font-size: 12px; line-height: 1.5; text-align: center; color: var(--fog); }
.share-status:empty { display: none; }
.manual-copy { width: 100%; font-size: 13px; line-height: 1.5; }
.manual-copy textarea {
  display: block; width: 100%; margin-top: 8px; padding: 12px;
  background: var(--ink); color: #fff; border: 1px solid var(--fog);
  font: inherit; resize: vertical;
}
.manual-copy textarea:focus-visible { outline: 2px solid var(--alarm); outline-offset: 3px; }
#nativeShare { flex-basis: 100%; }
.btn:disabled { cursor: wait; }
.noscript-truth { max-width: 500px; padding: 20px; background: var(--paper); color: var(--paper-ink); line-height: 1.6; }
@media (max-width: 420px) {
  .dossier { padding: 24px 18px; }
  .dossier-head { flex-wrap: wrap; }
  .paper { padding: 72px 20px 24px; }
  .btn.primary { max-width: 100%; padding: 15px 18px; }
  .btn.primary .btn-label { font-size: 13px; letter-spacing: .16em; }
  #shareBtn { flex-basis: 100%; padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-delay: 0s !important; transition: none !important; }
}
