/*
  Pipereply onboarding and settings: design tokens and primitives (visual refinement, approved by Joern 25 Oct 2026).
  Source of the system: v3/design/onboarding-visual/tokens.css. This is the app's own copy; DESIGN.md documents it.

  A light, precise workspace: white sidebar and cards on a near-white canvas, ink text, and one accent that is always
  Pipereply green (decision 27 Oct 2026). The business's own colour lives only in the client roles (--client-*), which
  only previews of customer-facing assets read (public/brand.js derives them contrast-safe). Depth is restrained; glass
  only on the action dock and the phone's top progress bar.

  Everything is scoped to .pr (on <body>) and forced light, so a dark OS or host theme can't turn text pale on white.
*/

html { color-scheme: light; background: #fafafa; -webkit-text-size-adjust: 100%; }

.pr {
  color-scheme: light;

  /* ---------- 1. Neutrals (fixed; never brand-tinted) ---------- */
  --ink: #20242b;          /* headings, primary text, option headings  15.57:1 on white */
  --ink-2: #535c68;        /* supporting text                          6.78:1 on white, 6.49:1 on canvas */
  --ink-3: #6b7480;        /* placeholders and captions on white only  4.74:1 on white */
  --surface: #ffffff;      /* cards, sidebar, inputs */
  --canvas: #fafafa;       /* the page behind the cards */
  --fill: #f3f4f6;         /* quiet fills: input rest, skeletons, tag wash */
  --line: #e7e9ec;         /* hairlines, card borders */
  --line-strong: #d3d7dd;  /* input and secondary-button strokes, upcoming step rings */
  --disabled-bg: #f1f2f4;
  --disabled-ink: #7b838e; /* disabled controls are exempt from 4.5 (WCAG 1.4.3) */

  /* Status (never brand-tinted) */
  --warn: #8a4b00;         /* "to check", "not found"  6.24:1 on --warn-bg */
  --warn-bg: #fff4e0;
  --warn-edge: #e2a33b;
  --danger: #b42318;       /* errors only  6.57:1 on white */
  --danger-bg: #fef3f2;

  /* ---------- 2. The accent: Pipereply green, always (decision 27 Oct 2026; never replaced by the client's colour) ----------
     --brand-edge   >= 3:1 on white and canvas: rings, selected borders, icons, progress, focus
     --brand-ink    >= 4.5:1 on white, canvas and --brand-tint-2: accent text and links
     --brand-tint   raw mixed 8% into white: primary button, selected card, current step
     --brand-tint-2 raw mixed 14% into white: hover and pressed tint
     --brand-solid  a fill that carries text at 4.5:1 (--on-brand-solid on top)
     Pipereply green's derivation (public/brand.js, test/brand.test.ts checks these values). */
  --brand: #4d9c82;
  --brand-edge: #4d9c82;
  --brand-ink: #3a7663;
  --brand-tint: #f1f7f5;
  --brand-tint-2: #e6f1ee;
  --brand-solid: #40816b;
  --on-brand-solid: #ffffff;

  /* ---------- 2b. The client's colour (public/brand.js sets these from their brand colour; Pipereply green until then) ----------
     Same roles and maths as the accent, read ONLY inside previews of customer-facing assets: .preview, .phone (Piper's
     texts, the welcome text, the chat widget) and the photo request handset. Never on navigation, buttons, progress,
     selection or focus outside a preview. */
  --client: #4d9c82;
  --client-edge: #4d9c82;
  --client-ink: #3a7663;
  --client-tint: #f1f7f5;
  --client-tint-2: #e6f1ee;
  --client-solid: #40816b;
  --on-client-solid: #ffffff;

  /* Older role names some modules still read: always mapped onto the safe Pipereply roles above. */
  --accent: var(--brand-ink);
  --tint: var(--brand-tint);
  --muted: var(--ink-2);
  --hair: var(--line);
  --hair-strong: var(--line-strong);
  --paper: var(--surface);
  --ground: var(--fill);
  --red: var(--danger);
  --green-ink: #3a7663;

  /* ---------- 3. Type ---------- */
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-display: clamp(30px, 1.25vw + 26px, 44px);
  --fs-h2: clamp(19px, 0.3vw + 18px, 22px);
  --fs-title: 17px;
  --fs-body: 16px;
  --fs-small: 14px;        /* the floor for anything a person reads */
  --lh-tight: 1.12;
  --lh-snug: 1.3;
  --lh-body: 1.55;

  /* ---------- 4. Space, radii, sizes ---------- */
  --r-tag: 8px;
  --r-input: 12px;
  --r-card: 18px;
  --r-panel: 24px;
  --r-pill: 999px;
  --tap: 48px;
  --btn-h: 52px;
  --side-w: 300px;
  --main-x: 56px;

  /* ---------- 5. Depth ---------- */
  --shadow-hair: 0 1px 2px rgb(20 24 31 / 0.05);
  --shadow-card: 0 1px 2px rgb(20 24 31 / 0.04), 0 6px 16px -8px rgb(20 24 31 / 0.08);
  --shadow-raise: 0 2px 4px rgb(20 24 31 / 0.04), 0 16px 36px -14px rgb(20 24 31 / 0.16);
  --shadow-press: inset 0 1px 2px rgb(20 24 31 / 0.10);
  --glass-bg: rgb(255 255 255 / 0.84);
  --glass-blur: blur(18px) saturate(1.8);
  --glass-edge: rgb(255 255 255 / 0.9);
  --glass-shadow: 0 1px 0 rgb(20 24 31 / 0.05), 0 12px 32px -14px rgb(20 24 31 / 0.22);

  /* ---------- 6. Motion ---------- */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 140ms;
  --t-med: 260ms;
  --t-slow: 520ms;

  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--canvas);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  .pr { --t-fast: 0ms; --t-med: 0ms; --t-slow: 0ms; }
  .pr *, .pr *::before, .pr *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

.pr *, .pr *::before, .pr *::after { box-sizing: border-box; }
.pr [hidden] { display: none !important; }
:where(.pr) :where(button, input, select, textarea) { font: inherit; color: inherit; }

/* ---------- 7. Type roles ---------- */
.pr h1 { font-size: var(--fs-display); font-weight: 700; line-height: var(--lh-tight); letter-spacing: -0.025em; text-wrap: balance; margin: 0; color: var(--ink); }
.pr h1:focus { outline: none; }
:where(.pr) p { margin: 0; }
.pr .lead { font-size: 17px; color: var(--ink-2); max-width: 54ch; text-wrap: pretty; }
.pr .muted { color: var(--ink-2); }
.pr a { color: var(--brand-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.pr a:hover { text-decoration-thickness: 2px; }
.pr .sr-only, .pr .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pr .i { width: 20px; height: 20px; flex: none; }

/* ---------- 8. Buttons ----------
   Primary: lightly tinted pill, 1.5px brand edge, dark brand text, and a solid brand disc carrying the arrow (the one
   strong colour hit on a screen). Secondary: white, neutral stroke, ink text. Ghost: text only. All 52px pills. */
.pr .btn {
  --_bg: var(--surface); --_fg: var(--ink); --_bd: var(--line-strong);
  appearance: none; font: inherit; font-weight: 600; font-size: 16px; line-height: 1.15;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--btn-h); padding: 0 22px; border-radius: var(--r-pill);
  background: var(--_bg); color: var(--_fg); border: 1.5px solid var(--_bd);
  box-shadow: var(--shadow-hair), inset 0 1px 0 rgb(255 255 255 / 0.9);
  cursor: pointer; text-decoration: none; text-align: center; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t-fast) var(--ease), box-shadow var(--t-med) var(--ease), transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.pr .btn:hover:not(:disabled) { --_bg: #f7f8f9; box-shadow: var(--shadow-card), inset 0 1px 0 rgb(255 255 255 / 0.9); }
.pr .btn:active:not(:disabled) { transform: scale(0.98); box-shadow: var(--shadow-press); --_bg: var(--fill); }
.pr .btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand-edge) 45%, transparent); outline-offset: 2px; }

