/**
 * Accueil immersif — plein écran, marque hero, motion.
 * Chargé uniquement sur index.php / index-mobile.php.
 */
@import url("https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=Outfit:wght@400;500;600;700&display=swap");

/* ========== Page home : sortie du « carton » glass ========== */
body.page-home {
  --home-ink: #f4f7ff;
  --home-muted: rgba(226, 232, 240, 0.72);
  --home-accent: #2dd4bf;
  --home-accent-2: #38bdf8;
  --home-warm: #fbbf24;
  --font-display: "Syne", "Outfit", system-ui, sans-serif;
  --font-ui: "Outfit", system-ui, sans-serif;
  font-family: var(--font-ui);
  color: var(--home-ink);
  background: #04070f;
  overflow-x: hidden;
}

body.page-home::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(90% 70% at 15% 10%, rgba(45, 212, 191, 0.22), transparent 55%),
    radial-gradient(70% 60% at 90% 15%, rgba(56, 189, 248, 0.18), transparent 50%),
    radial-gradient(80% 50% at 50% 100%, rgba(251, 191, 36, 0.08), transparent 45%),
    linear-gradient(180deg, #071018 0%, #04070f 55%, #02040a 100%);
  animation: home-bg-drift 18s ease-in-out infinite alternate;
}

body.page-home::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 20%, transparent 75%);
}

@keyframes home-bg-drift {
  from {
    filter: hue-rotate(0deg) saturate(1);
    transform: scale(1);
  }
  to {
    filter: hue-rotate(12deg) saturate(1.15);
    transform: scale(1.04);
  }
}

body.page-home .wrap.wrap--home-immersive {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ========== Barre du haut : flottante SUR le hero ========== */
body.page-home .wrap--home-immersive {
  position: relative;
}

/* site-top est dans .site-panel (pas enfant direct de .wrap) */
body.page-home .wrap--home-immersive > .site-panel {
  position: fixed;
  top: max(0.65rem, env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 40;
  transform: translateX(-50%);
  width: calc(100% - 1.25rem);
  max-width: none;
  margin: 0;
  pointer-events: none;
}

body.page-home .wrap--home-immersive > .site-panel > .site-top,
body.page-home .wrap--home-immersive > .site-panel > .site-top--hub-nav {
  position: relative;
  z-index: 40;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  background: rgba(4, 10, 18, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}

body.page-home .wrap--home-immersive > .site-panel > .site-top--hub-nav .site-brand__logo {
  height: 36px;
  filter: drop-shadow(0 4px 14px rgba(45, 212, 191, 0.35));
}

/* ========== HERO plein viewport ========== */
.home-hero {
  position: relative;
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 6.5rem clamp(1.1rem, 4vw, 2.5rem) 4rem;
  overflow: hidden;
}

/* Menu sans hero (défaut / retour / ?hub=). Le hero n’apparaît que via ?accueil=1 (logo PerkLab). */
body.page-home .wrap--home-immersive.home-skip-hero .home-hero {
  display: none;
}

body.page-home .wrap--home-immersive.home-skip-hero .games-hub {
  padding-top: calc(5rem + env(safe-area-inset-top, 0px));
}

.home-hero__plane {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 90% 70% at 50% 40%, rgba(14, 165, 233, 0.2), transparent 60%),
    radial-gradient(circle at 20% 80%, rgba(45, 212, 191, 0.18), transparent 40%),
    radial-gradient(circle at 85% 70%, rgba(251, 191, 36, 0.12), transparent 35%);
}

.home-hero__plane::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    conic-gradient(from 120deg at 50% 45%, transparent 0deg, rgba(45, 212, 191, 0.12) 60deg, transparent 120deg, rgba(56, 189, 248, 0.1) 200deg, transparent 280deg);
  animation: home-orbit 28s linear infinite;
}

@keyframes home-orbit {
  to {
    transform: rotate(360deg);
  }
}

.home-hero__content {
  position: relative;
  z-index: 2;
  max-width: 52rem;
  margin: 0 auto;
}

.home-hero__brand {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 14vw, 8.1rem);
  line-height: 0.88;
  letter-spacing: -0.05em;
  background: linear-gradient(125deg, #ffffff 0%, #e0f2fe 28%, #5eead4 62%, #fde68a 100%);
  background-size: 160% 160%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 16px 48px rgba(45, 212, 191, 0.4));
  animation: home-brand-in 0.95s cubic-bezier(0.22, 1, 0.36, 1) both, home-brand-shine 7s ease-in-out 1s infinite alternate;
}

@keyframes home-brand-shine {
  from {
    background-position: 0% 40%;
  }
  to {
    background-position: 100% 60%;
  }
}

