/* ═══════════════════════════════════════
   JEUX — Hero compact + Memory game
   ═══════════════════════════════════════ */

/* ---- Hero ---- */
.hero-jeux {
  padding: 34px 28px 30px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(145deg, rgba(255,255,255,.94), rgba(255,245,233,.78)),
    linear-gradient(135deg, rgba(124,197,208,.14), rgba(213,154,70,.08));
  border: 1px solid rgba(255,255,255,.82);
  box-shadow: 0 34px 100px rgba(29,23,19,.13);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  animation: fadeRise .75s ease both;
}

.hero-jeux::before {
  content: "";
  position: absolute;
  inset: auto -8% -28% auto;
  width: 20rem;
  height: 20rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(213,154,70,.18), transparent 68%);
  animation: halo 11s ease-in-out infinite;
}

.hero-jeux-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 24px;
  align-items: end;
  position: relative;
  z-index: 1;
}

.hero-jeux-copy { text-align: left; }

.hero-jeux .eyebrow { margin-bottom: 12px; }

.hero-jeux h1 {
  font-family: 'Cormorant Garamond', serif;
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: .96;
  letter-spacing: -.03em;
}

.hero-jeux .hero-text {
  margin: 12px 0 0;
  max-width: 54ch;
  color: var(--ink-soft);
  font-size: .96rem;
  line-height: 1.68;
}

.hero-jeux-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.hero-jeux-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(13,97,125,.08);
  color: var(--sea);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero-jeux-side {
  padding: 24px;
  border-radius: 28px;
  background:
    linear-gradient(160deg, rgba(18,77,96,.92), rgba(38,71,53,.86)),
    linear-gradient(135deg, rgba(255,255,255,.18), rgba(255,255,255,0));
  color: #f7efe5;
  box-shadow: 0 26px 64px rgba(13,97,125,.24);
  position: relative;
  overflow: hidden;
}

.hero-jeux-side::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.24);
  pointer-events: none;
}

.hero-jeux-note {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  color: rgba(247,239,229,.82);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.hero-jeux-side strong {
  display: block;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  line-height: 1;
}

.hero-jeux-side p {
  margin: 10px 0 0;
  color: rgba(247,239,229,.8);
  font-size: .93rem;
  line-height: 1.78;
}

/* ---- Game wrapper ---- */
.game-section {
  margin-top: 28px;
  animation: fadeRise .75s ease .15s both;
}

.game-shell {
  padding: 20px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(145deg, rgba(255,255,255,.95), rgba(255,247,237,.82)),
    linear-gradient(135deg, rgba(124,197,208,.1), rgba(213,154,70,.05));
  border: 1px solid rgba(255,255,255,.82);
  box-shadow: 0 28px 70px rgba(29,23,19,.1);
}

/* ---- Stats bar ---- */
.game-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  padding: 16px 24px;
  border-radius: 999px;
  background: var(--glass-strong);
  border: 1px solid rgba(255,255,255,.74);
  box-shadow: 0 12px 40px rgba(29,23,19,.06);
  backdrop-filter: blur(18px);
}

.stat {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .92rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.stat-icon { font-size: 1.1rem; }

.stat-value {
  color: var(--sea);
  font-weight: 800;
  min-width: 1.6ch;
}

.stat-divider {
  width: 1px;
  height: 22px;
  background: var(--line);
}

/* ---- Card grid ---- */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 560px;
  margin: 0 auto;
}

/* ---- Single card ---- */
.memory-card {
  aspect-ratio: 1;
  perspective: 800px;
  cursor: pointer;
}

.memory-card.is-matched { pointer-events: none; }
.memory-card.is-flipped { pointer-events: none; }

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.4,.0,.2,1);
  border-radius: var(--radius-lg);
}

.memory-card.is-flipped .card-inner,
.memory-card.is-matched .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,.74);
  box-shadow: 0 10px 30px rgba(29,23,19,.08);
}

/* Back of card (visible initially) */
.card-back {
  background: linear-gradient(135deg, var(--sea), var(--leaf));
  box-shadow:
    0 10px 30px rgba(13,97,125,.18),
    inset 0 1px 0 rgba(255,255,255,.2);
  z-index: 2;
}

