/* ============================================================
   MAIN STYLESHEET - Home Page (Consolidated & Optimized)
   Mobile first, with tablet & desktop breakpoints
   ============================================================ */

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

html {
  height: 100%;
  scrollbar-width: none;
}

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

body {
  min-height: 100%;
  min-height: 100dvh;
  font-family: 'Arial Rounded MT Bold', Arial, sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
}

/* ============================================================
   BACKGROUND — iOS-SAFE FIXED TECHNIQUE
   body::before with position:fixed renders correctly on iOS Safari.
   background-attachment:fixed on body is broken on iOS.
   ============================================================ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url('../photos/background-desktop.png');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}

/* ============================================================
   LAUNCHER WRAPPER — Main Container
   ============================================================ */
.launcher {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-height: 100dvh;
  padding: 24px 10px 20px;
}

/* ============================================================
   GAME GRID — Card Layout
   ============================================================ */
.game-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 340px;
}

.game-card {
  display: flex;
  justify-content: center;
  position: relative;
}

.game-card__link {
  display: block;
  text-decoration: none;
  touch-action: manipulation;         /* removes 300ms tap delay */
  -webkit-user-select: none;
  user-select: none;                  /* prevents text selection on rapid taps */
  -webkit-tap-highlight-color: transparent; /* removes iOS blue tap flash */
  transition: transform 0.2s ease;
}

.game-card__img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* ============================================================
   INTERACTION STATES
   ============================================================ */
@media (hover: hover) {
  .game-card__link:hover {
    transform: scale(1.06);
  }
}

.game-card__link:active {
  transform: scale(0.93);
  transition-duration: 0.07s;
}

.game-card__link:focus-visible {
  outline: 3px solid #ffe066;
  outline-offset: 4px;
}

/* ============================================================
   MOBILE — ≤600px
   ============================================================ */
@media (max-width: 600px) {
  body::before {
    background-image: url("../photos/background-mobile.png");
    background-size: cover;
    background-position: center top;
  }

  .launcher {
    padding: 21px 10px 40px;
  }

  .game-grid {
    margin-top: 140px;
  }

  .game-card--puzzle {
    top: -115px;
    left: 18px;
  }

  .game-card--difference {
    top: -110px;
    left: 8px;
  }

  .game-card--shadow {
    top: -170px;
    left: 20px;
  }

  .game-card--shapes {
    top: -170px;
    left: 6px;
  }

  .game-card--counting {
    top: -50px;
    left: 18px;
  }
}
/* ============================================================
   TABLET — 640px to 1023px
   ============================================================ */
@media (min-width: 640px) and (max-width: 1023px) {
  .game-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
    max-width: 820px;
  }

  .game-card__img {
    width: 180px;
    height: 180px;
  }

  .launcher {
    padding: 40px 24px 30px;
  }

  .game-card {
    top: 0;   /* Reset mobile individual offsets */
    left: 0;
  }
}

/* ============================================================
   DESKTOP — 1024px and up
   ============================================================ */
@media (min-width: 1024px) {
  .launcher {
    justify-content: flex-start;
    padding-top: 250px;
  }

  .game-grid {
    grid-template-columns: repeat(5, 170px);
    justify-content: center;
    gap: 20px;
    margin-top: 0;
  }

  .game-card__img {
    width: 170px;
    height: 170px;
  }

  .game-card {
    top: 0;
    left: 0;
  }

  /* 🔥 TON FIX ICI */
  .game-card--counting {
    transform: translateY(-60px);
  }
}
/* ============================================================
   LARGE DESKTOP — 1440px and up
   ============================================================ */
@media (min-width: 1440px) {
  .game-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 260px));
    max-width: 1320px;
  }

  .game-card__img {
    width: 240px;
    height: 240px;
  }
}

/* ============================================================
   ACCESSIBILITY — Reduced Motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .game-card__link,
  .game-card__img {
    transition: none;
  }
}
