/* ------------------------------------------------------------------
   PULSAR — feuille de style commune du site public
   Identité reprise de src/ui/tokens.ts : papier crème, encre noire,
   orange chaud, ombres « sticker » dures, bordures épaisses.
   ------------------------------------------------------------------ */

@font-face { font-display: swap; }

:root {
  /* Surfaces */
  --ink: #1E1A17;
  --cream: #FAF6EF;
  --cream-deep: #EDE8DF;
  --muted: #D9D3C8;
  --muted-fg: #5A4E44;

  /* Marque */
  --primary: #E86830;
  --orange-soft: #F5A055;
  --secondary: #C83B2F;
  --accent: #F5C518;
  --azur: #7AB8D8;
  --menthe: #7DC4A0;
  --violet: #B090C8;

  /* Couleur de la 1re paire de Sondes — SONDE_COLORS[0] (src/hooks/useSonde.ts).
     Partagée par la case d'entrée et la case de sortie d'une même émergence. */
  --sonde-1: #e8635a;

  /* Typo */
  --display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --body: 'Instrument Sans', 'Avenir Next', 'Segoe UI', Helvetica, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Rythme */
  --radius: 18px;
  --radius-sm: 10px;
  --border: 3px solid var(--ink);
  --shadow: 6px 6px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --maxw: 1080px;
  --readw: 68ch;
}

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background-color: var(--cream);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: -0.005em;
  overflow-x: hidden;
}

/* Grain + halo stellaire discret, purement décoratifs */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1px 1px at 12% 18%, rgba(30,26,23,.30) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 8%,  rgba(30,26,23,.22) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 62% 42%, rgba(232,104,48,.35) 50%, transparent 51%),
    radial-gradient(1px 1px at 30% 72%, rgba(30,26,23,.20) 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 64%, rgba(30,26,23,.26) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 45% 92%, rgba(245,197,24,.45) 50%, transparent 51%),
    radial-gradient(120% 80% at 50% -10%, #FFFDF8 0%, var(--cream) 55%);
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .30;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

/* ── Typographie ─────────────────────────────────────────────────── */

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  font-variation-settings: 'SOFT' 20, 'WONK' 1, 'opsz' 40;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 .5em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h3 { font-size: clamp(1.15rem, 2.2vw, 1.45rem); }
h4 { font-size: 1.05rem; letter-spacing: 0; }

p { margin: 0 0 1.1em; }
a { color: var(--secondary); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--primary); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

strong { font-weight: 600; }

.eyebrow {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted-fg);
  margin: 0 0 1rem;
}

.lede { font-size: 1.2rem; color: var(--muted-fg); max-width: var(--readw); }

/* ── Structure ───────────────────────────────────────────────────── */

.wrap { width: min(100% - 2.5rem, var(--maxw)); margin-inline: auto; }
.narrow { width: min(100% - 2.5rem, 780px); margin-inline: auto; }

section { padding: clamp(3rem, 8vw, 6rem) 0; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--cream);
  padding: .7rem 1.1rem;
  z-index: 99;
}
.skip:focus { left: 1rem; top: 1rem; }

/* ── En-tête ─────────────────────────────────────────────────────── */

.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
  background: rgba(250, 246, 239, .82);
  border-bottom: 3px solid var(--ink);
}

.site-head .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .75rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.28rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}

.brand .mark {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid var(--ink);
  box-shadow: 0 0 0 4px rgba(232, 104, 48, .18);
  flex: none;
}

.site-nav {
  margin-left: auto;
  display: flex;
  gap: 1.1rem;
  align-items: center;
  font-size: .95rem;
}

.site-nav a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
}
.site-nav a:hover,
.site-nav a[aria-current='page'] { border-bottom-color: var(--primary); }

/* ── Boutons ─────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--body);
  font-weight: 600;
  font-size: 1rem;
  padding: .85rem 1.5rem;
  border: var(--border);
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translate(2px, 2px); box-shadow: 3px 3px 0 var(--ink); color: #fff; }
.btn:active { transform: translate(6px, 6px); box-shadow: 0 0 0 var(--ink); }

/* Badge App Store officiel : le seul vrai CTA de la page. Les règles
   d'Apple interdisent de retoucher l'artwork (pas de bordure, d'ombre ni de
   rotation ajoutées) et imposent une hauteur ≥ 40 px et une marge libre d'au
   moins ¼ de la hauteur autour — d'où le padding. Seul retour au survol :
   un léger décalage, l'image elle-même reste intacte. */
