/*
 * LoudChat landing page. The look is "Tracked" (DESIGN.md); the colour
 * values are the same ones as mobile/src/constants/theme.ts.
 *
 * Colour always carries meaning: the hi-vis signal colour is only ever the
 * talk button, amber is due soon and red is late. None of the three appears
 * on this page, so nothing here uses them.
 */

@font-face {
  font-family: "Archivo";
  src: url("fonts/Archivo-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --paper: #F3F3F0;
  --text: #0E0F11;
  --mute: #5C6067;
  --faint: #686D74;

  --shell: #0E0F11;
  --on-shell: #FFFFFF;
  --on-shell-mute: rgba(255, 255, 255, 0.62);
  --dock-primary: #F5F5F2;
  --on-dock-primary: #0E0F11;
  --dock-outline: rgba(255, 255, 255, 0.3);

  --display: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ui: system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --header: 72px;
  --gutter: 40px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17181B;
    --text: #F5F5F2;
    --mute: #A6AAB1;
    --faint: #8F939A;
    --shell: #08090A;
  }
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--shell);
  color: var(--text);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--text); color: var(--paper); }
.top ::selection, .join ::selection { background: var(--dock-primary); color: var(--on-dock-primary); }

/* Header: a solid shell field, as in the app. */

.top {
  height: var(--header);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  background: var(--shell);
  color: var(--on-shell);
}

.mark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 26px;
  line-height: 1;
}

/* Two halves: the pitch on paper, the registration on the shell. */

main {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr);
  min-height: calc(100vh - var(--header));
  min-height: calc(100svh - var(--header));
  background: var(--shell);
}

.pitch {
  display: grid;
  align-content: center;
  background: var(--paper);
  border-top-right-radius: 24px;
  padding: 56px 56px 72px var(--gutter);
}

/* The headline is set a line at a time, so the first letters read C, H, A, T down the edge. */
h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.25rem, 6.2vw - 0.875rem, 4.5rem);
  line-height: 1.03;
}
h1 .line, h1 .vo .rise { display: block; }

/* Two headlines are kept until one is chosen; only one is ever shown. */
html[data-line="voice"] .pick-chat,
html:not([data-line="voice"]) .pick-voice { display: none; }

/* The crossed-out word. The line is drawn as a background so it can be drawn in. */
h1 s {
  text-decoration: none;
  white-space: nowrap;
  color: var(--faint);
  background: linear-gradient(var(--text), var(--text)) no-repeat left 58% / 100% 0.085em;
}

.short {
  margin: 28px 0 0;
  max-width: 30em;
  font-size: 20px;
  line-height: 28px;
  color: var(--mute);
  text-wrap: pretty;
}
.short b { color: var(--text); font-weight: 700; letter-spacing: 0.04em; }

/* Registration: a solid shell field, like the app's dock. */

.join {
  display: grid;
  align-content: center;
  background: var(--shell);
  color: var(--on-shell);
  padding: 56px 56px 72px;
}
.join-inner { max-width: 440px; }

.join h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.625rem, 1.25rem + 0.9vw, 2rem);
  line-height: 1.12;
  text-wrap: balance;
}

.lede {
  margin: 12px 0 0;
  color: var(--on-shell-mute);
  text-wrap: pretty;
}
.lede b { color: var(--on-shell); font-weight: 600; overflow-wrap: anywhere; }

.field { display: grid; gap: 8px; margin-top: 18px; }
.lede + .field { margin-top: 28px; }

label {
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
}

input {
  width: 100%;
  height: 56px;
  padding: 0 16px;
  border: 1.5px solid var(--dock-outline);
  border-radius: 12px;
  background: transparent;
  color: var(--on-shell);
  caret-color: var(--on-shell);
  font: inherit;
  transition: border-color 0.15s var(--ease-out);
}
input:hover { border-color: rgba(255, 255, 255, 0.55); }
input:focus-visible {
  outline: 2px solid var(--on-shell);
  outline-offset: 2px;
  border-color: var(--on-shell);
}
/* A missing or wrong field is marked by a heavier outline and words, never by red: red means late. */
input[aria-invalid="true"] { border-color: var(--on-shell); border-width: 2.5px; }
input:-webkit-autofill {
  -webkit-text-fill-color: var(--on-shell);
  box-shadow: 0 0 0 1000px var(--shell) inset;
}

.error {
  margin: 0;
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
}

button {
  width: 100%;
  height: 60px;
  margin-top: 28px;
  padding: 0 24px;
  border: 0;
  border-radius: 12px;
  background: var(--dock-primary);
  color: var(--on-dock-primary);
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), opacity 0.15s var(--ease-out);
}
button:hover { background: #FFFFFF; }
button:active { opacity: 0.8; }
button:disabled { opacity: 0.6; cursor: default; }
button:disabled:hover { background: var(--dock-primary); }
button + .error { margin-top: 12px; }
button:focus-visible { outline: 2px solid var(--on-shell); outline-offset: 3px; }

.small {
  margin: 16px 0 0;
  font-size: 15px;
  line-height: 20px;
  color: var(--on-shell-mute);
}

.done:focus { outline: none; }

/* A field for robots only: off screen and out of the tab order. */
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* One moment of motion: the old word is crossed out, then the new name arrives a word at a time.
   It only runs while the page carries the "motion" class, which the script in the head
   removes after a few seconds, so nothing can stay hidden if the animation never plays. */

@media (prefers-reduced-motion: no-preference) {
  .motion h1 s { animation: strike 0.5s var(--ease-out) 0.35s backwards; }
  .motion .rise { animation: rise 0.55s var(--ease-out) calc(0.8s + var(--i) * 0.12s) backwards; }
  .motion .short { animation: rise 0.55s var(--ease-out) 1.6s backwards; }
}
@keyframes strike { from { background-size: 0 0.085em; } }
@keyframes rise { from { opacity: 0; transform: translateY(0.25em); } }

/* Phone and narrow windows: the headline, then the form. Nothing else. */

@media (max-width: 899px) {
  :root { --header: 62px; --gutter: 20px; }

  .mark { font-size: 24px; }

  main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    background: var(--paper);
  }

  .pitch { display: block; border-radius: 0; padding: 24px var(--gutter) 28px; }
  h1 { font-size: clamp(1.875rem, 9vw, 3.25rem); }
  h1 .vo .rise { display: inline; }
  .short { margin-top: 14px; font-size: 17px; line-height: 24px; }

  .join {
    display: block;
    border-radius: 24px 24px 0 0;
    padding: 24px var(--gutter) calc(28px + env(safe-area-inset-bottom));
  }
  .join h2 { font-size: 1.375rem; }
  .join-inner { max-width: 520px; margin: 0 auto; }
  .field { margin-top: 14px; }
  .lede + .field { margin-top: 22px; }
  input { height: 52px; }
  button { margin-top: 22px; }
}
