/* ============================================
   VARIABLES & RESET
   ============================================ */
:root {
  --gradient-start: #e6cce4;
  --gradient-end: #8DA6D6;
  --gradient: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  --text-light: #FFFFFF;
  --text-dark: #222222;
  --accent: #8DA6D6;
  --font: 'Outfit', sans-serif;
  --font-script: 'Dancing Script', cursive;
  --radius: 16px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-weight: 400;
  color: var(--text-dark);
  line-height: 1.65;
  overflow-x: hidden;
  background: var(--gradient-start);
}

.hidden { display: none !important; }

.container {
  width: 90%;
  max-width: 1080px;
  margin: 0 auto;
}

/* ============================================
   SECTION 1 — HERO
   ============================================ */
#hero {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 560px;
  background: var(--gradient);
  overflow: hidden;
}

/* ============================================
   LOGO — 3 ÉLÉMENTS DOM POSITIONNÉS
   Positions calculées par JS (positionAsLogo)
   ============================================ */
.game-piece {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  will-change: left, top, width, height;
}

.game-piece svg {
  display: block;
  width: 100%;
  height: 100%;
  transition: opacity 0.5s ease;
}

/* Pseudo-element = forme de jeu (paddle / balle)
   Invisible en mode logo, apparaît en mode jeu */
.game-piece::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.piece-paddle::after {
  border-radius: 6px;
}

.piece-ball::after {
  border-radius: 50%;
}

/* En mode jeu : le SVG disparaît, la forme simple apparaît */
.game-piece.game-shape svg {
  opacity: 0;
}

.game-piece.game-shape::after {
  opacity: 1;
}

/* Balle en jeu : ombre portée pour un effet lumineux */
.piece-ball.game-shape {
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.35));
}

/* Animation fluide lors des transitions logo ↔ jeu */
.game-piece.animating {
  transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              top 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Animation d'entrée du logo ── */
.game-piece.entering {
  transition: left 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              top 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.7s ease;
}

.game-piece.pre-enter {
  opacity: 0;
}

/* ── Zone de clic invisible sur le logo ── */
#logo-hitbox {
  position: absolute;
  z-index: 4;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  /* Dimensions définies par JS pour recouvrir le logo */
}

/* ── Tagline ── */
#tagline {
  position: absolute;
  z-index: 3;
  width: 100%;
  text-align: center;
  color: var(--text-light);
  font-family: var(--font-script);
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0 1rem;
  opacity: 0;
  animation: fadeInUp 1s ease 1.2s forwards;
  transition: opacity 0.4s ease;
  /* Position calculée par JS (sous le logo) */
}

#tagline.hide {
  opacity: 0 !important;
  pointer-events: none;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Indicateur de scroll ── */
#scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0.6;
  animation: bounce 2s ease 1.8s infinite;
  z-index: 2;
  transition: opacity 0.4s ease;
  opacity: 0;
}

#scroll-indicator.show {
  opacity: 0.6;
}

#scroll-indicator.hide {
  opacity: 0;
  pointer-events: none;
}

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

/* ============================================
   GAME UI OVERLAYS
   ============================================ */

/* Bouton fermer (×) */
#game-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 20;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
}

#game-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}

/* Score */
#game-score {
  position: absolute;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  gap: 0.8rem;
  align-items: center;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.05em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.score-sep {
  font-weight: 300;
  opacity: 0.4;
}

/* Compteur de rallye */
#rally-count {
  position: absolute;
  top: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.2s ease;
}

#rally-count.visible {
  opacity: 1;
}

#rally-count.bump {
  transform: translateX(-50%) scale(1.25);
}

#rally-number {
  font-size: clamp(0.75rem, 1.5vw, 0.9rem);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.1em;
}

#rally-number::before {
  content: '🏓 ';
  font-size: 0.8em;
}

