/* ==========================================================================
   Alkando — Coming Soon
   Palette lifted straight from the app icon: deep violet head, periwinkle
   chest, coral beak, on a soft lavender mark — inverted to a dark hero here.
   ========================================================================== */

:root {
  --bg-0: #060410;
  --bg-1: #0c0818;
  --purple-mid: #7c3aed;
  --periwinkle: #5e5ddf;
  --coral: #ff8c9c;
  --coral-soft: #ffb4bd;
  --purple-deep: #6f2adc;

  --text: #f4f1ff;
  --text-faint: #6c6390;

  --font-display: 'Quicksand', ui-rounded, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: radial-gradient(120% 90% at 50% 40%, var(--bg-1) 0%, var(--bg-0) 60%, #030209 100%);
  color: var(--text);
  font-family: var(--font-body);
  overflow-x: hidden;
}

/* ---------------------------------------------------------------------- */
/* Ambient glow backdrop                                                   */
/* ---------------------------------------------------------------------- */

.backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  will-change: transform;
}

.glow--purple {
  width: 60vmax;
  height: 60vmax;
  top: -20vmax;
  left: 50%;
  opacity: 0.35;
  background: radial-gradient(circle, var(--purple-mid) 0%, transparent 70%);
  animation: driftPurple 16s ease-in-out infinite;
}

.glow--coral {
  width: 40vmax;
  height: 40vmax;
  bottom: -18vmax;
  left: 20%;
  opacity: 0.16;
  background: radial-gradient(circle, var(--coral) 0%, transparent 72%);
  animation: driftCoral 20s ease-in-out infinite;
}

@keyframes driftPurple {
  0%, 100% { transform: translate(-50%, 0) scale(1); }
  50% { transform: translate(-46%, 3%) scale(1.06); }
}

@keyframes driftCoral {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(4%, -4%) scale(1.08); }
}

/* ---------------------------------------------------------------------- */
/* Matrix-style falling digits — continuous, drawn by script.js             */
/* ---------------------------------------------------------------------- */

#matrix-rain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.6;
  /* Fades out behind the hero/legal content so the digits read as an
     ambient effect around the edges instead of fighting the headline
     and bird for legibility. */
  mask-image: radial-gradient(55% 50% at 50% 42%, transparent 0%, transparent 25%, black 68%);
  -webkit-mask-image: radial-gradient(55% 50% at 50% 42%, transparent 0%, transparent 25%, black 68%);
}

/* ---------------------------------------------------------------------- */
/* Hero                                                                     */
/* ---------------------------------------------------------------------- */

.hero {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  max-width: 640px;
  margin: 0 auto;
}

.animation-wrap {
  position: relative; /* no z-index here — stays out of a new stacking context */
  width: min(88vw, 560px);
  aspect-ratio: 16 / 9;
  margin: 0 auto 8px;
}

.animation-wrap .poster,
.animation-wrap .bird-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  /* The source frames are baked onto a pure-black canvas (no alpha
     channel). "screen" drops that black straight into the page background
     — no visible box edge — while leaving the bird's own colours alone. */
  mix-blend-mode: screen;
}

/* Once the live canvas has a frame to show, hide the static poster —
   otherwise both are screen-blended at once and you get two birds. */
.animation-wrap.is-live .poster {
  opacity: 0;
}

.headline {
  position: relative; /* anchors the ::before/::after crack slices below */
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.4rem, 7vw, 4rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 8px 0 0;
  padding-bottom: 0.15em;
  background: linear-gradient(100deg, var(--coral-soft) 0%, var(--coral) 22%, var(--periwinkle) 55%, var(--purple-mid) 78%, var(--purple-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------------------------------------------------------------------- */
/* Footer                                                                    */
/* ---------------------------------------------------------------------- */

.site-footer {
  width: 100%;
  padding: 18px 20px clamp(20px, 4vw, 32px);
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-faint);
}

.site-footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--text);
  text-decoration-color: currentColor;
}

/* Language switcher — the current language renders as a plain <span>, the
   others as links to the same page under a different language folder. */
.lang-switch {
  margin: 8px 0 0;
  font-size: 0.72rem;
  color: var(--text-faint);
  letter-spacing: 0.02em;
  line-height: 1.9;
}

.lang-switch a {
  color: inherit;
  text-decoration: none;
}

.lang-switch a:hover,
.lang-switch a:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lang-switch [aria-current] {
  color: var(--text);
}

/* ---------------------------------------------------------------------- */
/* Glitch / stutter — intentional, triggered periodically by script.js      */
/* ---------------------------------------------------------------------- */

