/* ============================================================= */
/* PayProoof styles                                              */
/*                                                               */
/* Structure of this file:                                       */
/*   1. Design tokens (colours, fonts)                           */
/*   2. Accessibility setting overrides                          */
/*   3. Base / reset styles                                      */
/*   4. Buttons                                                  */
/*   5. Header                                                   */
/*   6. Hero + banknote illustration                             */
/*   7. How it works                                             */
/*   8. Checker (chat UI)                                        */
/*   9. Result cards (receipts)                                  */
/*  10. Comparison section                                       */
/*  11. Verdict key, footer, dialogs                             */
/*  12. Colour bands (page-level section backgrounds)            */
/*  13. Misc: logo eyes, swap buttons, save buttons              */
/*                                                               */
/* Every colour used by JS (canvas proof export) is read from    */
/* these custom properties via getComputedStyle, so changing the */
/* tokens here also changes the exported images.                 */
/* ============================================================= */

:root {
  /* --- Core palette (purple and cream) ----------------------- */
  --paper:   #f8fafc;   /* page background (light) */
  --surface: #ffffff;   /* panels and receipts */
  --wash:    #ede7fb;   /* soft purple fills */
  --line:    #c084fc;   /* soft purple: security-print lines, borders */
  --mid:     #6d3fc0;   /* readable purple: links, icons */
  --deep:    #1e1b4b;   /* dark indigo: headings, buttons, banknote */
  --ink:     #1b1838;   /* body text */
  --muted:   #57537a;   /* secondary text */
  --accent:  #f5ebdd;   /* cream highlights */

  /* --- Verdict colours --------------------------------------- */
  /* Always paired with a distinct shape + word + pattern, so    */
  /* colour is never the only signal (colour-blind safe).        */
  --safe:    #3f7d12;
  --caution: #e0a82e;
  --danger:  #b3125a;

  /* --- Typography & layout tokens ---------------------------- */
  --scale: 1;                                          /* text-size multiplier, driven by settings */
  --font-body: "Atkinson Hyperlegible", system-ui, sans-serif;
  --font-display: "Bricolage Grotesque", "Atkinson Hyperlegible", system-ui, sans-serif;
  --leading: 1.6;
  --tracking: 0;
}

/* --- Accessibility setting overrides (toggled by app.js) ---- */
/* The easy-read font swaps every text element to Lexend. */
html[data-easy-font] { --font-body: "Lexend", system-ui, sans-serif; --font-display: "Lexend", system-ui, sans-serif; }
/* More space between lines and letters. */
html[data-spacing]   { --leading: 1.95; --tracking: 0.03em; }
/* Colour-blind theme: blue surf + sunkissed orange, with a neutral safe colour. */
html[data-cb-palette] {
  --paper: #f6f8fb; --surface: #ffffff; --wash: #e3eaf4; --line: #8fa9cf;
  --mid: #3b5b8a; --deep: #1f3354; --ink: #16233a; --muted: #4b5a70; --accent: #f28b30;
  --safe: #3b5b8a; --caution: #f28b30; --danger: #1a1a1a;
}
/* High contrast: pure black text on white, with heavier borders. */
html[data-contrast] {
  --paper: #ffffff; --surface: #ffffff; --wash: #ece8f6; --line: #000000;
  --mid: #3b1f8a; --deep: #120f33; --ink: #000000; --muted: #1b1b1b;
}
html[data-contrast] .card,
html[data-contrast] .panel,
html[data-contrast] .example,
html[data-contrast] .mode { border-width: 2px; border-color: #000; }

/* Disable animations/transitions for users who prefer reduced motion. */
html[data-reduce-motion] *,
html[data-reduce-motion] *::before,
html[data-reduce-motion] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* --- Base / reset ------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  font-size: calc(100% * var(--scale));  /* scales with the text-size setting */
  scroll-behavior: smooth;
  scroll-padding-top: 84px;              /* leaves room for the sticky header */
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  line-height: var(--leading);
  letter-spacing: var(--tracking);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); color: var(--deep); line-height: 1.12; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); margin-bottom: 1rem; }
h3 { font-size: 1.2rem; margin-bottom: 0.35rem; }
p { max-width: 64ch; }                    /* keeps line length comfortable for reading */
img, svg { display: block; }

a { color: var(--mid); }

/* Focus ring: purple by default, black + yellow halo in high contrast. */
:focus-visible { outline: 3px solid var(--mid); outline-offset: 3px; border-radius: 6px; }
html[data-contrast] :focus-visible { outline: 4px solid #000; box-shadow: 0 0 0 7px #ffd400; }

/* Utility: hide visually but keep accessible to screen readers. */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.hidden { display: none !important; }

/* Skip link: appears when keyboard-focused so users can bypass the nav. */
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--deep); color: #fff; padding: 0.6rem 1rem; border-radius: 8px;
}
.skip-link:focus { top: 1rem; }

