/* Finbro waitlist page. Look: the app's night sky (docs/DESIGN.md 9h): a navy sheet with its
   grid, one yellow accent, Fredoka for the big words, Rubik for what is read, JetBrains Mono for
   cell references. Content sits in cells (radius 10), actions are pills. The page is the night
   scheme in light and dark mode alike, as the app's night screens are. */

@font-face {
  font-family: 'Fredoka';
  src: url('fonts/Fredoka_600SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Rubik';
  src: url('fonts/Rubik_400Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Rubik';
  src: url('fonts/Rubik_600SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/JetBrainsMono_600SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: dark;
  /* colour: the app's night palette */
  --sky: #0b1530;
  --sky-deep: #081026;
  --sky-raised: #13214a;
  --line: rgba(124, 156, 236, 0.075);
  --line-strong: rgba(124, 156, 236, 0.22);
  --text: #f3f6ff;
  /* titles: the app's warm yellow, a step softer than the button so the button stays the one loud thing */
  --title: #ffd76e;
  --text-2: #b4c0de;
  --text-3: #8d9bc2;
  --accent: #ffc83d;
  --accent-hover: #ffd466;
  --on-accent: #0e1a33;
  --gain: #34d27b;
  --loss: #ff8a8a;

  /* the sheet */
  --cell: 48px;

  /* type */
  --display: 'Fredoka', ui-rounded, system-ui, sans-serif;
  --body: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* motion tokens (charles-ux-animation): one set used everywhere */
  --t-press: 150ms;
  --t-fade: 220ms;
  --t-swap: 300ms;
  --t-enter: 640ms;
  --ease-out: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-in: cubic-bezier(0.55, 0, 1, 0.45);
  --ease-move: cubic-bezier(0.77, 0, 0.175, 1);

  /* the cast: width of one figure's drawing box */
  --fig: clamp(78px, 11.6vw, 178px);
}

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

html {
  background: var(--sky);
  color: var(--text);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--sky);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a {
  color: inherit;
}

button,
a {
  touch-action: manipulation;
}

.skip {
  position: absolute;
  z-index: 10;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
}
.skip:focus-visible {
  transform: none;
}

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 4px;
  border-radius: 6px;
}

/* ---------- the sky: grid, column letters, row numbers, the jargon cells ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 50% 38%, rgba(40, 72, 160, 0.28), transparent 70%),
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / var(--cell) var(--cell),
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / var(--cell) var(--cell),
    var(--sky);
}

.sheet-cols,
.sheet-rows {
  position: absolute;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  opacity: 0.38;
  font-variant-numeric: tabular-nums;
}
.sheet-cols {
  top: 0;
  left: var(--cell);
  right: 0;
  height: 24px;
  display: flex;
}
.sheet-cols span {
  flex: 0 0 var(--cell);
  text-align: center;
  line-height: 24px;
}
.sheet-rows {
  top: var(--cell);
  left: 0;
  width: var(--cell);
  bottom: 0;
}
.sheet-rows span {
  display: block;
  height: var(--cell);
  line-height: var(--cell);
  text-align: center;
}

.terms {
  position: absolute;
  inset: 0;
}
.term {
  position: absolute;
  width: calc(var(--cell) * 3);
  height: var(--cell);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-radius: 2px;
  background: rgba(19, 33, 74, 0.55);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  opacity: 0.42;
  transition:
    opacity 400ms var(--ease-out),
    background-color 400ms var(--ease-out);
}
.term b {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
}
.term span {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-2);
  white-space: nowrap;
}
.term.on {
  opacity: 1;
  background: rgba(19, 33, 74, 0.95);
}
.term.on span {
  color: var(--text);
}

/* Excel's cell cursor: a 2.5 px outline just outside the cell, with the fill handle at its corner.
   Outer layer moves x, inner moves y, on different curves, so a hop travels on an arc. */
.cursor {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 400ms var(--ease-out);
}
.cursor.live {
  opacity: 1;
}
.cursor.away {
  opacity: 0.25;
}
.cursor,
.cursor-y {
  will-change: transform;
}
.cursor-box {
  position: relative;
  width: calc(var(--cell) * 3 + 8px);
  height: calc(var(--cell) + 8px);
  margin: -4px 0 0 -4px;
  border: 2.5px solid var(--accent);
  border-radius: 4px;
}
.cursor-handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--sky);
}

/* ---------- top bar ---------- */

.top {
  position: relative;
  z-index: 2;
  height: 72px;
  display: flex;
  align-items: center;
  padding: 0 clamp(20px, 4vw, 56px);
  padding-top: 8px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.01em;
  color: var(--title);
}
.brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: block;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 20px 32px;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(42px, 6.4vw, 88px);
  line-height: 1.04;
  letter-spacing: -0.015em;
  max-width: 11.5em;
  text-wrap: balance;
  color: var(--title);
}

