/* ============================================
   Mydnyte Studios — Main Stylesheet
   ============================================ */

/* --- Custom Properties --- */
:root {
  --black: #000000;
  --dark: #0a0a0f;
  --cyan: #00e5ff;
  --purple: #b000ff;
  --magenta: #ff00ff;
  --gradient: linear-gradient(135deg, var(--cyan), var(--purple));
  --text-primary: #e0e0e0;
  --text-dim: #999999;
  --font-pixel: 'Press Start 2P', monospace;
  --font-body: system-ui, -apple-system, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--black);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

/* --- Scanline Overlay --- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* --- Layout --- */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 100px 0;
}

/* --- Section Titles --- */
.section-title {
  font-family: var(--font-pixel);
  font-size: clamp(1rem, 3vw, 1.5rem);
  background: linear-gradient(135deg, var(--cyan) 0%, var(--purple) 50%, var(--magenta) 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
  margin-bottom: 40px;
  animation: gradientShift 6s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.3))
          drop-shadow(0 0 20px rgba(176, 0, 255, 0.15));
}

.section-text {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
  font-size: 1.05rem;
  color: var(--text-dim);
  line-height: 1.8;
}

/* --- Fade-in Animation (JS-driven) --- */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   HERO
   ============================================ */
#hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 40px 24px;
}

.hero-logo {
  width: clamp(180px, 35vw, 320px);
  margin: 0 auto 32px;
  animation: glowPulse 4s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 20px rgba(0, 229, 255, 0.3));
}

@keyframes glowPulse {
  0% {
    filter: drop-shadow(0 0 40px rgba(0, 229, 255, 0.9))
            drop-shadow(0 0 80px rgba(0, 229, 255, 0.6))
            drop-shadow(0 0 140px rgba(0, 229, 255, 0.3))
            drop-shadow(0 0 200px rgba(0, 229, 255, 0.15))
            drop-shadow(0 0 280px rgba(0, 229, 255, 0.05));
  }
  100% {
    filter: drop-shadow(0 0 40px rgba(176, 0, 255, 0.9))
            drop-shadow(0 0 80px rgba(255, 0, 255, 0.6))
            drop-shadow(0 0 140px rgba(176, 0, 255, 0.3))
            drop-shadow(0 0 200px rgba(255, 0, 255, 0.15))
            drop-shadow(0 0 280px rgba(255, 0, 255, 0.05));
  }
}

.hero-title {
  font-family: var(--font-pixel);
  font-size: clamp(1.2rem, 4.5vw, 2.8rem);
  line-height: 1.6;
  letter-spacing: 0.2em;
  word-spacing: 0;
  text-align: center;
}

.title-midnyte,
.title-studios {
  display: inline-block;
  position: relative;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--purple) 50%, var(--magenta) 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 6s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(0, 229, 255, 0.4))
          drop-shadow(0 0 30px rgba(176, 0, 255, 0.2));
  opacity: 0;
}

/* Flicker ON entrance — MIDNYTE first, then STUDIOS */
.title-midnyte {
  animation: gradientShift 6s ease-in-out infinite, flickerOn 1.2s 0.5s forwards, flickerIdle1 7s 2s infinite;
}

.title-studios {
  animation: gradientShift 6s ease-in-out infinite, flickerOn 1.2s 1s forwards, flickerIdle2 9s 2.5s infinite;
}

.tm {
  font-size: 0.45em;
  position: absolute;
  top: -0.1em;
  right: -2em;
  opacity: 0.8;
  -webkit-text-fill-color: transparent;
  background: inherit;
  background-size: inherit;
  -webkit-background-clip: text;
  background-clip: text;
}

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

/* Flicker on like an old CRT warming up */
@keyframes flickerOn {
  0% { opacity: 0; }
  5% { opacity: 0.6; }
  10% { opacity: 0; }
  15% { opacity: 0.4; }
  20% { opacity: 0; }
  30% { opacity: 0.8; }
  35% { opacity: 0.2; }
  40% { opacity: 0.9; }
  45% { opacity: 0.5; }
  55% { opacity: 1; }
  60% { opacity: 0.7; }
  70% { opacity: 1; }
  75% { opacity: 0.85; }
  85% { opacity: 1; }
  90% { opacity: 0.9; }
  100% { opacity: 1; }
}

