/* Domaine Eckes — styles communs (menu, boutons, cartes de jeux, pied de page) */
:root {
  --ink: #12182b;
  --ink-soft: #5d6273;
  --line: #e4e1d8;
  --paper: #fbfaf6;
  --paper-2: #f2efe6;
  --blue: #2f4c9c;
  --navy: #14203f;
  --gold: #e8b26a;
  --red: #c94a4a;
  --green: #2e7d5b;
  --radius: 20px;
  --gutter: clamp(16px, 4vw, 48px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', system-ui, sans-serif; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
.wrap { max-width: 1280px; margin: 0 auto; padding-inline: var(--gutter); }
.eyebrow { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; padding: .8em 1.4em; border-radius: 999px; font-weight: 500; font-size: .95rem; text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: transform .2s, background .2s, color .2s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn-light { background: #fff; color: var(--ink); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-line { border-color: var(--line); background: transparent; }
.btn-line:hover { background: var(--paper-2); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- MENU : pilule flottante ---------- */
.nav { position: fixed; z-index: 50; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(760px, calc(100% - 32px)); height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 6px 0 20px; border-radius: 999px; color: #fff; background: transparent; border: 1px solid transparent; transition: background .35s, color .35s, border-color .35s, box-shadow .35s; }
.nav.is-solid { background: rgba(255,255,255,.9); color: var(--ink); border-color: var(--line); box-shadow: 0 8px 30px rgba(18,24,43,.08); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: .04em; font-size: 1rem; text-decoration: none; }
.brand img { width: 22px; }
.nav-links { display: flex; gap: 28px; list-style: none; }
.nav-links a { text-decoration: none; font-size: .88rem; opacity: .75; transition: opacity .2s; }
.nav-links a:hover, .nav-links a[aria-current] { opacity: 1; }
.nav-links a[aria-current] { font-weight: 600; }
.btn-nav { padding: .6em 1.1em; font-size: .85rem; background: #fff; color: var(--ink); }
.nav.is-solid .btn-nav { background: var(--ink); color: #fff; }
.nav-droite { display: flex; align-items: center; gap: 6px; }
/* Choix de la langue : petit menu déroulant dans la pilule */
.nav-langue { position: relative; }
.nav-langue summary { list-style: none; display: grid; place-items: center; min-width: 40px; height: 36px; padding: 0 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; letter-spacing: .06em; cursor: pointer; opacity: .8; transition: opacity .2s, background .2s; }
.nav-langue summary::-webkit-details-marker { display: none; }
.nav-langue summary:hover, .nav-langue[open] summary { opacity: 1; background: rgba(127,127,127,.14); }
.nav-langue-liste { position: absolute; top: calc(100% + 10px); right: 0; display: grid; min-width: 150px; padding: 6px; border-radius: 16px; background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(18,24,43,.14); animation: langue-arrive .2s ease-out; }
@keyframes langue-arrive { from { opacity: 0; transform: translateY(-4px); } }
.nav-langue-liste a { display: flex; justify-content: space-between; gap: 18px; padding: 9px 12px; border-radius: 10px; text-decoration: none; font-size: .88rem; }
.nav-langue-liste a::after { content: attr(title); color: var(--ink-soft); font-size: .82rem; }
.nav-langue-liste a:hover { background: var(--paper-2); }
.nav-langue-liste a[aria-current] { font-weight: 600; }
.menu-langues { display: flex; gap: 8px; margin-top: 10px; }
.menu-langues a { padding: .45em .9em; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; font-size: .9rem !important; text-decoration: none; opacity: .8; }
.menu-langues a[aria-current] { background: #fff; color: var(--navy); opacity: 1; text-decoration: none !important; }
.f-langues [aria-current] { color: var(--ink); font-weight: 600; }

/* Bandeau qui propose la langue du navigateur (pages en français) */
.bandeau-langue { position: fixed; z-index: 45; left: 50%; bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px)); transform: translateX(-50%); width: min(560px, calc(100% - 32px)); display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 20px; border-radius: 999px; background: var(--navy); color: #fff; box-shadow: 0 18px 40px rgba(18,24,43,.25); font-size: .92rem; animation: bandeau-arrive .5s cubic-bezier(.2,.7,.2,1) both; }
.bandeau-langue p { flex: 1; line-height: 1.35; }
.bandeau-langue .btn { padding: .55em 1.05em; font-size: .85rem; background: #fff; color: var(--ink); }
.bandeau-langue .fermer { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; font-size: 1.2rem; cursor: pointer; }
.bandeau-langue .fermer:hover { background: rgba(255,255,255,.2); }
@keyframes bandeau-arrive { from { opacity: 0; transform: translate(-50%, 20px); } }
@media (max-width: 560px) { .bandeau-langue { border-radius: 22px; flex-wrap: wrap; padding: 14px 14px 14px 18px; } .bandeau-langue p { flex-basis: calc(100% - 50px); } }
.burger { display: none; background: none; border: 0; color: inherit; width: 44px; height: 44px; cursor: pointer; }
.burger span { display: block; width: 22px; height: 2px; background: currentColor; margin: 5px auto; border-radius: 2px; }
.mobile-menu { position: fixed; inset: 0; z-index: 60; background: var(--navy); color: #fff; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 22px; padding: var(--gutter); transform: translateY(-100%); transition: transform .45s cubic-bezier(.7,0,.2,1); }
.mobile-menu[hidden] { display: none; }
.mobile-menu.open { transform: none; }
.mobile-menu a:not(.btn) { font-size: 2rem; text-decoration: none; font-weight: 500; opacity: .8; }
.mobile-menu a[aria-current] { opacity: 1; text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }
.mobile-menu .close { position: absolute; top: calc(16px + env(safe-area-inset-top)); right: 16px; background: none; border: 0; color: #fff; font-size: 2rem; width: 48px; height: 48px; cursor: pointer; }

/* ---------- HÉROS SOMBRE AVEC MOT GÉANT ---------- */
.hero-dark { position: relative; height: 78vh; height: 78svh; min-height: 480px; overflow: hidden; background: var(--navy); color: #fff; }
.hero-dark canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-dark::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 40%, transparent 0%, rgba(20,32,63,.55) 75%), linear-gradient(180deg, rgba(20,32,63,.5), transparent 30%); }
.hero-word { position: absolute; z-index: 2; left: 0; right: 0; bottom: -0.11em; text-align: center; font-weight: 500; font-size: 30.5vw; line-height: .8; letter-spacing: -.055em; white-space: nowrap; color: var(--paper); user-select: none; pointer-events: none; }
.hero-intro { position: absolute; z-index: 3; left: var(--gutter); top: 34%; max-width: 340px; }
.hero-intro h1 { font-size: clamp(1.4rem, 2.4vw, 2rem); font-weight: 500; letter-spacing: -.02em; line-height: 1.15; }
.hero-intro p { margin-top: 12px; opacity: .75; line-height: 1.55; }
.hero-score { position: absolute; z-index: 3; right: var(--gutter); top: 34%; text-align: right; font-size: .8rem; opacity: .7; font-variant-numeric: tabular-nums; }
.hero-score b { display: block; font-size: 1.8rem; font-weight: 500; opacity: 1; }

/* ---------- ANIMATION D'ARRIVÉE ----------
   Les lettres du mot géant montent une à une, de gauche à droite (découpage fait par eckes.js).
   Les états de départ sont dans les @keyframes (fill-mode both) : si les animations sont
   désactivées (mouvements réduits), tout s'affiche directement dans sa position finale. */
.hero-word { animation: mot-secours .01s 1.2s both; }   /* sans JavaScript : le mot apparaît quand même */
.hero-word.lettres { animation: none; }
.hero-word .l { display: inline-block; animation: lettre-monte .95s cubic-bezier(.2,.75,.2,1) both; animation-delay: calc(120ms + var(--i) * 75ms); }
@keyframes mot-secours { from { opacity: 0; } }
@keyframes lettre-monte { from { opacity: 0; transform: translateY(42%); } }
.nav { animation: nav-arrive .8s cubic-bezier(.2,.75,.2,1) .35s both; }
@keyframes nav-arrive { from { opacity: 0; transform: translate(-50%, -14px); } }

/* ---------- CARTES DE JEUX ---------- */
.game { text-decoration: none; display: block; }
.tile-g { position: relative; aspect-ratio: 1; border-radius: var(--radius); background: var(--navy); overflow: hidden; transition: transform .4s cubic-bezier(.2,.7,.2,1); }
.game:hover .tile-g { transform: translateY(-4px); }
.tile-g canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.g-num { position: absolute; left: 16px; top: 14px; font-size: .78rem; color: rgba(255,255,255,.55); font-variant-numeric: tabular-nums; }
.g-play { position: absolute; right: 14px; bottom: 14px; background: #fff; color: var(--ink); font-size: .82rem; font-weight: 500; padding: 7px 14px; border-radius: 999px; opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; }
.game:hover .g-play, .game:focus-visible .g-play { opacity: 1; transform: none; }
.game .row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; font-size: 1rem; }
.game .row b { font-weight: 500; }
.game .row span { color: var(--ink-soft); font-size: .85rem; }
.g-desc { color: var(--ink-soft); font-size: .88rem; margin-top: 4px; }

/* ---------- PARTIE RAPIDE (SNAKE) ---------- */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 96px); align-items: center; }
.quick h2 { font-size: clamp(2rem, 4.2vw, 3.6rem); font-weight: 500; letter-spacing: -.035em; line-height: 1.04; margin-top: 14px; }
.quick-text > p:not(.eyebrow) { color: var(--ink-soft); line-height: 1.65; margin-top: 18px; max-width: 420px; }
.quick-scores { display: flex; gap: 12px; margin: 28px 0; }
.quick-scores div { min-width: 120px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 16px; }
.quick-scores small { display: block; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.quick-scores b { display: block; margin-top: 4px; font-size: 1.8rem; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.quick-board { position: relative; aspect-ratio: 1; border-radius: calc(var(--radius) + 6px); background: var(--navy); overflow: hidden; box-shadow: 0 30px 60px rgba(18,24,43,.18); }
.quick-board canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; outline: none; }
.quick-board canvas:focus-visible { box-shadow: inset 0 0 0 3px var(--gold); }
.quick-start { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 1em 2.2em; border-radius: 999px; border: 0; background: #fff; color: var(--ink); font-weight: 500; cursor: pointer; box-shadow: 0 12px 30px rgba(0,0,0,.25); transition: transform .2s; }
.quick-start:hover { transform: translate(-50%, -50%) scale(1.04); }
.quick-start[hidden] { display: none; }
.dpad { display: none; position: absolute; right: 12px; bottom: 12px; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(2, 40px); gap: 6px; }
.dpad button { border: 0; border-radius: 10px; background: rgba(255,255,255,.14); color: #fff; font-size: 1.1rem; cursor: pointer; }
.dpad [data-dir="up"] { grid-column: 2; grid-row: 1; }
.dpad [data-dir="left"] { grid-column: 1; grid-row: 2; }
.dpad [data-dir="down"] { grid-column: 2; grid-row: 2; }
.dpad [data-dir="right"] { grid-column: 3; grid-row: 2; }
@media (hover: none) { .dpad { display: grid; } .g-play { opacity: 1; transform: none; } }

/* ---------- PHOTO DE FIN EN FONDU ---------- */
.fade-photo { position: relative; height: clamp(260px, 42vw, 520px); background: url('/documents/images/phare.webp') center 40% / cover; }
@media (orientation: landscape) { .fade-photo { height: clamp(200px, 26vw, 370px); } }   /* écran à l'horizontale : photo moins haute */
.fade-photo::before, .fade-photo::after { content: ''; position: absolute; left: 0; right: 0; height: 45%; pointer-events: none; }
.fade-photo::before { top: 0; background: linear-gradient(var(--paper), rgba(251,250,246,0)); }
.fade-photo::after { bottom: 0; background: linear-gradient(rgba(251,250,246,0), var(--paper)); }

/* ---------- PIED DE PAGE ---------- */
.site-footer { padding-block: 40px calc(28px + env(safe-area-inset-bottom)); }
.f-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.f-grid p { color: var(--ink-soft); font-size: .9rem; line-height: 1.6; max-width: 300px; margin-top: 12px; }
.f-grid h3 { font-size: .8rem; font-weight: 500; color: var(--ink-soft); margin-bottom: 14px; }
.f-grid ul { list-style: none; display: grid; gap: 10px; }
.f-grid a { text-decoration: none; font-size: .92rem; }
.f-grid a:hover { color: var(--blue); }
.f-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .82rem; }

/* ---------- APPARITIONS ---------- */
.appear { opacity: 0; transform: translateY(24px); transition: opacity .9s, transform .9s cubic-bezier(.2,.7,.2,1); }
.appear.in { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .nav-links, .nav-droite { display: none; }
  .burger { display: block; }
  .nav { width: calc(100% - 24px); padding-right: 4px; }
  .quick { grid-template-columns: 1fr; }
  .f-grid { grid-template-columns: 1fr 1fr; }
  .f-grid > :first-child { grid-column: 1 / -1; }
  .hero-intro { top: auto; bottom: 36vw; }
  .hero-score { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .appear { opacity: 1; transform: none; }
}

/* ---------- Bouton « remonter en haut » ---------- */
.haut { position: fixed; z-index: 40; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px)); width: 52px; height: 52px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; color: var(--ink); cursor: pointer;
  background: conic-gradient(var(--ink) calc(var(--p, 0) * 360deg), var(--line) 0) border-box;   /* contour = progression dans la page */
  box-shadow: 0 12px 30px rgba(18,24,43,.16); opacity: 0; transform: translateY(16px) scale(.9); pointer-events: none; transition: opacity .35s, transform .45s cubic-bezier(.2,.7,.2,1); }
.haut::before { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.haut svg { position: relative; width: 22px; height: 22px; transition: transform .3s cubic-bezier(.2,.7,.2,1); }
.haut.visible { opacity: 1; transform: none; pointer-events: auto; }
.haut:hover svg { transform: translateY(-3px); }
.haut:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .haut { transition: opacity .2s; transform: none; } }
@media print { .haut { display: none; } }
.avec-bandeau .haut { bottom: max(96px, calc(env(safe-area-inset-bottom) + 88px)); }
@media (max-width: 560px) { .avec-bandeau .haut { bottom: max(140px, calc(env(safe-area-inset-bottom) + 132px)); } }
.hero-word.mot-long { font-size: 22vw; }
