/* ==========================================================================
   Retro Visual Effects — Windows 95 Themed + Arcade Accents
   Loaded after win95.css
   ========================================================================== */

/* Google Font for retro terminal text */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

/* --------------------------------------------------------------------------
   1. CRT Scanlines Overlay (Enhanced with phosphor effect)
   -------------------------------------------------------------------------- */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
              linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 2px, 3px 100%;
  opacity: 0.3;
  pointer-events: none;
  z-index: 99990;
  animation: scanline-shift 8s linear infinite;
}

@keyframes scanline-shift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(2px); }
}

/* --------------------------------------------------------------------------
   2. Screen Vignette (with CRT tube depth)
   -------------------------------------------------------------------------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: none;
  pointer-events: none;
  z-index: 99989;
}

/* --------------------------------------------------------------------------
   3. Subtle Screen Flicker
   -------------------------------------------------------------------------- */
@keyframes crt-flicker {
  0%,
  97%,
  100% {
    opacity: 1;
  }
  97.5% {
    opacity: 0.97;
  }
  98% {
    opacity: 1;
  }
  98.5% {
    opacity: 0.98;
  }
}

body {
  animation: crt-flicker 8s infinite;
}

/* --------------------------------------------------------------------------
   4. Blinking "NEW!" Badge
   -------------------------------------------------------------------------- */
.retro-new {
  color: #ff2a6d;
  font-size: 9px;
  font-weight: bold;
  animation: blink-new-neon 1.2s ease-in-out infinite;
  text-shadow:
    0 0 4px rgba(255, 42, 109, 0.8),
    0 0 2px rgba(255, 42, 109, 1);
}

@keyframes blink-new-neon {
  0%, 49%, 100% {
    opacity: 1;
    text-shadow:
      0 0 4px rgba(255, 42, 109, 0.8),
      0 0 2px rgba(255, 42, 109, 1);
  }
  50%, 99% {
    opacity: 0.3;
    text-shadow: 0 0 2px rgba(255, 42, 109, 0.4);
  }
}

/* --------------------------------------------------------------------------
   5. Hit Counter
   -------------------------------------------------------------------------- */
