/*
 * TiniTelli's coming-soon site: the waiting list, its notice and two small pages.
 *
 * Candy Pop, the founder's brand of 24 Oct: the same colours, fonts, shapes and movement as
 * @tv/ui's tokens.css, under the same names. Light always, never dark. Every colour, font, radius,
 * shadow and timing on this site is a token below, and so is every size that has a meaning; the
 * rules after them only read tokens (a few small measures that draw one shape, such as the tick's
 * mark, are written where they are used).
 *
 * The first page is one centred column with no box round the form (the founder, 17 Nov: the box
 * made it "a bit busy and lopsided"). Only the email field and the button are boxes.
 *
 * Its parts:
 *   1. The fonts, served from this site.
 *   2. The tokens: palette, type, shape, shadow, motion, sizes, colour roles.
 *   3. The page's base.
 *   4. The pieces: the column, the top of the first page, the title with the logo's dots, the form,
 *      the foot, the reading page.
 */

/* 1. The fonts. */
@font-face {
  font-family: 'Fredoka';
  src: url('/fonts/fredoka-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('/fonts/nunito-latin.woff2') format('woff2');
  font-weight: 200 1000;
  font-display: swap;
}

/* 2. The tokens. */
:root {
  /* The palette: the founder's ten colours and white. */
  --color-bubblegum: #d81e73; /* buttons and links */
  --color-plum: #2a1b3d; /* text */
  --color-muted: #6b5a7e; /* secondary text */
  --color-body: #4a3a5e; /* body copy */
  --color-lemon: #ffc93d; /* the star */
  --color-mint: #4ddba0; /* yes */
  --color-sky: #74c7ff; /* the show */
  --color-lilac: #b9a2ff; /* listening */
  --color-candy-floss: #ffe3f0; /* labels and chips */
  --color-blush: #fff5f9; /* background */
  --color-white: #ffffff; /* fields; text on Bubblegum (4.8:1) */

  /* Type: Fredoka for headings and buttons, Nunito for everything else. */
  --family-heading: 'Fredoka', ui-rounded, 'Arial Rounded MT Bold', system-ui, sans-serif;
  --family-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --weight-title: 700;
  --weight-button: 600;
  --weight-label: 800;
  --weight-strong: 700;
  --weight-regular: 400;

  /* Shape, shadow and motion. */
  --radius-pill: 9999px;
  --radius-card-lg: 28px;
  --radius-field: 16px;
  --radius-tick: 8px;
  --shadow-lift: 0 10px 28px rgb(216 30 115 / 0.16);
  --motion-quick: 150ms;
  --motion-gentle: 300ms;
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Sizes: a phone first; a tap target is never under 44 px. */
  --size-title: clamp(2.5rem, 11.2vw, 4rem);
  --size-notice-title: clamp(2rem, 8vw, 2.75rem);
  --size-heading: 1.5rem;
  --size-lede: 1.1875rem;
  --size-body: 1.0625rem;
  --size-small: 0.875rem;
  --size-label: 0.9375rem;
  --size-field: 1.125rem;
  --size-field-height: 3.5rem;
  --size-button-big: 1.375rem;
  --size-button-big-height: 4rem;
  --size-tick: 1.75rem;
  --size-target: 2.75rem;
  --size-logo: 3rem;
  --size-logo-small: 2.5rem;
  --size-line: 2px;
  --size-focus: 3px;
  --size-focus-offset: 2px;
  --size-top: 40rem; /* the headline's width */
  --size-measure: 30rem; /* the words under it */
  --size-form: 26rem; /* the form */
  --size-reading: 42rem; /* a page to read */
  --leading-title: 1.08;
  --leading-body: 1.5;
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1.25rem;
  --space-4: 2rem;
  --space-5: 3rem;

  /*
   * The logo's dots over the title's i's. Fredoka 700's own measures, in ems: its letters sit 0.236
   * above the foot of their box and a small letter is 0.5 tall. So a dot whose foot is 0.8 above the
   * box's foot sits 0.06 above its i, where a plain dot would; the i takes a little room each side
   * so that the shape, wider than a plain dot, never touches the tall letter beside it.
   */
  --dot-size: 0.27em;
  --dot-lift: 0.8em;
  --dot-room: 0.035em;

  /* Colour roles. Each colour has one job: Bubblegum is "do this", Mint is "yes", Lemon is the star. */
  --surface: var(--color-blush);
  --surface-raised: var(--color-white);
  --surface-soft: var(--color-candy-floss);
  --ink: var(--color-plum);
  --ink-body: var(--color-body);
  --ink-muted: var(--color-muted);
  --link: var(--color-bubblegum);
  --action: var(--color-bubblegum);
  --ink-on-action: var(--color-white);
  --yes: var(--color-mint);
  --ink-on-yes: var(--color-plum);
  --star: var(--color-lemon);
  --ink-on-star: var(--color-plum);
  --line: var(--color-muted); /* a field's edge: 3:1 or more */
  --focus: var(--color-plum);

  /* Light, always (R47): `only` stops a browser darkening the page by itself. */
  color-scheme: only light;
}

/* 3. The page's base. */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink-body);
  font: var(--weight-regular) var(--size-body) / var(--leading-body) var(--family-body);
}
h1,
h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--family-heading);
  text-wrap: balance;
}
p {
  margin: 0;
}
a {
  color: var(--link);
  font-weight: var(--weight-strong);
  text-decoration-thickness: var(--size-line);
  text-underline-offset: 0.2em;
}
:focus-visible {
  outline: var(--size-focus) solid var(--focus);
  outline-offset: var(--size-focus-offset);
}
.only-for-readers {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 4. The pieces. */

/* One centred column at every size, so nothing sits to one side. */
.column {
  width: 100%;
  margin-inline: auto;
  padding-inline: max(var(--space-3), env(safe-area-inset-left, 0px))
    max(var(--space-3), env(safe-area-inset-right, 0px));
}

/* The top of the first page: the logo, what state we are in, the headline, one line. */
.top {
  padding-block: var(--space-4);
  text-align: center;
}
.top .column {
  max-width: var(--size-top);
  display: grid;
  gap: var(--space-3);
  justify-items: center;
}
.logo {
  display: block;
  height: var(--size-logo);
  width: auto;
}
.soon {
  background: var(--star);
  color: var(--ink-on-star);
  border-radius: var(--radius-pill);
  padding: 0.375rem 0.875rem;
  font: var(--weight-button) var(--size-label) / 1.2 var(--family-heading);
}

/* The title. Its i's wear the logo's own dots: the star for the child, the heart and the paw for TiniTown. */
.title {
  font-size: var(--size-title);
  font-weight: var(--weight-title);
  line-height: var(--leading-title);
  letter-spacing: -0.01em;
}
.dot-i {
  position: relative;
  margin-inline: var(--dot-room);
}
.dot-i::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: var(--dot-lift);
  height: var(--dot-size);
  aspect-ratio: var(--dot-shape-width, 1.05);
  translate: -50% 0;
  background-color: var(--dot);
  -webkit-mask: var(--shape) center / contain no-repeat;
  mask: var(--shape) center / contain no-repeat;
}
.dot-star {
  --shape: url('/shapes/star.svg');
  --dot: var(--star);
}
.dot-heart {
  --shape: url('/shapes/heart.svg');
  --dot: var(--color-bubblegum);
  --dot-shape-width: 1.33; /* the heart is wider than it is tall, so its i takes more room */
  --dot-room: 0.07em;
}
.dot-paw {
  --shape: url('/shapes/paw.svg');
  --dot: var(--ink);
}
.lede {
  max-width: var(--size-measure);
  font-size: var(--size-lede);
  color: var(--ink-body);
}