/* --- Buttons ------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 48px; padding: 0 1.3rem;
  border-radius: 999px; border: 2px solid transparent;
  font: inherit; font-weight: 700; text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--deep); color: #fff; }
.btn-primary:hover { background: var(--mid); }
.btn-quiet { background: transparent; color: var(--deep); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--deep); }

/* Circular icon button (e.g. close, remove) — 44px meets touch target guidance. */
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 50%; border: 2px solid var(--line); background: var(--surface);
  color: var(--deep); cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }

/* --- Header ------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--wash);
}
.logo {
  display: flex; align-items: center; gap: 0.55rem;
  font-family: var(--font-display); font-weight: 800; font-size: 1.3rem;
  color: var(--deep); text-decoration: none;
}
.logo-mark { width: 38px; height: 38px; object-fit: contain; }
.site-nav { display: flex; gap: 1.4rem; margin-left: auto; align-items: center; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 700; }
.site-nav a:hover { color: var(--mid); text-decoration: underline; text-underline-offset: 4px; }
.site-nav .nav-cta { color: var(--mid); }
.access-btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-height: 44px; padding: 0 0.9rem;
  border-radius: 999px; border: 2px solid var(--deep);
  background: var(--surface); color: var(--deep);
  font: inherit; font-weight: 700; cursor: pointer;
}
.access-btn svg { width: 22px; height: 22px; }

/* --- Hero --------------------------------------------------- */
.hero {
  max-width: 1160px; margin: 0 auto;
  display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center;
  padding: clamp(2.5rem, 7vw, 5.5rem) clamp(1rem, 4vw, 2.5rem);
}
.hero h1 {
  font-size: clamp(2.2rem, 1.3rem + 3.2vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 1.2rem;
  max-width: 17ch;
}
.lede { font-size: 1.15rem; color: var(--muted); margin-bottom: 2rem; max-width: 46ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; }

/* --- Banknote illustration --------------------------------- */
/* The note has a hidden micro-text layer and lens that follow */
/* the pointer, driven by --x/--y CSS variables set in JS.     */
.note {
  position: relative;
  aspect-ratio: 5 / 3;
  border-radius: 20px;
  overflow: hidden;
  background: var(--deep);
  color: #fff;
  box-shadow: 0 1px 0 var(--line), 0 24px 48px -28px var(--deep);
  cursor: none;                /* hides the mouse cursor; the lens takes over */
  --x: 70%; --y: 45%;          /* default lens position */
}
.note-pattern { position: absolute; inset: 0; width: 100%; height: 100%; }
.note-content {
  position: absolute; inset: 0; padding: clamp(1rem, 3vw, 1.8rem);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 0.3rem;
}
.note-amount {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2.2rem, 1.5rem + 3vw, 3.6rem); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.note-line { opacity: 0.85; font-variant-numeric: tabular-nums; }
.note-stamp {
  position: absolute; top: clamp(1rem, 3vw, 1.6rem); right: clamp(1rem, 3vw, 1.6rem);
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.8rem 0.35rem 0.4rem;
  border: 2px solid #fff; border-radius: 999px;
  font-weight: 700; transform: rotate(-6deg);
}
.note-stamp svg { width: 22px; height: 22px; color: var(--accent); }

/* Micro-text layer: only visible inside a circular "lens" mask. */
.note-micro {
  position: absolute; inset: 0;
  background: var(--wash); color: var(--deep);
  font-size: 9px; line-height: 11px; letter-spacing: 0.08em; font-weight: 700;
  overflow: hidden; word-break: break-all;
  clip-path: circle(0px at var(--x) var(--y));
  transition: clip-path 0.25s ease;
}
.note.is-checking .note-micro { clip-path: circle(64px at var(--x) var(--y)); }
.note-lens {
  position: absolute; left: var(--x); top: var(--y);
  width: 132px; height: 132px; margin: -66px 0 0 -66px;
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: 0 0 0 2px var(--deep), 0 10px 24px rgba(0, 0, 0, 0.35);
  opacity: 0; transform: scale(0.6);
  transition: opacity 0.2s, transform 0.25s;
  pointer-events: none;
}
/* The lens handle */
.note-lens::after {
  content: ""; position: absolute; right: -30px; bottom: -30px;
  width: 44px; height: 10px; border-radius: 6px; background: #fff;
  transform: rotate(45deg); transform-origin: left center;
}
.note.is-checking .note-lens { opacity: 1; transform: scale(1); }
.note-hint {
  position: absolute; left: 50%; top: 1rem; transform: translateX(-50%);
  font-size: 0.85rem; opacity: 0.75; white-space: nowrap;
}
.note.is-checking .note-hint { opacity: 0; }

/* On touch devices there is no hover, so hide the hint and use the normal cursor. */
@media (hover: none) {
  .note { cursor: auto; }
  .note-hint { display: none; }
}

/* --- How it works ------------------------------------------- */
.how {
  max-width: 920px; margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) clamp(1rem, 4vw, 2.5rem);
}
.steps { list-style: none; padding: 0; position: relative; display: grid; gap: clamp(2.5rem, 6vw, 4.5rem); counter-reset: step; }
/* The vertical track with the animated coin. */
.track {
  position: absolute; left: 22px; top: 8px; bottom: 8px; width: 4px;
  background: var(--wash); border-radius: 4px;
}
.track-fill {
  position: absolute; left: 0; top: 0; width: 100%;
  height: calc(var(--p, 0) * 100%);        /* --p is 0..1, set by scroll handler */
  background: var(--mid); border-radius: 4px;
}
.coin {
  position: absolute; left: 50%; top: calc(var(--p, 0) * 100%);
  width: 44px; height: 44px; margin: -22px 0 0 -22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent); color: var(--deep);
  border: 3px solid var(--deep);
  font-family: var(--font-display); font-weight: 800; font-size: 1.2rem;
  box-shadow: 0 0 0 6px var(--paper);
}
.step {
  counter-increment: step;
  display: grid; grid-template-columns: 160px 1fr; gap: 1.5rem; align-items: center;
  padding-left: 72px;
  opacity: 0.6;
  transition: opacity 0.4s;
}
.step.is-reached { opacity: 1; }
/* Uses CSS counters to prefix "1. ", "2. ", "3. " automatically. */
.step h3::before { content: counter(step) ". "; color: var(--mid); }
.step p { color: var(--muted); }
.step-art { width: 160px; height: 120px; }

