/*
 * 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;

  --field: #FFFFFF;
  --edge: #8A8E95;

  --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;
    --field: #222428;
    --edge: #6B6F76;
    --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, 5.4vw - 0.875rem, 4rem);
  line-height: 1.03;
}
h1 .line { display: block; }

/* 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; }

/* What Chatterman does, said plainly, and the promise in three beats. */

.sell { margin-top: 28px; max-width: 34em; }
.lead {
  margin: 0;
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  text-wrap: balance;
}
.does {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.does li { position: relative; padding-left: 22px; }
.does li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text);
}
.boss { margin: 16px 0 0; text-wrap: pretty; }
.boss b { font-weight: 600; }
.punch {
  margin: 20px 0 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.15;
}

/* 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; }

.small a { color: inherit; text-underline-offset: 3px; }
.small a:hover { color: var(--on-shell); }
.small a:focus-visible { outline: 2px solid var(--on-shell); outline-offset: 2px; border-radius: 2px; }

/* The invite page: three steps on paper, the team code on the shell. */

.steps {
  margin: 28px 0 0;
  padding: 0 0 0 1.4em;
  max-width: 32em;
  display: grid;
  gap: 10px;
  font-size: 20px;
  line-height: 28px;
}
.steps li::marker { font-family: var(--display); font-weight: 700; }
.team-code {
  margin: 10px 0 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.75rem, 2rem + 3vw, 4rem);
  line-height: 1.05;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
a.button {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  margin-top: 28px;
  border-radius: 12px;
  background: var(--dock-primary);
  color: var(--on-dock-primary);
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
  transition: background-color 0.15s var(--ease-out), opacity 0.15s var(--ease-out);
}
a.button:hover { background: #FFFFFF; }
a.button:active { opacity: 0.8; }
a.button:focus-visible { outline: 2px solid var(--on-shell); outline-offset: 3px; }

/* Support, privacy and terms: plain text on paper. */

.legal { background: var(--paper); }
a.mark { color: inherit; text-decoration: none; }
main.doc {
  display: block;
  min-height: 0;
  background: var(--paper);
  padding: 40px var(--gutter) 80px;
}
.doc-inner { max-width: 680px; }
.doc h1 { font-size: clamp(1.875rem, 1.2rem + 2vw, 2.5rem); }
.doc-date { margin: 10px 0 0; font-size: 15px; color: var(--mute); }
.doc-nav { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 20px; }
.doc a { color: var(--text); font-weight: 600; text-underline-offset: 3px; }
.doc a:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 2px; }
.doc-part { margin-top: 52px; scroll-margin-top: 16px; }
.doc h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 26px; line-height: 1.15; }
.doc h3 { margin: 26px 0 0; font-size: 17px; line-height: 24px; font-weight: 600; }
.doc p { margin: 8px 0 0; max-width: 68ch; }
.doc form { max-width: 440px; }
.doc input, .doc textarea {
  width: 100%;
  border: 1.5px solid var(--edge);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  caret-color: var(--text);
  font: inherit;
}
.doc textarea { display: block; padding: 12px 16px; resize: vertical; }
.doc input:hover, .doc textarea:hover { border-color: var(--text); }
.doc input:focus-visible, .doc textarea:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-color: var(--text);
}
.doc input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px var(--field) inset;
}
.doc button { background: var(--text); color: var(--paper); }
.doc button:hover { background: var(--text); opacity: 0.88; }
.doc button:disabled:hover { background: var(--text); opacity: 0.6; }
.doc button:focus-visible { outline-color: var(--text); }
.doc .sent { font-weight: 600; }
.doc .sent:focus { outline: none; }

/* 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; }
  .motion .sell { animation: rise 0.55s var(--ease-out) 1.85s 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); }
  .short { margin-top: 14px; font-size: 17px; line-height: 24px; }
  .steps { margin-top: 18px; font-size: 17px; line-height: 24px; }
  .sell { margin-top: 16px; }
  .lead { font-size: 17px; line-height: 24px; }
  .does, .boss { display: none; }
  .punch { margin-top: 10px; font-size: 18px; }

  .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; }
}
