/*
 * The waitlist page. It follows the app's sign-in screen (the wordmark, one
 * line, one action) and copies the app's monochrome tokens from
 * packages/brand/src/tokens/tokens.css, since this page is built without it.
 * Hover changes a background instantly; nothing moves when pressed.
 */

@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/inter-latin.woff2') format('woff2-variations');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --fill: #f2f2f2;
  --fill-hover: #e8e8e8;
  --text: #0a0a0a;
  --text-secondary: #6b6b6b;
  --text-tertiary: #8c8c8c;
  --inverse: #0a0a0a;
  --inverse-hover: #262626;
  --inverse-text: #ffffff;
  --radius: 0.625rem;
  --enter-shift: 4px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0a0a0a;
    --fill: #1a1a1a;
    --fill-hover: #242424;
    --text: #f5f5f5;
    --text-secondary: #a1a1a1;
    --text-tertiary: #737373;
    --inverse: #f5f5f5;
    --inverse-hover: #d9d9d9;
    --inverse-text: #0a0a0a;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --enter-shift: 0px;
  }
}

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

html {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter Variable', Inter, ui-sans-serif, system-ui, sans-serif;
  font-synthesis: none;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

h1,
p {
  margin: 0;
}

::selection {
  background: var(--text);
  color: var(--bg);
}

main {
  flex: 1;
  width: 100%;
  max-width: 32rem;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 1.5rem;
}

/* The wordmark is drawn in the text colour through the logo as a mask, so
   it follows the theme. Sized from the logo's 146 × 49 viewBox. */
.wordmark {
  display: block;
  height: 4.5rem;
  width: calc(4.5rem * 146 / 49);
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: url('/sparsed.svg') left center / contain no-repeat;
  mask: url('/sparsed.svg') left center / contain no-repeat;
  user-select: none;
}

.intro {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

h1 {
  font-size: 1.25rem;
  line-height: 1.75rem;
  letter-spacing: -0.01em;
  font-weight: 400;
  text-wrap: balance;
}

.secondary {
  color: var(--text-secondary);
  text-wrap: pretty;
}

/* The form and its thank-you share one place, so the column never moves
   when one replaces the other. */
.slot {
  display: grid;
  width: 100%;
}
.slot > * {
  grid-area: 1 / 1;
  min-width: 0;
}

.join,
.done {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.row {
  display: flex;
  gap: 0.5rem;
}

input[type='email'] {
  flex: 1;
  min-width: 0;
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--fill);
  color: var(--text);
  font: inherit;
  /* 16px keeps iOS from zooming into the field. */
  font-size: 1rem;
  line-height: 1.5rem;
  outline: none;
}
input[type='email']::placeholder {
  color: var(--text-tertiary);
  opacity: 1;
}
input[type='email']:hover {
  background: var(--fill-hover);
}
input[type='email']:focus-visible {
  background: var(--fill);
  outline: 2px solid var(--text);
  outline-offset: 0;
}
/* The interface has no red: an invalid field gets a border in the text
   colour, and the message below says what's wrong. */
input[type='email'][aria-invalid='true'] {
  outline: 1px solid var(--text);
}
input[type='email'][aria-invalid='true']:focus-visible {
  outline-width: 2px;
}

button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  flex-shrink: 0;
  height: 2.25rem;
  padding: 0 0.875rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--inverse);
  color: var(--inverse-text);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: default;
  user-select: none;
}
button:hover {
  background: var(--inverse-hover);
}
button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
button[aria-busy='true'] {
  opacity: 0.4;
}

/* Shown only when sending takes longer than 400ms, so a quick answer
   never flashes it. Linear, since it stands for time passing. */
.spinner {
  display: none;
  width: 0.875rem;
  height: 0.875rem;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 9999px;
}
button[aria-busy='true'] .spinner {
  display: block;
  opacity: 0;
  animation:
    spinner-show 0s linear 400ms forwards,
    spinner-turn 700ms linear infinite;
}
@keyframes spinner-show {
  to {
    opacity: 1;
  }
}
@keyframes spinner-turn {
  to {
    transform: rotate(1turn);
  }
}

@media (pointer: coarse) {
  input[type='email'],
  button {
    height: 2.75rem;
  }
}

/* Turnstile shows itself only when it needs the person to act; the script
   marks that moment. */
.check.asking {
  margin-top: 0.75rem;
}

/* The message's line is kept even when empty, so the column never moves
   when one appears. */
.message {
  min-height: 1.25rem;
  font-weight: 500;
  text-wrap: pretty;
}

.done {
  gap: 0.25rem;
  outline: none;
}
/* Plays when the thank-you appears, not when the page loads. */
.done:not([hidden]) {
  animation: enter 220ms var(--ease-out);
}
.join[hidden],
.done[hidden] {
  display: flex;
  visibility: hidden;
}
.done-title {
  font-weight: 500;
}
@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(var(--enter-shift));
  }
}

/* The raffle rules: the same column, read from the top. */
main.rules {
  justify-content: flex-start;
  gap: 1.75rem;
}
.rules a.wordmark {
  color: var(--text);
  height: 3rem;
  width: calc(3rem * 146 / 49);
}
.rules section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.rules h2 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
}
.rules p,
.rules li {
  color: var(--text-secondary);
  text-wrap: pretty;
}
.rules p a {
  color: var(--text);
  text-underline-offset: 0.2em;
}
.rules ul {
  margin: 0;
  padding-left: 1.125rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

footer {
  width: 100%;
  max-width: 32rem;
  margin: 0 auto;
  padding: 0 1.5rem max(1rem, env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.25rem;
}
footer a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-decoration: none;
}
footer a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
footer a:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-radius: 0.25rem;
}
