/* Red Protocol: shared theme
   Noir dossier look from the invitation poster: warm near-black, blood-red
   glow, silver serif capitals, typewriter case-file text, wax seals. */

:root {
  /* surfaces */
  --ink: #070505;
  --ink-2: #0f0909;
  --ink-3: #170d0d;
  --ink-4: #201212;
  --line: #2e1919;
  --line-soft: #1e1010;

  /* reds */
  --red: #e0141e;
  --red-hot: #ff3434;
  --red-deep: #6e0a0e;
  --red-wash: rgba(224, 20, 30, 0.12);
  --red-line: rgba(255, 52, 52, 0.42);
  --red-glow: rgba(255, 30, 30, 0.5);

  /* neutrals */
  --text: #ede6e2;
  --muted: #a8968f;
  --dim: #6f5d58;
  --silver-1: #ffffff;
  --silver-2: #c9c3bf;
  --silver-3: #8c8481;

  /* case-file paper */
  --paper: #d9c7a3;
  --paper-2: #c4ae86;
  --paper-ink: #2b1a10;

  --ok: #84d6a5;
  --warn: #f0b45a;

  --f-display: "Cinzel", "Trajan Pro", Georgia, serif;
  --f-ui: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-type: "Special Elite", "Courier Prime", "Courier New", monospace;
  --f-mono: "Courier Prime", "Courier New", ui-monospace, monospace;

  --radius: 4px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--f-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 85% -5%, rgba(224, 20, 30, 0.22), transparent 65%),
    radial-gradient(700px 600px at -10% 40%, rgba(110, 10, 14, 0.25), transparent 70%),
    radial-gradient(900px 500px at 50% 110%, rgba(224, 20, 30, 0.12), transparent 70%),
    var(--ink);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* film grain + scanlines over everything, never blocking clicks */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.5;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px),
    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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

a { color: inherit; }

::selection { background: var(--red); color: #fff; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- small type ---------- */

.label {
  font-family: var(--f-ui);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}

.label-red { color: var(--red-hot); }

.rule {
  display: block;
  width: 56px;
  height: 2px;
  background: var(--red);
  box-shadow: 0 0 12px var(--red-glow);
}

.typed {
  font-family: var(--f-type);
  letter-spacing: 0.06em;
}

/* ---------- top bar ---------- */

.topbar {
  position: relative;
  z-index: 20;
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px var(--gutter-r) 0 var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.topbar .brand { justify-self: start; }
.topbar .nav { justify-self: end; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
}

.brand b { color: var(--red-hot); font-weight: 700; }
.brand-mark { width: 26px; height: 26px; color: var(--red); filter: drop-shadow(0 0 6px var(--red-glow)); }

.nav { display: flex; gap: 4px; }

.nav a {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: color 0.2s, border-color 0.2s;
}

.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); border-color: var(--line); }

/* ---------- the RED / PROTOCOL title ---------- */

.rp-title {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.rp-title > span { position: relative; display: block; width: fit-content; }

.rp-red {
  color: var(--red);
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.32) 0 2px, transparent 2px 5px),
    linear-gradient(180deg, #ff5a4f 0%, #e0141e 55%, #9c0a10 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 30, 30, 0.45));
}

.rp-silver {
  color: var(--silver-2);
  background: linear-gradient(180deg, var(--silver-1) 0%, var(--silver-2) 48%, var(--silver-3) 52%, #e2ddd9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(2px 0 0 rgba(224, 20, 30, 0.35)) drop-shadow(0 6px 18px rgba(0, 0, 0, 0.6));
}

/* glitch slices: a shifted copy flickers through a band every few seconds */
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background: inherit;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  pointer-events: none;
  opacity: 0;
}

.glitch::before { animation: glitch-a 6s steps(1) infinite; }
.glitch::after { animation: glitch-b 6s steps(1) infinite 0.08s; }

@keyframes glitch-a {
  0%, 91%, 100% { opacity: 0; transform: none; clip-path: inset(0 0 0 0); }
  92% { opacity: 1; transform: translateX(-6px); clip-path: inset(18% 0 62% 0); }
  94% { opacity: 1; transform: translateX(5px); clip-path: inset(58% 0 22% 0); }
  96% { opacity: 1; transform: translateX(-3px); clip-path: inset(40% 0 44% 0); }
}