.pr .btn.primary { --_bg: var(--brand-tint); --_fg: var(--brand-ink); --_bd: var(--brand-edge); }
.pr .btn.primary:has(> .disc) { padding: 0 8px 0 24px; gap: 14px; }
.pr .btn.primary .disc { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--brand-solid); color: var(--on-brand-solid); transition: transform var(--t-med) var(--ease), background-color var(--t-fast) var(--ease); }
.pr .btn.primary .disc svg { width: 18px; height: 18px; }
.pr .btn.primary:hover:not(:disabled) { --_bg: var(--brand-tint-2); box-shadow: 0 1px 2px rgb(20 24 31 / 0.05), 0 10px 22px -12px color-mix(in srgb, var(--brand-edge) 70%, transparent); }
.pr .btn.primary:hover:not(:disabled) .disc { transform: translateX(2px); }
.pr .btn.primary:active:not(:disabled) { --_bg: var(--brand-tint-2); }

.pr .btn.ghost { --_bg: transparent; --_bd: transparent; --_fg: var(--ink-2); box-shadow: none; padding: 0 14px; font-weight: 500; }
.pr .btn.ghost:hover:not(:disabled) { --_bg: var(--fill); --_fg: var(--ink); box-shadow: none; }
.pr .btn.ghost:active:not(:disabled) { box-shadow: none; }