/* Gentle random idle flicker for MIDNYTE */
@keyframes flickerIdle1 {
  0%, 100% { opacity: 1; }
  4% { opacity: 0.88; }
  5% { opacity: 1; }
  32% { opacity: 1; }
  33% { opacity: 0.82; }
  34% { opacity: 0.92; }
  35% { opacity: 1; }
  67% { opacity: 1; }
  68% { opacity: 0.75; }
  69% { opacity: 0.95; }
  70% { opacity: 0.85; }
  71% { opacity: 1; }
  89% { opacity: 1; }
  90% { opacity: 0.9; }
  91% { opacity: 1; }
}

/* Separate idle flicker for STUDIOS — different timing */
@keyframes flickerIdle2 {
  0%, 100% { opacity: 1; }
  12% { opacity: 1; }
  13% { opacity: 0.8; }
  14% { opacity: 0.93; }
  15% { opacity: 1; }
  48% { opacity: 1; }
  49% { opacity: 0.85; }
  50% { opacity: 1; }
  73% { opacity: 1; }
  74% { opacity: 0.7; }
  75% { opacity: 0.9; }
  76% { opacity: 0.82; }
  77% { opacity: 1; }
  95% { opacity: 1; }
  96% { opacity: 0.88; }
  97% { opacity: 1; }
}

.hero-tagline {
  font-family: var(--font-body);
  font-size: clamp(0.85rem, 2vw, 1.1rem);
  color: var(--text-dim);
  margin-top: 20px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(0, 229, 255, 0.15);
}

/* --- Scroll Indicator --- */
.scroll-indicator {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  animation: bounce 2s ease-in-out infinite;
}

.scroll-arrow {
  font-size: 1rem;
  color: var(--cyan);
  opacity: 0.6;
  transition: opacity 0.3s;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}

.scroll-indicator:hover .scroll-arrow {
  opacity: 1;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(10px); }
}

/* ============================================
   GAMES
   ============================================ */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 32px;
  max-width: 700px;
  margin: 0 auto;
}

/* Gradient border wrapper */
.game-card-wrapper {
  background: var(--gradient);
  padding: 1px;
  border-radius: 4px;
  transition: box-shadow 0.3s ease;
}

.game-card-wrapper:hover {
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.25),
              0 0 48px rgba(176, 0, 255, 0.1);
}

.game-card {
  background: var(--dark);
  border-radius: 3px;
  overflow: hidden;
}

.game-card-image {
  height: 180px;
  background: linear-gradient(135deg, #0d0d1a, #1a0a2e);
  display: flex;
  align-items: center;
  justify-content: center;
}

.coming-soon-badge {
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--purple) 50%, var(--magenta) 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.1em;
  animation: gradientShift 6s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.4));
}

.game-card-info {
  padding: 20px;
}

.game-card-title {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.5;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.3),
               0 0 20px rgba(176, 0, 255, 0.15);
}

.game-card-desc {
  font-size: 0.9rem;
  color: var(--text-dim);
}

/* ============================================
   CONTACT / SOCIAL
   ============================================ */
.social-links {
  display: flex;
  justify-content: center;
  gap: 32px;
}

.social-link {
  color: var(--text-dim);
  transition: color 0.3s, filter 0.3s;
}

.social-link:hover {
  color: var(--cyan);
  filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.5));
}

/* ============================================
   FOOTER
   ============================================ */
#footer {
  padding: 40px 24px;
  text-align: center;
  border-top: 1px solid #111;
}

#footer p {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .section {
    padding: 72px 0;
  }

  .games-grid {
    grid-template-columns: 1fr;
    max-width: 400px;
  }

  .social-links {
    gap: 24px;
  }
}
