/* ===== Accessibility ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #16161f;
  --border-subtle: #1e1e2e;
  --text-primary: #e8e8f0;
  --text-secondary: #8888a0;
  --accent: #00d4ff;
  --accent-glow: rgba(0, 212, 255, 0.35);
  --accent-dim: rgba(0, 212, 255, 0.12);
  --danger: #ff4466;
  --radius: 14px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== Background Canvas ===== */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

/* ===== Header ===== */
.header {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 3.5rem 1rem 1rem;
}

.logo {
  font-size: 2.8rem;
  font-weight: 800;
  text-decoration: none;
  color: var(--text-primary);
  letter-spacing: -1px;
  display: inline-block;
  transition: var(--transition);
}

.logo:hover {
  text-shadow: 0 0 24px var(--accent-glow);
}

.tagline {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-top: 0.5rem;
  font-weight: 400;
}

/* ===== Container ===== */
.container {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ===== Games Grid ===== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.75rem;
}

/* ===== Game Card ===== */
.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
  outline: none;
}

.game-card:hover,
.game-card:focus-visible {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--accent);
  box-shadow:
    0 0 20px var(--accent-glow),
    0 12px 40px rgba(0, 0, 0, 0.5);
}

.game-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.game-card:active {
  transform: translateY(-2px) scale(1.005);
}

.game-card__thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--bg-secondary);
  display: block;
}

.game-card__body {
  padding: 1.15rem 1.25rem 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.game-card__title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.game-card__desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.45;
  flex: 1;
}

.game-card__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding: 0.6rem 1.25rem;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: background var(--transition), box-shadow var(--transition);
  pointer-events: none; /* card handles click */
}

.game-card:hover .game-card__action,
.game-card:focus-visible .game-card__action {
  background: rgba(0, 212, 255, 0.2);
  box-shadow: 0 0 14px var(--accent-glow);
}

/* ===== Footer ===== */
.footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ===== Page Transition Overlay ===== */
.page-transition {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.page-transition.active {
  opacity: 1;
  pointer-events: all;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .header {
    padding: 2.5rem 1rem 0.75rem;
  }

  .logo {
    font-size: 2rem;
  }

  .tagline {
    font-size: 0.92rem;
  }

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

  .container {
    padding: 1.5rem 1rem 3rem;
  }
}

@media (min-width: 641px) and (max-width: 960px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== Thumbnail Placeholder (canvas-generated) ===== */
.game-card__thumb[data-placeholder] {
  background: linear-gradient(135deg, var(--bg-secondary), #1a1a28);
}