@keyframes glitch-b {
  0%, 92%, 100% { opacity: 0; transform: none; clip-path: inset(0 0 0 0); }
  93% { opacity: 0.8; transform: translateX(7px); clip-path: inset(70% 0 8% 0); }
  95% { opacity: 0.8; transform: translateX(-5px); clip-path: inset(8% 0 76% 0); }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--f-ui);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  padding: 14px 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: progress; }

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #f0232c, #b90d15);
  border-color: #ff4a4a;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4) inset, 0 8px 28px -8px var(--red-glow);
}

.btn-primary:hover { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4) inset, 0 10px 36px -6px rgba(255, 30, 30, 0.75); }

.btn-ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--line);
}

.btn-ghost:hover { border-color: var(--red-line); color: #fff; }
.btn-sm { padding: 8px 12px; font-size: 0.68rem; }
.btn-block { width: 100%; }

:focus-visible { outline: 2px solid var(--red-hot); outline-offset: 3px; }

/* ---------- CONFIDENTIAL stamp ---------- */

.stamp {
  display: inline-block;
  font-family: var(--f-ui);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--text);
  padding: 7px 10px 7px 14px;
  border: 1px solid currentColor;
  box-shadow: 0 0 0 3px transparent, inset 0 0 0 2px transparent;
  outline: 1px solid rgba(237, 230, 226, 0.25);
  outline-offset: 3px;
}

.stamp-red {
  color: var(--red-hot);
  outline-color: rgba(255, 52, 52, 0.3);
  text-shadow: 0 0 8px rgba(255, 30, 30, 0.4);
}

/* ---------- wax seal ---------- */

.seal {
  --size: 84px;
  position: relative;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  border-radius: 46% 54% 50% 50% / 52% 48% 54% 46%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 140, 120, 0.55), transparent 38%),
    radial-gradient(circle at 50% 50%, #c4121b 0 52%, #8e0a10 70%, #5e060a 100%);
  box-shadow:
    0 0 0 4px rgba(150, 10, 16, 0.55),
    0 0 0 7px rgba(110, 8, 12, 0.35),
    0 10px 24px rgba(0, 0, 0, 0.6),
    inset 0 -6px 12px rgba(0, 0, 0, 0.45),
    inset 0 4px 8px rgba(255, 120, 110, 0.25);
}

.seal::before {
  content: "";
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255, 120, 110, 0.3);
}

.seal svg {
  position: relative;
  width: 42%;
  height: 42%;
  color: #7a080d;
  filter: drop-shadow(0 1px 0 rgba(255, 130, 120, 0.45));
}

/* ---------- typewritten case-file paper ---------- */

.paper {
  position: relative;
  color: var(--paper-ink);
  background:
    radial-gradient(120% 90% at 20% 10%, rgba(255, 255, 255, 0.18), transparent 60%),
    radial-gradient(80% 60% at 90% 100%, rgba(80, 40, 10, 0.25), transparent 70%),
    linear-gradient(180deg, var(--paper), var(--paper-2));
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.redact {
  display: inline-block;
  height: 0.95em;
  vertical-align: -0.1em;
  background: #050303;
  border-radius: 1px;
}

/* ---------- sound toggle ---------- */

.sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 6px;
  padding: 7px 10px;
  font-family: var(--f-ui);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.sound-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sound-toggle svg path:first-child { fill: currentColor; stroke: none; }
.sound-toggle:hover { color: var(--text); border-color: var(--red-line); }
.sound-toggle[aria-pressed="true"] { color: var(--red-hot); border-color: var(--red-line); box-shadow: 0 0 14px -4px var(--red-glow); }
.sound-toggle[aria-pressed="true"] .wave { animation: wave 1.6s ease-in-out infinite; }
.sound-toggle.hint { animation: hint 2.4s ease-in-out infinite; }

@keyframes wave { 50% { opacity: 0.35; } }
@keyframes hint { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 52, 52, 0); } 50% { box-shadow: 0 0 0 4px rgba(255, 52, 52, 0.18); border-color: var(--red-line); } }

/* ---------- atmosphere: fog ---------- */

.fog {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.fog span {
  position: absolute;
  width: 75vmax;
  height: 75vmax;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(150, 8, 14, 0.3), transparent 72%);
  animation: drift 52s ease-in-out infinite alternate;
  will-change: transform;
}