/* Ligne centrale du terrain */
#court-line {
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  z-index: 2;
  transform: translateX(-50%);
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.1) 0px,
    rgba(255, 255, 255, 0.1) 10px,
    transparent 10px,
    transparent 22px
  );
}

/* Sélecteur de difficulté */
#difficulty-select {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 25;
  text-align: center;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.diff-title {
  color: var(--text-light);
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 700;
  margin-bottom: 1.2rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4), 0 0 20px rgba(0, 0, 0, 0.12);
  letter-spacing: 0.05em;
}

.diff-buttons {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
}

.diff-buttons button {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.7rem 1.5rem;
  min-height: 48px;
  min-width: 100px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-light);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45), 0 0 12px rgba(0, 0, 0, 0.15);
}

.diff-buttons button:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: #fff;
  transform: translateY(-2px);
}

.diff-buttons button:active {
  transform: translateY(0);
}

/* Tutoriel */
#game-tutorial {
  position: absolute;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  text-align: center;
  animation: fadeIn 0.5s ease;
}

#tutorial-text {
  font-size: clamp(0.85rem, 2vw, 1rem);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.6rem 1.4rem;
  border-radius: 100px;
  white-space: nowrap;
}

#game-tutorial.fade-out {
  opacity: 0;
  transition: opacity 0.5s ease;
}

/* Écran de fin */
#game-end {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 25;
  text-align: center;
  animation: fadeIn 0.4s ease;
}

#game-winner {
  color: var(--text-light);
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.end-buttons {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

.end-buttons button {
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.8rem 2rem;
  min-width: 130px;
  min-height: 48px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  letter-spacing: 0.03em;
}

.end-buttons button:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: #fff;
  transform: translateY(-2px);
}

.end-buttons button:active {
  transform: translateY(0);
}

/* ============================================
   SECTION 2 — À PROPOS
   ============================================ */
#about {
  background: #faf8fb;
  padding: 6rem 0;
}

#about h2 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 2rem;
}

#about h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--gradient);
  border-radius: 2px;
  margin-top: 0.6rem;
}

.about-content {
  max-width: 720px;
}

.about-content p {
  font-size: clamp(1rem, 1.8vw, 1.1rem);
  color: #444;
  margin-bottom: 1.2rem;
  line-height: 1.8;
}

/* ============================================
   SECTION 3 — SERVICES
   ============================================ */
#services {
  background: var(--gradient);
  padding: 6rem 0;
}

#services h2 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 3rem;
  text-align: center;
}

#services h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 2px;
  margin: 0.6rem auto 0;
}

.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.service-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  transition: transform 0.3s ease, background 0.3s ease;
}

.service-card:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.18);
}

.service-icon {
  width: 52px;
  height: 52px;
  color: var(--text-light);
  margin-bottom: 1.2rem;
}

.service-icon svg {
  width: 100%;
  height: 100%;
}

.service-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

.service-card p {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.7;
}

/* ============================================
   FOOTER
   ============================================ */
#footer {
  background: #1a1a2e;
  padding: 3rem 0;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  text-align: center;
}

.social-links {
  display: flex;
  gap: 1.2rem;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  color: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  transition: all 0.25s ease;
}

.social-links a:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.social-links a svg {
  width: 20px;
  height: 20px;
}

.copyright {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.45);
}

.legal-link {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.35);
  text-decoration: none;
  transition: color 0.2s ease;
}

.legal-link:hover {
  color: rgba(255, 255, 255, 0.7);
}

/* ============================================
   RESPONSIVE — TABLETTE (≥ 768px)
   ============================================ */
@media (min-width: 768px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .service-card:last-child {
    grid-column: 1 / -1;
    max-width: 50%;
    justify-self: center;
  }
}

/* ============================================
   RESPONSIVE — DESKTOP (≥ 1024px)
   ============================================ */
@media (min-width: 1024px) {
  .services-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .service-card:last-child {
    grid-column: auto;
    max-width: none;
    justify-self: auto;
  }
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
  }
}
