/* =============================================================
   RETRO C64 / ATARI DEMO WEBSITE - STYLES
   ============================================================= */

/* --- CSS Custom Properties (C64 Palette) --- */
:root {
  --c64-black: #000000;
  --c64-white: #ffffff;
  --c64-red: #9f4e44;
  --c64-cyan: #6abfc6;
  --c64-purple: #a057a3;
  --c64-green: #5cab5e;
  --c64-blue: #50459b;
  --c64-yellow: #c9d487;
  --c64-orange: #a1683c;
  --c64-brown: #6d5412;
  --c64-light-red: #cb7e75;
  --c64-dark-grey: #626262;
  --c64-grey: #898989;
  --c64-light-green: #9ae29b;
  --c64-light-blue: #6c5eb5;
  --c64-light-grey: #b8b8b8;

  --bg-deep: #0a0a2e;
  --bg-dark: #0c0c3a;
  --text-primary: #6abfc6;
  --text-bright: #ffffff;
  --text-dim: #50459b;
  --glow-color: rgba(106, 191, 198, 0.6);
  --glow-strong: rgba(106, 191, 198, 0.9);

  --font-main: 'Press Start 2P', monospace;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  overflow-x: hidden;
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  font-family: var(--font-main);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.8;
  position: relative;
}

/* --- Background Canvas (Raster Bars) --- */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 1;
  transition: opacity 1.5s ease-out;
}

#bg-canvas.fade-out {
  opacity: 0;
}

/* --- Scanline Overlay --- */
#scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
}

/* Subtle flicker animation */
#scanlines::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 46, 0.03);
  animation: flicker 0.15s infinite alternate;
  pointer-events: none;
}

@keyframes flicker {
  0% { opacity: 0.02; }
  100% { opacity: 0.05; }
}

/* CRT screen turn-on animation (plays once on load) */
body {
  animation: crtOn 0.6s ease-out;
}

@keyframes crtOn {
  0% {
    filter: brightness(0);
  }
  10% {
    filter: brightness(0);
  }
  11% {
    filter: brightness(4) saturate(0);
  }
  20% {
    filter: brightness(1.5) saturate(0.5);
  }
  50% {
    filter: brightness(1.1) saturate(0.8);
  }
  100% {
    filter: brightness(1) saturate(1);
  }
}

/* --- Vignette Overlay --- */
#vignette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgba(0, 0, 0, 0.5) 100%
  );
}

/* --- CRT Screen Container --- */
#crt-screen {
  position: relative;
  z-index: 10;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 30px 120px;
  min-height: 100vh;
}

/* --- Boot Screen --- */
#boot-screen {
  padding-top: 60px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

#boot-hint {
  font-size: 0.45rem;
  color: var(--c64-dark-grey);
  margin-top: 20px;
  animation: blink 1.5s step-end infinite;
}

#boot-text {
  white-space: pre-wrap;
  font-size: 0.75rem;
  line-height: 2;
  color: var(--c64-light-blue);
  text-shadow: 0 0 8px var(--glow-color);
}

#cursor {
  display: inline-block;
  color: var(--c64-light-blue);
  font-size: 0.75rem;
  animation: blink 0.5s step-end infinite;
  text-shadow: 0 0 8px var(--glow-color);
}

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

/* --- Hidden state --- */
.hidden {
  display: none !important;
}

/* --- Main Content --- */
#main-content {
  animation: fadeInCRT 0.8s ease-out;
}

@keyframes fadeInCRT {
  0% {
    opacity: 0;
    filter: brightness(3) blur(2px);
  }
  30% {
    opacity: 1;
    filter: brightness(1.5) blur(0px);
  }
  100% {
    opacity: 1;
    filter: brightness(1) blur(0px);
  }
}

/* --- Hero Section --- */
#hero {
  text-align: center;
  padding: 60px 0 40px;
}

.hero-title-wrap {
  overflow: hidden;
  padding: 10px 0;
}

#hero-title {
  font-size: 1.6rem;
  letter-spacing: 4px;
  color: var(--text-bright);
  text-shadow:
    0 0 10px var(--glow-strong),
    0 0 20px var(--glow-color),
    0 0 40px rgba(106, 191, 198, 0.3);
  margin-bottom: 16px;
  line-height: 1.4;
}

.tagline {
  font-size: 0.65rem;
  color: var(--c64-yellow);
  letter-spacing: 2px;
  margin-bottom: 20px;
  text-shadow: 0 0 6px rgba(201, 212, 135, 0.5);
}