.lede {
  margin: 22px 0 0;
  max-width: 34em;
  font-size: clamp(17px, 1.45vw, 20px);
  line-height: 1.5;
  color: var(--text-2);
  text-wrap: balance;
}

/* ---------- sign up ---------- */

.signup {
  display: grid;
  margin-top: 40px;
  width: min(100%, 520px);
}
.signup > * {
  grid-area: 1 / 1;
}

.form {
  text-align: left;
  transition:
    opacity var(--t-swap) var(--ease-out),
    transform var(--t-swap) var(--ease-out);
}
.form label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  margin: 0 0 8px 2px;
}
.row {
  display: flex;
  gap: 12px;
}

.cell {
  position: relative;
  flex: 1;
  min-width: 0;
}
.cell input {
  width: 100%;
  height: 56px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1.5px solid rgba(180, 192, 222, 0.32);
  background: rgba(8, 16, 38, 0.72);
  color: var(--text);
  font: 400 17px/1 var(--body);
  outline: none;
  transition: border-color var(--t-press) ease;
}
.cell input::placeholder {
  color: var(--text-3);
}
.cell input:focus-visible {
  outline: none;
}
@media (hover: hover) and (pointer: fine) {
  .cell input:hover {
    border-color: rgba(180, 192, 222, 0.5);
  }
}
.cell.bad input {
  border-color: var(--loss);
}

/* the focus ring is the cell cursor */
.cell-cursor {
  position: absolute;
  inset: -6px;
  border: 2.5px solid var(--accent);
  border-radius: 14px;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.985);
  transition:
    opacity var(--t-press) var(--ease-out),
    transform var(--t-press) var(--ease-out);
}
.cell-cursor .cursor-handle {
  right: -6px;
  bottom: -6px;
}
.cell:focus-within .cell-cursor {
  opacity: 1;
  transform: none;
}

.go {
  position: relative;
  display: grid;
  place-items: center;
  height: 56px;
  padding: 0 30px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 18px/1 var(--display);
  letter-spacing: 0.005em;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform var(--t-press) var(--ease-out),
    background-color var(--t-press) ease;
}
.go > span {
  grid-area: 1 / 1;
  transition: opacity 180ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .go:hover {
    background: var(--accent-hover);
  }
}
.go:active {
  transform: scale(0.96);
}
.go:focus-visible {
  outline-offset: 5px;
  border-radius: 999px;
}
.go-busy {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
}
.go.busy .go-label {
  opacity: 0;
}
.go.busy .go-busy {
  opacity: 1;
}
.go[aria-disabled='true'] {
  cursor: progress;
}
.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid rgba(14, 26, 51, 0.25);
  border-top-color: var(--on-accent);
  animation: spin 700ms linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error {
  margin: 10px 0 0 2px;
  min-height: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--loss);
}
.error:empty {
  display: none;
}

.hint {
  margin: 10px 0 0 2px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
}
.hint-use {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  font: 600 14px/1.5 var(--body);
  color: var(--title);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.note {
  margin: 14px 0 0 2px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-3);
}
.note a {
  color: var(--text-2);
  text-underline-offset: 3px;
  text-decoration-color: rgba(180, 192, 222, 0.5);
  transition: color var(--t-press) ease;
}
@media (hover: hover) and (pointer: fine) {
  .note a:hover {
    color: var(--text);
  }
}

/* a field people never see; bots fill it in */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* the done state takes the form's place in the same cell */
.done {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  text-align: left;
  padding: 20px 22px;
  border-radius: 10px;
  background: rgba(19, 33, 74, 0.86);
  box-shadow: inset 0 0 0 1.5px rgba(52, 210, 123, 0.45);
  align-self: center;
  transition:
    opacity var(--t-swap) var(--ease-out),
    transform var(--t-swap) var(--ease-out);
}
.done[hidden] {
  display: flex;
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}
.form.gone {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity 220ms var(--ease-in),
    transform 220ms var(--ease-in),
    visibility 0s linear 220ms;
}
.tick {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--gain);
}
.tick svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--sky);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
}
.done:not([hidden]) .tick svg {
  transition: stroke-dashoffset 360ms var(--ease-out) 160ms;
  stroke-dashoffset: 0;
}
.done-title {
  margin: 2px 0 4px;
  font: 600 20px/1.2 var(--display);
  color: var(--title);
}
.done-line {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-2);
}