.pr .btn.small { min-height: 40px; font-size: 14px; padding: 0 16px; gap: 6px; }
.pr .btn.small.primary:has(> .disc) { padding: 0 5px 0 16px; }
.pr .btn.small .disc { width: 30px; height: 30px; }

.pr .btn:disabled, .pr .btn[aria-disabled="true"] { --_bg: var(--disabled-bg); --_fg: var(--disabled-ink); --_bd: var(--line); box-shadow: none; cursor: not-allowed; transform: none; }
.pr .btn.ghost:disabled { --_bg: transparent; --_bd: transparent; }
.pr .btn.primary:disabled .disc { background: #d9dce1; color: #fff; }

/* Back: a quiet text button on wide screens, a 52px round secondary on phones (app.css) */
.pr .btn.back { --_bg: transparent; --_bd: transparent; --_fg: var(--ink-2); box-shadow: none; padding: 0 16px 0 12px; font-weight: 500; gap: 8px; }
.pr .btn.back:hover:not(:disabled) { --_bg: var(--fill); --_fg: var(--ink); box-shadow: none; }
.pr .btn.back svg { width: 20px; height: 20px; }

/* ---------- 9. Switch and tags ---------- */
.pr .switch { position: relative; display: inline-block; vertical-align: middle; width: 52px; height: 32px; flex: none; }
.pr .switch input { appearance: none; -webkit-appearance: none; margin: 0; padding: 0; border: 0; min-height: 0; position: absolute; inset: 0; width: 100%; height: 100%; border-radius: var(--r-pill); background: #c9ced5; cursor: pointer; transition: background-color var(--t-med) var(--ease); box-shadow: none; }
.pr .switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(20 24 31 / 0.18), 0 3px 8px rgb(20 24 31 / 0.12); transition: transform var(--t-med) var(--ease); }
.pr .switch input:checked { background: var(--brand-edge); }
.pr .switch input:checked::after { transform: translateX(20px); }
.pr .switch input:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand-edge) 45%, transparent); outline-offset: 2px; box-shadow: none; }
/* a 48px touch target around the 52 x 32 switch */
.pr .switch::before { content: ""; position: absolute; inset: -8px -4px; }

.pr .tag { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-small); font-weight: 500; line-height: 1.1; padding: 6px 10px; border-radius: var(--r-pill); white-space: nowrap; vertical-align: middle; }
.pr .tag svg { width: 14px; height: 14px; flex: none; }
.pr .tag.brand, .pr .tag.on { background: var(--brand-tint); color: var(--brand-ink); }
.pr .tag.quiet, .pr .tag.missing { background: var(--fill); color: var(--ink-2); }
.pr .tag.warn, .pr .tag.suggested { background: var(--warn-bg); color: var(--warn); }

/* ---------- 10. Inputs ---------- */
.pr input[type="text"], .pr input[type="tel"], .pr input[type="number"], .pr input[type="email"], .pr input[type="url"], .pr input[type="password"], .pr input[type="date"], .pr input[type="time"], .pr input:not([type]), .pr textarea, .pr select {
  width: 100%; font-size: 16px; line-height: 1.4; color: var(--ink); min-height: 52px; padding: 13px 16px;
  border-radius: var(--r-input); border: 1px solid var(--line-strong); background: var(--surface);
  box-shadow: inset 0 1px 2px rgb(20 24 31 / 0.04);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.pr textarea { min-height: 112px; resize: vertical; line-height: 1.5; }
.pr :is(input:not([type]), input[type="text"], input[type="tel"], input[type="number"], input[type="email"], input[type="url"], input[type="password"], input[type="date"], input[type="time"], textarea, select):hover { border-color: #b9bfc7; }
.pr :is(input:not([type]), input[type="text"], input[type="tel"], input[type="number"], input[type="email"], input[type="url"], input[type="password"], input[type="date"], input[type="time"], textarea, select):focus { outline: none; border-color: var(--brand-edge); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-edge) 18%, transparent); }
.pr input::placeholder, .pr textarea::placeholder { color: var(--ink-3); opacity: 1; }
.pr :is(input:not([type]), input[type="text"], input[type="tel"], input[type="number"], input[type="email"], input[type="url"], input[type="password"], input[type="date"], input[type="time"], textarea, select):disabled { background: var(--disabled-bg); color: var(--disabled-ink); }
.pr .invalid, .pr [aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: 0 0 0 4px rgb(180 35 24 / 0.10) !important; }

/* ---------- 11. Surfaces ---------- */
.pr .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-card); }
.pr .glass { background: var(--glass-bg); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .pr .glass { background: rgb(255 255 255 / 0.96); } }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
