/* Atkinson Hyperlegible Next: digits and letters that can't be mistaken for
   each other (0/O, 1/l/I), which matters for device and phone numbers. */
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(atkinson-hyperlegible-next-5.3.0-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(atkinson-hyperlegible-next-5.3.0-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Enamel of a boiler casing, navy ink, and one heat colour: the flame and
   whichever field you're in. The sticker stays paper-white in both themes,
   like the printed label on the unit. */
:root {
  --bg: #eef1f3;
  --text: #18233a;
  --text-hover: #2b3a58;
  --on-text: #ffffff;
  --muted: #556174;
  --line: #7a8797;
  --field: #ffffff;
  --glow: #e5422b;
  --error: #b3261e;
  --error-tint: #fbe9e7;
  --sticker: #ffffff;
  --sticker-text: #18233a;
  --sticker-muted: #556174;
  --sticker-rule: rgba(24, 35, 58, 0.28);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101826;
    --text: #e6ebf1;
    --text-hover: #ffffff;
    --on-text: #101826;
    --muted: #9aa6b6;
    --line: #5f6e85;
    --field: #172133;
    --glow: #ff6a4d;
    --error: #ff8a80;
    --error-tint: #2e1a1f;
    --sticker: #e9edf1;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.125rem/1.5 "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.page {
  max-width: 36rem;
  margin: 0 auto;
  padding: 20px 16px 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.brand svg {
  width: 22px;
  height: 22px;
  color: var(--glow);
}

h1 {
  margin: 40px 0 8px;
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lead {
  margin: 0 0 32px;
  color: var(--muted);
  text-wrap: pretty;
}

@media (min-width: 480px) {
  .page {
    padding-top: 40px;
  }
  h1 {
    margin-top: 56px;
  }
}

/* Fields */

.field {
  margin: 0 0 24px;
  padding: 0;
  border: 0;
  min-width: 0;
}

label,
legend {
  display: block;
  margin-bottom: 8px;
  padding: 0;
  font-weight: 700;
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 6px;
}

textarea {
  min-height: 148px;
  resize: vertical;
}

::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

input:focus,
textarea:focus {
  outline: 3px solid var(--glow);
  outline-offset: 2px;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-width: 2px;
  border-color: var(--error);
}

.hint,
.error {
  margin: 8px 0 0;
  font-size: 1rem;
  text-wrap: pretty;
}

.hint {
  color: var(--muted);
}

.hint.above {
  margin: -4px 0 8px;
}

.error {
  color: var(--error);
  font-weight: 700;
}

/* The device number, set like the label it was printed on. */

.sticker {
  padding: 14px 18px 16px;
  color: var(--sticker-text);
  background: var(--sticker);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(24, 35, 58, 0.1), 0 1px 2px rgba(24, 35, 58, 0.14), 0 10px 24px -12px rgba(24, 35, 58, 0.4);
  cursor: text;
}

.sticker label,
.sticker-label {
  margin: 0 0 2px;
  font-size: 1rem;
  font-weight: 700;
}

.sticker .optional {
  color: var(--sticker-muted);
}

.sticker input[type="text"],
.sticker .number {
  margin: 0;
  font-size: 3.75rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.sticker input[type="text"] {
  min-height: 0;
  padding: 0 0 4px;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--sticker-rule);
  border-radius: 0;
  caret-color: var(--glow);
}

.sticker input[type="text"]:focus {
  outline: none;
  border-bottom-color: var(--glow);
}

/* Without a number there's nothing to show off yet. */
.sticker.blank input[type="text"] {
  font-size: 1.5rem;
  letter-spacing: 0.04em;
}

.sticker:focus-within {
  outline: 3px solid var(--glow);
  outline-offset: 3px;
}

.sticker:has([aria-invalid="true"]) {
  box-shadow: 0 0 0 2px var(--error);
}

@media (min-width: 480px) {
  .sticker {
    padding: 18px 24px 20px;
  }
  .sticker:not(.blank) input[type="text"] {
    font-size: 4.5rem;
  }
}

/* Appointment type */

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

@media (min-width: 480px) {
  .choices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.choice {
  position: relative;
  margin: 0;
}

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

.choice span {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 14px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.choice span::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-radius: 50%;
}

@media (hover: hover) {
  .choice:hover span {
    border-color: var(--text);
  }
}

.choice input:checked + span {
  color: var(--on-text);
  background: var(--text);
  border-color: var(--text);
}

.choice input:checked + span::before {
  border-color: var(--on-text);
  background: var(--on-text);
  box-shadow: inset 0 0 0 3px var(--text);
}

.choice input:focus-visible + span {
  outline: 3px solid var(--glow);
  outline-offset: 2px;
}

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

@media (forced-colors: active) {
  .choice input:checked + span {
    outline: 2px solid Highlight;
  }
  .choice input:checked + span::before {
    background: Highlight;
  }
}

/* Feedback and actions */

.alert {
  margin: 0 0 24px;
  padding: 14px 16px;
  color: var(--error);
  background: var(--error-tint);
  border-left: 4px solid var(--error);
  border-radius: 2px;
  font-weight: 700;
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  margin-top: 32px;
  padding: 14px 20px;
  font: inherit;
  font-weight: 700;
  color: var(--on-text);
  background: var(--text);
  border: 2px solid var(--text);
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
}

@media (hover: hover) {
  .button:hover {
    background: var(--text-hover);
    border-color: var(--text-hover);
  }
}

.button:focus-visible {
  outline: 3px solid var(--glow);
  outline-offset: 3px;
}

.button:disabled {
  opacity: 0.7;
  cursor: progress;
}

.button.secondary {
  color: var(--text);
  background: transparent;
}

@media (hover: hover) {
  .button.secondary:hover {
    color: var(--on-text);
    background: var(--text);
    border-color: var(--text);
  }
}

.fineprint {
  margin: 12px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
  text-align: center;
}

/* Thank-you page */

.done h1 {
  margin-top: 24px;
}

.check {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-top: 40px;
  border-radius: 50%;
  color: var(--on-text);
  background: var(--text);
}

.check svg {
  width: 28px;
  height: 28px;
}

/* The one moment of motion: the tick is drawn once the request is in. */
@media (prefers-reduced-motion: no-preference) {
  .check path {
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
    animation: draw 0.45s 0.15s cubic-bezier(0.65, 0, 0.35, 1) forwards;
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

.sticker.small {
  display: inline-block;
  cursor: auto;
}

.sticker.small .number {
  font-size: 2.25rem;
}

/* Honeypot: hidden from people, visible to naive bots. */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