/* --- Checker ------------------------------------------------ */
.checker {
  max-width: 820px; margin: 0 auto clamp(3rem, 8vw, 5rem);
  padding: clamp(1.2rem, 3vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
}
.checker-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1rem; }
.checker-head h2 { margin: 0; }
.home-currency { display: grid; gap: 0.25rem; font-weight: 700; font-size: 0.9rem; color: var(--muted); }
.home-currency select {
  min-height: 44px; padding: 0 0.8rem;
  border: 2px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 700;
}

/* Mode pills: the active one is filled dark, others stay light. */
.modes { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.mode {
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-height: 44px; padding: 0 1rem;
  border-radius: 999px; border: 2px solid var(--wash);
  background: var(--paper); color: var(--ink);
  font: inherit; font-weight: 700; cursor: pointer;
}
.mode svg { width: 20px; height: 20px; color: var(--mid); }
.mode:hover { border-color: var(--line); }
.mode.active { background: var(--deep); border-color: var(--deep); color: #fff; }
.mode.active svg { color: var(--accent); }

/* The chat log: scrollable column of user messages and bot cards. */
.chat {
  min-height: 300px; max-height: 60vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.9rem;
  padding: 1rem;
  background: var(--paper);
  border-radius: 16px;
}
.welcome > p { color: var(--muted); margin-bottom: 0.8rem; }
.examples { display: grid; gap: 0.6rem; }
.example {
  display: flex; align-items: center; gap: 0.8rem;
  min-height: 52px; padding: 0.7rem 1rem;
  border: 2px solid var(--wash); border-radius: 12px;
  background: var(--surface); color: var(--ink);
  font: inherit; text-align: left; cursor: pointer;
}
.example svg { width: 24px; height: 24px; flex-shrink: 0; color: var(--mid); }
.example:hover { border-color: var(--mid); }

/* Message bubbles: right-aligned user, left-aligned bot. */
.msg { max-width: min(88%, 560px); }
.msg.user {
  align-self: flex-end;
  background: var(--deep); color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 16px 16px 4px 16px;
}
.msg.user img { max-width: 200px; width: 100%; border-radius: 10px; margin-bottom: 0.4rem; }
.msg.bot { align-self: flex-start; width: min(100%, 560px); }

/* --- Result cards (styled like paper receipts) ------------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--mid);
  border-radius: 14px;
  padding: 1.2rem 1.2rem 1.1rem;
  font-variant-numeric: tabular-nums;   /* numbers align in columns */
}
.card-label { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.3rem; }
.big { font-family: var(--font-display); font-size: clamp(1.8rem, 1.3rem + 2vw, 2.4rem); font-weight: 800; color: var(--deep); line-height: 1.1; }
.sub { color: var(--muted); }
.meta { margin-top: 0.9rem; padding-top: 0.6rem; border-top: 2px dashed var(--wash); font-size: 0.85rem; color: var(--muted); }
.text { line-height: var(--leading); }
.note-small { margin-top: 0.6rem; font-size: 0.9rem; color: var(--muted); }

/* Key/value rows separated by a dotted receipt-style rule. */
.rows { margin-top: 0.9rem; }
.row {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 2px dotted var(--wash);
}
.row span:first-child { color: var(--muted); }
.row span:last-child { font-weight: 700; text-align: right; }

.card h3 { font-size: 1rem; margin: 1rem 0 0.4rem; }
.card ul { padding-left: 1.2rem; }
.card li { margin-bottom: 0.3rem; }

/* Verdict badges: each uses a distinct shape + border style + pattern,
   so they remain distinguishable without colour. */
.verdict {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.9rem 0.35rem 0.4rem;
  border-radius: 999px; border: 2px solid currentColor;
  font-weight: 700; margin-bottom: 0.8rem;
}
.verdict svg { width: 26px; height: 26px; }
.verdict.safe { color: var(--safe); background: color-mix(in srgb, var(--safe) 10%, var(--surface)); }
.verdict.caution { color: #5c3d00; border-style: dashed; background: color-mix(in srgb, var(--caution) 22%, var(--surface)); }
.verdict.caution svg { color: var(--caution); }
.verdict.danger {
  color: #fff; border-color: var(--danger);
  background: repeating-linear-gradient(-45deg, var(--danger) 0 8px, color-mix(in srgb, var(--danger) 78%, #000) 8px 16px);
}
.verdict.danger svg { color: #fff; }
.verdict.danger svg { --icon-inner: var(--danger); }   /* lets the inner X match the fill */

/* Bar chart comparing the offered rate with the real rate. */
.rate-bars { margin-top: 1rem; display: grid; gap: 0.5rem; }
.rate-bar { display: grid; grid-template-columns: 7rem 1fr; align-items: center; gap: 0.6rem; font-size: 0.9rem; }
.rate-bar .bar { height: 14px; border-radius: 7px; background: var(--wash); overflow: hidden; }
.rate-bar .bar span { display: block; height: 100%; border-radius: 7px; background: var(--mid); }
.rate-bar.offered .bar span { background: repeating-linear-gradient(-45deg, var(--muted) 0 6px, var(--ink) 6px 12px); }

/* Loading indicator: three pulsing dots while a check runs. */
.loading { display: flex; gap: 6px; padding: 1.2rem; }
.loading::before { display: none; }
.loading span { width: 9px; height: 9px; border-radius: 50%; background: var(--mid); animation: blink 1.2s infinite; }
.loading span:nth-child(2) { animation-delay: 0.2s; }
.loading span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }

/* "Read aloud" button appended by JS to each result card. */
.speak-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin-top: 0.8rem; min-height: 40px; padding: 0 0.9rem;
  border: 2px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--deep);
  font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer;
}
.speak-btn svg { width: 18px; height: 18px; }

/* Photo preview thumbnail above the composer. */
.image-preview { position: relative; display: inline-block; margin-top: 0.8rem; }
.image-preview img { height: 76px; border-radius: 10px; border: 2px solid var(--line); }
.image-preview button {
  position: absolute; top: -10px; right: -10px;
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 50%; border: none; background: var(--deep); color: #fff; cursor: pointer;
}
.image-preview button svg { width: 16px; height: 16px; }

/* Composer: camera button, text field, submit button. */
.composer { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.8rem; }
.upload-btn {
  width: 48px; height: 48px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%; border: 2px solid var(--line);
  background: var(--surface); color: var(--deep); cursor: pointer;
}
.upload-btn svg { width: 22px; height: 22px; }
.upload-btn:focus-within { outline: 3px solid var(--mid); outline-offset: 3px; }
/* 16px minimum font-size prevents iOS Safari from zooming on focus. */
#messageInput {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 1rem;
  border: 2px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: max(16px, 1rem);
}
#messageInput:focus { outline: 3px solid var(--mid); outline-offset: 2px; border-color: var(--mid); }

/* --- Verdict key -------------------------------------------- */
.key { max-width: 920px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem) clamp(3rem, 8vw, 5rem); }
.key-intro { color: var(--muted); margin-bottom: 1.4rem; }
.key-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.key-item {
  display: flex; gap: 0.8rem; align-items: flex-start;
  padding: 1.1rem; border-radius: 16px;
  background: var(--surface); border: 2px solid var(--wash);
}
.key-item svg { width: 40px; height: 40px; flex-shrink: 0; }
.key-item p { font-size: 0.95rem; color: var(--muted); }
.key-item.safe svg { color: var(--safe); }
.key-item.caution { border-style: dashed; border-color: var(--caution); }
.key-item.caution svg { color: var(--caution); }
.key-item.danger { border-color: var(--danger); background: repeating-linear-gradient(-45deg, var(--surface) 0 10px, color-mix(in srgb, var(--danger) 7%, var(--surface)) 10px 20px); }
.key-item.danger svg { color: var(--danger); }

