:root {
  --bg-core: #1b1f27;
  --bg-edge: #05060a;
  --ink: #ffffff;
  --ink-muted: #9aa1b1;
  --logo-size: min(30vh, 13vw);
  --wordmark-size: calc(var(--logo-size) * 0.66);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 90% 70% at 50% 32%, var(--bg-core), transparent 70%),
    linear-gradient(160deg, #12151c 0%, var(--bg-edge) 100%);
  background-color: var(--bg-edge);
  color: var(--ink);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Inter, Roboto,
    Helvetica, Arial, sans-serif;
  overflow: hidden;
}

.stage {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 4vmin;
}

/* --- Bloc logo + wordmark --- */

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.logo {
  width: var(--logo-size);
  height: var(--logo-size);
  flex: none;
  color: var(--ink);
  filter: drop-shadow(0 0 4vmin rgba(255, 255, 255, 0.12));
  animation: logo-reveal 1200ms cubic-bezier(0.22, 1, 0.36, 1) 200ms both;
}

.wordmark {
  margin: 0;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-family: Michroma, "Segoe UI", sans-serif;
  font-size: var(--wordmark-size);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
  animation:
    wordmark-expand 900ms cubic-bezier(0.65, 0, 0.35, 1) 1500ms both,
    wordmark-fade 700ms ease-out 1900ms both;
}

.wordmark__name {
  color: var(--ink);
}

.wordmark__tld {
  color: var(--ink-muted);
}

/* --- Glitch ponctuel : le 9 bascule en G --- */

.glitch {
  position: relative;
  display: inline-block;
  animation: glitch-shake 7s steps(1, end) -2.6s infinite;
}

.glitch__from {
  display: inline-block;
  animation: glitch-out 7s steps(1, end) -2.6s infinite;
}

.glitch__to {
  position: absolute;
  inset: 0;
  text-align: center;
  opacity: 0;
  animation: glitch-in 7s steps(1, end) -2.6s infinite;
}

/* --- Animations --- */

@keyframes logo-reveal {
  from {
    opacity: 0;
    transform: scale(0.82) translateY(3%);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes wordmark-expand {
  from {
    max-width: 0;
    padding-left: 0;
  }
  to {
    max-width: 10em;
    padding-left: 0.18em;
  }
}

@keyframes wordmark-fade {
  from {
    opacity: 0;
    transform: translateX(-0.15em);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes glitch-out {
  0%,
  85.9% {
    opacity: 1;
  }
  86%,
  87.4% {
    opacity: 0;
  }
  87.5%,
  88.4% {
    opacity: 1;
  }
  88.5%,
  93.9% {
    opacity: 0;
  }
  94%,
  94.6% {
    opacity: 1;
  }
  94.7%,
  95.9% {
    opacity: 0;
  }
  96%,
  100% {
    opacity: 1;
  }
}

@keyframes glitch-in {
  0%,
  85.9% {
    opacity: 0;
  }
  86%,
  87.4% {
    opacity: 1;
  }
  87.5%,
  88.4% {
    opacity: 0;
  }
  88.5%,
  93.9% {
    opacity: 1;
  }
  94%,
  94.6% {
    opacity: 0;
  }
  94.7%,
  95.9% {
    opacity: 1;
  }
  96%,
  100% {
    opacity: 0;
  }
}

@keyframes glitch-shake {
  0%,
  85.9% {
    transform: none;
    text-shadow: none;
  }
  86% {
    transform: translate(-0.03em, 0.01em);
    text-shadow: 0.035em 0 rgba(255, 0, 80, 0.65), -0.035em 0 rgba(0, 220, 255, 0.65);
  }
  88.5% {
    transform: translate(0.025em, -0.015em);
    text-shadow: -0.03em 0 rgba(255, 0, 80, 0.5), 0.03em 0 rgba(0, 220, 255, 0.5);
  }
  91% {
    transform: none;
    text-shadow: 0.012em 0 rgba(0, 220, 255, 0.35);
  }
  94% {
    transform: translate(-0.02em, 0);
    text-shadow: 0.03em 0 rgba(255, 0, 80, 0.6), -0.03em 0 rgba(0, 220, 255, 0.6);
  }
  96%,
  100% {
    transform: none;
    text-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .logo,
  .wordmark {
    animation-duration: 1ms;
    animation-delay: 0ms;
  }

  .glitch,
  .glitch__from,
  .glitch__to {
    animation: none;
  }

  .glitch__to {
    display: none;
  }
}
