:root {
  --night: #070a12;
  --night-high: #0c1220;
  --bone: #ece4d2;
  --bone-deep: #d3c7ac;
  --letter-top: #1b2334;
  --letter-low: #0e1320;
  --lede: #66708a;
  --font: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  /* the moon and the type, sized on width and height so they fit any box */
  --moon: min(60vw, 58vh);
  --type: min(16vw, 19vh);
}

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

html, body { height: 100%; }

body {
  background: var(--night);
  color: var(--bone);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 300px;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(180deg, var(--night) 0%, var(--night-high) 100%);
}

/* the soft light around the moon, a wide radial gradient that GSAP moves with it */
.halo {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--moon) * 3.2);
  height: calc(var(--moon) * 3.2);
  border-radius: 50%;
  z-index: -3;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(236, 228, 210, 0.2) 0%, rgba(236, 228, 210, 0.08) 34%, rgba(180, 196, 230, 0.03) 62%, transparent 100%);
  opacity: 0;
}

/* the moon: GSAP owns the transform of .moon, CSS owns the face inside */
.moon {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--moon);
  height: var(--moon);
  z-index: -2;
  pointer-events: none;
}

.moon__face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 40% 34%, #f6f1e5 0%, var(--bone) 46%, var(--bone-deep) 100%);
  box-shadow:
    0 0 calc(var(--moon) * 0.05) rgba(236, 228, 210, 0.45),
    0 0 calc(var(--moon) * 0.2) rgba(236, 228, 210, 0.16),
    inset calc(var(--moon) * -0.03) calc(var(--moon) * -0.04) calc(var(--moon) * 0.08) rgba(150, 136, 108, 0.22);
}

/* two or three round shadows, barely there */
.moon__mare {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(150, 136, 110, 0.22), rgba(150, 136, 110, 0.1) 60%, transparent);
}
.moon__mare--a { left: 22%; top: 26%; width: 30%; height: 26%; }
.moon__mare--b { left: 56%; top: 46%; width: 20%; height: 18%; opacity: 0.8; }
.moon__mare--c { left: 34%; top: 64%; width: 13%; height: 12%; opacity: 0.65; }

/* a still grain, so the soft gradients do not band */
.grain {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.14;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><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.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.hero {
  position: relative;
  display: grid;
  justify-items: center;
  gap: min(5.2vh, 38px);
  text-align: center;
  padding: 0 6vw;
}

.words {
  position: relative;
  display: grid;
}

.title {
  grid-area: 1 / 1;
  position: relative;
  font-size: var(--type);
  line-height: 0.88;
  letter-spacing: -0.035em;
  font-weight: 800;
  font-variation-settings: 'wdth' 92;
  text-transform: none;
  white-space: nowrap;
}

/* the letters themselves: dark, opaque, a shade lighter than the night so they read even off the moon */
.title--body {
  z-index: 1;
  color: transparent;
  background: linear-gradient(180deg, var(--letter-top) 0%, var(--letter-low) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* the same words on top, through the SVG filter: only the edge of each letter that faces the moon is left, in bone,
   and the round mask keeps it where the moon is */
.title--rim {
  z-index: 2;
  color: var(--bone);
  filter: url(#moonlit);
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
  -webkit-mask-image: radial-gradient(circle var(--mr, 300px) at var(--mx, 50%) var(--my, 50%), #000 0%, #000 34%, rgba(0, 0, 0, 0.45) 66%, transparent 100%);
  mask-image: radial-gradient(circle var(--mr, 300px) at var(--mx, 50%) var(--my, 50%), #000 0%, #000 34%, rgba(0, 0, 0, 0.45) 66%, transparent 100%);
}

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.lede {
  font-size: clamp(12px, min(2.6vw, 2.8vh), 18px);
  font-weight: 460;
  font-variation-settings: 'wdth' 108;
  letter-spacing: 0.04em;
  color: var(--lede);
}