/* --- Footer ------------------------------------------------- */
.site-footer { padding: 2rem clamp(1rem, 4vw, 2.5rem); border-top: 1px solid var(--wash); color: var(--muted); font-size: 0.9rem; text-align: center; }
.site-footer p { margin: 0 auto; }

/* --- Dialogs (accessibility + trust panel) ----------------- */
.access-panel {
  width: min(440px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  margin: auto 1rem auto auto;   /* docked to the right edge */
  padding: 1.4rem;
  border: 2px solid var(--deep); border-radius: 20px;
  background: var(--surface); color: var(--ink);
}
.access-panel::backdrop { background: rgba(30, 27, 75, 0.5); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.panel-head h2 { margin: 0; font-size: 1.5rem; }
.setting { border: 0; padding: 0; margin-bottom: 1rem; }
.setting legend { font-weight: 700; margin-bottom: 0.5rem; }

/* Segmented control for the text-size radios. */
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span {
  display: grid; place-items: center; min-height: 44px; padding: 0 0.4rem;
  border: 2px solid var(--line); border-radius: 12px; font-weight: 700; text-align: center; cursor: pointer;
}
.segmented input:checked + span { background: var(--deep); border-color: var(--deep); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid var(--mid); outline-offset: 2px; }

/* Custom toggle switches built from checkboxes. */
.toggle {
  display: flex; align-items: center; gap: 0.8rem;
  min-height: 52px; padding: 0.4rem 0;
  border-bottom: 1px solid var(--wash); cursor: pointer; font-weight: 700;
}
.toggle input {
  appearance: none; flex-shrink: 0;
  width: 48px; height: 28px; border-radius: 999px;
  background: var(--wash); border: 2px solid var(--muted);
  position: relative; cursor: pointer;
}
.toggle input::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%; background: var(--muted);
  transition: transform 0.15s;
}
.toggle input:checked { background: var(--mid); border-color: var(--deep); }
.toggle input:checked::after { transform: translateX(20px); background: #fff; }
.reset-btn { margin-top: 1.2rem; width: 100%; }

/* --- Responsive breakpoints --------------------------------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero h1 { max-width: 18ch; }
  .key-list { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .site-nav { display: none; }
  .access-btn { margin-left: auto; }
  .step { grid-template-columns: 1fr; padding-left: 64px; gap: 0.6rem; }
  .step-art { width: 120px; height: 90px; }
  .checker { border-radius: 0; border-left: 0; border-right: 0; }
  .chat { max-height: 65vh; padding: 0.7rem; }
  .access-panel { margin: auto; }
}
@media (max-width: 420px) {
  .access-btn span { display: none; }
  .access-btn { padding: 0; width: 44px; justify-content: center; }
  .send-btn { padding: 0 1rem; }
  .mode { padding: 0 0.8rem; font-size: 0.95rem; }
}

/* --- Conversion card ---------------------------------------- */
/* Two circular "coin chips" either side of an arrow, plus a    */
/* currency selector and a swap button.                         */
.convert-visual { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.9rem; }
.coin-chip {
  display: grid; place-items: center;
  width: 54px; height: 54px; border-radius: 50%;
  border: 3px solid var(--deep); background: var(--wash);
  color: var(--deep); font-weight: 700; font-size: 0.9rem;
}
.coin-chip.to { background: var(--deep); color: #fff; }
.convert-visual svg { width: 40px; height: 20px; color: var(--mid); }
.card-link {
  display: inline-flex; align-items: center; min-height: 44px; margin-top: 0.8rem; margin-right: 0.5rem;
  padding: 0 1rem; border-radius: 999px;
  background: var(--deep); color: #fff; font-weight: 700; text-decoration: none;
}
.card-link:hover { background: var(--mid); }

/* --- Compare section ---------------------------------------- */
.compare { max-width: 920px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem) clamp(3rem, 8vw, 5rem); }
.compare-intro { color: var(--muted); margin-bottom: 1.4rem; }
.compare-panel {
  padding: clamp(1.2rem, 3vw, 2rem);
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px;
}
.compare-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 0.8rem; }
.field { display: grid; gap: 0.3rem; font-weight: 700; color: var(--muted); }
.field input, .field select {
  min-height: 52px; padding: 0 1rem;
  border: 2px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 1.15rem; font-weight: 700;
}
.field input:focus, .field select:focus { outline: 3px solid var(--mid); outline-offset: 2px; border-color: var(--mid); }
.compare-note { font-size: 0.9rem; color: var(--muted); margin-bottom: 1rem; }

/* Provider ranking list: best offer first, with a bar showing
   how much of the "fair" amount each one delivers. */
.providers { list-style: none; padding: 0; display: grid; gap: 0.6rem; }
.provider {
  display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 0.3rem 1rem; align-items: center;
  padding: 0.9rem 1rem;
  border: 2px solid var(--wash); border-radius: 14px;
  font-variant-numeric: tabular-nums;
}
.provider.best { border-color: var(--safe); background: color-mix(in srgb, var(--safe) 6%, var(--surface)); }
.provider-name { font-weight: 700; }
.provider-badge { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; font-weight: 700; color: var(--safe); }
.provider-badge svg { width: 18px; height: 18px; }
.provider-rate { color: var(--muted); font-size: 0.95rem; }
.provider-gets { text-align: right; font-weight: 800; font-size: 1.1rem; color: var(--deep); }
.provider-bar { grid-column: 1 / -1; height: 10px; border-radius: 5px; background: var(--wash); overflow: hidden; }
.provider-bar span { display: block; height: 100%; border-radius: 5px; background: var(--line); }
.provider.best .provider-bar span { background: var(--safe); }

.compare-summary {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1rem;
  margin-top: 1.1rem; padding-top: 1rem; border-top: 2px dashed var(--wash);
}
.compare-summary strong { font-family: var(--font-display); font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2rem); color: var(--deep); }
.compare-summary span { color: var(--muted); }