.separator {
  font-size: 0.3rem;
  color: var(--c64-blue);
  letter-spacing: -1px;
  line-height: 1;
  margin: 16px 0;
  overflow: hidden;
  user-select: none;
  background: linear-gradient(
    90deg,
    var(--c64-blue) 0%,
    var(--c64-cyan) 50%,
    var(--c64-blue) 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: separatorSweep 3s ease-in-out infinite;
}

@keyframes separatorSweep {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 0%; }
}

.subtitle {
  font-size: 0.6rem;
  line-height: 2.2;
  color: var(--text-primary);
  max-width: 600px;
  margin: 0 auto;
  text-shadow: 0 0 4px var(--glow-color);
}

/* --- Section Titles --- */
.section-title {
  font-size: 1rem;
  text-align: center;
  margin-bottom: 30px;
  letter-spacing: 3px;
  color: var(--text-bright);
  text-shadow:
    0 0 10px var(--glow-strong),
    0 0 20px var(--glow-color);
}

/* --- Skills Section --- */
#skills {
  padding: 40px 0;
}

.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.skill-item {
  background: rgba(10, 10, 46, 0.6);
  border: 1px solid var(--c64-blue);
  padding: 16px;
  transition: all 0.2s;
  position: relative;
}

.skill-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    180deg,
    rgba(106, 191, 198, 0.05) 0%,
    transparent 100%
  );
  pointer-events: none;
}

.skill-item:hover {
  border-color: var(--c64-cyan);
  box-shadow:
    0 0 10px rgba(106, 191, 198, 0.2),
    inset 0 0 10px rgba(106, 191, 198, 0.05);
}

.skill-icon {
  display: block;
  font-size: 0.7rem;
  color: var(--c64-yellow);
  margin-bottom: 8px;
  text-shadow: 0 0 4px rgba(201, 212, 135, 0.4);
}

.skill-name {
  display: block;
  font-size: 0.6rem;
  color: var(--text-bright);
  margin-bottom: 10px;
  text-shadow: 0 0 6px var(--glow-color);
}

.skill-desc {
  display: block;
  font-size: 0.5rem;
  color: var(--c64-light-blue);
  line-height: 2;
  opacity: 0.8;
}

/* --- Links Section --- */
#links {
  padding: 40px 0;
}

.link-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 400px;
  margin: 0 auto;
}

.link-item {
  display: block;
  font-size: 0.7rem;
  padding: 10px 16px;
  color: var(--text-primary);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.15s;
  position: relative;
  text-shadow: 0 0 4px var(--glow-color);
}

.link-item:hover {
  color: var(--c64-yellow);
  background: rgba(80, 69, 155, 0.3);
  border-color: var(--c64-blue);
  text-shadow: 0 0 8px rgba(201, 212, 135, 0.5);
}

.link-item:hover .link-key {
  color: var(--text-bright);
}

/* Highlight bar effect on hover */
.link-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(106, 191, 198, 0.15) 0%,
    transparent 100%
  );
  transition: width 0.2s;
}

.link-item:hover::before {
  width: 100%;
}

.link-key {
  color: var(--c64-green);
  margin-right: 12px;
  text-shadow: 0 0 4px rgba(92, 171, 94, 0.4);
}

/* --- Footer --- */
#footer {
  padding: 40px 0 20px;
  text-align: center;
}

#footer p {
  font-size: 0.5rem;
  color: var(--c64-dark-grey);
  text-shadow: none;
}

/* --- Sine Wave Scroller Canvas --- */
#scroller-canvas {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60px;
  z-index: 50;
  pointer-events: none;
}

/* --- Color Cycle Animation (applied via JS) --- */
.color-cycle {
  /* Base state - JS will manipulate the color */
}

/* --- Keyboard navigation focus styles --- */
.link-item:focus {
  outline: 2px solid var(--c64-cyan);
  outline-offset: 2px;
  color: var(--c64-yellow);
  background: rgba(80, 69, 155, 0.3);
}

/* --- Responsive --- */
@media (max-width: 600px) {
  html {
    font-size: 12px;
  }

  #crt-screen {
    padding: 20px 16px 120px;
  }

  #hero-title {
    font-size: 1.1rem;
    letter-spacing: 2px;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }

  .subtitle {
    font-size: 0.55rem;
  }

  #boot-screen {
    padding-top: 30px;
  }

  .separator {
    font-size: 0.25rem;
  }
}

@media (max-width: 400px) {
  #hero-title {
    font-size: 0.9rem;
  }

  .tagline {
    font-size: 0.5rem;
  }
}
