/* ════════════════════════════════════════════════════════════════
   SpaceWord — site vitrine
   Direction : « la porte dorée des lettres » — nuit d'ardoise,
   or enluminé, typographie ancienne, tuiles de Scrabble.
   ════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'IM Fell English';
  src: url('assets/fonts/IMFellEnglish.woff2') format('woff2'),
       url('assets/fonts/IMFellEnglish.ttf') format('truetype');
  font-display: swap;
}

:root {
  --bg: #101419;
  --bg-2: #15191e;
  --panel: #1f262e;
  --text: #e9ebee;
  --muted: #9aa2ab;
  --gold: #d4a843;
  --gold-2: #f0c869;
  --gold-deep: #8f6f2a;
  --cream: #f5efe0;
  --border: #39434e;
  --display: 'IM Fell English', Georgia, serif;
  --body: 'Plus Jakarta Sans', system-ui, sans-serif;
  /* Aligne les sections pleine largeur sur le conteneur interne de 1180px
     (bord du conteneur + padding interne des sections normales). */
  --rail-pad: calc(max(0px, (100vw - 1180px) / 2) + clamp(16px, 4vw, 40px));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 90px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Voile étoilé + grain, sur toute la page */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(240, 200, 105, .55) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 8%, rgba(233, 235, 238, .4) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 55% 36%, rgba(240, 200, 105, .3) 50%, transparent 51%),
    radial-gradient(1px 1px at 30% 64%, rgba(233, 235, 238, .3) 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 52%, rgba(240, 200, 105, .4) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 6% 88%, rgba(233, 235, 238, .25) 50%, transparent 51%),
    radial-gradient(1px 1px at 66% 80%, rgba(240, 200, 105, .35) 50%, transparent 51%);
  background-size: 900px 900px;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

img { display: block; max-width: 100%; }
a { color: var(--gold-2); text-decoration: none; }
section { position: relative; z-index: 1; }
h1 { margin: 0; }

