@font-face {
  font-family: 'Inter';
  src: url('assets/fonts/InterVariable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter-Fallback';
  src: local('system-ui'), local('-apple-system'), local('Segoe UI');
  size-adjust: 107%;
  ascent-override: 90%;
  descent-override: 22%;
  line-gap-override: 0%;
}

:root {
  --type-display: 'Inter', 'Inter-Fallback', system-ui, sans-serif;
  --motion-fast: 200ms;
  --motion-medium: 400ms;
  --motion-slow: 30s;
  --idle-pause-after: 5000ms;

  --bg: #0a1420;
  --fg: #eaf2ff;
  --accent: #a0e6ff;
  --accent-2: #5a7fb0;
  --grain-opacity: 0.05;
  --shader-intensity: 1;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior-y: contain;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--type-display);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  position: relative;
  width: 100%;
  height: 100dvh;
}

#shader,
#trail {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100lvh;
  display: block;
  touch-action: none;
  pointer-events: none;
}

#shader { z-index: 0; }

#grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='256' height='256'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 256px 256px;
  mix-blend-mode: overlay;
}

#spotlight {
  --sx: 50%;
  --sy: 50%;
  --s-strength: 0;
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(
    circle 320px at var(--sx) var(--sy),
    color-mix(in srgb, var(--accent) calc(35% * var(--s-strength)), transparent),
    transparent 70%
  );
  transition: background var(--motion-fast) linear;
}

#trail { z-index: 4; }

#stage {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  z-index: 6;
  padding: 1rem;
  text-align: center;
  pointer-events: none;
}

body:not([data-typo-ready]) #headline,
body:not([data-typo-ready]) #subline,
body:not([data-typo-ready]) #signoff {
  opacity: 0;
}

#headline {
  pointer-events: auto;
  appearance: none;
  background: none;
  border: none;
  padding: 0.2em 0.4em;
  font-family: inherit;
  color: var(--fg);
  font-size: clamp(3.575rem, 17.16vw, 10.2rem);
  letter-spacing: -0.04em;
  font-variation-settings: "wght" 520;
  line-height: 1;
  cursor: default;
  transition: font-variation-settings var(--motion-medium) ease;
  will-change: transform, font-variation-settings;
  user-select: none;
  -webkit-user-select: none;
}

#headline:hover,
#headline:focus-visible,
#headline:active {
  font-variation-settings: "wght" 740;
  outline: none;
}

#headline:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 0.3em;
  border-radius: 2px;
}

#subline {
  font-size: clamp(1.17rem, 3.64vw, 1.68rem);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-variation-settings: "wght" 340;
  opacity: 0.78;
  color: var(--fg);
}

#signoff {
  font-size: clamp(0.91rem, 3.04vw, 1.62rem);
  letter-spacing: 0.22em;
  font-variation-settings: "wght" 320;
  font-style: italic;
  opacity: 0.42;
  color: var(--fg);
  margin-top: 0.6rem;
}

.char {
  display: inline-block;
  position: relative;
  opacity: 0;
  filter: blur(8px);
  transform: translateY(0.1em);
  animation: char-in 480ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  animation-delay: calc(var(--i, 0) * 22ms);
}

/* Shadow-only twin of each letter, painted behind the glyph. Carries the opaque
   stepped text-shadow; its `opacity` is the per-letter cursor-glow proximity, so
   the shadow keeps its tonal steps yet fades transparently against the canvas. */
.char::before {
  content: attr(data-ch);
  position: absolute;
  left: 0;
  top: 0;
  z-index: -1;
  color: transparent;
  text-shadow: var(--char-shadow, none);
  opacity: var(--char-shadow-strength, 0);
  pointer-events: none;
}

#subline .char {
  animation-delay: calc(720ms + var(--i, 0) * 18ms);
}

#signoff .char {
  animation-delay: calc(1480ms + var(--i, 0) * 14ms);
}

@keyframes char-in {
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

.ripple {
  position: fixed;
  pointer-events: none;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--accent) 80%, var(--fg));
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  opacity: 0.7;
  z-index: 5;
  animation: ripple-out var(--motion-medium) ease-out forwards;
  will-change: transform, opacity;
}

@keyframes ripple-out {
  to {
    transform: scale(14);
    opacity: 0;
  }
}

#cycle-hint {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--fg) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--fg) 14%, transparent);
  z-index: 9;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity var(--motion-fast) ease;
  pointer-events: auto;
}

#cycle-hint:hover { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }
  .char {
    opacity: 1;
    filter: none;
    transform: none;
  }
  #spotlight { --s-strength: 0.6; }
}