@media (max-width: 640px) {
  .compare-form { grid-template-columns: 1fr; }
  .provider { grid-template-columns: 1fr auto; }
  .provider-rate { grid-column: 1 / -1; grid-row: 2; }
}

/* --- Colour bands ------------------------------------------- */
/* Each major section sits on a full-width block of colour. The  */
/* band tokens are redefined in the colour-blind and high-       */
/* contrast themes so contrast is maintained everywhere.         */
:root {
  --band-dark: #1e1b4b;     --on-dark: #ffffff;   --on-dark-muted: #ddd6fe;
  --band-bright: #f5ebdd;   --on-bright: #1e1b4b;
  --band-soft: #c084fc;     --on-soft: #1e1b4b;
  --band-light: #f8fafc;
}
html[data-cb-palette] {
  --band-dark: #3b5b8a;     --on-dark: #ffffff;   --on-dark-muted: #e3eaf4;
  --band-bright: #f28b30;   --on-bright: #14213d;
  --band-soft: #c9d6ea;     --on-soft: #14213d;
  --band-light: #f6f8fb;
}
html[data-contrast] {
  --band-dark: #000000;     --on-dark: #ffffff;   --on-dark-muted: #ffffff;
  --band-bright: #ffffff;   --on-bright: #000000;
  --band-soft: #ffffff;     --on-soft: #000000;
  --band-light: #ffffff;
}

