/*
 * The rescue order form's look (docs/rescue-orders.md). An inline form in the
 * page, not chat.css's corner button: its own root, .rr, with the same kind
 * of variables, which a site's stylesheet can set:
 *
 *   .rr { --rr-accent: #1f6f5c; --rr-radius: 6px; }
 *
 * The defaults take the site's own design tokens where it has them (the
 * alterview.dev network's --color-*, --font-*, --radius-*), then a block
 * theme's (--wp--preset--*), then calm neutrals. Every rule sets its own
 * font, weight and colour in longhand with .rr in front, so a theme's label,
 * heading and button rules cannot leak in.
 */
.rr {
  --rr-accent: var(--color-accent, var(--wp--preset--color--primary, var(--wp--preset--color--accent, #1f6f5c)));
  --rr-accent-hover: var(--color-accent-hover, var(--rr-accent));
  --rr-accent-ink: var(--color-text-on-accent, #ffffff);
  --rr-bg: var(--color-surface, #ffffff);
  --rr-ink: var(--color-text, #16181d);
  --rr-muted: var(--color-text-muted, #555c69);
  --rr-line: var(--color-border, #d6d9e0);
  --rr-soft: var(--color-surface-muted, #f4f6f8);
  --rr-bad: #b42318;
  --rr-radius: var(--radius-md, 10px);
  --rr-font: var(--font-sans, var(--wp--preset--font-family--body, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif));
  --rr-font-title: var(--font-display, var(--rr-font));

  max-width: 640px;
  margin: 24px 0;
  padding: 24px;
  background: var(--rr-bg);
  border: 1px solid var(--rr-line);
  border-top: 3px solid var(--rr-accent);
  border-radius: var(--rr-radius);
  font-family: var(--rr-font);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: normal;
  text-transform: none;
  text-align: left;
  color: var(--rr-ink);
}

.rr *, .rr *::before, .rr *::after { box-sizing: border-box; }
.rr [hidden] { display: none !important; }
.rr p, .rr h2, .rr label, .rr legend, .rr button, .rr input, .rr select, .rr textarea {
  font-family: var(--rr-font);
  letter-spacing: normal;
  text-transform: none;
  text-shadow: none;
}

.rr .rc-form-title {
  margin: 0 0 6px;
  padding: 0;
  font-family: var(--rr-font-title);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--rr-ink);
}
.rr .rc-intro { margin: 0 0 18px; padding: 0; color: var(--rr-muted); font-size: 15px; line-height: 1.5; }

.rr .rc-field { margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.rr .rc-field > label, .rr .rc-choice legend {
  display: block;
  margin: 0 0 4px;
  padding: 0;
  color: var(--rr-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.rr .rc-hint { margin: 0 0 6px; padding: 0; color: var(--rr-muted); font-size: 13px; line-height: 1.45; }

.rr input[type="text"], .rr input[type="email"], .rr input[type="tel"], .rr select, .rr textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--rr-line);
  border-radius: var(--rr-radius);
  background: var(--rr-bg);
  color: var(--rr-ink);
  font-size: 16px; /* 16px: no zoom on focus on phones */
  font-weight: 400;
  line-height: 1.4;
  box-shadow: none;
}
.rr textarea { min-height: 120px; resize: vertical; }
.rr input:focus, .rr select:focus, .rr textarea:focus { border-color: var(--rr-accent); }
.rr [aria-invalid="true"] { border-color: var(--rr-bad); outline: 2px solid var(--rr-bad); outline-offset: 1px; }

.rr .rc-radio, .rr .rc-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  margin: 0 0 6px;
  padding: 10px 0 0;
}
.rr .rc-radio label, .rr .rc-check label {
  margin: 0;
  padding: 0;
  color: var(--rr-ink);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
  cursor: pointer;
}
.rr .rc-check label a { color: inherit; text-decoration: underline; }
.rr input[type="radio"], .rr input[type="checkbox"] {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--rr-accent);
}

.rr .rc-price {
  margin: 6px 0 12px;
  padding: 14px 16px;
  background: var(--rr-soft);
  border-left: 3px solid var(--rr-accent);
  border-radius: var(--rr-radius);
}
.rr .rc-price p { margin: 0 0 4px; padding: 0; font-size: 15px; line-height: 1.45; color: var(--rr-ink); }
.rr .rc-price p:last-child { margin: 0; color: var(--rr-muted); }
.rr .rc-price .rc-price-title { font-weight: 600; }

.rr .rc-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.rr .rc-privacy { margin: 10px 0 14px; padding: 0; color: var(--rr-muted); font-size: 13px; line-height: 1.45; }
.rr .rc-privacy a { color: inherit; text-decoration: underline; background: none; padding: 0; }

.rr .rc-status { margin: 0 0 10px; font-size: 14px; color: var(--rr-muted); }
.rr .rc-status:empty { display: none; }
.rr .rc-status.rc-bad { color: var(--rr-bad); }

.rr .rc-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 0 16px;
  border: 0;
  border-radius: var(--rr-radius);
  background: var(--rr-accent);
  color: var(--rr-accent-ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  box-shadow: none;
  cursor: pointer;
}
.rr .rc-send:hover { background: var(--rr-accent-hover); }
.rr .rc-send[disabled] { opacity: 0.6; cursor: progress; }

.rr .rc-done { outline: none; }
.rr .rc-done-title { margin: 0 0 8px; font-family: var(--rr-font-title); font-weight: 600; font-size: 20px; color: var(--rr-ink); }
.rr .rc-done-body { margin: 0 0 8px; overflow-wrap: anywhere; }

.rr button:focus-visible, .rr input:focus-visible, .rr select:focus-visible, .rr textarea:focus-visible, .rr a:focus-visible {
  outline: 3px solid var(--rr-accent);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .rr { padding: 18px 16px; margin: 16px 0; }
}
