/* crowflyer live-geolocation demo — clean-light style matching the widget
   (WORK-18 design tokens: warm-white canvas, near-black ink, calm green accent).
   Class names are unchanged; demo.js and the HTML drive the same hooks. */

:root {
  --signal: #2e7d5b;
  --signal-hi: #3e9770;
  --signal-lo: #245f45;
  --signal-press: #1a4733;
  --signal-wash: #e4efe9;

  --surface: #f7f6f3;
  --surface-card: #ffffff;
  --line: #e7e4dd;
  --line-strong: #d8d4cb;

  --text-primary: #16181d;
  --text-secondary: #6b6f76;
  --text-tertiary: #8a8f97;

  --warn: #b8791c;
  --warn-wash: rgba(184, 121, 28, 0.12);
  --danger: #e5484d;
  --danger-wash: rgba(229, 72, 77, 0.1);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --shadow-control: 0 1px 2px rgba(22, 24, 29, 0.1);
  --shadow-raised: 0 2px 8px rgba(22, 24, 29, 0.1);
  --shadow-float: 0 8px 28px rgba(22, 24, 29, 0.16);
  --focus-ring: 2px solid var(--signal-hi);

  --font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(0.22, 0.8, 0.28, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2rem 1rem 3rem;
  font-family: var(--font-sans);
  background: var(--surface);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 480px;
  margin: 0 auto;
}

/* Small brand eyebrow above every page title. */
.page::before {
  content: "CROWFLYER · LIVE DEMO";
  display: block;
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--signal);
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.5rem;
}

p {
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0 0 1rem;
}

.hidden {
  display: none !important;
}

button {
  font: inherit;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: 48px;
  /* A scroll that brings a button into view stops short of the edge, so its focus ring (2px + 2px offset) isn't cut. */
  scroll-margin-block: 0.75rem;
  transition:
    background 0.18s var(--ease),
    border-color 0.18s var(--ease),
    box-shadow 0.18s var(--ease);
}

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

button.primary {
  background: var(--signal);
  color: #ffffff;
  font-weight: 600;
  width: 100%;
  font-size: 1.05rem;
  box-shadow: 0 4px 18px rgba(46, 125, 91, 0.22);
}

/* Darker, not lighter: white on --signal-hi is 3.6:1, under the 4.5:1 the label needs (WCAG 1.4.3). */
button.primary:hover {
  background: var(--signal-lo);
}

/* Darker again than hover, so a press still gives feedback (white on it is 10.5:1). */
button.primary:active {
  background: var(--signal-press);
}

button.secondary {
  width: 100%;
  background: var(--surface-card);
  color: var(--text-primary);
  font-weight: 600;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-control);
}

button.secondary:hover {
  border-color: var(--text-tertiary);
}

/* Role picker — two selectable cards. */
.role-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

/* WORK-28. The role picker follows the kind; the hidden one takes no space. */
.role-picker.hidden {
  display: none;
}

.role-picker label {
  position: relative;
  flex: 1;
  padding: 1rem 0.75rem;
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-control);
  text-align: center;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    border-color 0.18s var(--ease),
    background 0.18s var(--ease),
    color 0.18s var(--ease);
}

.role-picker label:hover {
  border-color: var(--line-strong);
}

.role-picker input[type="radio"] {
  position: absolute;
  opacity: 0;
}

.role-picker input[type="radio"]:checked + span {
  font-weight: 600;
}

.role-picker label:has(input:checked) {
  border-color: var(--signal);
  background: var(--signal-wash);
  color: var(--signal-lo);
  box-shadow: inset 0 0 0 1px var(--signal);
}

.role-picker label:has(input:focus-visible) {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* WORK-31. The slot picker has a caption above it and a hint under each option. */
.picker-label {
  margin: 1.5rem 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.picker-label + .role-picker {
  margin-top: 0.5rem;
}

/* The option's own colour: --text-tertiary is 3.2:1 on the card (2.8:1 when
   checked), under the 4.5:1 small text needs. Size and weight set it apart. */
.role-picker__hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  font-weight: 400;
  color: inherit;
}

/* Share card (QR + link). */
.qr-section {
  background: var(--surface-card);
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
  margin: 0 0 1rem;
  text-align: center;
}

.qr-section > p:first-child {
  margin: 0 0 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.qr-section svg {
  max-width: 220px;
  height: auto;
  margin: 0 auto;
  display: block;
}

.share-url {
  margin: 0.75rem 0 0;
  padding: 0.5rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  word-break: break-all;
  color: var(--text-secondary);
  background: var(--surface);
  border-radius: var(--radius-sm);
}

.widget-section {
  margin: 1rem 0;
}

crowflyer-track {
  display: block;
  width: 100%;
  height: 560px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  overflow: hidden;
}

/* WORK-27. The watch card sits under the join card: same card, smaller QR, so
   joining stays the primary action. */
.watch-section svg {
  max-width: 160px;
}

.watch-section__note {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* WORK-27. Participants are told watchers can see them — information, not a warning. */
.watch-notice {
  margin: 0.75rem 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin: 1rem 0;
  font-size: 0.95rem;
}

.banner p {
  color: inherit;
  margin: 0 0 0.5rem;
}

.banner p:last-child {
  margin-bottom: 0;
}

.banner.error {
  background: var(--danger-wash);
  color: #9b2226;
  border: 1px solid rgba(229, 72, 77, 0.35);
}

.banner.warn {
  background: var(--warn-wash);
  color: #7a5212;
  border: 1px solid rgba(184, 121, 28, 0.35);
}

.banner.done {
  background: var(--signal-wash);
  color: var(--signal-lo);
  border: 1px solid rgba(46, 125, 91, 0.35);
}

.banner.done a {
  color: inherit;
  font-weight: 600;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0.75rem 0;
}

/* Live pulse dot before the status text. */
.status-line::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 4px var(--signal-wash);
  flex-shrink: 0;
}

.status-line.stopped::before {
  background: var(--text-tertiary);
  box-shadow: none;
}

.end-demo {
  margin-top: 1.5rem;
}

/* WORK-4 Slice 3. Driver-only mode picker: 4 chips (car/bike/walking/transit). */
.mode-picker {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem;
  margin: 0.5rem 0 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  box-shadow: var(--shadow-control);
}
.mode-picker.hidden {
  display: none;
}
.mode-picker__legend {
  padding: 0 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.mode-picker__chip {
  position: relative;
  flex: 1;
  min-height: 44px; /* tap target ≥ 44px per a11y */
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition:
    background 0.18s var(--ease),
    border-color 0.18s var(--ease),
    color 0.18s var(--ease);
}
.mode-picker__chip input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.mode-picker__chip:has(input[type="radio"]:checked) {
  background: var(--signal-wash);
  color: var(--signal-lo);
  border-color: var(--signal);
}
.mode-picker__chip:focus-within {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* The watch page's own two rules, moved here from an inline <style> in
   watch.html (WORK-35, #137): the page carries no inline code. They match only
   body.watch, and sit last so the cascade is as it was. */
body.watch {
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
}
body.watch crowflyer-watch {
  display: block;
  width: 100%;
  height: 100vh;
  height: 100dvh;
}
