:root {
  /* Matches the logo artwork's background so the image edges disappear. */
  --bg: #0f1014;
  --fg: #e9e4dc;
  --muted: #8a8580;
  --ember: #ff2a1f;
  --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

/* Navbar */

.navbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(16px, 4vw, 40px);
}

.brand {
  color: var(--fg);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.32em;
}

.github {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--muted);
  transition: color 200ms ease, background-color 200ms ease;
}

.github:hover,
.github:focus-visible {
  color: var(--fg);
  background: rgb(255 255 255 / 0.06);
}

a:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 3px;
}

/* Hero */

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 96px 16px 64px;
}

.logo {
  position: relative;
  width: min(820px, 92vw, 110svh);
  aspect-ratio: 820 / 560;
  /* Fade the artwork's rectangular edges into the page background. The mark
     sits within the inner ~76% of the image, so a 10% fade never touches it. */
  --edge-x: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent);
  --edge-y: linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: var(--edge-x), var(--edge-y);
  -webkit-mask-composite: source-in;
  mask-image: var(--edge-x), var(--edge-y);
  mask-composite: intersect;
}

.logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* The two artworks are pixel-identical except for the eyes, so fading the
   red-eyed layer in reads as the eyes lighting up. */
.logo-eyes {
  opacity: 0;
}

/* Extra bloom around each eye, layered on top with a light-adding blend. */
.logo-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0;
  background:
    radial-gradient(circle at 43.3% 30.5%, rgb(255 42 31 / 0.55) 0, rgb(255 42 31 / 0) 4.5%),
    radial-gradient(circle at 56.8% 30.7%, rgb(255 42 31 / 0.55) 0, rgb(255 42 31 / 0) 4.5%);
}

.title {
  margin: clamp(8px, 2vw, 20px) 0 0;
  font-weight: 500;
  font-size: clamp(1rem, 2.4vw, 1.4rem);
  letter-spacing: 0.5em;
  /* Letter-spacing adds trailing space after the last glyph; offset it so the
     text stays optically centered. */
  margin-right: -0.5em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0;
}

.logo.is-awake .logo-eyes {
  animation: eyes-ignite 2.6s 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.logo.is-awake .logo-glow {
  animation:
    glow-ignite 2.6s 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards,
    glow-breathe 4s 3.1s ease-in-out infinite;
}

.logo.is-awake + .title {
  animation: title-in 1.2s 2.4s ease-out forwards;
}

/* A couple of faint sputters before catching, like something powering on. */
@keyframes eyes-ignite {
  0% { opacity: 0; }
  14% { opacity: 0.4; }
  20% { opacity: 0.08; }
  30% { opacity: 0.65; }
  36% { opacity: 0.2; }
  100% { opacity: 1; }
}

@keyframes glow-ignite {
  0%, 30% { opacity: 0; }
  36% { opacity: 0.15; }
  75% { opacity: 1; }
  100% { opacity: 0.8; }
}

@keyframes glow-breathe {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 0.4; }
}

@keyframes title-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Reduced motion (and no JS, via <noscript> in index.html): show the final,
   awake state. */
@media (prefers-reduced-motion: reduce) {
  .logo .logo-eyes,
  .logo.is-awake .logo-eyes {
    animation: none;
    opacity: 1;
  }
  .logo .logo-glow,
  .logo.is-awake .logo-glow {
    animation: none;
    opacity: 0.8;
  }
  .title,
  .logo.is-awake + .title {
    animation: none;
    opacity: 1;
  }
}
