:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --text: #1b1f24;
  --muted: #5b6470;
  --border: #d9dee4;
  --accent: #1f6f5c;
  --accent-hover: #175446;
  --accent-text: #ffffff;
  --button-shadow: rgba(31, 111, 92, 0.35);
  --focus-ring: #6fc3ab;
  --error: #b42318;
  --success: #1f6f5c;
  --max: 44rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1a1f25;
    --text: #e8eaed;
    --muted: #a3acb8;
    --border: #2e353e;
    --accent: #4fb89c;
    --accent-hover: #6fcfb5;
    --accent-text: #0b1512;
    --button-shadow: rgba(0, 0, 0, 0.45);
    --focus-ring: #a6e3d2;
    --error: #f97066;
    --success: #4fb89c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1rem; }

header.site {
  border-bottom: 1px solid var(--border);
}
header.site .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
nav.site { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
nav.site a { color: var(--muted); text-decoration: none; }
nav.site a:hover, nav.site a[aria-current="page"] { color: var(--text); }

main { padding: 2rem 0 3rem; }
h1 { font-size: 1.9rem; line-height: 1.25; margin: 0 0 1rem; }
h2 { font-size: 1.25rem; margin: 2rem 0 0.5rem; }
.updated { color: var(--muted); font-size: 0.95rem; }
.lead { font-size: 1.15rem; color: var(--muted); }

.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-text);
  border: 0;
  border-radius: 10px;
  padding: 0.85rem 1.6rem;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 2px var(--button-shadow), 0 6px 16px -6px var(--button-shadow);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, opacity 0.2s ease;
}
.button:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 4px var(--button-shadow), 0 10px 22px -8px var(--button-shadow);
  transform: translateY(-1px);
}
.button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px var(--button-shadow);
}
.button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}
.button:disabled { opacity: 0.6; cursor: default; transform: none; }

/* Dim a form's button until every field is valid. Fields report validity
   natively (required) or via setCustomValidity (phone-input.js). The button
   stays clickable so a click explains what's missing. Browsers without :has()
   simply don't dim. */
form.sms:has(:invalid) .button {
  opacity: 0.5;
  box-shadow: none;
}
form.sms:has(:invalid) .button:hover {
  background: var(--accent);
  transform: none;
}
/* The form uses its own messages, so hide browsers' built-in invalid styling. */
form.sms :invalid { box-shadow: none; }

@media (max-width: 480px) {
  form.sms .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
  .button:hover, .button:active { transform: none; }
}

form.sms { display: grid; gap: 1rem; }
form.sms .field { display: grid; gap: 0.3rem; font-weight: 600; }
/* Country picker (flag and code) and number side by side; the number gets the rest. */
.phone-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.5rem;
}
/* The selected country's flag and code and a chevron. The native select
   covers it, transparent, so a click opens the browser's list of countries. */
.country-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.6rem 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}
.country-display { white-space: nowrap; font-weight: 400; }
.country-picker::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-top: -0.2rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
}
.country-picker:hover { border-color: var(--muted); }
.country-picker:has(select:focus-visible) { outline: 3px solid var(--focus-ring); outline-offset: 1px; }
form.sms .country-picker select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  /* Option text in the opened list. */
  font-size: 1rem;
  font-weight: 400;
}
form.sms input[type="text"],
form.sms input[type="email"],
form.sms input[type="tel"] {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  width: 100%;
}
.consent {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  font-size: 0.85rem;
  line-height: 1.5;
}
.consent input { width: 1.1rem; height: 1.1rem; margin-top: 0.1rem; accent-color: var(--accent); }
.form-hint { margin: -0.4rem 0 0; color: var(--muted); font-size: 0.85rem; }
.field-error { color: var(--error); font-size: 0.9rem; font-weight: 600; }
.field-error:empty { display: none; }
form.sms input[aria-invalid="true"] { border-color: var(--error); }

.status { min-height: 1.5rem; margin: 0; font-weight: 600; }
.status.error { color: var(--error); }
.status.success { color: var(--success); }
/* Links under a form (SMS Terms, Privacy Policy, and in dialogs the info
   page), separated by a middle dot. */
.form-links { display: flex; flex-wrap: wrap; gap: 0 0.5rem; margin: 0; font-size: 0.85rem; }
.form-links a + a::before { content: "·"; display: inline-block; margin-right: 0.5rem; color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; }

/* The sign-up form opened from other pages (sms-dialog.js). */
dialog.sms-dialog {
  width: min(42rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: 1.25rem 1.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.45);
}
dialog.sms-dialog::backdrop { background: rgba(10, 13, 16, 0.6); }
body:has(dialog.sms-dialog[open]) { overflow: hidden; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.dialog-head h2 { margin: 0; font-size: 1.35rem; }
.dialog-close {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  margin: -0.35rem -0.6rem 0 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.dialog-close:hover { color: var(--text); background: var(--border); }
.dialog-close:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 1px; }
dialog.sms-dialog .lead { font-size: 1rem; margin: 0.5rem 0 1rem; }

@media (max-width: 480px) {
  dialog.sms-dialog { padding: 1rem 1rem 0.75rem; }
}

footer.site {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}
footer.site .wrap { padding-top: 1.5rem; padding-bottom: 2rem; }
footer.site nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin-bottom: 0.75rem; }
footer.site a { color: var(--muted); }
