/* Shared tokens and components. Mobile first. Colours are variables only; dark mode redefines them. */
:root {
  --bg: #fafaf8;
  --bg-soft: #f2f1ec;
  --surface: #ffffff;
  --text: #1f262e;
  --muted: #56616c;
  --line: rgba(31, 38, 46, 0.12);
  --line-strong: rgba(31, 38, 46, 0.24);
  --accent: #ff7a2e;          /* fills: buttons, highlights */
  --accent-ink: #14181d;      /* text on accent fills (AA) */
  --accent-text: #c2410c;     /* orange used as text on the page (AA) */
  --accent-soft: rgba(255, 122, 46, 0.12);
  --ok: #157347;
  --err: #b42318;
  --shadow: 0 1px 2px rgba(20, 24, 29, 0.05), 0 12px 32px -12px rgba(20, 24, 29, 0.18);
  --glow: rgba(255, 122, 46, 0.22);
  --radius: 18px;
  --font-display: "Outfit", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1116;
  --bg-soft: #131820;
  --surface: #161b22;
  --text: #f3f5f7;
  --muted: #9aa4af;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.22);
  --accent: #ff7a2e;
  --accent-ink: #14181d;
  --accent-text: #ff9152;
  --accent-soft: rgba(255, 122, 46, 0.14);
  --ok: #4ade80;
  --err: #ff8a80;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -14px rgba(0, 0, 0, 0.7);
  --glow: rgba(255, 122, 46, 0.18);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; letter-spacing: -0.02em; margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent-text); text-underline-offset: 3px; }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { height: 38px; width: auto; }
.brand .logo-dark { display: none; }
:root[data-theme="dark"] .brand .logo-light { display: none; }
:root[data-theme="dark"] .brand .logo-dark { display: block; }
.header-actions { display: flex; align-items: center; gap: 10px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent; font: 600 1rem/1 var(--font-display); text-decoration: none; cursor: pointer; transition: transform .15s ease, box-shadow .2s ease, background .2s ease; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 24px -8px var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 28px -8px var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 0.95rem; }

.theme-toggle { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--text); display: inline-grid; place-items: center; cursor: pointer; }
.theme-toggle:hover { background: var(--bg-soft); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0 96px; color: var(--muted); font-size: 0.95rem; }
.site-footer .wrap { display: grid; gap: 20px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }

/* legal / simple pages */
.prose { max-width: 720px; padding: 48px 0 72px; }
.prose h1 { font-size: clamp(2rem, 6vw, 3rem); margin-bottom: 16px; }
.prose h2 { font-size: 1.35rem; margin: 32px 0 8px; }
.prose p, .prose li { color: var(--muted); }
.prose p + p { margin-top: 12px; }
.prose ul { padding-left: 20px; }
.prose .todo { background: var(--accent-soft); border-radius: 8px; padding: 2px 6px; color: var(--text); }

/* form primitives */
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 0.95rem; }
.field .hint { font-size: 0.85rem; color: var(--muted); }
.field .opt { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="email"], input[type="tel"], input[type="url"], select, textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 1rem; /* 16px: no iOS zoom */
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--err); }
.field .err { color: var(--err); font-size: 0.875rem; min-height: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (min-width: 768px) {
  .wrap { padding: 0 32px; }
  .site-header .wrap { height: 72px; }
  .brand img { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* long-form legal pages */
.prose h3 { font-size: 1.1rem; margin: 22px 0 6px; }
.prose ul { margin: 8px 0; }
.prose li + li { margin-top: 6px; }
.prose .toc { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; margin: 20px 0 8px; columns: 1; }
.prose .toc ol { margin: 0; padding-left: 20px; }
.prose .toc a { color: var(--text); }
.prose .tbl-wrap { overflow-x: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; }
.prose table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 0.95rem; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--muted); }
.prose th { background: var(--bg-soft); color: var(--text); font-weight: 600; }
.prose tr:last-child td { border-bottom: 0; }
.prose h2[id] { scroll-margin-top: 88px; }
@media (min-width: 768px) { .prose { max-width: 800px; } .prose .toc { columns: 2; } }
