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

html, body { margin: 0; background: #03040b; color: #f3f1ec; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
a { color: inherit; text-decoration: none; }

/* Space behind the whole page, as tall as the page so it scrolls with it. The dust
   canvas covers all of it; sky.js moves the star canvas to wherever the screen is.
   On a page shorter than the screen it still fills the visible screen (dvh). The
   star canvas is two screens tall with the mobile browser bars hidden (lvh), so it
   still covers the screen while they slide away mid-scroll. */
body { position: relative; }
.sky { position: absolute; inset: 0; z-index: 0; min-height: 100vh; min-height: 100dvh; overflow: hidden; pointer-events: none; }
.sky canvas { position: absolute; top: 0; left: 0; width: 100%; display: block; }
.sky .dust { height: 100%; }
.sky .stars { height: 200vh; height: 200lvh; will-change: transform; }
.hero, .below { position: relative; z-index: 1; }

/* Top of the page: the reel fills the screen, dimmed and darkening downward. Only its
   bottom part fades out, through a mask, so the sky shows there and nowhere else. */
.hero { height: 100svh; min-height: 480px; overflow: hidden; }
.stage {
  position: absolute; inset: 0;
  --dim: 0.3; /* darkens the whole video */
  /* solid for most of the height, then it fades into the sky only near the bottom */
  -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 82%, transparent 100%);
}
.reel { position: absolute; inset: 0; }
.reel video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: var(--focus, 50% 50%);
  opacity: 0;
  transition: opacity 200ms ease-out;
}
.reel video.on { opacity: 1; }
.stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    /* vignette: darkens the corners and edges, leaves the middle alone */
    radial-gradient(ellipse 75% 75% at 50% 45%, transparent 45%, rgb(0 0 0 / 0.55) 100%),
    linear-gradient(to bottom, transparent 0%, rgb(0 0 0 / 0.35) 30%, rgb(0 0 0 / 0.6) 62%, rgb(0 0 0 / 0.6) 100%),
    rgb(0 0 0 / var(--dim));
}
/* Top bar, fixed over the page: the name on the left (a link back to the top), the contribute link on the right. */
.bar {
  position: fixed; z-index: 2; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 28px 40px;
}
.name {
  margin: 0;
  font: 800 22px / 1 "Archivo", system-ui, sans-serif;
  font-stretch: 125%;
  letter-spacing: -0.01em;
}
.links { display: flex; align-items: baseline; gap: 20px; }
.links a {
  font: 500 13px / 1 "Archivo", system-ui, sans-serif;
  font-stretch: 125%;
  letter-spacing: 0.02em;
}
.links a:hover, .links a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }

/* Content under the reel */
.below { overflow-x: clip; }

/* Eidolon constellation: loose, asymmetric, clipped at the right edge */
.eidolons {
  position: relative;
  height: 230svh;
  min-height: 1400px;
  overflow: hidden;
}
.eidolon {
  position: absolute; z-index: 1; display: block; height: auto;
  /* Each one floats on its own slow cycle: a small drift and a slight tilt */
  animation: float var(--t, 9s) ease-in-out var(--delay, 0s) infinite;
  will-change: transform;
}
.e1 { width: min(22vw, 720px); left: 58%; top: 3%;  --t: 9s;    --delay: -2s;  --dx: 24px;  --dy: -56px; --r0: -6deg; --r1: 4deg; }
.e2 { width: 36vw;             left: -4vw; top: 14%; --t: 12s;   --delay: -7s;  --dx: -28px; --dy: -68px; --r0: 4deg;  --r1: -5deg; }
.e3 { width: min(26vw, 720px); right: 4%; top: 30%; --t: 8s;    --delay: -4s;  --dx: 20px;  --dy: -48px; --r0: 6deg;  --r1: -4deg; }
.e4 { width: min(16vw, 720px); left: 44%; top: 44%; --t: 7s;    --delay: -1s;  --dx: -18px;  --dy: -44px; --r0: -4deg; --r1: 6deg; }
.e5 { width: min(30vw, 720px); left: 8%;  top: 58%; --t: 11s;   --delay: -5s;  --dx: 26px;  --dy: -60px; --r0: 5deg; --r1: -4deg; }
.e6 { width: 24vw;             right: -3vw; top: 72%; --t: 10s; --delay: -8s;  --dx: -24px; --dy: -56px; --r0: -4deg; --r1: 5deg; }
@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(var(--r0, 0deg)); }
  50% { transform: translate3d(var(--dx, 0px), var(--dy, -12px), 0) rotate(var(--r1, 0deg)); }
}

.colophon {
  padding: 16svh 18px 28px;
  color: rgb(243 241 236 / 0.26);
  font: 500 11px / 1.5 "Archivo", system-ui, sans-serif;
  font-stretch: 125%;
  letter-spacing: 0.02em;
  text-align: center;
}

/* Contribute page: one centred block over the sky */
.contribute {
  position: relative; z-index: 1;
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 96px 20px;
  text-align: center;
}
.contribute h1 {
  margin: 0;
  font: 800 clamp(40px, 6vw, 80px) / 1 "Archivo", system-ui, sans-serif;
  font-stretch: 125%;
  letter-spacing: -0.02em;
}
.contribute p {
  max-width: 46ch;
  text-wrap: balance;
  margin: 20px 0 36px;
  font: 500 clamp(15px, 1.3vw, 18px) / 1.6 "Archivo", system-ui, sans-serif;
  font-stretch: 125%;
  color: rgb(243 241 236 / 0.8);
}
.repo {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 22px;
  border-radius: 10px;
  background: #f3f1ec; color: #03040b;
  font: 800 14px / 1 "Archivo", system-ui, sans-serif;
  font-stretch: 125%;
  letter-spacing: 0.01em;
}
.repo svg { width: 18px; height: 18px; fill: currentColor; }
.repo:hover { background: #fff; }

@media (max-width: 700px) {
  .bar { padding: 20px; }
  .name { font-size: 18px; }
  .links a { font-size: 11px; }
  .links { gap: 14px; }
  .eidolons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 12svh 0;
    height: auto;
    min-height: 0;
    padding: 10svh 0 14svh;
  }
  .eidolon { position: relative; inset: auto; height: auto; }
  .e1 { grid-column: 2; grid-row: 1; width: 48vw; margin-left: -2vw; }
  .e2 { grid-column: 1; grid-row: 1; width: 70vw; margin-top: 14svh; margin-left: -10vw; }
  .e3 { grid-column: 2; grid-row: 2; width: 60vw; margin-top: 6svh; margin-left: -14vw; }
  .e4 { grid-column: 1; grid-row: 2; width: 44vw; margin-left: 6vw; }
  .e5 { grid-column: 1; grid-row: 3; width: 58vw; margin-top: 4svh; margin-left: -4vw; }
  .e6 { grid-column: 2; grid-row: 3; width: 62vw; margin-top: 24svh; margin-left: -8vw; }
  .colophon { padding-top: 10svh; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .reel video { transition: none; }
  .eidolon { animation: none; }
}