/* ── Boutons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .02em;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.btn-gold {
  color: #2a2008;
  background: linear-gradient(180deg, var(--gold-2) 0%, var(--gold) 55%, #b8902f 100%);
  box-shadow:
    0 1px 0 rgba(255, 240, 200, .8) inset,
    0 -2px 0 rgba(90, 65, 10, .35) inset,
    0 6px 18px rgba(212, 168, 67, .25);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 1px 0 rgba(255,240,200,.8) inset, 0 -2px 0 rgba(90,65,10,.35) inset, 0 10px 26px rgba(212,168,67,.4); }
.btn-ghost {
  color: var(--muted);
  border: 1px solid var(--border);
  background: rgba(31, 38, 46, .5);
}
.btn-disabled { cursor: default; }
.btn-small { padding: 9px 18px; font-size: 14px; }
.btn-big { padding: 18px 40px; font-size: 19px; border-radius: 14px; }

/* ── En-tête ─────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: linear-gradient(180deg, rgba(16, 20, 25, .85), rgba(16, 20, 25, .55));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(212, 168, 67, .14);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 22px;
  color: var(--cream);
}
.brand img { filter: drop-shadow(0 2px 6px rgba(212, 168, 67, .5)); }
.site-nav { display: flex; gap: 22px; margin-left: auto; }
.site-nav a {
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .04em;
  transition: color .15s;
}
.site-nav a:hover { color: var(--gold-2); }
.header-actions { display: flex; align-items: center; gap: 14px; }
.lang-toggle {
  font: 700 13px var(--body);
  color: var(--muted);
  background: rgba(31, 38, 46, .6);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  letter-spacing: .05em;
}
.lang-toggle .on {
  color: var(--gold-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.lang-sep { opacity: .4; margin: 0 4px; }

/* ── Héros ───────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 110px 20px 80px;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background: url('assets/hero-bg.webp') center 30% / cover no-repeat;
  animation: heroDrift 36s ease-in-out infinite alternate;
}
@media (max-width: 700px) {
  .hero-bg { background-image: url('assets/hero-bg-960.webp'); }
}
.hero.paused .hero-bg { animation-play-state: paused; }
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 65% at 50% 42%, transparent 30%, rgba(16, 20, 25, .55) 75%, var(--bg) 100%),
    linear-gradient(180deg, rgba(16, 20, 25, .55) 0%, rgba(16, 20, 25, .15) 30%, rgba(16, 20, 25, .25) 70%, var(--bg) 100%);
}
@keyframes heroDrift {
  from { transform: scale(1) translateY(0); }
  to   { transform: scale(1.06) translateY(-12px); }
}
.hero-inner {
  position: relative;
  text-align: center;
  max-width: 880px;
  animation: fadeUp 1s ease both;
}
.hero-kicker {
  font-family: var(--display);
  font-size: clamp(15px, 2vw, 19px);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-2);
  text-shadow:
    0 1px 3px rgba(0, 0, 0, .95),
    0 0 14px rgba(0, 0, 0, .85),
    0 2px 24px rgba(0, 0, 0, .7);
  margin: 0 0 18px;
}
.hero-title {
  width: min(92%, 760px);
  height: auto;
  margin: 0 auto 22px;
  filter: drop-shadow(0 8px 30px rgba(0, 0, 0, .75)) drop-shadow(0 0 40px rgba(212, 168, 67, .25));
}
.hero-sub {
  font-size: clamp(16px, 2.2vw, 19.5px);
  font-weight: 400;
  color: #f3f0e6;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .9), 0 0 4px rgba(0,0,0,.8);
  max-width: 660px;
  margin: 0 auto 32px;
}
.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}
.hero-trust {
  font-size: 13.5px;
  letter-spacing: .08em;
  color: rgba(245, 239, 224, .85);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .9);
  margin: 0;
}

/* Tuiles flottantes */
.hero-tiles { position: absolute; inset: 0; pointer-events: none; }
.ftile {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 54px;
  height: 54px;
  transform: rotate(var(--r)) scale(var(--s));
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 30px;
  color: #2a2415;
  background: linear-gradient(170deg, #fbf6e8 0%, #efe6cd 60%, #ddcfa9 100%);
  border-radius: 9px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .9) inset,
    0 -3px 0 rgba(140, 115, 60, .45) inset,
    0 12px 24px rgba(0, 0, 0, .5);
  animation: floatTile 9s ease-in-out infinite;
  animation-delay: var(--d);
  opacity: .9;
}
.ftile i {
  font-style: normal;
  position: absolute;
  right: 5px;
  bottom: 2px;
  font-size: 11px;
  font-family: var(--body);
  font-weight: 700;
  color: #7a6536;
}
@keyframes floatTile {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -22px; }
}

.scroll-cue {
  position: absolute;
  bottom: 26px;
  left: 50%;
  translate: -50% 0;
  width: 26px;
  height: 42px;
  border: 2px solid rgba(245, 239, 224, .5);
  border-radius: 14px;
}
.scroll-cue span {
  position: absolute;
  top: 7px; left: 50%;
  translate: -50% 0;
  width: 4px; height: 8px;
  border-radius: 3px;
  background: var(--gold-2);
  animation: cue 1.8s ease-in-out infinite;
}
@keyframes cue { 0%,100% { transform: translateY(0); opacity: 1; } 60% { transform: translateY(14px); opacity: 0; } }

/* ── Bandeau de chiffres ─────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  max-width: 1100px;
  margin: -10px auto 0;
  padding: 34px clamp(16px, 4vw, 40px) 10px;
}
.stat { text-align: center; }
.stat strong {
  display: block;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(30px, 4.6vw, 52px);
  color: var(--gold-2);
  text-shadow: 0 0 28px rgba(212, 168, 67, .35);
  line-height: 1.1;
}
.stat span {
  font-size: 13.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Sections ────────────────────────────────────────────────── */