.band { width: 100%; }
.band-dark   { background: var(--band-dark);   color: var(--on-dark); }
.band-bright { background: var(--band-bright); color: var(--on-bright); }
.band-soft   { background: var(--band-soft);   color: var(--on-soft); }
.band-light  { background: var(--band-light); }
.band-light .key { padding-top: clamp(3rem, 8vw, 5rem); }

.band-dark h1, .band-dark h2, .band-dark h3 { color: var(--on-dark); }
.band-bright h2, .band-bright h3 { color: var(--on-bright); }
.band-soft h2 { color: var(--on-soft); }
.band-dark .lede, .band-dark .compare-intro { color: var(--on-dark-muted); }
.band-dark :focus-visible, .site-header :focus-visible, .site-footer :focus-visible { outline-color: var(--band-bright); }

/* White panels always use normal dark ink, whatever band they sit on. */
.checker, .compare-panel, .card, .access-panel { color: var(--ink); }

/* Header and footer always use the dark band palette. */
.site-header { background: var(--band-dark); border-bottom: 1px solid color-mix(in srgb, var(--on-dark) 15%, transparent); backdrop-filter: none; }
.logo { color: var(--on-dark); }
.site-nav a { color: var(--on-dark); }
.site-nav a:hover, .site-nav .nav-cta { color: var(--band-bright); }
.access-btn { background: var(--band-bright); color: var(--on-bright); border-color: var(--band-bright); }
.site-footer { background: var(--band-dark); color: var(--on-dark-muted); border-top: 0; }

/* Hero: cream button on indigo, soft purple banknote. */
.band-dark .btn-primary { background: var(--band-bright); color: var(--on-bright); }
.band-dark .btn-primary:hover { filter: brightness(1.08); background: var(--band-bright); }
.band-dark .btn-quiet { color: var(--on-dark); border-color: var(--band-soft); }
.band-dark .btn-quiet:hover { border-color: var(--on-dark); }