.store-badge {
  display: inline-block;
  padding: .85rem .85rem .85rem 0;
  line-height: 0;
  border-radius: 12px;
  transition: transform .12s ease;
}
.store-badge img { display: block; height: 54px; width: auto; }
.store-badge:hover { transform: translateY(-2px); }
.store-badge:focus-visible { outline: 3px solid var(--primary); outline-offset: -4px; }

/* « Comment on joue ? » est une aide secondaire, pas l'action qu'on veut :
   le badge App Store juste à côté est le seul vrai CTA. Un ghost plein
   (bordure + fond + ombre dure) lui ferait concurrence — deux pôles d'attention
   côte à côte. Ici : lien souligné, sans fond ni ombre, un cran sous le
   bouton plein dans la hiérarchie. */
.btn.ghost {
  background: none;
  border: none;
  box-shadow: none;
  padding: .5rem .1rem;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--muted-fg);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.btn.ghost:hover,
.btn.ghost:focus-visible {
  background: none;
  box-shadow: none;
  color: var(--secondary);
  text-decoration-color: var(--secondary);
  transform: translateX(3px);
}
.btn.ghost:active { transform: translateX(5px); }

.btn-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 1.3em;
  height: 1.3em;
  border-radius: 50%;
  border: 2px solid currentColor;
  color: inherit;
  font-family: var(--mono);
  font-weight: 700;
  font-size: .8em;
}

/* ── Liste d'attente ─────────────────────────────────────────────── */

/* Sans JavaScript le formulaire ne peut rien envoyer : il est masqué et un
   <noscript> renvoie vers l'adresse de contact. Les trois règles sont écrites
   dans cet ordre — la dernière doit primer pour les langues inactives. */
.waitlist { display: none; }
.js .waitlist { display: block; }
.waitlist[hidden] { display: none; }

.waitlist { margin-top: 1.7rem; max-width: 32rem; }
.waitlist-head { margin: 0 0 .7rem; }
/* Bouton de la liste Android : crème, pas orange — il reste un cran sous le
   badge App Store, seul CTA plein de la page. */