/* One small performance when the page opens: the logo's dots pop in turn, then the title's. Never again. */
@media (prefers-reduced-motion: no-preference) {
  .logo [data-dot],
  .dot-i::before {
    animation: pop var(--motion-gentle) var(--ease-bounce) both;
  }
  .logo [data-dot] {
    transform-box: fill-box;
    transform-origin: center;
  }
  .logo [data-dot='heart'] {
    animation-delay: 200ms;
  }
  .logo [data-dot='paw'] {
    animation-delay: 350ms;
  }
  .logo [data-dot='star'] {
    animation-delay: 500ms;
  }
  .dot-star::before {
    animation-delay: 750ms;
  }
  .dot-heart::before {
    animation-delay: 900ms;
  }
  .dot-paw::before {
    animation-delay: 1050ms;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    scale: 0.4;
  }
}

/* The form: straight on the page, with no box round it. */
.ask {
  padding-block: 0 var(--space-5);
}
.join {
  max-width: var(--size-form);
  display: grid;
  gap: var(--space-3);
}
.field,
.country {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.field label,
.country legend {
  padding: 0;
  color: var(--ink);
  font-size: var(--size-label);
  font-weight: var(--weight-label);
}
.field input {
  width: 100%;
  height: var(--size-field-height);
  padding-inline: 1rem;
  border: var(--size-line) solid var(--line);
  border-radius: var(--radius-field);
  background: var(--surface-raised);
  color: var(--ink);
  font: var(--weight-regular) var(--size-field) / 1.2 var(--family-body);
}
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-4);
}
.choice,
.tick {
  position: relative;
  display: inline-grid;
  grid-template-columns: var(--size-tick) auto;
  gap: var(--space-2);
  align-items: center;
  min-height: var(--size-target);
  color: var(--ink);
  font-weight: var(--weight-strong);
}
.choice input,
.tick input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.choice .mark,
.tick .mark {
  display: grid;
  place-items: center;
  width: var(--size-tick);
  height: var(--size-tick);
  border: var(--size-line) solid var(--line);
  background: var(--surface-raised);
  transition: background-color var(--motion-quick) var(--ease-soft);
}
.choice .mark {
  border-radius: var(--radius-pill);
}
.tick .mark {
  border-radius: var(--radius-tick);
}
.choice .mark::after,
.tick .mark::after {
  content: '';
  scale: 0;
  transition: scale var(--motion-quick) var(--ease-bounce);
}
.choice .mark::after {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: var(--radius-pill);
  background: var(--ink-on-yes);
}
.tick .mark::after {
  width: 0.45rem;
  height: 0.8rem;
  margin-block-start: -0.15rem;
  border: solid var(--ink-on-yes);
  border-width: 0 0.1875rem 0.1875rem 0;
  rotate: 45deg;
}
.choice input:checked + .mark,
.tick input:checked + .mark {
  background: var(--yes);
  border-color: var(--ink-on-yes);
}
.choice input:checked + .mark::after,
.tick input:checked + .mark::after {
  scale: 1;
}
.choice input:focus-visible + .mark,
.tick input:focus-visible + .mark {
  outline: var(--size-focus) solid var(--focus);
  outline-offset: var(--size-focus-offset);
}
.hint {
  font-size: var(--size-small);
  color: var(--ink-muted);
}
.promise {
  color: var(--ink);
}
/* The honeypot (card 470): a field no person sees, reaches by keyboard or hears; robots fill it. */
.trap {
  display: none;
}
.go {
  width: 100%;
  min-height: var(--size-button-big-height);
  padding: var(--space-1) var(--space-3);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--action);
  color: var(--ink-on-action);
  box-shadow: var(--shadow-lift);
  font: var(--weight-button) var(--size-button-big) / 1.15 var(--family-heading);
  cursor: pointer;
  transition: scale var(--motion-quick) var(--ease-bounce);
}
.go:active {
  scale: 0.97;
}

