/* The page as designed (Figma 2151:100604), on Ahead's tokens (Ahead/Design/Tokens.swift). */

@font-face {
  font-family: "Unbounded";
  src: url("/fonts/Unbounded.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

@font-face {
  font-family: "Sora";
  src: url("/fonts/Sora.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --bg-canvas: #000;
  --bg-surface: #0f0f0f;
  --bg-surface-inset: #181818;
  --fill-inverse: #fff;
  --text-primary: #fff;
  --text-tertiary: rgb(255 255 255 / 0.35);
  --text-on-accent: #000;
  --danger: #ff787a;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  --display: "Unbounded", "Arial Black", sans-serif;
  --sans: "Sora", system-ui, sans-serif;
}

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

html {
  background: var(--bg-canvas);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font: 400 16px/1.4 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Nothing on the page selects, so a long press never lights it up. The email field opts back in. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

h1, p { margin: 0; font-weight: inherit; }
img { display: block; }
::selection { background: #fff; color: #000; }

button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }

:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

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

/* Behind everything: the dial and its dust, turning. */

.field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100lvh;
  display: block;
  cursor: grab;
  touch-action: pan-y pinch-zoom;
}

.field-fade { display: none; }

.no-webgl .field { display: none; }

.is-grabbing,
.is-grabbing * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }

/* The site's nav: a floating glass pill of Phosphor icons on the left, regular for a page and fill
   for the one you're on, each named beside it on hover. Narrower than 820px the left edge belongs
   to the content, so the pill lies along the bottom instead. */

.site-nav {
  position: fixed;
  z-index: 10;
  left: 24px;
  top: 50%;
  translate: 0 -50%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 999px;
  background: rgb(24 24 24 / 0.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  backdrop-filter: blur(24px) saturate(1.6);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 0.08),
    inset 0 1px 0 rgb(255 255 255 / 0.06),
    0 12px 40px rgb(0 0 0 / 0.55);
}

.site-nav .nav-item {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: rgb(255 255 255 / 0.55);
  text-decoration: none;
  -webkit-touch-callout: none;
  transition: color 160ms ease, background-color 160ms ease, transform 160ms var(--ease-out);
}

.site-nav .nav-item:active { transform: scale(0.92); }

.site-nav svg {
  grid-area: 1 / 1;
  width: 22px;
  height: 22px;
}

.site-nav .icon-on { visibility: hidden; }

.site-nav .nav-item[aria-current="page"] {
  color: var(--text-primary);
  background: rgb(255 255 255 / 0.12);
}

.site-nav .nav-item[aria-current="page"] .icon-off { visibility: hidden; }
.site-nav .nav-item[aria-current="page"] .icon-on { visibility: visible; }

/* The name, out to the right of the pill. Screen readers get it from the link's own label. */
.nav-label {
  position: absolute;
  left: calc(100% + 18px);
  top: 50%;
  translate: 0 -50%;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgb(24 24 24 / 0.92);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08);
  color: var(--text-primary);
  font: 500 13px/1.2 var(--sans);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 120ms ease, transform 120ms var(--ease-out);
  pointer-events: none;
}

.site-nav .nav-item:focus-visible .nav-label {
  opacity: 1;
  transform: none;
}

@media (hover: hover) and (pointer: fine) {
  .site-nav .nav-item:hover { color: var(--text-primary); }
  .site-nav .nav-item:not([aria-current="page"]):hover { background: rgb(255 255 255 / 0.06); }

  .site-nav .nav-item:hover .nav-label {
    opacity: 1;
    transform: none;
    transition-duration: 160ms, 220ms;
  }
}

@media (max-width: 819px) {
  .site-nav {
    top: auto;
    bottom: max(16px, env(safe-area-inset-bottom));
    left: 50%;
    translate: -50% 0;
    flex-direction: row;
  }

  .nav-label { display: none; }
}

/* On a phone, Safari's own toolbar is along the bottom, so the pill sits at the top-left of the
   page instead, a little smaller, and scrolls away with it rather than floating over the words. */
@media (max-width: 640px) {
  .site-nav {
    position: absolute;
    top: 16px;
    bottom: auto;
    left: 20px;
    translate: none;
    gap: 2px;
    padding: 4px;
  }

  .site-nav .nav-item {
    width: 40px;
    height: 40px;
  }

  .site-nav svg {
    width: 20px;
    height: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-nav .nav-item,
  .nav-label { transition: none; }
}

/* The card, centred, with the design's 60pt above and below it. */

.page {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 16px;
  /* Only the card takes touches: the rest of the page belongs to the dial behind it. */
  pointer-events: none;
}

.card-wrap {
  position: relative;
  width: min(613px, 100%);
  display: flex;
}

/* The card's heavy shadow, cast over the dots. It's two blurred plates, moved rather than
   repainted, and the page swings them away from the pointer as if it were the light. */
.card-shadow {
  position: absolute;
  inset: 0;
  border-radius: 40px;
  background: #000;
  pointer-events: none;
  transform: translate(var(--x, 0), var(--y, 0));
}

.card-shadow-wide { filter: blur(90px); opacity: 0.95; }
.card-shadow-close { filter: blur(34px); opacity: 0.9; }

.card {
  position: relative;
  width: 100%;
  min-height: min(862px, calc(100svh - 120px));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  /* The design's 120pt, closing up in a window too short to hold it. */
  --room: clamp(48px, calc((100svh - 602px) / 2), 120px);
  padding-top: var(--room);
  overflow: clip;
  border-radius: 20px;
  background: var(--bg-surface);
  pointer-events: auto;
}

.hero-grid {
  position: absolute;
  top: -139px;
  left: 50%;
  margin-left: -201px;
  pointer-events: none;
}

.card-body {
  position: relative;
  width: min(453px, calc(100% - 48px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--room);
}

.content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 60px;
}

/* Brand/Wordmark */
.wordmark {
  font: 700 22px/1 var(--display);
  letter-spacing: -1.32px;
  text-transform: uppercase;
}

.copy {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}

/* Title/1 */
.title {
  font: 700 40px/1.2 var(--display);
  letter-spacing: -1.2px;
  text-transform: uppercase;
  text-wrap: balance;
}

/* Body/Regular, in text/tertiary */
.body {
  color: var(--text-tertiary);
  font: 400 16px/1.4 var(--sans);
  letter-spacing: -0.32px;
  text-wrap: pretty;
}

/* The form */

.signup {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.signup-row {
  min-height: 81px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 12px 24px;
  border-radius: 999px;
  background: var(--bg-surface-inset);
  transition: box-shadow 160ms ease;
}

.signup-row:focus-within { box-shadow: inset 0 0 0 2px #fff; }

.signup input {
  flex: 1;
  min-width: 0;
  height: 57px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  caret-color: #fff;
  font: 400 16px/1.4 var(--sans);
  letter-spacing: -0.32px;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

.signup input::placeholder { color: var(--text-tertiary); opacity: 1; }

.signup input:-webkit-autofill {
  -webkit-text-fill-color: #fff;
  -webkit-box-shadow: 0 0 0 40px var(--bg-surface-inset) inset;
  caret-color: #fff;
}

.signup button {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  border: 0;
  border-radius: 999px;
  background: var(--fill-inverse);
  color: var(--text-on-accent);
  font: 700 14px/1.2 var(--display);
  letter-spacing: -0.42px;
  text-transform: uppercase;
  white-space: nowrap;
  transition: transform 160ms var(--ease-out), opacity 160ms ease;
}

.signup button:active { transform: scale(0.96); }
.signup button[disabled] { opacity: 0.7; cursor: default; }

.signup button[aria-busy="true"]::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgb(0 0 0 / 0.25);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.signup-note { text-align: center; }
.signup-note.is-error { color: var(--danger); }

/* How many are on the list, under the form, the number in white; after joining, the invite note
   sits under it. It fades in if it arrives after the form is showing; in the opening it's there
   before the form rises. */
.signup-count:not([hidden]) {
  display: block;
  transition: opacity 400ms ease;
}

@starting-style {
  .signup-count:not([hidden]) { opacity: 0; }
}

.signup-count strong {
  color: var(--text-primary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Joined: the same place in the layout, so nothing moves. */
.signup-done {
  min-height: 81px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 999px;
  background: var(--bg-surface-inset);
  font: 700 14px/1.2 var(--display);
  letter-spacing: -0.42px;
  text-transform: uppercase;
  text-align: center;
  outline: none;
}

/* The foot */

.card-foot {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 40px;
}

.sound {
  flex: none;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--bg-surface-inset);
  color: var(--text-tertiary);
  font: 400 16px/1.4 var(--sans);
  letter-spacing: -0.32px;
  white-space: nowrap;
  transition: transform 160ms var(--ease-out), color 160ms ease;
}

.sound:active { transform: scale(0.96); }
.sound[aria-pressed="true"] { color: #fff; }

@media (hover: hover) and (pointer: fine) {
  .signup button:not([disabled]):hover { opacity: 0.88; }
  .sound:hover { color: #fff; }
}

/* The opening, in step with the dots (field.js). They make the app icon, then the dial. Then the
   card comes in from a little way off and rests in the middle, showing only the brand at its own
   middle. The brand moves up to its place, and the rest is revealed one by one. With no scripts,
   none of this applies. */

/* Waiting for the dots' first frame. */
.js:not(.is-playing) .card-wrap,
.js:not(.is-playing) .card-shadow,
.js:not(.is-playing) .brand,
.js:not(.is-playing) .wordmark,
.js:not(.is-playing) .hero-grid,
.js:not(.is-playing) .title,
.js:not(.is-playing) .copy .body,
.js:not(.is-playing) .signup,
.js:not(.is-playing) .card-foot,
.js:not(.is-playing) .site-nav { animation-play-state: paused; }

/* Everything here is timed from the card's arrival, which is set against the dots: it comes in as
   the last of the icon leaves the middle (the clock at the top of field.js). */
.js { --card-at: 2200ms; --words-at: calc(var(--card-at) + 1250ms); }

/* With no dots to wait for, the card comes straight in. */
.js.no-webgl { --card-at: 200ms; }

.js .card-wrap { animation: arrive 1000ms var(--ease-out) var(--card-at) backwards; }

@keyframes arrive { from { opacity: 0; transform: translateY(72px) scale(0.97); } }

.js .card-shadow { animation: fade 900ms ease-out calc(var(--card-at) + 200ms) backwards; }

@keyframes fade { from { opacity: 0; } }

.js .brand { animation: lift 800ms cubic-bezier(0.77, 0, 0.175, 1) calc(var(--card-at) + 850ms) backwards; }

@keyframes lift { from { transform: translateY(var(--brand-drop, 0)) scale(1.3); } }

/* The mark wipes on from the left, in white. */
.js .wordmark {
  background: linear-gradient(90deg, #fff 0 46%, transparent 52% 100%) 100% 0 / 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sweep 550ms linear calc(var(--card-at) + 300ms) forwards;
}

@keyframes sweep { to { background-position: 0 0; } }

/* The words wait for the brand to pass on its way up (--words-at), so it never crosses them. */
.js .hero-grid { animation: fade 1000ms ease-out var(--words-at) backwards; }

.js .title,
.js .copy .body,
.js .signup,
.js .card-foot {
  animation: rise 700ms var(--ease-out) backwards;
}

.js .title { animation-delay: var(--words-at); }
.js .copy .body { animation-delay: calc(var(--words-at) + 80ms); }
.js .signup { animation-delay: calc(var(--words-at) + 160ms); }
.js .card-foot { animation-delay: calc(var(--words-at) + 240ms); }

/* The nav comes last, once the page has said what it is. */
.js .site-nav { animation: rise 700ms var(--ease-out) calc(var(--words-at) + 400ms) backwards; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(6px); } }

@media (prefers-reduced-motion: reduce) {
  .js .card-wrap { animation: fade 300ms ease; }
  .js .card-shadow,
  .js .brand,
  .js .hero-grid,
  .js .title,
  .js .copy .body,
  .js .signup,
  .js .card-foot,
  .js .site-nav { animation: none; }
  .js .wordmark { background: none; color: #fff; animation: none; }
}

/* With the nav along the bottom, the card keeps clear of it. */
@media (max-width: 819px) {
  .page { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
}

/* The phone's own design (Figma 2159:100640): no container, on its own type, the dial an arc
   behind the brand at the top of the screen. */
@media (max-width: 640px) {
  .field-fade {
    display: block;
    position: fixed;
    inset: 0;
    height: 100lvh;
    /* Clear of the top edge too, so the dial never butts against Safari's status bar. */
    background: linear-gradient(#000 0, transparent 28px, transparent calc(var(--fade, 300px) - 80px), #000 var(--fade, 300px));
    pointer-events: none;
  }

  .page {
    display: block;
    padding: 0;
  }

  .card-wrap { width: 100%; }

  .card-shadow,
  .hero-grid { display: none; }

  .card {
    min-height: 100svh;
    /* The design's 235pt on its 884pt screen. Safari starts the page below the status bar and
       leaves about 714pt, where 163pt puts AHEAD in the same place on screen. A phone too short for
       that closes up. */
    padding-top: max(clamp(96px, calc(100svh - 551px), 173px), calc(100svh - 649px));
    border-radius: 0;
    background: none;
    pointer-events: none;
  }

  .card-body {
    width: calc(100% - 48px);
    gap: 48px;
    pointer-events: auto;
  }

  .content { gap: 48px; }

  /* Title/2 */
  .title {
    font-size: 32px;
    letter-spacing: -0.96px;
  }

  /* Subhead/Regular */
  .copy .body {
    font-size: 15px;
    letter-spacing: -0.3px;
  }

  .signup-row {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    min-height: 0;
    padding: 0;
    border-radius: 0;
    background: none;
  }

  .signup-row:focus-within { box-shadow: none; }

  .signup input {
    flex: none;
    width: 100%;
    height: 62px;
    padding: 20px;
    border-radius: 999px;
    background: var(--bg-surface-inset);
  }

  .signup input:focus { box-shadow: inset 0 0 0 2px #fff; }

  .signup button { width: 100%; }

  .signup-done { min-height: 62px; }

  /* Footnote/Regular */
  .signup-note,
  .card-foot .body {
    font-size: 13px;
    letter-spacing: 0;
  }

  .card-foot {
    padding: clamp(20px, calc((100svh - 640px) / 5), 48px) 24px;
    pointer-events: auto;
  }

  .sound {
    font-size: 13px;
    letter-spacing: 0;
  }
}

/* The same opening with no card to arrive: the brand appears in the middle of the screen, where
   the dots' icon was, and the fade comes up as the words do. */
@media (max-width: 640px) and (prefers-reduced-motion: no-preference) {
  /* The brand has further to go before it's clear of the title here. */
  .js { --words-at: calc(var(--card-at) + 1330ms); }

  .js .card-wrap { animation: none; }

  .js .brand {
    animation:
      fade 600ms ease-out var(--card-at) backwards,
      lift 800ms cubic-bezier(0.77, 0, 0.175, 1) calc(var(--card-at) + 850ms) backwards;
  }

  .js .field-fade { animation: fade 1100ms ease-out calc(var(--card-at) + 600ms) backwards; }

  .js:not(.is-playing) .field-fade { animation-play-state: paused; }
}
