/* ==========================================================================
   Fallen Galaxy — page de teasing
   HTML / CSS / JS natifs, aucune dépendance externe.
   ========================================================================== */

:root {
  --bg: #03060c;
  --bg-2: #07111f;
  --ink: #e8f0fa;
  --ink-soft: #b4c4d8;
  --muted: #8ea3bb;
  --accent: #4fb6ff;
  --accent-soft: rgba(79, 182, 255, 0.22);
  --accent-glow: rgba(79, 182, 255, 0.45);
  --cyan: #8fdcff;
  --danger: #ff5a6e;
  --panel: rgba(6, 14, 28, 0.62);
  --font-ui: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --gutter: clamp(16px, 4vw, 40px);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------------------
   Arrière-plan : étoiles (canvas), nébuleuse, lignes de balayage
   -------------------------------------------------------------------------- */

.starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Champ d'étoiles de secours (sans JavaScript) */
.no-js body {
  background:
    radial-gradient(1px 1px at 12% 22%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 12%, #cfe6ff 50%, transparent 51%),
    radial-gradient(1px 1px at 42% 68%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 74%, #9fd0ff 50%, transparent 51%),
    radial-gradient(1px 1px at 24% 88%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 36%, #fff 50%, transparent 51%),
    var(--bg);
}

.nebula {
  position: fixed;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 40% at 50% 28%, rgba(28, 94, 170, 0.28), transparent 70%),
    radial-gradient(ellipse 40% 35% at 18% 80%, rgba(70, 30, 110, 0.20), transparent 70%),
    radial-gradient(ellipse 45% 35% at 85% 70%, rgba(10, 70, 110, 0.22), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.75) 100%);
  animation: nebula-drift 40s ease-in-out infinite alternate;
}

@keyframes nebula-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-1.5%, 1%, 0) scale(1.04); }
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.022) 0,
    rgba(255, 255, 255, 0.022) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* Barre de balayage lente, très discrète */
.scanlines::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 22vh;
  top: -25vh;
  background: linear-gradient(to bottom, transparent, rgba(120, 200, 255, 0.045), transparent);
  animation: sweep 9s linear infinite;
}

@keyframes sweep {
  to { transform: translateY(150vh); }
}

/* --------------------------------------------------------------------------
   Mise en page
   -------------------------------------------------------------------------- */

.page {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(28px, 6vh, 64px) var(--gutter) 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(28px, 5vh, 52px);
}

/* --------------------------------------------------------------------------
   En-tête : signal, logo, accroche
   -------------------------------------------------------------------------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.kicker {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cyan);
  opacity: 0.9;
}

.kicker__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 10px rgba(255, 90, 110, 0.8);
  animation: blink 2.4s steps(1, end) infinite;
}

@keyframes blink {
  0%, 62%, 100% { opacity: 1; }
  64%, 70%      { opacity: 0.2; }
  72%           { opacity: 1; }
  76%, 80%      { opacity: 0.25; }
}

.logo-wrap {
  position: relative;
  width: min(100%, 780px);
  margin-top: 4px;
}

/* Halo bleu derrière le logo (respecte sa transparence) */
.logo-wrap::before {
  content: "";
  position: absolute;
  inset: 8% 6%;
  background: radial-gradient(ellipse at center, rgba(60, 160, 255, 0.28), transparent 68%);
  filter: blur(18px);
  z-index: -1;
  animation: halo 6s ease-in-out infinite;
}

@keyframes halo {
  0%, 100% { opacity: 0.75; }
  50%      { opacity: 1; }
}

.logo {
  width: 100%;
  height: auto;
  animation: logo-flicker 11s linear infinite;
}

/* Micro-instabilité du signal, sans flash */
@keyframes logo-flicker {
  0%, 91%, 100% { transform: translate3d(0, 0, 0); opacity: 1; }
  92%   { transform: translate3d(-3px, 0, 0) skewX(-2deg); opacity: 0.88; }
  93%   { transform: translate3d(2px, 0, 0); opacity: 0.95; }
  94%   { transform: translate3d(0, 0, 0); opacity: 1; }
}

.title {
  margin: 6px 0 0;
  max-width: 34ch;
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-wrap: balance;
}

.tagline {
  margin: 0;
  max-width: 52ch;
  font-size: clamp(0.98rem, 1.6vw, 1.08rem);
  color: var(--ink-soft);
  text-wrap: balance;
}

/* --------------------------------------------------------------------------
   Compte à rebours
   -------------------------------------------------------------------------- */

.countdown {
  position: relative;
  width: 100%;
  max-width: 900px;
  padding: clamp(22px, 4vw, 40px) clamp(14px, 3vw, 36px) clamp(24px, 4vw, 38px);
  background: var(--panel);
  border: 1px solid rgba(79, 182, 255, 0.18);
  border-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4) inset,
    0 30px 80px -30px rgba(20, 90, 170, 0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.countdown__corner {
  position: absolute;
  width: 18px; height: 18px;
  border-color: var(--accent);
  border-style: solid;
  opacity: 0.85;
}
.countdown__corner--tl { top: -1px;    left: -1px;  border-width: 2px 0 0 2px; }
.countdown__corner--tr { top: -1px;    right: -1px; border-width: 2px 2px 0 0; }
.countdown__corner--bl { bottom: -1px; left: -1px;  border-width: 0 0 2px 2px; }
.countdown__corner--br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

.countdown__label {
  margin: 0 0 clamp(16px, 3vw, 26px);
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 1.6vw, 0.95rem);
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--cyan);
}

