:root {
  --bg: #11151f;
  --fg: #f1f4fa;
  --muted: #8b95aa;
  --splash-bg: #fff;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

body.intro { overflow: hidden; }

/* ---------- Splash ---------- */
#splash {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center;
  background: var(--splash-bg);
  perspective: 900px;
  overflow: hidden;
  animation: splash-bg 4.6s ease-in-out forwards;
}
.splash-logo {
  width: min(60vmin, 460px);
  height: auto;
  transform-origin: center;
  /* arrive du fond (0-1.2s), reste 2s (1.2-3.2s), repart au fond (3.2-4.4s) */
  mix-blend-mode: multiply; /* fond blanc du logo fondu dans le fond du splash */
  animation: logo 4.4s cubic-bezier(.22,.8,.3,1) forwards;
  will-change: transform, opacity, filter;
}
@keyframes logo {
  0%   { transform: translateZ(-700px) scale(.35); opacity: 0; filter: blur(10px); }
  27%  { transform: translateZ(0) scale(1); opacity: 1; filter: blur(0); }
  73%  { transform: translateZ(0) scale(1); opacity: 1; filter: blur(0); }
  100% { transform: translateZ(-700px) scale(.35); opacity: 0; filter: blur(10px); }
}
@keyframes splash-bg {
  0%, 90% { opacity: 1; visibility: visible; }
  100%    { opacity: 0; visibility: hidden; }
}
#splash.done { display: none; }

/* ---------- Tuiles ---------- */
/* La page tient dans la fenêtre, sans défilement. */
html, body { height: 100%; overflow: hidden; }
#tiles {
  max-width: 935px;
  height: 100vh; height: 100dvh;
  margin: 0 auto;
  padding: 10px 16px 6px;
  display: flex; flex-direction: column;
  opacity: 0;
  animation: reveal .8s ease 4.2s forwards;
}
body.no-splash #tiles { animation-delay: 0s; animation-duration: .4s; }
@keyframes reveal { to { opacity: 1; } }

.brand { flex: none; margin-bottom: 4px; }
.brand img { display: block; border-radius: 12px; background: #fff; }

section { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; margin-top: 8px; }
h2 {
  flex: none;
  margin: 0 0 6px 4px;
  font-size: .62rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.grid {
  flex: 1; min-height: 0;
  display: grid; gap: 8px;
  grid-template-columns: repeat(6, minmax(0, 145px));
  grid-auto-rows: minmax(0, 128px);
}

.tile {
  position: relative;
  min-height: 0; overflow: hidden;
  padding: 8px 10px;
  border-radius: 14px;
  display: flex; flex-direction: column; justify-content: flex-end;
  color: #fff; text-decoration: none;
  background: linear-gradient(160deg, var(--c1), var(--c2));
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover, .tile:focus-visible {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 18px rgba(0,0,0,.5);
  outline: none;
}
.tile svg {
  position: absolute; top: 8px; left: 10px;
  width: clamp(19px, 4.3vh, 34px); height: clamp(19px, 4.3vh, 34px);
  fill: none; stroke: #fff; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.tile strong { font-size: .9rem; line-height: 1.1; }
.tile span { margin-top: 2px; font-size: .68rem; opacity: .75; }

.blue   { --c1: #2c6fd1; --c2: #1d54a8; }
.teal   { --c1: #1f9a86; --c2: #167563; }
.olive  { --c1: #8a8f2a; --c2: #6a6e1d; }
.orange { --c1: #d9651b; --c2: #b04a0e; }
.purple { --c1: #8049c2; --c2: #5f35a0; }
.green  { --c1: #1e9a54; --c2: #14733f; }
.rust   { --c1: #c4532c; --c2: #983a1a; }
.indigo { --c1: #6552cc; --c2: #4a3aa6; }
.red    { --c1: #c92b45; --c2: #9d1c33; }
.brown  { --c1: #a05c1e; --c2: #7a4412; }
.slate  { --c1: #5a6479; --c2: #3f485a; }
.cyan   { --c1: #1a8ba0; --c2: #126a7b; }
.amber  { --c1: #b8741a; --c2: #8f5710; }
.grey   { --c1: #6e7686; --c2: #515867; }

footer { flex: none; margin-top: 6px; text-align: center; color: var(--muted); font-size: .64rem; }

@media (max-width: 760px) {
  #tiles { padding: 8px 10px 4px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 8px; border-radius: 12px; }
  .tile strong { font-size: .68rem; }
  .tile span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .splash-logo { animation: none; }
  #splash { animation-duration: 1.5s; }
  #tiles { animation-delay: 1.4s; }
}
