:root {
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #000;
  color: #fff;
  overflow: hidden;
  cursor: none;
  font-family: 'VT323', monospace;
}

#stage {
  display: block;
  width: 100vw;
  height: 100vh;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#hud {
  position: fixed;
  top: 10px;
  left: 14px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: #ffe066;
  text-shadow: 0 0 6px #ff6600, 1px 1px 0 #000;
  display: flex;
  gap: 14px;
  opacity: 0.75;
  pointer-events: none;
  z-index: 10;
}

/* Syndis logo watermark, top-right. Z-index sits below the startgate
   so it's hidden during the C64 boot, then visible on every slide. */
#watermark {
  position: fixed;
  top: 18px;
  right: 18px;
  width: clamp(60px, 8vw, 110px);
  height: auto;
  opacity: 0.7;
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.7));
  transition: opacity 800ms ease-out;
}
#watermark.hidden-logo {
  opacity: 0;
}

#hud.hidden { display: none; }

/* Slide-number badge, bottom-left. A working aid for perfecting slides;
   press N to hide it for the real talk. Sits below the startgate (z-index 20)
   so it stays hidden during the C64 boot. */
#slideno {
  position: fixed;
  bottom: 14px;
  right: 16px;
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  color: #ffe066;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 224, 102, 0.35);
  border-radius: 6px;
  padding: 7px 10px;
  letter-spacing: 0.06em;
  text-shadow: 0 0 8px #ff6600, 1px 1px 0 #000;
  opacity: 0.85;
  pointer-events: none;
  z-index: 6;
}
#slideno.hidden { display: none; }

/* --- C64 boot screen --- */
#startgate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;               /* black "letterbox" surround */
  z-index: 20;
  transition: opacity 700ms ease-out;
  padding: 0;
}

#startgate.gone {
  opacity: 0;
  pointer-events: none;
}

.c64 {
  /* Classic 4:3 CRT screen, centered in the widescreen viewport.
     Width clamps so the box stays inside both 90vw and 90vh. */
  box-sizing: border-box;
  aspect-ratio: 4 / 3;
  width: min(90vw, calc(90vh * 4 / 3));

  background: #2e2c9b;            /* C64 dark blue interior */
  border: clamp(16px, 3.5vw, 48px) solid #706deb; /* C64 light blue bezel */

  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: clamp(20px, 3.5vw, 48px);

  box-shadow: 0 0 64px rgba(112, 109, 235, 0.4);
  position: relative;
  overflow: hidden;
}

.c64::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.15) 3px
  );
  mix-blend-mode: multiply;
}

/* a soft bright band rolling down the screen — live CRT feel */
.c64::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 22%;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(to bottom,
    rgba(176,176,255,0), rgba(176,176,255,0.10), rgba(176,176,255,0));
  animation: c64roll 7s linear infinite;
}

.c64-screen {
  margin: 0;
  font-family: 'VT323', 'Courier New', monospace;
  font-size: clamp(14px, 2.1vw, 26px);
  line-height: 1.25;
  color: #b0b0ff;                 /* C64 light blue text on dark blue */
  letter-spacing: 0.04em;
  white-space: pre;
  text-shadow: 0 0 2px rgba(176, 176, 255, 0.6);
  /* Size to the longest line (the "64K RAM..." banner) and center the
     whole block horizontally. That makes the C64-authentic leading
     spaces inside each line produce the right visual centering. */
  width: max-content;
  align-self: center;
}

.c64-cursor {
  display: inline-block;
  background: #b0b0ff;
  color: #2e2c9b;
  width: 0.55em;
  animation: c64blink 0.7s steps(2, end) infinite;
}

.c64-press {
  margin-top: auto;               /* push the prompt to the bottom of the screen */
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(12px, 1.4vw, 18px);
  color: #ffe066;
  text-align: center;
  text-shadow: 0 0 8px #ff6600;
  animation: blink 1s steps(2) infinite;
  letter-spacing: 0.08em;
}

/* When the user presses the key, flash the C64 frame & background like
   a real C64 loader. The surrounding letterbox stays black. */
#startgate.loading .c64 {
  animation: c64load-frame 0.08s steps(2) 18; /* ~1.4s of mayhem */
}
#startgate.loading .c64-press {
  visibility: hidden;
}

@keyframes c64blink {
  50% { background: transparent; color: #b0b0ff; }
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0.35; }
}

@keyframes c64load-frame {
  0%   { background: #2e2c9b; border-color: #706deb; }
  20%  { background: #56ac4d; border-color: #c46c71; }
  40%  { background: #813338; border-color: #75cec8; }
  60%  { background: #edf171; border-color: #6ab04c; }
  80%  { background: #b03a48; border-color: #edf171; }
  100% { background: #2e2c9b; border-color: #706deb; }
}

@keyframes c64roll {
  from { transform: translateY(-100%); }
  to   { transform: translateY(460%); }
}

/* on keypress: the screen fills with fast-scrolling C64 tape-loader stripes */
#startgate.loading .c64::before {
  height: 100%;
  opacity: 0.55;
  background: repeating-linear-gradient(
    to bottom,
    #56ac4d 0 8px, #c46c71 8px 16px, #75cec8 16px 24px,
    #edf171 24px 32px, #706deb 32px 40px);
  animation: c64stripes 0.14s linear infinite;
}
@keyframes c64stripes {
  from { background-position: 0 0; }
  to   { background-position: 0 40px; }
}

/* =============================================================
   STANDALONE ADDITIONS
   The CSP on ethicalhacker.se is font-src 'self' — no Google Fonts.
   Same two faces, served from our own assets/fonts/.
   ============================================================= */
@font-face {
  font-family: 'Press Start 2P';
  src: url('assets/fonts/pressstart-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: block;
}
@font-face {
  font-family: 'VT323';
  src: url('assets/fonts/vt323-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: block;
}

/* Lyrics + download links. They sit on the C64 boot screen, duck out through
   the AS/400 hack and the memorial, and fade back in with the spectacle. */
#dl {
  position: fixed;
  left: 0; right: 0;
  bottom: 18px;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  padding: 0 16px;
  transition: opacity 800ms ease-out;
}
#dl a {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(9px, 1.1vw, 12px);
  line-height: 1.6;
  color: #2bff66;
  text-decoration: none;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(43, 255, 102, 0.45);
  border-radius: 5px;
  padding: 9px 13px;
  letter-spacing: 0.05em;
  text-shadow: 0 0 8px rgba(43, 255, 102, 0.6);
  cursor: pointer;
  transition: color 120ms, background 120ms, border-color 120ms;
}
#dl a:hover, #dl a:focus-visible {
  color: #000;
  background: #2bff66;
  border-color: #2bff66;
  outline: none;
}
#dl.hidden-logo { opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  #dl, #watermark, #startgate { transition: none; }
  .c64-press, .c64-cursor, .c64::before { animation: none; }
}