/* IMPORTANT: none of this ever applies `transform`, `filter`, or `opacity`
   to .animation-wrap or any of ITS ancestors. Every one of those creates a
   new stacking context, which traps the poster/canvas's mix-blend-mode
   against that context's own (transparent) background instead of the real
   page background — bringing back the hard black box for the glitch's
   duration. .animation-wrap gets a margin nudge instead of a transform,
   and the canvas gets a blend-mode swap instead of a filter — both stay
   inside the existing blend group, so the seam-free background survives. */

body.glitching .site-footer {
  animation: glitchJump 0.28s steps(2, end);
}

body.glitching .headline,
body.glitching .legal-title {
  animation: glitchJump 0.28s steps(2, end), glitchRGB 0.28s steps(2, end);
}

body.glitching .animation-wrap {
  animation: glitchNudge 0.28s steps(2, end);
}

body.glitching .animation-wrap .bird-canvas {
  animation: glitchBlend 0.28s steps(2, end);
}

@keyframes glitchJump {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-6px, 2px); }
  40%  { transform: translate(5px, -1px); }
  60%  { transform: translate(-3px, 1px) skewX(1deg); }
  80%  { transform: translate(4px, 0); }
  100% { transform: translate(0, 0); }
}

@keyframes glitchNudge {
  0%   { margin: 0; }
  20%  { margin: 2px 0 0 -6px; }
  40%  { margin: -1px 0 0 5px; }
  60%  { margin: 1px 0 0 -3px; }
  80%  { margin: 0 0 0 4px; }
  100% { margin: 0; }
}

@keyframes glitchBlend {
  0%, 100% { mix-blend-mode: screen; }
  30% { mix-blend-mode: difference; }
  55% { mix-blend-mode: exclusion; }
  75% { mix-blend-mode: screen; }
}

@keyframes glitchRGB {
  0%, 100% { text-shadow: none; }
  20% { text-shadow: -2px 0 var(--coral), 2px 0 var(--purple-mid); }
  50% { text-shadow: 2px 0 var(--coral), -2px 0 var(--periwinkle); }
  80% { text-shadow: -1px 0 var(--purple-deep), 1px 0 var(--coral); }
}

/* "Cracks" — duplicate the headline text via attr(data-text), each copy
   clipped to a thin horizontal band and torn sideways, like a sliced/
   corrupted video signal. Sits on top of the real text (which stays put
   underneath) only for the burst's duration. */
.headline::before,
.headline::after,
.legal-title::before,
.legal-title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background: inherit;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  pointer-events: none;
}

body.glitching .headline::before,
body.glitching .legal-title::before {
  opacity: 0.9;
  clip-path: polygon(0 15%, 100% 15%, 100% 38%, 0 38%);
  animation: crackSliceA 0.28s steps(3, end);
}

body.glitching .headline::after,
body.glitching .legal-title::after {
  opacity: 0.9;
  clip-path: polygon(0 62%, 100% 62%, 100% 82%, 0 82%);
  animation: crackSliceB 0.28s steps(3, end);
}

@keyframes crackSliceA {
  0%, 100% { transform: translate(0, 0); }
  30% { transform: translate(-10px, 0); }
  60% { transform: translate(7px, -2px); }
  85% { transform: translate(-4px, 0); }
}

@keyframes crackSliceB {
  0%, 100% { transform: translate(0, 0); }
  30% { transform: translate(9px, 0); }
  60% { transform: translate(-8px, 2px); }
  85% { transform: translate(5px, 0); }
}

/* Faint scanline flicker over the whole viewport for the same beat. */
body.glitching::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.05) 0px,
    rgba(255, 255, 255, 0.05) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
  animation: scanFlicker 0.28s steps(2, end);
}

@keyframes scanFlicker {
  0%, 100% { opacity: 0; }
  30% { opacity: 0.55; }
  60% { opacity: 0.2; }
}

/* ---------------------------------------------------------------------- */
/* Reduced motion                                                           */
/* ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .glow {
    animation: none !important;
  }

  #matrix-rain {
    display: none;
  }

  body.glitching .site-footer,
  body.glitching .headline,
  body.glitching .legal-title,
  body.glitching .animation-wrap,
  body.glitching .animation-wrap .bird-canvas,
  body.glitching::after {
    animation: none !important;
  }

  body.glitching .headline::before,
  body.glitching .headline::after,
  body.glitching .legal-title::before,
  body.glitching .legal-title::after {
    animation: none !important;
    opacity: 0 !important;
  }
}
