/* ===============================
   INFOSTRA – Retro CRT Theme
   Style.css (full rebuild)
   =============================== */

/* ---------- Variabili tema ---------- */
:root {
  --green: #00FF00;
  --green-dim: #00cc00;
  --bg: #000000;
  --maxw: 1000px;
}

/* ---------- Reset di base ---------- */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
}

/* ---------- Sfondo CRT su TUTTA la pagina ---------- */
body {
  background: var(--bg);
  color: var(--green);
  font-family: 'Press Start 2P', monospace;
  text-align: center;
  min-height: 100vh;
  position: relative;
  line-height: 1.6;
}

/* Strati fissi: scanlines + grana + glow/vignettatura */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* Scanlines (tile) */
body::before {
  background: url("img/scanlines_tile.png") top left / auto repeat;
  opacity: .5;
  mix-blend-mode: screen;
}

/* Grana + alone verde ai bordi (CRT glow) + vignettatura */
body::after {
  background:
    /* alone verde morbido dal centro */
    radial-gradient(ellipse at center,
      rgba(0, 255, 0, 0.10) 0%,
      rgba(0, 255, 0, 0.05) 40%,
      rgba(0, 255, 0, 0.00) 70%),
    /* vignettatura leggera ai bordi */
    radial-gradient(ellipse at center,
      rgba(0, 0, 0, 0.00) 60%,
      rgba(0, 0, 0, 0.30) 100%),
    /* grana */
    url("img/noise.png");
  background-size:
    100% 100%,
    100% 100%,
    256px 256px;
  background-repeat: no-repeat, no-repeat, repeat;
  opacity: 0.35; /* regola l’intensità del mix */
}

/* Contenuti sopra gli overlay */
header, main, footer, .crt {
  position: relative;
  z-index: 1;
}

/* ---------- Layout contenuti ---------- */
.crt {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: start;
  padding: 28px 18px 36px;
}

header h1 {
  font-size: 26x;
  letter-spacing: 1px;
  margin: 0 0 10px 0;
  text-shadow: 0 0 6px var(--green-dim), 0 0 14px var(--green-dim);
}

main { max-width: var(--maxw); margin: 0 auto; }

/* ---------- Titolo/prompt DOS in alto ---------- */
.dos-prompt {
  text-align: left;
  max-width: 800px;
  margin: 14px auto 20px;
  color: var(--green);
  font-size: 16px;
  text-shadow: 0 0 6px var(--green-dim), 0 0 12px var(--green-dim);
}

/* ---------- Logo ---------- */
.logo {
  width: 230px;
  max-width: 60vw;
  display: block;
  margin: 22px auto 10px;
  image-rendering: pixelated; /* look retrò */
  filter: drop-shadow(0 0 6px var(--green-dim));
}

/* ---------- Testi ---------- */
h2, p, nav { margin: 20px 0; }
h2 { font-size: 20px; }
.services {
  opacity: .95;
  text-shadow: 0 0 6px var(--green-dim), 0 0 12px var(--green-dim);
}

/* ---------- Navbar ---------- */
.nav {
  margin: 22px auto;
}
.nav a {
  color: var(--green);
  text-decoration: none;
  margin: 0 12px;
  transition: filter .2s ease, opacity .2s ease, text-shadow .2s ease;
  text-shadow: 0 0 6px var(--green-dim), 0 0 12px var(--green-dim);
}
.nav a:hover,
.nav a.active {
  text-decoration: underline;
  filter: brightness(1.15);
}

/* ---------- Cursore lampeggiante ---------- */
.cursor {
  display: inline-block;
  margin-left: 6px;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ---------- Blocchi stile terminale ---------- */
pre {
  text-align: left;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: 800px;
  margin: 16px auto 24px;
  padding: 10px 12px;
  border-left: 2px solid var(--green);
  background: rgba(0, 255, 0, 0.02);
  text-shadow: 0 0 6px var(--green-dim);
}

/* ---------- Form contatti (DOS style) ---------- */
.contact-form {
  margin: 16px auto 28px;
}

.contact-form input,
.contact-form textarea,
.contact-form button {
  background: black;
  color: var(--green);
  border: 2px solid var(--green);
  font-family: 'Press Start 2P', monospace;
  width: 80%;
  max-width: 520px;
  padding: 10px 12px;
  text-align: left;
  box-shadow: 0 0 10px rgba(0,255,0,0.08) inset, 0 0 8px rgba(0,255,0,0.10);
}
.contact-form textarea { resize: vertical; }
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--green), 0 0 14px rgba(0,255,0,0.35);
}
.contact-form button {
  cursor: pointer;
  text-align: center;
}
.contact-form button:hover {
  background: var(--green);
  color: black;
}

/* ---------- Footer ---------- */
footer p {
  font-size: 12px;
  opacity: 0.95;
  text-shadow: 0 0 6px var(--green-dim), 0 0 12px var(--green-dim);
  margin: 24px 0 0;
}

/* ---------- Responsive soft ---------- */
@media (max-width: 640px) {
  header h1 { font-size: 14px; }
  h2 { font-size: 18px; }
  .dos-prompt { font-size: 14px; }
  .nav a { margin: 0 8px; }
  .logo { width: 200px; }
}

/* --- CRT jitter & flicker --- */
@keyframes crtJitter {
  0%   { transform: translate(0,0); filter: none; }
  50%  { transform: translate(0.5px, 0); filter: contrast(1.02) brightness(1.01); }
  100% { transform: translate(0,0); filter: none; }
}
@keyframes crtFlickerSoft {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.98; }
}

/* animazione di base (molto soft, continua) */
.crt {
  animation: crtFlickerSoft 7s linear infinite;
}

/* impulso breve quando il JS aggiunge la classe .jitter al body */
body.jitter .crt {
  animation: crtJitterY 80ms steps(1, end) 1;
}

/* --- Typewriter per il prompt --- */
/* il testo digitato sta in uno span che creiamo via JS: .tw */
.dos-prompt .tw {
  white-space: pre; /* rispetta gli spazi del prompt */
}

.access-denied {
  color: red;
  font-weight: bold;
  font-size: 18px;
  margin-top: 20px;
  animation: blinkRed 1s steps(2, start) infinite;
}

.access-granted {
  color: var(--green);
  font-weight: bold;
  font-size: 18px;
  margin-top: 20px;
  text-shadow: 0 0 6px var(--green-dim), 0 0 12px var(--green-dim);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blinkRed {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