.hit-counter {
  position: fixed;
  bottom: calc(32px + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: #c0c0c0;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  padding: 4px 12px;
  font-family: "Courier New", monospace;
  font-size: 11px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hit-counter__digits {
  background: #000000;
  color: var(--neon-cyan, #05d9e8);
  padding: 2px 6px;
  font-family: 'VT323', "Courier New", monospace;
  font-size: 14px;
  letter-spacing: 2px;
  border: 1px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  text-shadow: 0 0 8px rgba(5, 217, 232, 0.8), 0 0 16px rgba(5, 217, 232, 0.4);
}

/* --------------------------------------------------------------------------
   6. Marquee Scrolling Text
   -------------------------------------------------------------------------- */
.retro-marquee {
  overflow: hidden;
  white-space: nowrap;
  max-width: 200px;
}

.retro-marquee span {
  display: inline-block;
  animation: marquee-scroll 20s linear infinite;
  color: var(--neon-cyan, #05d9e8);
  text-shadow: 0 0 6px rgba(5, 217, 232, 0.6);
  font-family: 'Press Start 2P', 'VT323', monospace;
  font-size: 9px;
}

@keyframes marquee-scroll {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(-100%);
  }
}

/* --------------------------------------------------------------------------
   7. Pixel-Art Progress Bars
   -------------------------------------------------------------------------- */
.pixel-progress {
  height: 12px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  box-shadow: inset 1px 1px 0 #000000;
}

.pixel-progress__fill {
  height: 100%;
  background: #000080;
  image-rendering: pixelated;
}

/* --------------------------------------------------------------------------
   8. Under Construction Banner
   -------------------------------------------------------------------------- */
.under-construction {
  background: repeating-linear-gradient(
    45deg,
    #ffd700,
    #ffd700 10px,
    #000 10px,
    #000 20px
  );
  color: #fff;
  font-weight: bold;
  text-align: center;
  padding: 4px 8px;
  font-size: 10px;
  text-shadow: 1px 1px 0 #000;
  margin: 8px 0;
}

/* --------------------------------------------------------------------------
   9. Boot Screen
   -------------------------------------------------------------------------- */
.boot-screen {
  position: fixed;
  inset: 0;
  background: #000;
  color: #33ff33;
  font-family: 'Press Start 2P', 'VT323', "Courier New", monospace;
  z-index: 999999;
  padding: 40px;
  overflow: hidden;
  font-size: 14px;
  line-height: 2;
  text-shadow: 0 0 10px rgba(51, 255, 51, 0.8), 0 0 20px rgba(51, 255, 51, 0.4), 0 0 40px rgba(51, 255, 51, 0.2);
}

.boot-screen.hidden {
  display: none;
}

.boot-screen__cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: #33ff33;
  animation: blink-cursor 1s step-end infinite;
}

@keyframes blink-cursor {
  50% {
    opacity: 0;
  }
}

.boot-screen__progress {
  margin-top: 20px;
  width: 300px;
  height: 16px;
  border: 1px solid #33ff33;
  box-shadow: 0 0 6px rgba(51, 255, 51, 0.3);
}

.boot-screen__progress-fill {
  height: 100%;
  background: #33ff33;
  width: 0%;
  transition: width 0.3s linear;
}

/* --------------------------------------------------------------------------
   10. BSOD Screen
   -------------------------------------------------------------------------- */
.bsod-screen {
  position: fixed;
  inset: 0;
  background: #0000aa;
  color: #ffffff;
  font-family: 'VT323', "Courier New", monospace;
  z-index: 999999;
  display: none;
  padding: 10% 15%;
  text-align: center;
  font-size: 16px;
  line-height: 1.8;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.5), 0 0 16px rgba(255, 255, 255, 0.2);
}

.bsod-screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.bsod-screen__title {
  background: #aaaaaa;
  color: #0000aa;
  padding: 2px 8px;
  font-weight: bold;
  margin-bottom: 16px;
}

/* --------------------------------------------------------------------------
   11. Clippy Helper
   -------------------------------------------------------------------------- */
.clippy {
  position: fixed;
  bottom: 50px;
  right: 20px;
  background: #ffffcc;
  border: 2px solid #000;
  padding: 12px;
  box-shadow: 2px 2px 0 #000;
  font-size: 11px;
  font-family: "MS Sans Serif", Tahoma, Arial, sans-serif;
  z-index: 9990;
  display: none;
  max-width: 220px;
}

.clippy.active {
  display: block;
}

.clippy__character {
  font-size: 28px;
  margin-bottom: 4px;
}

.clippy__text {
  margin-bottom: 8px;
  line-height: 1.4;
}

.clippy__dismiss {
  background: #c0c0c0;
  border: 2px solid;
  border-color: #ffffff #000000 #000000 #ffffff;
  padding: 2px 12px;
  font-size: 10px;
  cursor: pointer;
  font-family: inherit;
}

/* --------------------------------------------------------------------------
   12. Desktop Context Menu (Right-Click)
   -------------------------------------------------------------------------- */
.desktop-context-menu {
  position: fixed;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #ffffff #000000 #000000 #ffffff;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 9997;
  min-width: 160px;
  padding: 2px;
  display: none;
}

.desktop-context-menu.active {
  display: block;
}

.desktop-context-menu__item {
  display: block;
  width: 100%;
  padding: 4px 24px 4px 8px;
  font-size: 11px;
  font-family: "MS Sans Serif", Tahoma, Arial, sans-serif;
  cursor: pointer;
  background: transparent;
  border: none;
  text-align: left;
}

.desktop-context-menu__item:hover {
  background: #000080;
  color: #ffffff;
  text-shadow: 0 0 4px rgba(5, 217, 232, 0.3);
}

.desktop-context-menu__divider {
  height: 1px;
  margin: 2px 4px;
  background: #808080;
  border-bottom: 1px solid #ffffff;
}

/* --------------------------------------------------------------------------
   13. Guestbook (Win95 Styled Form)
   -------------------------------------------------------------------------- */
.guestbook {
  margin-top: 16px;
  padding: 12px;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  background: #ffffff;
}

.guestbook__title {
  font-weight: bold;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.guestbook__field {
  margin-bottom: 8px;
}

.guestbook__field label {
  display: block;
  font-size: 11px;
  margin-bottom: 2px;
}

.guestbook__field input,
.guestbook__field textarea {
  width: 100%;
  background: #ffffff;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  box-shadow: inset 1px 1px 0 #000;
  padding: 4px 6px;
  font-size: 11px;
  font-family: "MS Sans Serif", Tahoma, Arial, sans-serif;
}

.guestbook__field textarea {
  height: 60px;
  resize: vertical;
}

/* --------------------------------------------------------------------------
   14. Accessibility — Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  body::after,
  body::before {
    display: none;
  }

  body {
    animation: none;
  }

  .retro-new,
  .retro-marquee span,
  .boot-screen__cursor {
    animation: none;
  }

  .window {
    animation: none;
  }

  .desktop-icon {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   16. High Contrast Overrides
   -------------------------------------------------------------------------- */
@media (forced-colors: active) {
  .boot-screen,
  .bsod-screen,
  .hit-counter__digits {
    text-shadow: none;
  }

  .window.active .window__titlebar,
  .taskbar__window-btn.active,
  .win95-btn:hover,
  .window__btn:hover {
    box-shadow: none;
  }
}

/* --------------------------------------------------------------------------
   15. Mobile Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .hit-counter {
    bottom: calc(40px + 80px + 8px);
    font-size: 10px;
  }

  .retro-marquee {
    max-width: 100px;
  }

  .clippy {
    bottom: 130px;
    right: 10px;
    max-width: 180px;
  }
}
