@font-face {
  font-family: "Instrument Serif";
  src: url("./assets/instrument-serif-regular.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("./assets/instrument-serif-italic.ttf") format("truetype");
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #e9eeeb;
  --ink: #111512;
  --line: rgba(17, 21, 18, 0.22);
  --moss: #618f30;
  --acid: #9ac64a;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

body {
  cursor: none;
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  cursor: none;
}

.experience {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.9), transparent 42%),
    linear-gradient(180deg, #eef2f0 0%, #dfe6e2 100%);
}

.experience::before {
  content: "";
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
  opacity: 0.11;
  background-image:
    repeating-radial-gradient(circle at 20% 30%, rgba(17, 21, 18, 0.24) 0 0.45px, transparent 0.55px 3px),
    repeating-radial-gradient(circle at 75% 65%, rgba(255, 255, 255, 0.35) 0 0.5px, transparent 0.65px 4px);
  background-size: 7px 9px, 11px 13px;
  mix-blend-mode: multiply;
}

.experience::after {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 110px rgba(33, 49, 40, 0.13);
}

#scene {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.topbar {
  position: absolute;
  z-index: 7;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 70px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.brand,
.topbar a {
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 15px;
  font-style: italic;
  text-transform: none;
}

.brand-mark {
  font-family: Arial, sans-serif;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
}

.topbar nav {
  display: flex;
  gap: 38px;
}

.topbar nav a,
.reset-button {
  position: relative;
}

.topbar nav a::after,
.reset-button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -5px;
  height: 1px;
  background: currentColor;
  transition: right 180ms ease;
}

.topbar nav a:hover::after,
.reset-button:hover::after {
  right: 0;
}

.reset-button {
  justify-self: end;
  padding: 0;
  border: 0;
  background: transparent;
  text-transform: uppercase;
}

.hero-copy {
  position: absolute;
  z-index: 2;
  top: 15%;
  left: 50%;
  width: min(720px, 58vw);
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  transition: opacity 400ms ease, transform 500ms ease;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.eyebrow span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--moss);
  box-shadow: 0 0 0 4px rgba(97, 143, 48, 0.14);
}

h1 {
  margin: 0;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(64px, 7.2vw, 122px);
  font-weight: 400;
  font-style: italic;
  line-height: 0.76;
  letter-spacing: -0.055em;
}

.subhead {
  margin: 30px 0 0;
  font-size: 9px;
  letter-spacing: 0.23em;
  text-transform: uppercase;
}

.growth-readout {
  position: absolute;
  z-index: 7;
  right: 28px;
  bottom: 28px;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 7px 9px;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.growth-readout strong {
  grid-column: 1 / -1;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 34px;
  font-weight: 400;
  font-style: italic;
  line-height: 0.8;
  text-align: right;
}

.pulse {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 0 0 rgba(154, 198, 74, 0.5);
  animation: pulse 1.8s infinite;
}

.instruction {
  position: absolute;
  z-index: 7;
  left: 28px;
  bottom: 28px;
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: opacity 300ms ease;
}

.instruction i {
  width: 28px;
  height: 1px;
  background: var(--line);
}

.cursor {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  width: 42px;
  height: 42px;
  margin: -21px 0 0 -21px;
  border: 1px solid rgba(17, 21, 18, 0.62);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-100px, -100px, 0) scale(0.72);
  transition: width 180ms ease, height 180ms ease, margin 180ms ease, border-color 180ms ease, opacity 180ms ease;
}

.cursor::before,
.cursor::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: rgba(17, 21, 18, 0.55);
  transform: translate(-50%, -50%);
}

.cursor::before {
  width: 10px;
  height: 1px;
}

.cursor::after {
  width: 1px;
  height: 10px;
}

.cursor span {
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: rgba(120, 167, 55, 0.12);
  transform: scale(0);
  transition: transform 180ms ease;
}

body.pointer-visible .cursor {
  opacity: 1;
}

body.pointer-growing .cursor {
  width: 58px;
  height: 58px;
  margin: -29px 0 0 -29px;
  border-color: var(--moss);
}

body.pointer-growing .cursor span {
  transform: scale(1);
}

body.pointer-dragging .cursor {
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
}

.loading {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  background: var(--paper);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
  transition: opacity 600ms ease, visibility 600ms ease;
}

.loading i {
  position: relative;
  width: 180px;
  height: 1px;
  overflow: hidden;
  background: rgba(17, 21, 18, 0.16);
}

.loading b {
  margin-top: -6px;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 32px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.02em;
}

.loading i::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  background: var(--moss);
  animation: loading 1.2s ease-in-out infinite;
}

.is-ready .loading {
  opacity: 0;
  visibility: hidden;
}

.is-interacting .hero-copy {
  opacity: 0.22;
  transform: translateX(-50%) translateY(-8px);
}

.is-interacting .instruction {
  opacity: 0.45;
}

.fallback {
  position: absolute;
  z-index: 40;
  inset: 0;
  display: none;
  place-content: center;
  padding: 32px;
  background: var(--paper);
  text-align: center;
}

.fallback h2 {
  margin: 0;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 42px;
  font-weight: 400;
  font-style: italic;
}

.fallback p {
  margin: 14px 0 24px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.fallback button {
  justify-self: center;
  padding: 11px 18px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.no-webgl .fallback,
.load-failed .fallback {
  display: grid;
}

.load-failed .loading {
  display: none;
}

body.load-failed,
body.load-failed button {
  cursor: auto;
}

@keyframes loading {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(340%); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(154, 198, 74, 0.42); }
  50% { box-shadow: 0 0 0 7px rgba(154, 198, 74, 0); }
}

@media (max-width: 899px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 18px;
  }

  .topbar nav {
    display: none;
  }

  .hero-copy {
    top: 18%;
    width: 94vw;
  }

  h1 {
    font-size: clamp(48px, 12vw, 68px);
    line-height: 0.78;
  }

  .subhead {
    display: none;
  }

  .instruction {
    left: 18px;
  }

  .growth-readout {
    right: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
