/*
 * Site de Smile Defense : l'accueil, d'un seul écran et sans défilement, dans les rayons des écrans de fin du jeu, et les
 * pages de texte (confidentialité, assistance, page introuvable). Hypercasual : rond, saturé, et une seule chose à lire.
 */
:root {
  --blue: #0d7af5;
  --blue-light: #2bb0ff;
  --blue-deep: #0a3fa8;
  --night: #0e1130;
  --yellow: #ffd23f;
  --cream: #fff8e6;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

/* Une langue à la fois : l'anglais sans JavaScript, sinon celle de lang.js. */
html:not([data-lang="fr"]) body [lang="fr"],
html[data-lang="fr"] body [lang="en"] {
  display: none !important;
}

.lang-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(14, 17, 48, 0.45);
  color: var(--cream);
}

.lang-switch button {
  min-width: 44px;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: inherit;
  font: 800 0.8rem/1 var(--font);
  letter-spacing: 0.06em;
  cursor: pointer;
}

.lang-switch button[aria-pressed="true"] {
  background: var(--yellow);
  color: var(--night);
}

.lang-switch button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Accueil ---------- */

body.landing {
  --footer: 46px;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  background: var(--blue-deep);
  color: var(--cream);
  font-family: var(--font);
}

/* Le fond coupe ce qui dépasse : sans lui, les rayons agrandiraient la page. */
.backdrop {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Les rayons tournent lentement autour du téléphone. Assez grands pour couvrir l'écran à tout angle. */
.rays {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 64%;
  width: 260vmax;
  height: 260vmax;
  margin: -130vmax 0 0 -130vmax;
  background: repeating-conic-gradient(var(--blue-light) 0deg 11.25deg, var(--blue) 11.25deg 22.5deg);
  animation: turn 120s linear infinite;
  pointer-events: none;
}

.vignette {
  position: absolute;
  z-index: 0;
  inset: 0;
  background: radial-gradient(circle at 64% 50%, rgba(153, 230, 255, 0.55) 0, rgba(153, 230, 255, 0) 45vmin, rgba(10, 63, 168, 0) 60vmax, rgba(10, 63, 168, 0.75) 100vmax);
  pointer-events: none;
}

@keyframes turn {
  to {
    transform: rotate(360deg);
  }
}

.topbar {
  position: absolute;
  z-index: 3;
  top: max(14px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
}

.stage {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(16px, 3vw, 56px);
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) clamp(16px, 4vw, 56px) 16px;
}

.pitch {
  min-width: 0;
  text-align: center;
}

.wordmark {
  margin: 0;
  line-height: 0;
}

.wordmark img {
  width: min(100%, 560px, 62vh);
  height: auto;
  filter: drop-shadow(0 10px 18px rgba(10, 30, 110, 0.45));
}

.tagline {
  margin: 0.45em 0 0;
  color: #fff;
  font-size: clamp(1.4rem, min(3.2vw, 4.6vh), 2.5rem);
  font-weight: 900;
  line-height: 1.1;
  text-shadow: 0 3px 0 rgba(10, 30, 110, 0.7), 0 6px 18px rgba(10, 30, 110, 0.45);
}

.blurb {
  max-width: 31em;
  margin: 0.8em auto 0;
  font-size: clamp(0.98rem, min(1.6vw, 2.5vh), 1.2rem);
  font-weight: 650;
  line-height: 1.42;
  text-shadow: 0 2px 8px rgba(10, 30, 110, 0.75);
}

.soon {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: clamp(12px, 2.6vh, 26px) 0 0;
  padding: 0.62em 1.2em;
  border: 3px solid #0a1040;
  border-radius: 999px;
  background: var(--yellow);
  box-shadow: 0 5px 0 #0a1040;
  color: #0a1040;
  font-size: clamp(0.95rem, min(1.7vw, 2.5vh), 1.2rem);
  font-weight: 900;
  text-wrap: balance;
}

.squad {
  display: flex;
  justify-content: center;
  gap: clamp(4px, 1vw, 14px);
  margin: clamp(10px, 2.4vh, 26px) 0 0;
  padding: 0;
  list-style: none;
}

.squad img {
  display: block;
  width: auto;
  height: clamp(52px, 11vh, 112px);
  max-width: 24vw;
  object-fit: contain;
  filter: drop-shadow(0 6px 8px rgba(10, 30, 110, 0.45));
  animation: bob 2.8s ease-in-out infinite;
}

.squad li:nth-child(2) img {
  animation-delay: -0.7s;
}

.squad li:nth-child(3) img {
  animation-delay: -1.4s;
}

.squad li:nth-child(4) img {
  animation-delay: -2.1s;
}

@keyframes bob {
  50% {
    transform: translateY(-7px);
  }
}

.showcase {
  position: relative;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Le téléphone n'a rien d'un appareil précis : un cadre arrondi, au format des captures. */
.phone {
  position: relative;
  height: min(100%, 860px);
  aspect-ratio: 1206 / 2622;
  max-width: 100%;
  overflow: hidden;
  border: clamp(5px, 0.9vh, 9px) solid #0a1040;
  border-radius: clamp(20px, 4.4vh, 44px);
  background: #0a1040;
  box-shadow: 0 18px 40px rgba(10, 30, 110, 0.55);
}

.phone img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  animation: slide 22.5s linear infinite;
}

.phone img:nth-child(1) {
  animation-delay: -0.6s;
}

.phone img:nth-child(2) {
  animation-delay: 3.9s;
}

.phone img:nth-child(3) {
  animation-delay: 8.4s;
}

.phone img:nth-child(4) {
  animation-delay: 12.9s;
}

.phone img:nth-child(5) {
  animation-delay: 17.4s;
}

/* Cinq captures, 4,5 s chacune, dont 0,6 s de fondu. La première part déjà visible : son délai négatif saute son fondu d'entrée. */
@keyframes slide {
  0% {
    opacity: 0;
  }
  2.7% {
    opacity: 1;
  }
  20% {
    opacity: 1;
  }
  22.7% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

.cannon {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 3%;
  width: clamp(110px, 28vh, 270px);
  height: auto;
  margin-left: calc(-1 * clamp(130px, 37.8vh, 370px));
  filter: drop-shadow(0 10px 14px rgba(10, 30, 110, 0.5));
  pointer-events: none;
}

.landing footer {
  position: relative;
  z-index: 2;
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 6px;
  min-height: var(--footer);
  padding: 0 16px env(safe-area-inset-bottom);
  background: var(--night);
  font-size: 0.9rem;
  font-weight: 650;
}

.landing footer a {
  padding: 8px;
  color: rgba(255, 248, 230, 0.9);
  text-decoration: none;
}

.landing footer a:hover {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Téléphone et tablette en portrait : le texte en haut, le téléphone dessous, coupé par le pied de page sur les petits écrans. */
@media (max-width: 1100px) and (orientation: portrait) {
  .rays {
    top: 66%;
    left: 50%;
  }

  .vignette {
    background: radial-gradient(circle at 50% 66%, rgba(153, 230, 255, 0.55) 0, rgba(153, 230, 255, 0) 45vmin, rgba(10, 63, 168, 0) 60vmax, rgba(10, 63, 168, 0.75) 100vmax);
  }

  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
    padding-top: calc(max(14px, env(safe-area-inset-top)) + 46px);
    padding-bottom: 0;
  }

  .wordmark img {
    width: min(70vw, 25vh);
  }

  .tagline {
    margin-top: 0.3em;
    font-size: clamp(1.15rem, min(6vw, 3vh), 1.7rem);
  }

  .blurb,
  .squad {
    display: none;
  }

  .soon {
    margin-top: 10px;
    font-size: clamp(0.85rem, min(3.8vw, 2vh), 1.05rem);
    box-shadow: 0 4px 0 #0a1040;
  }

  .showcase {
    align-items: flex-start;
    overflow: hidden;
    margin: 0 -16px;
    padding-top: 6px;
  }

  .phone {
    height: auto;
    width: min(62vw, 30vh);
  }

  .cannon {
    bottom: 0;
    width: clamp(92px, 29vw, 160px);
    margin-left: calc(-1 * (min(31vw, 15vh) + 0.62 * clamp(92px, 29vw, 160px)));
  }
}

/* Écrans bas et larges (téléphone couché, petite fenêtre) : l'essentiel. */
@media (max-height: 560px) and (min-width: 520px) {
  .blurb,
  .squad,
  .cannon {
    display: none;
  }

  .wordmark img {
    width: min(100%, 300px, 54vh);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rays,
  .squad img {
    animation: none;
  }

  .phone img {
    animation: none;
  }

  .phone img:first-child {
    opacity: 1;
  }
}

/* ---------- Pages de texte ---------- */

body.paper {
  --bg: #e9f4ff;
  --surface: #fff;
  --ink: #101a44;
  --ink-soft: #4d5a84;
  --line: #c8dcf3;
  --accent: #0a5fd0;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  body.paper {
    --bg: #0b0f2c;
    --surface: #141a40;
    --ink: #eef1ff;
    --ink-soft: #aab2e0;
    --line: #2c3160;
    --accent: #6cc8ff;
  }
}

.paper main {
  max-width: 720px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px 64px;
}

.paper .masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.paper .home {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font: 900 1.25rem/1 var(--font);
  text-decoration: none;
}

.paper .home img {
  width: 40px;
  height: 40px;
  border-radius: 22%;
}

.paper .lang-switch {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.paper .lang-switch button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
}

.paper article {
  margin-top: 20px;
  padding: 24px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.paper h1 {
  margin: 0 0 4px;
  font: 900 1.9rem/1.2 var(--font);
}

.paper h2 {
  margin: 26px 0 4px;
  font: 800 1.08rem/1.3 var(--font);
}

.paper p,
.paper ul {
  margin: 8px 0;
}

.paper ul {
  padding-left: 1.2em;
}

.paper a {
  color: var(--accent);
  text-underline-offset: 3px;
}

.paper .meta {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.paper .short {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--bg);
}

.paper .lost {
  margin: 48px 0 0;
  text-align: center;
}

.paper .lost img {
  width: min(70vw, 280px);
  height: auto;
}