.home-hero__headline {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.15rem, 3.2vw, 1.75rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--home-ink);
  animation: home-rise 0.85s 0.12s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.home-hero__lead {
  margin: 0 auto 1.75rem;
  max-width: 28rem;
  font-size: clamp(0.98rem, 2.2vw, 1.15rem);
  line-height: 1.5;
  color: var(--home-muted);
  animation: home-rise 0.85s 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.home-hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  animation: home-rise 0.85s 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.home-hero__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.7rem 1.35rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.home-hero__btn--primary {
  color: #041016;
  background: linear-gradient(135deg, #5eead4, #38bdf8);
  box-shadow: 0 10px 36px rgba(45, 212, 191, 0.4);
}

.home-hero__btn--primary:hover {
  color: #041016;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 44px rgba(45, 212, 191, 0.5);
}

.home-hero__btn--ghost {
  color: var(--home-ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.home-hero__btn--ghost:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.home-hero__scroll {
  position: absolute;
  bottom: 1.4rem;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  color: var(--home-muted);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  animation: home-bob 2.2s ease-in-out infinite;
}

.home-hero__scroll span {
  width: 1px;
  height: 2rem;
  background: linear-gradient(180deg, rgba(94, 234, 212, 0.9), transparent);
}

@keyframes home-brand-in {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes home-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes home-bob {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(6px);
  }
}

/* ========== Hub sections : panneaux immersifs ========== */
body.page-home .site--home-hub {
  position: sticky;
  top: 0.5rem;
  z-index: 15;
  margin: 0 auto 0.5rem;
  width: calc(100% - 1.5rem);
  max-width: none;
  padding: 0;
  background: transparent;
}

body.page-home .games-hub {
  width: calc(100% - 1.5rem);
  max-width: none;
  margin: 0 auto;
  padding-bottom: 3rem;
  scroll-margin-top: 5rem;
}

body.page-home #home-hub-anchor {
  scroll-margin-top: 4.5rem;
}

body.page-home .games-section {
  position: relative;
  margin: 0 0 2.5rem;
  padding: clamp(1.75rem, 4vw, 2.75rem) clamp(1rem, 3vw, 1.75rem);
  border-radius: 28px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: home-rise 0.7s ease both;
}

body.page-home .games-section::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -15%;
  width: 55%;
  height: 80%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.12), transparent 70%);
  pointer-events: none;
}

body.page-home .games-section__title {
  position: relative;
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.65rem, 4.5vw, 2.45rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #fff;
}

body.page-home .games-section__lead {
  position: relative;
  margin: 0 0 1.35rem;
  max-width: 36rem;
  font-size: 1.05rem;
  color: var(--home-muted);
}

body.page-home .games-section--hub-jeux {
  background:
    linear-gradient(155deg, rgba(251, 191, 36, 0.1), rgba(255, 255, 255, 0.03) 40%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}

body.page-home .games-section--hub-cours {
  background:
    linear-gradient(155deg, rgba(56, 189, 248, 0.12), rgba(255, 255, 255, 0.03) 45%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}

body.page-home .games-section--hub-exos {
  background:
    linear-gradient(155deg, rgba(45, 212, 191, 0.12), rgba(255, 255, 255, 0.03) 45%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}

body.page-home .games-section--hub-enigmes {
  background:
    linear-gradient(155deg, rgba(34, 211, 238, 0.12), rgba(255, 255, 255, 0.03) 45%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}

/* Cartes plus grandes, hover cinéma */
body.page-home .games-grid .game-card:not(.game-card--disabled) {
  border-radius: 22px;
  border-width: 2px;
  transform: translateZ(0);
  transition:
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.35s ease,
    filter 0.35s ease;
}

body.page-home .games-grid .game-card:not(.game-card--disabled):hover {
  transform: translateY(-8px) scale(1.015);
  filter: brightness(1.06);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 28px 56px rgba(0, 0, 0, 0.5),
    0 0 28px var(--gc-glow),
    0 0 64px var(--gc-glow);
}

body.page-home .games-grid .game-card .game-card__link > h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

body.page-home .games-grid {
  gap: 1.1rem;
}

@media (min-width: 900px) {
  body.page-home .games-grid:not(.games-grid--cours-niveaux):not(.games-grid--meta) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

body.page-home .site.site:not(.site--home-hub) {
  width: calc(100% - 1.5rem);
  max-width: none;
  margin: 0 auto 2rem;
  padding: 1.25rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 760px) {
  .home-hero {
    min-height: 92dvh;
    padding-top: 6.5rem;
  }

  .home-hero__brand {
    font-size: clamp(2.6rem, 14vw, 4.5rem);
  }

  body.page-home .wrap--home-immersive > .site-panel {
    width: calc(100% - 0.75rem);
  }

  body.page-home .wrap--home-immersive > .site-panel > .site-top--hub-nav {
    border-radius: 22px;
    padding: 0.45rem 0.55rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.page-home::before,
  .home-hero__plane::before,
  .home-hero__brand,
  .home-hero__headline,
  .home-hero__lead,
  .home-hero__cta,
  .home-hero__scroll,
  body.page-home .games-section {
    animation: none !important;
  }
}