.section {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(70px, 9vw, 110px) clamp(16px, 4vw, 40px) 0;
}
.section-wide { max-width: none; padding-left: 0; padding-right: 0; }
.section-wide > .tile-heading, .section-wide > .section-sub { padding-left: var(--rail-pad); padding-right: 24px; }
.section-sub {
  color: var(--muted);
  max-width: 640px;
  margin: 0 0 36px;
}

/* Titres en tuiles */
.tile-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 26px;
}
.tile-heading .tile {
  position: relative;
  width: clamp(46px, 6.4vw, 72px);
  height: clamp(46px, 6.4vw, 72px);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: clamp(27px, 3.8vw, 44px);
  color: #2a2415;
  background: linear-gradient(170deg, #fbf6e8 0%, #efe6cd 60%, #ddcfa9 100%);
  border-radius: 10px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .9) inset,
    0 -4px 0 rgba(140, 115, 60, .4) inset,
    0 10px 22px rgba(0, 0, 0, .45);
  transform: rotate(var(--tr, 0deg));
  transition: transform .25s ease;
}
.tile-heading .tile:hover { transform: rotate(0deg) translateY(-6px); }
.tile-heading .tile sub {
  position: absolute;
  right: 6px;
  bottom: 4px;
  line-height: 1;
  font-size: clamp(10px, 1.2vw, 13px);
  font-family: var(--body);
  font-weight: 700;
  color: #7a6536;
}
.tile-heading .tile-space { width: clamp(18px, 2.6vw, 30px); }

/* ── Cartes « le jeu » ───────────────────────────────────────── */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(31, 38, 46, .85), rgba(21, 25, 30, .9));
  border: 1px solid rgba(212, 168, 67, .16);
  border-radius: 16px;
  padding: 26px 26px 24px;
  overflow: hidden;
  transition: border-color .2s ease, transform .2s ease;
}
.card:hover { border-color: rgba(212, 168, 67, .45); transform: translateY(-4px); }
.card-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .14;
  pointer-events: none;
}
.card h3 {
  position: relative;
  font-family: var(--display);
  font-weight: 400;
  font-size: 24px;
  color: var(--gold-2);
  margin: 0 0 10px;
}
.card p { position: relative; color: #c6ccd3; font-size: 15.5px; margin: 0; }

/* ── Mondes ──────────────────────────────────────────────────── */
.worlds-rail, .shots-rail {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  padding: 8px var(--rail-pad) 26px;
  scroll-snap-type: x mandatory;
  scrollbar-color: var(--gold-deep) transparent;
}
.world {
  flex: 0 0 auto;
  margin: 0;
  scroll-snap-align: center;
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(212, 168, 67, .25);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
}
.world img {
  width: clamp(220px, 24vw, 300px);
  height: auto;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  transition: transform .5s ease;
}
.world:hover img { transform: scale(1.05); }
.world figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 36px 16px 14px;
  font-family: var(--display);
  font-size: 20px;
  color: var(--cream);
  text-align: center;
  background: linear-gradient(180deg, transparent, rgba(10, 12, 16, .85));
}

/* ── Héros ───────────────────────────────────────────────────── */
.parade {
  overflow: hidden;
  padding: 20px 0 10px;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.parade-track {
  display: flex;
  align-items: flex-end;
  gap: clamp(10px, 2vw, 26px);
  width: max-content;
  animation: parade 60s linear infinite;
}
.parade:hover .parade-track,
.parade.paused .parade-track { animation-play-state: paused; }
.parade-track img {
  height: clamp(240px, 34vw, 420px);
  width: auto;
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, .55));
}
.parade-track img:nth-child(odd) { translate: 0 6px; }
@keyframes parade { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.avatar-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  max-width: 980px;
  margin: 34px auto 0;
  padding: 0 24px;
}
.avatar-grid img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  object-position: top;
  border-radius: 50%;
  border: 2px solid rgba(212, 168, 67, .4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .5);
  transition: transform .2s ease, border-color .2s ease;
}
.avatar-grid img:hover { transform: scale(1.18); border-color: var(--gold-2); }