/* The foot: who we are, as company law asks, on every page. */
.foot {
  padding-block: 0 var(--space-5);
  display: grid;
  gap: var(--space-1);
  color: var(--ink-muted);
  font-size: var(--size-small);
}
.foot.column {
  max-width: var(--size-reading);
}
.first-page .foot {
  max-width: var(--size-measure);
  text-align: center;
}
.foot a {
  color: var(--ink);
}
.foot .alone,
.message a {
  display: inline-block;
  padding-block: 0.5625rem; /* a link standing alone is a full 44 px to tap */
}

/* A page to read (the notice) and a page with one message (nearly there; not found). */
.reading {
  max-width: var(--size-reading);
  padding-block: var(--space-3) var(--space-4);
  display: grid;
  gap: var(--space-4);
}
.reading .logo {
  height: var(--size-logo-small);
}
.logo-link {
  display: inline-block;
  border-radius: var(--radius-field);
}
.prose {
  display: grid;
  gap: var(--space-3);
}
.prose h1 {
  font-size: var(--size-notice-title);
  font-weight: var(--weight-title);
  line-height: 1.1;
}
.prose h2 {
  margin-block-start: var(--space-2);
  font-size: var(--size-heading);
  font-weight: var(--weight-button);
  line-height: 1.2;
}
.prose ul {
  margin: 0;
  padding-inline-start: var(--space-3);
  display: grid;
  gap: var(--space-1);
}
.prose strong {
  color: var(--ink);
  font-weight: var(--weight-label);
}
.prose a {
  overflow-wrap: anywhere;
}
.short-version {
  background: var(--surface-soft);
  border-radius: var(--radius-card-lg);
  padding: var(--space-3);
  color: var(--ink);
  font-size: var(--size-lede);
}
.message {
  display: grid;
  gap: var(--space-3);
  justify-items: start;
}
.message h1 {
  font-size: var(--size-title);
  font-weight: var(--weight-title);
  line-height: var(--leading-title);
}
.message .join {
  width: 100%;
}
.message p {
  font-size: var(--size-lede);
  max-width: var(--size-measure);
}
