@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:wght@700&display=swap');

body {
  background-color: black;
  height: 100vh;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  font-family: 'Courier Prime', monospace;
}

.tv-container {
  position: relative;
  width: 95vw;
  max-width: 1400px;
  aspect-ratio: 16 / 9;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Container brightness animation */
.tv-container.tv-on-animation::before {
  animation: 
    tvBrightness 0.8s ease-out forwards,
    static-flicker 0.15s steps(4) infinite;
}

@keyframes tvBrightness {
  0%   { filter: brightness(5); }
  50%  { filter: brightness(3); }
  100% { filter: brightness(1); }
}

.tv-frame {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-image: url('ibm.png');
  background-size: contain;
  background-position: center center;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 10; /* Highest */
}

.tv-screen {
  width: 35%;
  height: 46%;
  background: #000;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  z-index: 1;
  overflow: hidden;
  margin-top: -23%;
  margin-left: 0%;
  transform: scaleY(0) scaleX(0);
  visibility: hidden;
  padding: 25px;
  box-sizing: border-box;
}

/* Static overlay — SCREEN ONLY */
.tv-screen::before {
  content: '';
  position: absolute;
  inset: -50%;
  opacity: 0.15;
  z-index: 2;
  pointer-events: none;
  background-image: repeating-radial-gradient(
    circle at 50% 50%,
    #fff,
    #000 0.00085px
  );
  background-size: 100px 100px;
  animation: static-flicker 0.15s steps(4) infinite;
}

/* Scanlines — SCREEN ONLY (updated for authenticity) */
.tv-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  /* Thicker, more prominent scanlines for CRT */
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 1px,
      rgba(0, 0, 0, 0.10) 1px,
      rgba(0, 0, 0, 0.10) 2px,
      transparent 4px
    );
  background-size: 100% 5px;
  opacity: 0.7;
}

.tv-screen.tv-on {
  visibility: visible;
  animation: tvOn 0.8s ease-out forwards;
}

@keyframes tvOn {
  0%   { transform: scaleY(0.005) scaleX(0); }
  50%  { transform: scaleY(0.005) scaleX(1); }
  100% { transform: scaleY(1) scaleX(1); }
}

@keyframes static-flicker {
  0% { transform: translate(0,0); }
  25% { transform: translate(-1%, 2%); }
  50% { transform: translate(-2%, -1%); }
  75% { transform: translate(1%, -2%); }
  100% { transform: translate(0,0); }
}

.boot-screen {
  /* Font and text styling */
  font-family: 'Courier Prime', monospace;
  color: #ffffff;
  font-size: clamp(0.2rem, 0.9vw, 1rem);
  line-height: 1.2;
  text-shadow: none;
  
  /* Box sizing and background */
  background-color: #000000;
  box-sizing: border-box;
  
  /* Size - EASY TO ADJUST */
  width: 95%;    /* Adjust this value (80%, 70%, etc.) */
  height: 95%;   /* Adjust this value (80%, 70%, etc.) */
  
  /* Positioning - EASY TO ADJUST */
  position: absolute;
  top: 5%;       /* Distance from top of screen */
  left: 5%;      /* Distance from left of screen */
  
  /* Overflow and visibility */
  overflow: hidden;
  opacity: 0;
  
  /* Z-index layering */
  z-index: 3; /* Between static (z:2) and scanlines (z:6) */
}