.note {
  background: var(--band-soft); color: var(--on-soft);
  --line: var(--on-soft); --accent: #ffffff;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--band-soft) 35%, transparent), 0 30px 60px -30px #000;
}
.note-stamp { border-color: var(--on-soft); }
.note-stamp svg { color: var(--on-soft); }
.note-lens { border-color: var(--on-soft); box-shadow: 0 0 0 2px #fff, 0 10px 24px rgba(0, 0, 0, 0.35); }
.note-lens::after { background: var(--on-soft); }

/* How it works on cream. */
.band-bright .step p { color: var(--on-bright); }
.band-bright .step h3::before { color: var(--on-bright); }
.band-bright .track { background: color-mix(in srgb, var(--on-bright) 18%, transparent); }
.band-bright .track-fill { background: var(--on-bright); }
.band-bright .coin { background: var(--band-dark); color: var(--band-bright); border-color: var(--band-dark); box-shadow: 0 0 0 6px var(--band-bright); }

/* Checker on soft purple. */
.band-soft .checker { margin: 0 auto; border: 0; box-shadow: 0 30px 60px -35px var(--band-dark); }
.band-soft { padding: clamp(2.5rem, 7vw, 5rem) 0; }

/* Compare on indigo. */
.band-dark .compare { padding-top: clamp(3rem, 8vw, 5rem); }
.compare-panel { border: 0; }

@media (max-width: 720px) {
  .band-soft { padding: 0; }
  .band-soft .checker { box-shadow: none; }
}
.band-bright .step-art g > :first-child { stroke: var(--on-bright); stroke-width: 2.5; }

/* Faded steps stay readable on coloured backgrounds. */
.band-bright .step { opacity: 0.72; }
.band-bright .step.is-reached { opacity: 1; }

/* --- Compare offers ----------------------------------------- */
.real-rate { margin: 0.4rem 0 1.4rem; padding: 1rem 1.1rem; border-radius: 14px; background: var(--wash); }
.real-rate-label { font-weight: 700; color: var(--muted); }
.real-rate-amount { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); color: var(--deep); }
.offers-title { font-size: 1.2rem; color: var(--deep); margin-bottom: 0.2rem; }
.offers { display: grid; gap: 0.7rem; margin-bottom: 0.8rem; }
.offer {
  display: grid; grid-template-columns: 1.2fr 1.2fr 1fr auto; gap: 0.6rem; align-items: end;
  padding: 0.8rem; border: 2px dashed var(--line); border-radius: 14px;
}
.offer .field span { font-size: 0.85rem; }
.offer .field input { min-height: 46px; font-size: 1rem; }
.offer-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.2rem; }
.provider .verdict { margin: 0.3rem 0 0; padding: 0.15rem 0.6rem 0.15rem 0.25rem; font-size: 0.85rem; }
.provider .verdict svg { width: 20px; height: 20px; }
.provider-loss { display: block; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.compare-empty { padding: 0.6rem 0; }
@media (max-width: 640px) {
  .offer { grid-template-columns: 1fr 1fr; }
  .offer .field:first-child { grid-column: 1 / -1; }
  .offer-remove { grid-column: 2; justify-self: end; }
}
/* Keep form boxes inside their panel, and dark text on the white panel. */
.field input, .field select { width: 100%; min-width: 0; }
.offer > *, .compare-form > * { min-width: 0; }
.compare-panel h3 { color: var(--deep); }
.compare-panel .btn-quiet { color: var(--deep); border-color: var(--line); }
.compare-panel .btn-quiet:hover { border-color: var(--deep); }

/* --- "Ask someone you trust" button + dialog ---------------- */
.trust-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 42px; margin-top: 0.8rem; padding: 0 1rem;
  border: 2px solid var(--deep); border-radius: 999px;
  background: var(--band-bright); color: var(--on-bright);
  font: inherit; font-size: 0.92rem; font-weight: 700; white-space: nowrap; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.trust-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.trust-btn:hover { background: var(--deep); color: #fff; }
.trust-panel { width: min(520px, calc(100vw - 2rem)); margin: auto; }
.trust-why { color: var(--muted); margin-bottom: 1rem; }
.trust-label { display: block; font-weight: 700; margin-bottom: 0.3rem; }
#trustMessage {
  width: 100%; padding: 0.8rem; resize: vertical;
  border: 2px solid var(--line); border-radius: 12px;
  font: inherit; font-size: max(16px, 0.95rem); line-height: 1.5; color: var(--ink); background: var(--surface);
}
#trustMessage:focus { outline: 3px solid var(--mid); outline-offset: 2px; }
.trust-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 1rem; }
.trust-actions .btn-primary { grid-column: 1 / -1; }
.trust-status { min-height: 1.5em; margin-top: 0.6rem; font-weight: 700; color: var(--mid); }
@media (max-width: 420px) { .trust-actions { grid-template-columns: 1fr; } }