/* shake for a wrong email, on submit only (360 ms, the field that is wrong) */
.shake {
  animation: shake 360ms var(--ease-move);
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  16% {
    transform: translateX(-10px);
  }
  33% {
    transform: translateX(10px);
  }
  50% {
    transform: translateX(-6px);
  }
  66% {
    transform: translateX(6px);
  }
  83% {
    transform: translateX(-3px);
  }
}

/* ---------- the desk: the cast standing on it, the footer as its front edge ---------- */

.desk {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  height: calc(var(--fig) * 472 / 360 * 0.86);
  margin-bottom: -2px;
  pointer-events: none;
}
.desk-figures {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.fig {
  pointer-events: auto;
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0 calc(var(--fig) * -0.09);
  background: none;
  width: var(--fig);
  aspect-ratio: 360 / 472;
  cursor: pointer;
  transform: translateY(var(--rise, 0));
  -webkit-tap-highlight-color: transparent;
}
.fig svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.fig:focus-visible {
  outline-offset: -8px;
  border-radius: 20px;
}

.foot {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 52px;
  padding: 0 clamp(20px, 4vw, 56px) env(safe-area-inset-bottom);
  background: var(--sky-deep);
  box-shadow: inset 0 1px 0 var(--line-strong);
  font-size: 13.5px;
  color: var(--text-3);
}
.foot a {
  text-decoration: none;
  color: var(--text-2);
  transition: color var(--t-press) ease;
}
@media (hover: hover) and (pointer: fine) {
  .foot a:hover {
    color: var(--text);
  }
}

/* ---------- entrance (first paint only; a launch page plays it once) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    animation: rise var(--t-enter) var(--ease-out) both;
    animation-delay: 120ms;
  }
  .reveal.r1 {
    animation-delay: 210ms;
  }
  .reveal.r2 {
    animation-delay: 300ms;
  }
  .fig {
    animation: stand 700ms var(--ease-out) both;
    animation-delay: calc(420ms + var(--n) * 45ms);
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}
@keyframes stand {
  from {
    opacity: 0;
    transform: translateY(46%);
  }
}

/* ---------- small screens ---------- */

@media (max-width: 1099px) {
  .sheet-cols,
  .sheet-rows {
    display: none;
  }
}

@media (max-width: 560px) {
  :root {
    --fig: clamp(74px, 23vw, 118px);
  }
  .top {
    height: 64px;
  }
  h1 {
    font-size: clamp(32px, 9.3vw, 44px);
    line-height: 1.08;
  }
  .lede {
    margin-top: 16px;
    font-size: 16.5px;
  }
  .brand {
    font-size: 21px;
  }
  .brand img {
    width: 32px;
    height: 32px;
  }
  .hero {
    justify-content: flex-start;
    padding-top: clamp(28px, 8vh, 72px);
  }
  .signup {
    margin-top: 32px;
  }
  .row {
    flex-direction: column;
  }
  .go {
    width: 100%;
  }
  .fig {
    margin: 0 calc(var(--fig) * -0.205);
  }
}

/* ---------- reduced motion: every end state, no travel ---------- */

@media (prefers-reduced-motion: reduce) {
  .form,
  .done,
  .form.gone,
  .cell-cursor,
  .term,
  .cursor {
    transition: none;
  }
  .done[hidden] {
    transform: none;
  }
  .form.gone {
    transform: none;
  }
  .done .tick svg {
    stroke-dashoffset: 0;
    transition: none;
  }
  .go:active {
    transform: scale(0.96);
  }
}

/* ---------- the privacy page ---------- */

.doc {
  position: relative;
  z-index: 2;
  flex: 1;
  width: min(100% - 40px, 640px);
  margin: 24px auto 72px;
  padding: clamp(24px, 4vw, 44px);
  border-radius: 10px;
  background: rgba(8, 16, 38, 0.82);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.doc h1 {
  font-size: clamp(34px, 4.4vw, 48px);
  max-width: none;
}
.doc-lede {
  margin: 10px 0 8px;
  color: var(--text-3);
  font-size: 15px;
}
.doc h2 {
  margin: 32px 0 8px;
  font: 600 20px/1.25 var(--display);
  color: var(--title);
}
.doc p {
  margin: 0;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-2);
  max-width: 62ch;
}
.doc a {
  color: var(--text);
  text-underline-offset: 3px;
}
.doc .doc-back {
  margin-top: 36px;
}

/* ---------- the page the confirmation link opens ---------- */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.state[hidden] {
  display: none;
}
.after {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 40px;
}
.after-line {
  margin: 0;
  font-size: 15px;
  color: var(--text-2);
}
.go-link {
  text-decoration: none;
}
.share-done {
  margin: 0;
  min-height: 1.5em;
  font-size: 14px;
  color: var(--text-2);
}

/* the bot check: takes no room unless Cloudflare asks for a tick */
.bot-check:empty {
  display: none;
}