.boot-line {
  margin-bottom: 2px;
  white-space: pre;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.boot-line.visible { opacity: 1; }

.boot-lines-wrapper {
  display: flex;
  flex-direction: column;
  transition: transform 0.3s linear;
  /* Add padding to move text away from edges */
  padding: 20px;
}

.boot-cursor {
  display: inline-block;
  background-color: #ffffff;
  width: 8px;
  height: 16px;
  animation: blink 1s infinite;
  margin-left: 2px;
  vertical-align: middle;
  opacity: 0;
  z-index: 1; /* Above scanlines */
  position: relative;
}

.boot-cursor.visible { opacity: 1; }

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

.boot-complete {
  display: none;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 3; /* BELOW CRT overlay (4) */
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.tv-screen.booted .boot-screen { display: none; }
.tv-screen.booted .boot-complete { display: flex; }

nav {
  z-index: 3; /* BELOW CRT overlay (4) */
  position: relative;
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 3; /* BELOW CRT overlay (4) */
  position: relative;
}

nav li { margin: -3px; }

nav a {
  background-color: #1a1a1a;
  color: white;
  text-decoration: none;
  font-family: 'Courier Prime', monospace;
  font-size: clamp(0.5rem, 1vw, 10rem);
  padding: 0vw 1vw;
  border-left: 0.4vw solid #0072bc;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.5);
  transition: all 0.2s;
  text-transform: uppercase;
  display: inline-block;
  white-space: nowrap;
}

nav a:hover {
  background-color: #e0e0e0;
  color: black;
  transform: scale(1.05) rotate(-1deg);
}

footer {
  position: absolute;
  bottom: 10px;
  color: #444;
  font-family: sans-serif;
  font-size: 0.7rem;
  z-index: 11;
}

/* -----------------------------
   Authentic Tandy/IBM Color Monitor CRT Effect - OPTION 1
   ----------------------------- */
.crt-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4; /* above boot text, below tv-frame */
  /* Curvature effect */
  border-radius: 2% 2% 1% 1% / 3% 3% 1% 1%;
  overflow: hidden;
}

/* Phosphor glow (color bleed) */
.crt-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    /* Green phosphor glow */
    radial-gradient(
      circle at 30% 20%,
      rgba(0, 255, 0, 0.03) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 70% 80%,
      rgba(0, 255, 0, 0.02) 0%,
      transparent 50%
    ),
    /* Red phosphor glow */
    radial-gradient(
      circle at 20% 70%,
      rgba(255, 0, 0, 0.02) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 30%,
      rgba(255, 0, 0, 0.03) 0%,
      transparent 50%
    ),
    /* Blue phosphor glow */
    radial-gradient(
      circle at 50% 50%,
      rgba(0, 0, 255, 0.01) 0%,
      transparent 50%
    );
  z-index: 1;
  animation: phosphorPulse 8s infinite alternate;
}

/* Scanlines with color convergence issues */
.crt-overlay::after {
  content: '';
  position: absolute;
  inset: -10%;
  background: 
    /* Horizontal scanlines (thicker for CGA/EGA) */
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 1px,
      rgba(0, 0, 0, 0.4) 2px,
      rgba(0, 0, 0, 0.4) 3px,
      transparent 4px
    ),
    /* Vertical color misalignment (convergence issues) */
    repeating-linear-gradient(
      90deg,
      rgba(255, 0, 0, 0.05) 0px,
      rgba(255, 0, 0, 0.05) 1px,
      transparent 2px,
      transparent 3px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(0, 255, 0, 0.05) 1px,
      rgba(0, 255, 0, 0.05) 2px,
      transparent 3px,
      transparent 4px
    ),
    /* Subtle vignette */
    radial-gradient(
      ellipse at center,
      transparent 30%,
      rgba(0, 0, 0, 0.5) 100%
    );
  background-size: 
    100% 5px, /* Scanlines */
    4px 100%, /* Red misalignment */
    4px 100%, /* Green misalignment */
    100% 100%; /* Vignette */
  z-index: 2;
  opacity: 0.7;
  animation: convergenceDrift 15s infinite alternate ease-in-out;
}

/* Static noise (more subtle than before) */
.static-noise {
  position: absolute;
  inset: 0;
  background-image: 
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.02) 0px,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 2px,
      transparent 3px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.01) 0px,
      rgba(255, 255, 255, 0.01) 1px,
      transparent 2px,
      transparent 3px
    );
  z-index: 3;
  opacity: 0.15;
  animation: staticFlicker 0.2s steps(2) infinite;
}

/* Animations for CRT effects */
@keyframes phosphorPulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

@keyframes convergenceDrift {
  0% { 
    background-position: 
      0px 0px,
      0px 0px,
      1px 0px,
      0px 0px;
  }
  100% { 
    background-position: 
      0px 0px,
      2px 0px,
      -1px 0px,
      0px 0px;
  }
}

@keyframes staticFlicker {
  0% { opacity: 0.1; }
  50% { opacity: 0.15; }
  100% { opacity: 0.1; }
}

.fhv-logo {
  width: 50%;
  display: block;
  margin: 0 auto -5px auto;
  position: relative;
  top: -5%;
  z-index: 3;
}

