/* ============================================
   JEUX DU JOUR — Shared Stylesheet
   Aesthetic: Retro-arcade meets modern minimalism
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Outfit:wght@300;400;600;700;800&display=swap');

:root {
  /* Core palette — dark arcade vibe */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a26;
  --bg-card-hover: #222233;
  --surface: #252535;
  --surface-light: #2e2e42;

  /* Accent colors — neon arcade */
  --accent-primary: #00e5a0;
  --accent-secondary: #7b61ff;
  --accent-warm: #ff6b6b;
  --accent-gold: #ffd369;

  /* Text */
  --text-primary: #e8e8f0;
  --text-secondary: #8888a0;
  --text-muted: #555570;

  /* Glow effects */
  --glow-primary: 0 0 20px rgba(0, 229, 160, 0.3);
  --glow-secondary: 0 0 20px rgba(123, 97, 255, 0.3);
  --glow-warm: 0 0 20px rgba(255, 107, 107, 0.3);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background grain texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ---- NAVIGATION ---- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: var(--space-md) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-nav .logo {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent-primary);
  text-decoration: none;
  letter-spacing: -0.5px;
  text-shadow: var(--glow-primary);
  transition: var(--transition-fast);
}

.site-nav .logo:hover {
  filter: brightness(1.2);
}

.site-nav .logo span {
  color: var(--text-muted);
  font-weight: 400;
}

.nav-links {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
}

.nav-links a {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent-primary);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--accent-primary);
  border-radius: 2px;
  box-shadow: var(--glow-primary);
}

/* ---- MAIN CONTENT ---- */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
}

/* ---- HERO (index) ---- */
.hero {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.hero h1 {
  font-family: 'Space Mono', monospace;
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: var(--space-md);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeInUp 0.8s ease-out;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  font-weight: 300;
  animation: fadeInUp 0.8s ease-out 0.15s both;
}

/* ---- GAME CARDS (index) ---- */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.game-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-decoration: none;
  color: inherit;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.6s ease-out both;
}

.game-card:nth-child(2) { animation-delay: 0.1s; }
.game-card:nth-child(3) { animation-delay: 0.2s; }

.game-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.1);
}

.game-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transition: var(--transition-normal);
}

.game-card.sutom::before { background: var(--accent-warm); }
.game-card.sutom:hover { box-shadow: var(--glow-warm); }
.game-card.game-2048::before { background: var(--accent-gold); }
.game-card.game-2048:hover { box-shadow: 0 0 20px rgba(255, 211, 105, 0.3); }
.game-card.snake::before { background: var(--accent-primary); }
.game-card.snake:hover { box-shadow: var(--glow-primary); }
.game-card.lightsout::before { background: var(--accent-secondary); }
.game-card.lightsout:hover { box-shadow: var(--glow-secondary); }
.game-card.nonogram::before { background: #14b8a6; }
.game-card.nonogram:hover { box-shadow: 0 0 20px rgba(20, 184, 166, 0.3); }
.game-card.nerdle::before { background: #f97316; }
.game-card.nerdle:hover { box-shadow: 0 0 20px rgba(249, 115, 22, 0.3); }
.game-card:nth-child(3) { animation-delay: 0.2s; }
.game-card:nth-child(4) { animation-delay: 0.3s; }
.game-card:nth-child(5) { animation-delay: 0.4s; }
.game-card:nth-child(6) { animation-delay: 0.5s; }
.game-card:nth-child(7) { animation-delay: 0.6s; }

.game-card .game-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
  display: block;
}

.game-card h2 {
  font-family: 'Space Mono', monospace;
  font-size: 1.4rem;
  margin-bottom: var(--space-sm);
}

.game-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

.game-card .play-btn {
  display: inline-block;
  margin-top: var(--space-lg);
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.game-card:hover .play-btn {
  color: var(--accent-primary);
}

/* ---- PAGE TITLE (game pages) ---- */
.page-title {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.page-title h1 {
  font-family: 'Space Mono', monospace;
  font-size: 2rem;
  margin-bottom: var(--space-xs);
}

.page-title p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ---- BUTTONS ---- */
.btn {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--bg-primary);
}

.btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: var(--glow-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--surface-light);
}

.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

/* ---- MODAL / OVERLAY ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-normal);
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 420px;
  width: 90%;
  text-align: center;
  transform: scale(0.9);
  transition: var(--transition-bounce);
}

.modal-overlay.visible .modal {
  transform: scale(1);
}

.modal h2 {
  font-family: 'Space Mono', monospace;
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

.modal p {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.modal .btn {
  margin: 0 var(--space-xs);
}

/* ---- ANIMATIONS ---- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@keyframes flip {
  0% { transform: rotateX(0); }
  50% { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
  .site-nav {
    padding: var(--space-sm) var(--space-md);
  }

  .nav-links {
    gap: var(--space-md);
  }

  .nav-links a {
    font-size: 0.75rem;
  }

  .main-content {
    padding: var(--space-xl) var(--space-md);
  }

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

/* ---- FOOTER ---- */
.site-footer {
  text-align: center;
  padding: var(--space-2xl) var(--space-md) var(--space-lg);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: 'Space Mono', monospace;
  position: relative;
  z-index: 1;
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent-primary);
}