/* --- "Save a PayProoof" button + "Good to know" notes ------- */
.save-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 42px; margin: 0.8rem 0.5rem 0 0; padding: 0 1rem;
  border: 2px solid var(--line); border-radius: 999px;
  background: var(--wash); color: var(--deep);
  font: inherit; font-size: 0.92rem; font-weight: 700; white-space: nowrap; cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.save-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.save-btn:hover { background: var(--deep); color: #fff; border-color: var(--deep); }

/* On phones the two buttons sit one above the other at the same width. */
@media (max-width: 560px) {
  .save-btn, .trust-btn { display: flex; width: 100%; margin-right: 0; font-size: 0.9rem; min-height: 44px; }
}
.good-to-know {
  margin-top: 1rem; padding: 0.8rem 1rem;
  border: 2px solid var(--line); border-radius: 12px;
  background: color-mix(in srgb, var(--wash) 55%, var(--surface));
  font-size: 0.9rem; color: var(--ink);
}
.good-to-know strong { display: block; margin-bottom: 0.3rem; }
.good-to-know ul { padding-left: 1.1rem; margin: 0; }
.good-to-know li { margin-bottom: 0.25rem; }

.compare-panel .save-btn { margin-top: 1rem; }
.compare-panel .good-to-know { margin-top: 1rem; }

.read-as { margin: 0 0 0.8rem; padding: 0.5rem 0.8rem; border-left: 4px solid var(--line); background: var(--paper); font-size: 0.9rem; color: var(--muted); }
.msg.bot .card + .card { margin-top: 0.8rem; }

/* --- Logo eyes: two of the "o"s in PayProoof ---------------- */
.wordmark { display: inline-flex; align-items: baseline; white-space: nowrap; }
.eye {
  position: relative; display: inline-block;
  width: 0.6em; height: 0.6em; margin: 0 0.03em;
  border-radius: 50%;
  background: #fff;
  overflow: hidden;
  animation: eye-blink 6s infinite;
}
/* --px/--py are set inline by setUpEyes() to make the pupil follow the pointer. */
.pupil {
  position: absolute; left: 50%; top: 50%;
  width: 0.3em; height: 0.3em; margin: -0.15em 0 0 -0.15em;
  border-radius: 50%;
  background: var(--band-dark);
  transform: translate(var(--px, 0.06em), var(--py, 0.06em));
  transition: transform 0.08s linear;
}
.pupil::after {   /* little shine in each eye */
  content: ""; position: absolute; left: 18%; top: 16%;
  width: 30%; height: 30%; border-radius: 50%; background: #fff;
}
@keyframes eye-blink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }
html[data-contrast] .pupil { background: #000; }

/* --- Compare: amount with its currency, and the swap button - */
.compare-form { grid-template-columns: 1fr auto 1fr; align-items: end; }
.field > label { font-weight: 700; color: var(--muted); }
.money-input { display: flex; min-width: 0; }
.money-input input { flex: 1; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.field .money-input select {
  width: auto; flex: 0 0 auto; padding: 0 0.6rem;
  border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0;
  background: var(--wash);
}
.swap-btn {
  width: 52px; height: 52px; display: grid; place-items: center;
  border-radius: 50%; border: 2px solid var(--deep);
  background: var(--band-bright); color: var(--on-bright); cursor: pointer;
  transition: transform 0.25s;
}
.swap-btn svg { width: 24px; height: 24px; }
.swap-btn:hover { transform: rotate(180deg); }
@media (max-width: 640px) {
  .compare-form { grid-template-columns: 1fr; }
  .swap-btn { justify-self: center; width: 46px; height: 46px; }
  .swap-btn svg { transform: rotate(90deg); }
}

/* --- Conversion card: change currency or swap round --------- */
.convert-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.9rem; }
.convert-controls label { font-size: 0.9rem; font-weight: 700; color: var(--muted); }
.convert-controls select {
  min-height: 42px; padding: 0 0.6rem;
  border: 2px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 700;
}
.convert-swap {
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 42px; padding: 0 0.9rem;
  border: 2px solid var(--line); border-radius: 999px;
  background: var(--wash); color: var(--deep);
  font: inherit; font-size: 0.92rem; font-weight: 700; cursor: pointer;
}
.convert-swap svg { width: 18px; height: 18px; }
.convert-swap:hover { background: var(--deep); color: #fff; border-color: var(--deep); }

/* Third "o" in the logo: a magnifying glass. */
.lens {
  position: relative; display: inline-block;
  width: 0.62em; height: 0.62em; margin: 0 0.07em 0 0.12em;
  border: 0.1em solid currentColor; border-radius: 50%;
  background: color-mix(in srgb, var(--band-bright) 30%, transparent);
}
.lens::before {   /* shine on the glass */
  content: ""; position: absolute; right: 14%; top: 12%;
  width: 34%; height: 22%; border-radius: 50%;
  background: currentColor; opacity: 0.8; transform: rotate(35deg);
}
.lens::after {    /* the handle */
  content: ""; position: absolute; left: 18%; top: 82%;
  width: 0.3em; height: 0.12em; border-radius: 0.06em;
  background: currentColor;
  transform: rotate(135deg); transform-origin: left center;
}
.logo:hover .lens { animation: lens-look 0.8s ease-in-out; }
@keyframes lens-look { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-14deg); } 70% { transform: rotate(10deg); } }

.provider-split { display: block; font-size: 0.8rem; color: var(--muted); }

/* --- New chat button ---------------------------------------- */
.new-chat-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 44px; padding: 0 1rem;
  border: 2px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--deep);
  font: inherit; font-size: 0.92rem; font-weight: 700; cursor: pointer;
}
.new-chat-btn svg { width: 18px; height: 18px; }
.new-chat-btn:hover { background: var(--deep); color: #fff; border-color: var(--deep); }