.countdown__grid {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(4px, 1.2vw, 14px);
}

.unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  /* Largeur stable : 2 chiffres */
  flex: 0 0 auto;
}

.unit__value {
  display: block;
  min-width: 2.3ch;
  padding: 0.08em 0.18em;
  font-family: var(--font-mono);
  font-size: clamp(2.6rem, 8.2vw, 5.6rem);
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  text-align: center;
  color: #f4f9ff;
  background: linear-gradient(to bottom, rgba(18, 40, 70, 0.55), rgba(6, 14, 28, 0.55));
  border: 1px solid rgba(79, 182, 255, 0.16);
  border-radius: 4px;
  text-shadow: 0 0 18px var(--accent-glow);
}

/* Jours : jusqu'à 3 chiffres, largeur réservée pour éviter les sauts */
.unit--days .unit__value { min-width: 3.3ch; }

.unit__label {
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 1.3vw, 0.82rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  /* Largeur stable pour « seconde » / « secondes » */
  min-width: 9ch;
}

.unit__sep {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 6vw, 4.2rem);
  line-height: 1.25;
  color: var(--accent);
  opacity: 0.55;
  user-select: none;
}

/* Brouillage lors d'un saut temporel : décalage chromatique, aucun flash */
.countdown__grid.is-glitching .unit__value {
  color: #dcecff;
  text-shadow:
    -3px 0 rgba(255, 70, 110, 0.55),
     3px 0 rgba(70, 200, 255, 0.65),
     0 0 18px var(--accent-glow);
  animation: jitter 0.09s steps(2, end) infinite;
}

@keyframes jitter {
  0%   { transform: translate3d(0, 0, 0); clip-path: inset(0 0 0 0); }
  50%  { transform: translate3d(-2px, 1px, 0); clip-path: inset(18% 0 30% 0); }
  100% { transform: translate3d(2px, -1px, 0); clip-path: inset(0 0 0 0); }
}

.countdown__status {
  margin: clamp(16px, 3vw, 22px) 0 0;
  min-height: 1.6em;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.25s ease;
}

.countdown__status.is-alert { color: #ff8a98; }

.countdown__question {
  margin: 10px 0 0;
  font-size: clamp(1.35rem, 3.4vw, 2.1rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-shadow: 0 0 22px rgba(79, 182, 255, 0.35);
}

.countdown__nojs {
  margin: 0 auto;
  max-width: 46ch;
  font-size: 1.05rem;
  color: var(--ink-soft);
}

/* Sans JavaScript : on masque les chiffres et le statut */
.no-js .countdown__grid,
.no-js .countdown__status { display: none; }

/* --------------------------------------------------------------------------
   Description du jeu & pied de page
   -------------------------------------------------------------------------- */

.about {
  width: 100%;
  max-width: 720px;
  margin-top: auto;
  padding-top: clamp(8px, 2vh, 20px);
  border-top: 1px solid rgba(143, 220, 255, 0.12);
}

.about__title {
  margin: 18px 0 10px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cyan);
}

.about p {
  margin: 0 0 12px;
  font-size: 0.98rem;
  color: var(--ink-soft);
}

.about strong { color: var(--ink); font-weight: 600; }

.footer p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.8;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

/* Téléphones : grille 2 × 2, séparateurs masqués */
@media (max-width: 600px) {
  .countdown__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
    max-width: 360px;
    margin: 0 auto;
  }
  .unit__sep { display: none; }
  .unit__value,
  .unit--days .unit__value {
    width: 100%;
    min-width: 0;
    font-size: clamp(2.4rem, 13vw, 3.4rem);
  }
  .unit__label { min-width: 0; letter-spacing: 0.14em; }
  .kicker { display: block; font-size: 0.66rem; letter-spacing: 0.1em; }
  .kicker__dot { display: inline-block; margin-right: 8px; vertical-align: 0.05em; }
  .countdown__status { font-size: 0.7rem; letter-spacing: 0.08em; }
}

@media (max-height: 700px) and (min-width: 601px) {
  .page { gap: 22px; padding-top: 22px; }
  .logo-wrap { width: min(100%, 620px); }
}

/* --------------------------------------------------------------------------
   Réduction des animations
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .nebula,
  .scanlines::after,
  .kicker__dot,
  .logo-wrap::before,
  .logo { animation: none !important; }
  .scanlines::after { display: none; }
  .countdown__grid.is-glitching .unit__value {
    animation: none;
    text-shadow: 0 0 18px var(--accent-glow);
    opacity: 0.7;
  }
  .unit__value { transition: opacity 0.2s ease; }
}
