/*
  Design tokens, copied from the easyperio app
  (easyperio/packages/web/src/styles.css, `:root`) so the waiting list and the
  app look like one product. Light theme only. Raw colour and size values live
  here and nowhere else; every rule below reads a token.

  Contrast ratios (WCAG 2.x, AA needs 4.5:1 for text, 3:1 for control borders
  and the focus ring), as measured in the app:
    text on surface          #111827 on #ffffff   17.74
    muted text on surface    #4b5563 on #ffffff    7.56
    muted text on subtle     #4b5563 on #f3f4f6    6.87
    primary button           #ffffff on #0f766e    5.47
    primary button hover     #ffffff on #115e59    7.58
    secondary button text    #0f766e on #ffffff    5.47
    error text on surface    #b91c1c on #ffffff    6.47
    error text on alert bg   #b91c1c on #fef2f2    5.91
    input border             #6b7280 on #ffffff    4.83  (non-text, needs 3)
    focus ring               #0f766e on #ffffff    5.47  (non-text, needs 3)

  Served at `/styles.css` (not hashed): the Worker's confirm and unsubscribe
  pages link it too.
*/
:root {
  --color-primary: #0f766e;
  --color-primary-hover: #115e59;
  --color-on-primary: #ffffff;
  --color-text: #111827;
  --color-text-muted: #4b5563;
  --color-surface: #ffffff;
  --color-surface-subtle: #f3f4f6;
  --color-disabled: #e5e7eb;
  --color-border: #6b7280;
  --color-divider: #d1d5db;
  --color-error: #b91c1c;
  --color-error-surface: #fef2f2;
  --color-success: #166534;
  --color-success-surface: #f0fdf4;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;

  --font-family: system-ui, sans-serif;
  --font-size-base: 1rem;
  --font-size-small: 0.875rem;
  --font-size-h1: 1.75rem;
  --font-size-h2: 1.375rem;
  --font-weight-semibold: 600;
  --line-height: 1.5;

  --radius: 0.5rem;
  --border-width: 1px;

  --control-min-height: 48px;
  --form-max-width: 24rem;
  --container-max-width: 64rem;

  --focus-ring-width: 3px;
  --focus-ring-offset: 2px;
  --focus-ring: var(--focus-ring-width) solid var(--color-primary);
}

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

html,
body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  color: var(--color-text);
  background: var(--color-surface);
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

h1 {
  margin: 0 0 var(--space-3);
  font-size: var(--font-size-h1);
  line-height: 1.2;
}

h2 {
  margin: 0 0 var(--space-3);
  font-size: var(--font-size-h2);
  line-height: 1.25;
}

p {
  margin: 0 0 var(--space-3);
}

a {
  color: var(--color-primary);
}

a:hover {
  color: var(--color-primary-hover);
}

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

[tabindex="-1"]:focus:not(:focus-visible) {
  outline: none;
}

[hidden] {
  display: none !important;
}