.fog span:nth-child(1) { left: -25vmax; top: 5vh; }
.fog span:nth-child(2) {
  right: -30vmax;
  top: -25vmax;
  background: radial-gradient(closest-side, rgba(224, 20, 30, 0.2), transparent 72%);
  animation-duration: 68s;
  animation-delay: -22s;
}
.fog span:nth-child(3) {
  left: 15vw;
  bottom: -45vmax;
  background: radial-gradient(closest-side, rgba(80, 4, 8, 0.45), transparent 72%);
  animation-duration: 84s;
  animation-delay: -40s;
}

@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(9vw, -7vh) scale(1.18); }
  100% { transform: translate(-7vw, 6vh) scale(0.94); }
}

/* ---------- atmosphere: searchlight + power flicker ---------- */

.searchlight {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: radial-gradient(circle 620px at var(--mx, 50%) var(--my, 30%),
    transparent 0%, transparent 30%, rgba(0, 0, 0, 0.26) 70%, rgba(0, 0, 0, 0.38) 100%);
  transition: opacity 0.5s ease;
}

.searchlight.dim { opacity: 0.25; }

.flicker {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
  background: #000;
  opacity: 0;
}

.flicker.on { animation: power 1.1s steps(1) 1; }

@keyframes power {
  0% { opacity: 0; }
  8% { opacity: 0.4; }
  12% { opacity: 0; }
  20% { opacity: 0.55; }
  23% { opacity: 0.1; }
  28% { opacity: 0.3; }
  32%, 100% { opacity: 0; }
}

/* ---------- the watching eye ---------- */

.eye {
  display: inline-block;
  width: 52px;
  height: 26px;
  color: var(--red-hot);
  filter: drop-shadow(0 0 8px rgba(255, 30, 30, 0.45));
}

.eye svg { display: block; width: 100%; height: 100%; overflow: visible; }
.eye-white { fill: #120707; }
.eye-lid { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.eye-ball { transform: translate(var(--ex, 0px), var(--ey, 0px)); transition: transform 0.18s ease-out; }
.eye-iris { fill: #7c0a10; stroke: currentColor; stroke-width: 1; }
.eye-ring { fill: none; stroke: rgba(255, 120, 100, 0.35); stroke-width: 0.8; stroke-dasharray: 1.4 1.2; }
.eye-pupil { fill: #050202; }
.eye-glint { fill: rgba(255, 210, 200, 0.85); }
.eye.blink svg { animation: blink 0.24s ease-in-out; transform-origin: 50% 50%; }

@keyframes blink { 45%, 55% { transform: scaleY(0.06); } }

/* ---------- transmission ticker ---------- */

.ticker {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-block: 1px solid var(--line-soft);
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.75), rgba(20, 4, 6, 0.6), rgba(0, 0, 0, 0.75));
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.ticker-track { display: flex; width: max-content; animation: ticker 70s linear infinite; }
.ticker-track > div { display: flex; align-items: center; }

.ticker span {
  padding: 11px 0;
  font-family: var(--f-type);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
}

.ticker b { margin: 0 22px; font-size: 0.55rem; font-weight: 400; color: var(--red-hot); text-shadow: 0 0 8px var(--red-glow); }

@keyframes ticker { to { transform: translateX(-50%); } }

.dc { color: var(--red-hot); -webkit-text-fill-color: var(--red-hot); }

/* ---------- motion ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes flicker {
  0%, 100% { opacity: 1; }
  41% { opacity: 1; } 42% { opacity: 0.55; } 43% { opacity: 1; }
  78% { opacity: 1; } 79% { opacity: 0.7; } 80% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .glitch::before, .glitch::after { display: none; }
}

@media (max-width: 560px) {
  .topbar { gap: 8px; }
  .nav { gap: 0; }
  .nav a { padding: 8px 6px; font-size: 0.64rem; letter-spacing: 0.12em; }
  .brand span { display: none; }
  .eye { width: 36px; height: 18px; }
  .sound-label { display: none; }
  .sound-toggle { margin-left: 4px; padding: 6px 7px; }
}

/* Smallest phones: the decorative eye steps aside so the menu fits. */
@media (max-width: 370px) {
  .eye-top { display: none; }
  .topbar { grid-template-columns: auto 1fr; }
}