.btn.quiet { background: var(--cream); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn.quiet:hover { color: var(--ink); box-shadow: 1px 1px 0 var(--ink); }

.waitlist-row { display: flex; flex-wrap: wrap; gap: .7rem; }

/* Sous cette largeur le bouton passe sous le champ : autant qu'il en fasse
   toute la largeur plutôt que de rester orphelin à gauche. */
@media (max-width: 460px) {
  .waitlist-row { flex-direction: column; }
  .waitlist-row .btn { justify-content: center; }
}

.waitlist input[type='email'] {
  flex: 1 1 15rem;
  min-width: 0;
  font-family: var(--body);
  font-size: 1rem;
  padding: .85rem 1.3rem;
  border: var(--border);
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.waitlist input[type='email']::placeholder { color: var(--muted-fg); opacity: 1; }

.waitlist button[disabled] {
  opacity: .55;
  cursor: progress;
  transform: none;
  box-shadow: var(--shadow);
}

/* Le champ leurre n'est pas `display: none` : un robot ignore ce qui est
   masqué, et c'est justement lui qu'on veut voir le remplir. */
.waitlist .trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.waitlist-note {
  margin: .7rem 0 0;
  font-size: .82rem;
  line-height: 1.5;
  color: var(--muted-fg);
}

/* Hauteur réservée : le message d'état s'affiche sans décaler ce qui suit. */
.waitlist-status {
  display: block;
  min-height: 1.5em;
  margin: .6rem 0 0;
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .05em;
  line-height: 1.5;
  color: var(--muted-fg);
}
/* Vert soutenu plutôt que --menthe, illisible sur le crème. Défini ici et non
   dans la palette : celle-ci recopie src/ui/tokens.ts, où le site n'a rien à
   ajouter. */
.waitlist-status.is-ok { color: #2F6F4F; font-weight: 600; }
.waitlist-status.is-error { color: var(--secondary); font-weight: 600; }

/* ── Cartes sticker ──────────────────────────────────────────────── */

.card {
  background: var(--cream);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.6rem;
}

.grid { display: grid; gap: 1.4rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* Pilule + bordure encre + ombre dure = exactement le langage visuel des
   .btn juste à côté. Bordure en tirets et coins carrés (var(--radius-sm))
   cassent la silhouette « bouton » pour que ce badge lise comme un état,
   pas comme une action possible. */
/* Ton en retrait (bordure fine, fond neutre, texte muted-fg) : c'est une
   information de statut (« Android : bientôt »), elle ne doit pas parler
   plus fort que le badge App Store au-dessus. Seule l'icône garde une
   touche de couleur chaude. */
.tag {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .3rem .6rem .3rem .5rem;
  border: 1.5px dashed var(--muted-fg);
  border-radius: var(--radius-sm);
  background: var(--cream-deep);
  color: var(--muted-fg);
  rotate: -1.2deg;
}
.tag svg { flex: none; color: var(--primary); }
.tag .tick {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: tagTick 2.6s ease-in-out infinite;
}
@keyframes tagTick {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-35deg); }
}

/* ── Sélecteur de langue ─────────────────────────────────────────── */

.lang {
  display: inline-flex;
  margin-bottom: 2.2rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  background: var(--cream);
  box-shadow: var(--shadow-sm);
}

.lang button {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .4rem .8rem;
  border: 0;
  background: transparent;
  color: var(--muted-fg);
  cursor: pointer;
}
.lang button + button { border-left: 2px solid var(--ink); }
.lang button[aria-pressed='true'] { background: var(--ink); color: var(--cream); }

[data-lang][hidden] { display: none; }

/* Dans l'en-tête, le sélecteur est un élément de barre : la marge basse ne
   vaut que sur les pages de texte, où il précède le contenu. */
.site-head .lang { margin-bottom: 0; }

/* ── Pages de texte légal / support ──────────────────────────────── */

.doc { padding-top: clamp(2rem, 5vw, 3.5rem); }

.doc-head {
  border-bottom: 3px solid var(--ink);
  padding-bottom: 1.5rem;
  margin-bottom: 2.5rem;
}

.doc h2 {
  margin-top: 2.8rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  scroll-margin-top: 6rem;
}

.doc h2::before {
  content: '';
  display: block;
  width: 46px;
  height: 4px;
  background: var(--primary);
  margin-bottom: .9rem;
}

.doc h3 { margin-top: 1.8rem; font-size: 1.1rem; }
.doc ul, .doc ol { padding-left: 1.2rem; margin: 0 0 1.2em; }
.doc li { margin-bottom: .45em; }
.doc p, .doc li { max-width: var(--readw); }

.meta {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--muted-fg);
  letter-spacing: .04em;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.6em;
  font-size: .93rem;
  background: var(--cream);
  border: var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
th, td { text-align: left; padding: .7rem .85rem; border-bottom: 2px solid var(--muted); vertical-align: top; }
th { background: var(--cream-deep); font-weight: 600; }
tr:last-child td { border-bottom: 0; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.callout {
  border: var(--border);
  border-left-width: 10px;
  border-radius: var(--radius-sm);
  background: #FFF9EC;
  padding: 1.1rem 1.25rem;
  margin: 1.6rem 0;
}
.callout p:last-child { margin-bottom: 0; }

details {
  border: var(--border);
  border-radius: var(--radius-sm);
  background: var(--cream);
  box-shadow: var(--shadow-sm);
  padding: .9rem 1.1rem;
  margin-bottom: .9rem;
}
details[open] { background: #FFFDF8; }
summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 1.02rem;
  list-style: none;
  display: flex;
  gap: .7rem;
  align-items: flex-start;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: '+';
  font-family: var(--mono);
  color: var(--primary);
  font-weight: 700;
  flex: none;
}
details[open] summary::before { content: '–'; }
details > *:not(summary) { margin-top: .8rem; }

/* ── Pied de page ────────────────────────────────────────────────── */

.site-foot {
  border-top: 3px solid var(--ink);
  background: var(--cream-deep);
  padding: 2.5rem 0 3rem;
  margin-top: 3rem;
}

.site-foot .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
}

.site-foot nav { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.site-foot a { color: var(--ink); }
.site-foot .meta { margin: 0; }

/* ── Utilitaires ─────────────────────────────────────────────────── */

.center { text-align: center; }
.stack > * + * { margin-top: 1rem; }
.mono { font-family: var(--mono); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ══════════════════════════════════════════════════════════════════
   Décor — assets du jeu (logo, planètes, astéroïdes, constellations)
   ══════════════════════════════════════════════════════════════════ */

/* ── Logo tampon : fond qui rebondit puis les 6 lettres ──────────── */

.logo-stamp {
  position: relative;
  width: min(100%, 520px);
  aspect-ratio: 1164 / 280;
  margin: 0 0 1.4rem;
}
.logo-stamp img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.logo-stamp .bg { animation: pop .5s cubic-bezier(.2,1.4,.4,1) backwards; }
.logo-stamp .ltr { animation: stamp .42s cubic-bezier(.2,1.3,.35,1) backwards; }
.logo-stamp .ltr:nth-of-type(2) { animation-delay: .35s; }
.logo-stamp .ltr:nth-of-type(3) { animation-delay: .50s; }
.logo-stamp .ltr:nth-of-type(4) { animation-delay: .65s; }
.logo-stamp .ltr:nth-of-type(5) { animation-delay: .80s; }
.logo-stamp .ltr:nth-of-type(6) { animation-delay: .95s; }
.logo-stamp .ltr:nth-of-type(7) { animation-delay: 1.10s; }

@keyframes pop   { 0% { opacity: 0; transform: scale(.2) } 70% { opacity: 1; transform: scale(1.06) } 100% { transform: scale(1) } }
@keyframes stamp { 0% { opacity: 0; transform: scale(1.7) rotate(-7deg) } 65% { opacity: 1; transform: scale(.94) rotate(1.5deg) } 100% { transform: scale(1) rotate(0) } }

.brand img { height: 22px; width: auto; display: block; }

/* ── Objets flottants (astéroïdes, éclats, étoiles) ──────────────── */

.floaters {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.floaters + * { position: relative; z-index: 1; }

.float { position: absolute; will-change: transform; }

/* Sous cette largeur, la colonne de texte occupe toute la page :
   le décor flottant passerait sous les paragraphes. */
@media (max-width: 1140px) { .floaters { display: none; } }
.float img {
  display: block;
  width: 100%;
  height: auto;
  animation: bob var(--dur, 7s) ease-in-out var(--delay, 0s) infinite;
  filter: drop-shadow(3px 3px 0 rgba(30, 26, 23, .14));
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-16px) rotate(7deg); }
}

.spin img { animation: spin var(--dur, 26s) linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Planètes : texture du jeu, défilement lent, bord encré ──────── */

.orb {
  border-radius: 50%;
  border: 3px solid var(--ink);
  background-repeat: repeat-x;
  background-size: auto 100%;
  box-shadow: inset -7px -9px 0 rgba(30, 26, 23, .22), 4px 4px 0 var(--ink);
  animation: drift 16s linear infinite;
  flex: none;
}
@keyframes drift { to { background-position: -260px 0; } }

.orb.p1 { background-image: url('/assets/img/planets/planet1.jpg'); }
.orb.p2 { background-image: url('/assets/img/planets/planet2.jpg'); }
.orb.p3 { background-image: url('/assets/img/planets/planet3.jpg'); }
.orb.p4 { background-image: url('/assets/img/planets/planet4.jpg'); }
.orb.p5 { background-image: url('/assets/img/planets/planet5.jpg'); }

/* ── Plaque de constellation ─────────────────────────────────────── */

.const-plate {
  border: 3px solid currentColor;
  border-radius: var(--radius-sm);
  background: #FFFDF8;
  overflow: hidden;
  aspect-ratio: 393 / 470;
}
.const-plate img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.2) contrast(1.08);
}

.watermark {
  position: absolute;
  pointer-events: none;
  opacity: .5;
  mix-blend-mode: multiply;
}

/* ── Icônes d'aides ──────────────────────────────────────────────── */

.hint-icon {
  width: 72px;
  height: 72px;
  display: block;
  margin-bottom: .9rem;
  filter: drop-shadow(3px 3px 0 rgba(30, 26, 23, .18));
}
.hint-icon.sm { width: 34px; height: 34px; margin: 0; }

summary .hint-icon.sm { margin-top: -2px; }

/* ── Listes à puce « éclat » ─────────────────────────────────────── */

.shard-list { list-style: none; padding-left: 0; }
.shard-list li {
  padding-left: 2rem;
  background: url('/assets/img/shard.svg') left .25em / 1.05rem auto no-repeat;
}

/* ── Révélation au défilement ────────────────────────────────────── */

.js .reveal { opacity: 0; transform: translateY(26px); }
.js .reveal.in {
  opacity: 1;
  transform: none;
  transition: opacity .7s cubic-bezier(.2,.7,.3,1), transform .7s cubic-bezier(.2,.7,.3,1);
}
.js .reveal.d1.in { transition-delay: .08s }
.js .reveal.d2.in { transition-delay: .16s }
.js .reveal.d3.in { transition-delay: .24s }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; }
  .float img, .orb, .logo-stamp img { animation: none !important; }
}