.visually-hidden,
.hp {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Page frame. */

.page,
body > main {
  width: 100%;
  max-width: var(--container-max-width);
  margin-inline: auto;
  padding: var(--space-4);
  overflow-wrap: anywhere;
}

body > main {
  max-width: 40rem;
  padding-block: var(--space-8);
}

.site-header {
  padding-bottom: var(--space-4);
}

.logo {
  display: block;
  width: auto;
  height: 2rem;
}

.logo-link {
  display: inline-block;
}

/* Hero: fits one phone screen above the form. */

.subheadline {
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
}

.points {
  margin: 0 0 var(--space-3);
  padding: 0;
  list-style: none;
}

.points li {
  position: relative;
  padding-left: var(--space-6);
  margin-bottom: var(--space-2);
}

.points li::before {
  content: "✓";
  content: "✓" / "";
  position: absolute;
  left: 0;
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
}

.status-line {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: var(--color-surface-subtle);
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.cta {
  width: 100%;
}

/* Buttons. */

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-min-height);
  padding: var(--space-3) var(--space-6);
  border: var(--border-width) solid var(--color-primary);
  border-radius: var(--radius);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font: inherit;
  font-weight: var(--font-weight-semibold);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:hover,
button:hover {
  background: var(--color-primary-hover);
  color: var(--color-on-primary);
}

.button-secondary {
  background: var(--color-surface);
  color: var(--color-primary);
}

.button-secondary:hover {
  background: var(--color-surface-subtle);
  color: var(--color-primary-hover);
}

button:disabled {
  cursor: progress;
  background: var(--color-disabled);
  border-color: var(--color-disabled);
  color: var(--color-text-muted);
}

/* Form. */

.signup {
  max-width: 32rem;
  padding-top: var(--space-8);
  scroll-margin-top: var(--space-4);
}

.lead {
  color: var(--color-text-muted);
}

.notice {
  padding: var(--space-3);
  border-radius: var(--radius);
  background: var(--color-surface-subtle);
}

form {
  margin: 0;
}

.field {
  margin: 0 0 var(--space-4);
  padding: 0;
  border: 0;
  min-width: 0;
}

label,
legend {
  display: block;
  margin-bottom: var(--space-1);
  padding: 0;
  font-weight: var(--font-weight-semibold);
}

.hint {
  margin-bottom: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

input[type="email"],
input[type="text"] {
  display: block;
  width: 100%;
  min-height: var(--control-min-height);
  padding: var(--space-2) var(--space-3);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

input[aria-invalid="true"] {
  border-color: var(--color-error);
  box-shadow: 0 0 0 var(--border-width) var(--color-error);
}

.field-error {
  margin: var(--space-1) 0 0;
  color: var(--color-error);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
}

/* Choices: radio buttons that look like toggle buttons. */

.choices {
  display: grid;
  gap: var(--space-2);
}

.choices-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choices-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice {
  position: relative;
  margin: 0;
  font-weight: normal;
}

.choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.choice span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: var(--control-min-height);
  padding: var(--space-2);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  text-align: center;
  line-height: 1.2;
}

.choice input:checked + span {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-weight: var(--font-weight-semibold);
}

.choice input:checked + span::before {
  content: "✓";
  content: "✓" / "";
}

.choice input:focus-visible + span {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

.choice input:hover:not(:checked) + span {
  background: var(--color-surface-subtle);
}

fieldset[data-invalid] .choice span {
  border-color: var(--color-error);
}

.consent {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-1) var(--space-3);
  align-items: start;
}

.consent input {
  width: 1.5rem;
  height: 1.5rem;
  margin: 0;
  accent-color: var(--color-primary);
}

.consent label {
  margin: 0;
  font-weight: normal;
}

.consent .field-error {
  grid-column: 1 / -1;
}

.consent input[aria-invalid="true"] {
  outline: var(--border-width) solid var(--color-error);
  outline-offset: var(--focus-ring-offset);
}

.form-alert:empty {
  display: none;
}

.form-alert {
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  border: var(--border-width) solid var(--color-error);
  border-radius: var(--radius);
  background: var(--color-error-surface);
  color: var(--color-error);
}

.form-alert p {
  margin: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

#signup-form .actions .button-primary {
  flex: 1 1 100%;
}

/* Recording still. */

.still {
  margin: var(--space-8) auto;
  max-width: 17.5rem;
}

.still img {
  display: block;
  width: 100%;
  height: auto;
  border: var(--border-width) solid var(--color-divider);
  border-radius: var(--radius);
}

.still figcaption {
  margin-top: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  text-align: center;
}

/* Footer. */

.site-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  border-top: var(--border-width) solid var(--color-divider);
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.site-footer p {
  margin-bottom: var(--space-1);
}

.footer-label {
  font-weight: var(--font-weight-semibold);
}

/* Privacy notice. */

.notice-page {
  max-width: 40rem;
}

.notice-page section {
  margin-top: var(--space-6);
}

.notice-page h2 {
  font-size: var(--font-size-base);
}

.notice-page ul {
  margin: 0 0 var(--space-3);
  padding-left: var(--space-6);
}

.version {
  margin-top: var(--space-6);
  color: var(--color-text-muted);
}

/* Wider screens: the still beside the copy and the form. */

@media (min-width: 48rem) {
  .page {
    padding: var(--space-6) var(--space-8);
  }

  .cta {
    width: auto;
  }
}

@media (min-width: 60rem) {
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18rem;
    column-gap: var(--space-12);
    align-items: start;
  }

  .hero,
  .signup {
    grid-column: 1;
  }

  .still {
    grid-column: 2;
    grid-row: 1 / span 2;
    position: sticky;
    top: var(--space-6);
    margin: 0;
  }
}