/* ── Trésors ─────────────────────────────────────────────────── */
.treasure {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(24px, 5vw, 60px);
  align-items: center;
}
.treasure-copy h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(26px, 3.4vw, 36px);
  color: var(--cream);
  margin: 0 0 16px;
}
.treasure-copy p { color: #c6ccd3; font-size: 16px; }
.econ-icons { display: flex; gap: 26px; margin-top: 22px; }
.econ-icons span { display: flex; align-items: center; gap: 9px; }
.econ-icons em { font-style: normal; font-size: 14px; font-weight: 700; color: var(--gold-2); letter-spacing: .04em; }
.chest-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}
.chest {
  width: clamp(74px, 8.5vw, 120px);
  height: auto;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .55));
  transition: transform .25s ease;
}
.chest.big { width: clamp(110px, 12vw, 170px); }
.chest:hover { transform: translateY(-10px) rotate(-2deg); }

/* ── Captures ────────────────────────────────────────────────── */
.phone {
  flex: 0 0 auto;
  scroll-snap-align: center;
  padding: 10px;
  border-radius: 30px;
  background: linear-gradient(180deg, #2a323b, #161b21);
  border: 1px solid rgba(212, 168, 67, .3);
  box-shadow: 0 22px 50px rgba(0, 0, 0, .55);
}
.phone img {
  width: clamp(190px, 21vw, 250px);
  height: auto;
  border-radius: 20px;
}

/* ── Finale ──────────────────────────────────────────────────── */
.finale {
  text-align: center;
  padding: clamp(80px, 11vw, 150px) 24px clamp(70px, 9vw, 120px);
  background:
    radial-gradient(ellipse 60% 50% at 50% 55%, rgba(212, 168, 67, .12), transparent 70%);
}
.portal { position: relative; width: 300px; height: 300px; margin: 0 auto 30px; }
.portal-ring {
  position: absolute;
  inset: 0;
  animation: spin 70s linear infinite;
}
.portal-star {
  position: absolute;
  inset: 0;
  margin: auto;
  animation: starPulse 4s ease-in-out infinite;
  filter: drop-shadow(0 0 24px rgba(240, 200, 105, .6));
}
@keyframes spin { to { rotate: 360deg; } }
@keyframes starPulse { 0%, 100% { scale: 1; } 50% { scale: 1.09; } }
.finale-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(30px, 5vw, 52px);
  color: var(--cream);
  margin: 0 0 30px;
}

/* ── Pied de page ────────────────────────────────────────────── */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 40px) 36px;
  border-top: 1px solid rgba(212, 168, 67, .14);
  color: var(--muted);
  font-size: 14px;
}
.site-footer p { margin: 0; }
.site-footer nav { display: flex; gap: 22px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--gold-2); }

/* ── Apparitions au défilement ───────────────────────────────── */
/* Cachées uniquement quand JS est actif (html.js posé par script.js),
   pour que la page reste lisible sans JavaScript. */
html.js .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .7s ease var(--rd, 0s), transform .7s ease var(--rd, 0s);
}
html.js .reveal.in { opacity: 1; transform: none; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html.js .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .site-nav { display: none; }
  .features { grid-template-columns: 1fr 1fr; }
  .treasure { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 26px; }
  /* Les tuiles décoratives entrent en collision avec le contenu
     centré du héros entre 560 et 900px : on les réserve au desktop. */
  .ftile { display: none; }
}
@media (max-width: 560px) {
  .features { grid-template-columns: 1fr; }
  .hero { padding-top: 90px; }
  .btn-big { padding: 16px 26px; font-size: 17px; }
  .tile-heading { gap: 6px; }
  .tile-heading .tile {
    width: clamp(34px, 9.6vw, 53px);
    height: clamp(34px, 9.6vw, 53px);
    font-size: clamp(20px, 5.6vw, 31px);
    border-radius: 8px;
  }
  .tile-heading .tile sub { font-size: 9px; right: 4px; bottom: 3px; }
  .tile-heading .tile-space { width: 14px; }
  .portal { width: 220px; height: 220px; }
  .portal-ring { width: 220px; height: 220px; }
  .brand span { display: none; }
}