.card-back::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: calc(var(--radius-lg) - 6px);
  border: 2px solid rgba(255,255,255,.18);
  pointer-events: none;
}

.card-back::after {
  content: "BA";
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: rgba(255,255,255,.35);
  letter-spacing: .04em;
}

.card-back:hover {
  box-shadow:
    0 14px 40px rgba(13,97,125,.24),
    inset 0 1px 0 rgba(255,255,255,.2);
}

.memory-card:hover .card-back { filter: brightness(1.06); }

/* Front of card (emoji side) */
.card-front {
  transform: rotateY(180deg);
  background:
    linear-gradient(145deg, rgba(255,255,255,.94), rgba(255,244,233,.82)),
    linear-gradient(135deg, rgba(124,197,208,.1), rgba(213,154,70,.06));
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  backdrop-filter: blur(12px);
}

/* Matched state */
.memory-card.is-matched .card-front {
  background:
    linear-gradient(145deg, rgba(61,108,80,.08), rgba(124,197,208,.12)),
    linear-gradient(145deg, rgba(255,255,255,.92), rgba(255,244,233,.8));
  border-color: rgba(61,108,80,.3);
  box-shadow:
    0 10px 30px rgba(61,108,80,.12),
    0 0 0 2px rgba(61,108,80,.12);
  animation: matchPulse .5s ease;
}

@keyframes matchPulse {
  0%   { transform: rotateY(180deg) scale(1); }
  40%  { transform: rotateY(180deg) scale(1.08); }
  100% { transform: rotateY(180deg) scale(1); }
}

/* ---- Restart button ---- */
.game-actions {
  display: flex;
  justify-content: center;
  margin-top: 26px;
}

.btn-restart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.82);
  color: var(--ink);
  font-family: 'Manrope', sans-serif;
  font-size: .94rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
  backdrop-filter: blur(10px);
}

.btn-restart:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(29,23,19,.1);
  background: rgba(255,255,255,.96);
}

/* ---- Victory overlay ---- */
.victory-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  background: rgba(29,23,19,.4);
  backdrop-filter: blur(8px);
  animation: fadeIn .35s ease both;
}

.victory-overlay.is-visible { display: flex; }

.victory-card {
  width: min(420px, calc(100% - 40px));
  padding: 44px 36px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(145deg, rgba(255,255,255,.96), rgba(255,244,233,.88)),
    linear-gradient(135deg, rgba(124,197,208,.12), rgba(213,154,70,.06));
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: 0 40px 100px rgba(29,23,19,.2);
  text-align: center;
  animation: victoryRise .5s cubic-bezier(.4,.0,.2,1) both;
}

.victory-emoji {
  font-size: 3.4rem;
  margin-bottom: 10px;
  animation: victoryBounce 1.2s ease infinite;
}

.victory-card h2 {
  font-family: 'Cormorant Garamond', serif;
  margin: 0 0 8px;
  font-size: 2.4rem;
  line-height: 1;
  color: var(--ink);
}

.victory-card .hero-text {
  margin: 0 auto 24px;
  font-size: .96rem;
  color: var(--ink-soft);
  line-height: 1.7;
}

.victory-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 28px;
}

.victory-stat { text-align: center; }

.victory-stat-value {
  display: block;
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--sea);
  line-height: 1.1;
}

.victory-stat-label {
  font-size: .78rem;
  color: var(--ink-soft);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes victoryRise {
  from { opacity: 0; transform: translateY(30px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .hero-jeux-grid { grid-template-columns: 1fr; }

  .memory-grid {
    gap: 10px;
    max-width: 340px;
  }

  .card-back::after { font-size: 1.2rem; }
  .card-front { font-size: 2rem; }

  .game-stats {
    gap: 10px;
    padding: 12px 16px;
    border-radius: 20px;
  }

  .stat { font-size: .82rem; }

  .hero-jeux { padding: 24px 18px 22px; }
  .hero-jeux-copy { text-align: center; }
  .hero-jeux .hero-text { margin-left: auto; margin-right: auto; }
  .hero-jeux-tags { justify-content: center; }
  .game-shell { padding: 16px; }

  .victory-card { padding: 32px 22px; }
  .victory-card h2 { font-size: 1.9rem; }
}
