/* NOIR — black and white, dark only. */

:root {
  color-scheme: dark;

  --bg: #000000;
  --fg: #ffffff;
  --fg-dim: rgba(255, 255, 255, 0.58);
  --fg-faint: rgba(255, 255, 255, 0.14);

  --font-display: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* Pointer-tracked glow origin, updated by main.js. */
  --mx: 50%;
  --my: 44%;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ---------- Atmosphere ---------- */

/* Soft light behind the wordmark, drifting toward the pointer. */
.glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    58vmax 58vmax at var(--mx) var(--my),
    rgba(255, 255, 255, 0.085),
    rgba(255, 255, 255, 0.028) 34%,
    transparent 68%
  );
  opacity: 0;
  animation: rise-in 2.4s var(--ease) 0.1s forwards;
}

/* Film grain, plus a vignette to pull the frame in at the edges. */
.grain {
  position: fixed;
  inset: -150%;
  z-index: 3;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 700ms steps(1) infinite;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(120% 88% at 50% 46%, transparent 42%, rgba(0, 0, 0, 0.72) 100%);
}

/* ---------- Header / nav ---------- */

.header {
  position: relative;
  z-index: 4;
  display: flex;
  justify-content: flex-end;
  padding: clamp(1.4rem, 3.4vw, 2.6rem) clamp(1.4rem, 4.5vw, 3.4rem);
}

.nav {
  display: flex;
  gap: clamp(1.5rem, 3.6vw, 3.1rem);
  opacity: 0;
  animation: rise-in 1.1s var(--ease) 1.55s forwards;
}

.nav__link {
  position: relative;
  color: var(--fg-dim);
  font-family: var(--font-mono);
  font-size: clamp(0.68rem, 1.05vw, 0.74rem);
  font-weight: 500;
  letter-spacing: 0.24em;
  text-decoration: none;
  padding-bottom: 0.42em;
  transition: color 0.45s var(--ease);
}

/* Trailing letter-space would push the label off-centre over its rule. */
.nav__link span { margin-right: -0.24em; display: inline-block; }

/* Hairline that wipes in from the left, and out to the right. */
.nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease);
}

.nav__link:hover,
.nav__link:focus-visible { color: var(--fg); }

.nav__link:hover::after,
.nav__link:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav__link:focus-visible {
  outline: none;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  z-index: 4;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 1.25rem clamp(3rem, 9vh, 6rem);
  text-align: center;
}

.hero__title {
  margin: 0;
  font-size: clamp(4.2rem, 21vw, 17rem);
  font-weight: 900;
  line-height: 0.9;
  color: var(--fg);
}

.wordmark {
  display: inline-block;
  letter-spacing: 0.085em;
  /* Cancel the trailing letter-space so the word optically centres. */
  margin-right: -0.085em;
  opacity: 0;
  animation: wordmark-in 1.9s var(--ease) 0.25s forwards;
}

.hero__tagline {
  margin: clamp(1.1rem, 2.6vh, 1.9rem) 0 0;
  white-space: nowrap;
  color: var(--fg-dim);
  font-family: var(--font-mono);
  font-size: clamp(0.5rem, 2.85vw, 0.86rem);
  font-weight: 400;
  letter-spacing: 0.17em;
  line-height: 1.75;
  opacity: 0;
  animation: rise-in 1.3s var(--ease) 1.05s forwards;
}

/* ---------- Motion ---------- */

@keyframes wordmark-in {
  from {
    opacity: 0;
    filter: blur(22px);
    transform: translateY(0.14em) scale(0.975);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: none;
  }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* Jitter the grain so it reads as film, not a static texture. */
@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-6%, 3%); }
  40%  { transform: translate(4%, -5%); }
  60%  { transform: translate(-3%, -2%); }
  80%  { transform: translate(5%, 4%); }
  100% { transform: translate(0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }

  .glow,
  .nav,
  .wordmark,
  .hero__tagline {
    animation-duration: 0.6s;
    animation-delay: 0s;
  }

  @keyframes wordmark-in {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  @keyframes rise-in {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
}

@media (max-width: 30rem) {
  .header { justify-content: center; }
  .nav { gap: 1.35rem; }

  /* Comfortable tap targets on touch. */
  .nav__link {
    padding: 0.55em 0.3em 0.5em;
    letter-spacing: 0.2em;
  }

  .nav__link span { margin-right: -0.2em; }
}

/* ---------- Wordmark link (sub-pages) ---------- */

.header--full { justify-content: space-between; align-items: center; }

.mark {
  color: var(--fg-dim);
  font-family: var(--font-display);
  font-size: clamp(0.82rem, 1.3vw, 0.95rem);
  font-weight: 900;
  letter-spacing: 0.22em;
  text-decoration: none;
  transition: color 0.45s var(--ease);
  opacity: 0;
  animation: rise-in 1.1s var(--ease) 1.4s forwards;
}

.mark span { display: inline-block; margin-right: -0.22em; }

.mark:hover,
.mark:focus-visible { color: var(--fg); outline: none; }

/* Current page reads as already underlined. */
.nav__link.is-current { color: var(--fg); }

.nav__link.is-current::after {
  transform: scaleX(1);
  transform-origin: left;
  opacity: 0.38;
  transition: opacity 0.45s var(--ease);
}

.nav__link.is-current:hover::after,
.nav__link.is-current:focus-visible::after { opacity: 1; }

/* ---------- About ---------- */

.sheet {
  position: relative;
  z-index: 4;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2rem) 1.25rem clamp(3rem, 8vh, 5rem);
  text-align: center;
}

.sheet__title {
  margin: 0 0 clamp(1.7rem, 4.5vh, 2.8rem);
  font-size: clamp(2.1rem, 7.6vw, 4.4rem);
  font-weight: 900;
  line-height: 0.95;
  color: var(--fg);
}

.prose {
  /* Mono makes ch an exact character count, so this is the measure. */
  max-width: 58ch;
  opacity: 0;
  animation: rise-in 1.3s var(--ease) 0.95s forwards;
}

.prose p {
  margin: 0 0 1.6em;
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 1.25vw, 0.85rem);
  letter-spacing: 0.06em;
  line-height: 2.1;
}

/* The line that lands hardest gets the mono treatment. */
.prose__stamp {
  margin-top: 2.2em;
  color: var(--fg) !important;
  font-family: var(--font-mono);
  font-size: clamp(0.7rem, 1.25vw, 0.82rem) !important;
  letter-spacing: 0.19em;
  line-height: 2.1 !important;
}

.prose__sign {
  margin: 0 !important;
  padding-top: 1.9em;
  border-top: 1px solid var(--fg-faint);
  color: var(--fg-dim) !important;
  font-family: var(--font-mono);
  font-size: clamp(0.62rem, 1.15vw, 0.76rem) !important;
  letter-spacing: 0.17em;
}

/* ---------- Beta countdown ---------- */

.countdown {
  width: min(210px, 44vw);
  height: 1px;
  margin-top: clamp(2rem, 5vh, 3.2rem);
  background: var(--fg-faint);
  opacity: 0;
  animation: rise-in 1s var(--ease) 1.5s forwards;
}

.countdown__bar {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--fg-dim);
  transform-origin: left;
  /* Duration is set from data-redirect-delay so the two never drift. */
  animation: countdown 5s linear forwards;
}

@keyframes countdown {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
