:root {
  --font-brand: "Overused Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-code: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --paper: #FFFFFF;
  --ink-dark: #09090B;
  --ink-light: #FFFFFF;
  --ink-muted: #64748B;
  --brand-blue: #005AE0;
  --brand-blue-hover: #0047B3;
  --brand-pale: #E0ECFF;
  --surface-card: #F8FAFC;
  --border-hairline: rgba(0, 0, 0, 0.06);
  --nav-glass: rgba(255, 255, 255, 0.78);
  --headline-shadow: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.08));
  /* CSS-only stand-in for the shader, same ramp, used when WebGL2 is unavailable. */
  --fallback-light: linear-gradient(135deg, #7FB2FA 0%, #3380F0 38%, #005AE0 68%, #0A3F94 100%);

  --nav-opacity: 0;
  --beat1-opacity: 1;
  --beat1-shift: 0px;
  --beat2-opacity: 0;
  --beat2-shift: 20px;
  --cta-opacity: 0;
  --cta-shift: 24px;
  --exit-opacity: 0;
  --fallback-opacity: 0;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 200ms;
  --duration-ink: 350ms;
}

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

html {
  font-family: var(--font-brand);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-dark);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ---------- Navbar ---------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  opacity: var(--nav-opacity);
  color: var(--ink-light);
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.nav--glass {
  background: var(--nav-glass);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom-color: var(--border-hairline);
}

.nav--ink { color: var(--ink-dark); }

.nav__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav__brand { display: flex; align-items: center; gap: 12px; }

.nav__logo { width: 36px; height: 36px; border-radius: 8px; }

.nav__text { display: flex; flex-direction: column; }

.nav__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: 800 15px/1.2 var(--font-brand);
  letter-spacing: 0.04em;
  cursor: pointer;
}

.nav__byline { font-size: 11px; line-height: 1.2; color: var(--ink-muted); }

.nav__byline a {
  color: var(--brand-blue);
  font-weight: 600;
  text-decoration: none;
  transition: filter var(--duration-fast) var(--ease-out);
}

.nav__byline a:hover { filter: brightness(1.25); }

/* Brand blue on lit blue is invisible, so over the light the byline uses the pale brand tint. */
.nav:not(.nav--ink) .nav__byline { color: rgba(255, 255, 255, 0.78); }
.nav:not(.nav--ink) .nav__byline a { color: var(--brand-pale); }

.nav__actions { display: flex; align-items: center; gap: 8px; }

.nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.nav__link:hover { opacity: 1; }

@media (max-width: 767px) {
  .nav__link { display: none; }
}

.nav__cta {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 8px;
  background: var(--brand-blue);
  color: var(--ink-light);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: background-color var(--duration-fast) var(--ease-out);
}

.nav__cta:hover { background: var(--brand-blue-hover); }

/* ---------- Hero ---------- */

.hero { position: relative; height: 235vh; }

.hero__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  /* lvh = the tallest viewport (browser bars hidden), so no white strip appears when the bars slide away. */
  height: 100lvh;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--paper);
}

.hero__canvas, .hero__fallback, .hero__exit {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero__canvas { display: block; }

.hero__fallback {
  display: none;
  background: var(--fallback-light);
  opacity: var(--fallback-opacity);
}

.no-webgl .hero__canvas { display: none; }
.no-webgl .hero__fallback { display: block; }

.hero__copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Centre on the area you can actually see: when browser bars are showing, dvh < lvh. */
  margin-bottom: calc(100lvh - 100dvh);
  padding: 0 16px;
  pointer-events: none;
}

/* Both beats share one grid cell, so swapping them never shifts layout. */
.hero__beats { display: grid; }

.hero__headline {
  grid-area: 1 / 1;
  margin: 0;
  text-align: center;
  white-space: nowrap;
  font-size: clamp(1.6rem, 9vw, 6rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--ink-dark);
  transition: color var(--duration-ink) var(--ease-out);
  filter: var(--headline-shadow);
}

.is-lit .hero__headline { color: var(--ink-light); }

.hero__headline--beat1 {
  opacity: var(--beat1-opacity);
  transform: translateY(var(--beat1-shift));
}

.hero__headline--beat2 {
  opacity: var(--beat2-opacity);
  transform: translateY(var(--beat2-shift));
}

/* Out of flow, hanging below the headline, so the hidden button never pushes the headline off centre. */
.hero__cta {
  position: absolute;
  top: calc(100% + 32px);
  left: 50%;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--brand-blue);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  opacity: var(--cta-opacity);
  transform: translate(-50%, var(--cta-shift));
  pointer-events: auto;
  transition: background-color var(--duration-fast) var(--ease-out);
}

.hero__cta:hover { background: var(--surface-card); }
.hero__cta[inert] { pointer-events: none; }

.hero__exit {
  top: auto;
  height: 45%;
  z-index: 3;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--paper));
  opacity: var(--exit-opacity);
  pointer-events: none;
}

@media (max-width: 640px) {
  .nav__cta { display: none; }
  .nav__inner { padding: 12px 16px; }
}

/* ---------- Back to top ---------- */

.to-top {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 40;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border-hairline);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: var(--card-shadow);
  color: var(--ink-dark);
  font: 600 20px/1 var(--font-brand);
  cursor: pointer;
}

.to-top:hover { color: var(--brand-blue); }
