/* Il Caso Mancini — base condivisa */
:root {
  --ink: #0b0a0d;
  --night: #100e15;
  --night-2: #18141f;
  --paper: #efe7d8;
  --paper-2: #e3d7c1;
  --paper-ink: #1d1a18;
  --muted: #7b7268;
  --blood: #8c1c22;
  --blood-2: #b3262d;
  --gold: #c8a35a;
  --gold-2: #e6cf98;
  --chalk: #f3efe6;
  --uv: #8f6bff;

  --f-display: 'Fraunces', 'Georgia', serif;
  --f-serif: 'Source Serif 4', 'Georgia', serif;
  --f-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --f-type: 'Special Elite', 'Courier New', monospace;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--chalk);
  font-family: var(--f-serif);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--blood); color: var(--chalk); }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }

[hidden] { display: none !important; }

.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;
}

/* Grana pellicola + vignetta */
.grain {
  position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: .07;
  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='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite; background-size: 160px;
}
@keyframes grain {
  0% { background-position: 0 0; } 20% { background-position: -40px 30px; }
  40% { background-position: 30px -50px; } 60% { background-position: -60px -20px; }
  80% { background-position: 50px 40px; } 100% { background-position: 0 0; }
}
.vignette {
  position: fixed; inset: 0; z-index: 89; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 45%, rgba(0,0,0,.55) 100%);
}

/* Nebbia */
.fog { position: absolute; inset: auto 0 0 0; height: 55%; pointer-events: none; opacity: .5; overflow: hidden; }
.fog::before, .fog::after {
  content: ''; position: absolute; inset: 0 -20%;
  background:
    radial-gradient(40% 60% at 20% 70%, rgba(190,180,210,.18), transparent 70%),
    radial-gradient(35% 50% at 60% 80%, rgba(190,180,210,.14), transparent 70%),
    radial-gradient(30% 45% at 90% 65%, rgba(190,180,210,.16), transparent 70%);
  animation: drift 38s linear infinite alternate;
}
.fog::after { animation-duration: 55s; animation-direction: alternate-reverse; transform: scaleX(-1); opacity: .7; }
@keyframes drift { from { translate: -8% 0; } to { translate: 8% 0; } }

/* Nastro della scena del crimine */
.tape {
  position: absolute; left: -10%; width: 120%; height: 46px; z-index: 5;
  background: linear-gradient(180deg, #e9c43a, #d8ad1f);
  color: #111; overflow: hidden; display: flex; align-items: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.35), inset 0 -1px 0 rgba(0,0,0,.25);
  font-family: var(--f-sans); font-weight: 800; letter-spacing: .2em; font-size: 14px;
  text-transform: uppercase; white-space: nowrap; pointer-events: none;
}
.tape > span { display: inline-block; padding-right: 0; animation: tape 40s linear infinite; }
.tape.rev > span { animation-direction: reverse; }
@keyframes tape { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* Pulsanti */
.btn {
  --bg: var(--blood);
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  padding: .95em 1.7em; border: 0; border-radius: 2px; cursor: pointer;
  background: var(--bg); color: var(--chalk);
  font-family: var(--f-sans); font-size: 14px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 12px 28px -10px rgba(140,28,34,.8);
  transition: transform .25s var(--ease-out), background .25s, box-shadow .25s;
  text-decoration: none;
}
.btn:hover { background: var(--blood-2); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.btn.ghost { background: transparent; color: currentColor; box-shadow: inset 0 0 0 1px currentColor; }
.btn.ghost:hover { background: rgba(255,255,255,.06); }

/* Effetto macchina da scrivere */
.type { font-family: var(--f-type); letter-spacing: .02em; }

/* Toast degli easter egg */
.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 200; translate: -50% calc(100% + 120px);
  max-width: min(92vw, 520px); padding: 14px 20px 14px 18px;
  background: rgba(16,14,21,.92); backdrop-filter: blur(10px);
  border: 1px solid rgba(200,163,90,.35); border-left: 3px solid var(--blood-2);
  color: var(--chalk); font-family: var(--f-sans); font-size: 14.5px; line-height: 1.45; width: max-content;
  box-shadow: 0 20px 50px rgba(0,0,0,.6);
  transition: translate .6s var(--ease-out);
}
.toast.show { translate: -50% 0; }
.toast b { color: var(--gold-2); font-weight: normal; }

@media (max-width: 420px) {
  .btn { letter-spacing: .14em; font-size: 13px; padding: 1em 1.2em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

[tabindex="-1"]:focus { outline: none; }
