@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-grotesque-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --color-paper: #FCFCFA;
  --color-ink: #302F2D;
  --color-muted: #6F6B67;
  --color-accent: #AA4937;
  --color-error: #A3301A;
  --color-moth-wing-light: #C4A893;
  --color-moth-wing-mid: #D9C4B6;
  --color-moth-wing-pale: #EADED0;
  --color-moth-wing-shadow: #AB7360;
  --color-moth-body: #77685E;
  --font-sans: "Bricolage Grotesque";
  --text-caption: 14px;
  --font-weight-statement: 300;
  --font-weight-wordmark: 450;
  --tracking-wordmark: -0.06em;
  --tracking-entry: -0.03em;
  --leading-control: 20px;
  --spacing-3: 12px;
  --spacing-hairline: 1px;
  --spacing-sheet-x: clamp(20px, 7vw, 112px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  overflow-x: clip;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-sans), system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.landing {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 12vh var(--spacing-sheet-x);
}

.waitlist, .joined {
  --text-poster: clamp(38px, min(9.6vw, 13.5vh), 168px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  font-size: var(--text-poster);
  letter-spacing: var(--tracking-wordmark);
  line-height: 1;
}

.title { position: relative; }

.joined { align-items: center; text-align: center; }
.joined .title { position: relative; }

.wordmark {
  display: flex;
  margin: 0;
  font-size: inherit;
  font-weight: var(--font-weight-wordmark);
  white-space: pre;
}

.wordmark .stop { color: var(--color-accent); }

.wordmark:focus { outline: none; }

.intro {
  margin: 0;
  white-space: pre-line;
  text-wrap: balance;
  color: var(--color-muted);
  font-weight: var(--font-weight-statement);
}

.moth {
  --tilt: -19deg;
  position: absolute;
  z-index: 1;
  width: 0.733em;
  height: 0.475em;
  top: -0.317em;
  right: 0.358em;
  transform-origin: 0 0;
  pointer-events: none;
}

.joined .moth {
  --tilt: 15deg;
  top: -0.433em;
  right: auto;
  left: 0.367em;
}

.moth svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  rotate: var(--tilt);
  transform-origin: top left;
}

.moth .wing {
  transform-box: view-box;
  transform-origin: 44px 32px;
}

form {
  --text-entry: clamp(22px, 0.3em, 40px);
  width: min(100%, calc(var(--text-entry) * 14));
  margin-top: 0.5em;
  letter-spacing: normal;
}

label {
  display: block;
  color: var(--color-muted);
  font-size: var(--text-caption);
  line-height: var(--leading-control);
}

.controls {
  display: flex;
  align-items: baseline;
  gap: var(--spacing-3);
  padding-bottom: 0.2em;
  border-bottom: var(--spacing-hairline) solid var(--color-ink);
  font-size: var(--text-entry);
}

.controls input, button {
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  line-height: 1.25;
}

.controls input {
  flex: 1;
  min-width: 0;
  padding: 0;
  font-weight: var(--font-weight-statement);
  letter-spacing: var(--tracking-entry);
  outline: none;
}

.controls #code {
  flex: none;
  width: 3ch;
  font-weight: var(--font-weight-wordmark);
}

@supports (field-sizing: content) {
  .controls #code { width: auto; field-sizing: content; }
}

input::placeholder { color: color-mix(in srgb, var(--color-muted) 65%, var(--color-paper)); opacity: 1; }

button {
  margin: -0.35em -0.3em -0.35em 0;
  padding: 0.35em 0.3em;
  border-radius: 4px;
  font-weight: var(--font-weight-wordmark);
  letter-spacing: var(--tracking-wordmark);
  text-transform: lowercase;
  cursor: pointer;
}

button::after { content: "."; color: var(--color-accent); }
button:disabled { opacity: 0.65; cursor: wait; }

:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
.controls:has(input:focus-visible) { border-color: var(--color-accent); box-shadow: 0 1px 0 var(--color-accent); }
.controls:has(input[aria-invalid="true"]) { border-color: var(--color-error); box-shadow: 0 1px 0 var(--color-error); }

#feedback {
  margin: 0;
  color: var(--color-error);
  font-size: var(--text-caption);
  line-height: var(--leading-control);
}


#feedback:not(:empty) { margin-top: var(--spacing-3); }

@media (max-width: 430px) {
  .waitlist, .joined { --text-poster: clamp(36px, 11.2vw, 48px); }
}

@media (min-width: 900px) {
  .waitlist, .joined { position: relative; }
  .title { position: static; }
  .waitlist .intro { max-width: 5.9em; }
  .waitlist .moth {
    --tilt: -17deg;
    width: 2.3em;
    height: 1.49em;
    top: 0.8em;
    right: 0.35em;
  }
}

.waitlist.leaving {
  position: fixed;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .leaving > * { animation: leave 0.5s cubic-bezier(0.4, 0, 1, 1) both; }
  .leaving > .intro { animation-delay: 0.07s; }
  .leaving > .title { animation-delay: 0.14s; }
  .arriving .wordmark, .arriving .intro { animation: arrive 0.9s 1.05s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .arriving .intro { animation-delay: 1.25s; }
}

@keyframes leave { to { opacity: 0; transform: translateY(-5px); } }
@keyframes arrive { from { opacity: 0; transform: translateY(7px); } }
