/* Shared stylesheet for the static pages (privacy, terms, refund, 404).
   The variables are copied from public/index.html so these pages match the
   editorial paper look and the same theme toggle (localStorage key
   "safeagreeTheme"). If you change a colour in index.html, change it here. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root, html[data-theme="light"] {
  --bg: #f4efe3;
  --surface: #fdfbf4;
  --surface-2: #f1ebdc;
  --surface-3: #e9e1cd;
  --border: #ddd3bd;
  --border-strong: #c8bda2;
  --ink-line: #211d16;
  --text: #211d16;
  --text-muted: #7b7263;
  --text-faint: #a2977f;

  --accent: #b03b2e;
  --accent-bright: #9c2f22;
  --accent-soft: rgba(176,59,46,0.09);
  --accent-border: rgba(176,59,46,0.45);

  --btn-bg: #211d16;
  --btn-fg: #fdfbf4;
  --btn-hover: #383124;

  --warning: #8a6d1a;
  --warning-bg: #f7efd2;
  --warning-border: #e2cf8d;

  --hl: #f5d867;
  --hl-mark: rgba(245,216,103,0.9);

  --header-bg: rgba(253,251,244,0.92);
  --dot: rgba(33,29,22,0.06);
  --shadow: 6px 6px 0 rgba(33,29,22,0.12);
  --shadow-sm: 3px 3px 0 rgba(33,29,22,0.10);

  --radius: 8px;
  --radius-sm: 6px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #16130d;
  --surface: #1f1a12;
  --surface-2: #292317;
  --surface-3: #342c1d;
  --border: #3e3524;
  --border-strong: #564b32;
  --ink-line: #ded2b6;
  --text: #ece3d0;
  --text-muted: #a89c84;
  --text-faint: #7c7160;

  --accent: #d0654e;
  --accent-bright: #e08a75;
  --accent-soft: rgba(208,101,78,0.14);
  --accent-border: rgba(208,101,78,0.45);

  --btn-bg: #ece3d0;
  --btn-fg: #211d16;
  --btn-hover: #f6efdd;

  --warning: #d9b45b;
  --warning-bg: rgba(217,180,91,0.10);
  --warning-border: rgba(217,180,91,0.35);

  --hl: #c9a83c;
  --hl-mark: rgba(201,168,60,0.4);

  --header-bg: rgba(31,26,18,0.92);
  --dot: rgba(236,227,208,0.05);
  --shadow: 6px 6px 0 rgba(0,0,0,0.42);
  --shadow-sm: 3px 3px 0 rgba(0,0,0,0.32);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
}
::selection { background: var(--hl); color: #211d16; }
a { color: var(--accent-bright); }

/* Header, the masthead */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: saturate(120%) blur(10px);
  -webkit-backdrop-filter: saturate(120%) blur(10px);
  border-bottom: 3px double var(--ink-line);
  padding: 13px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; }
.logo-mark { flex-shrink: 0; display: block; color: var(--text); }
.logo-mark .logo-check { color: var(--accent); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.brand-name .grad-text { color: var(--accent-bright); }
.brand-tag { font-size: 12px; color: var(--text-muted); font-style: italic; font-family: var(--font-display); }
.header-controls { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border: 1.5px solid var(--ink-line);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.icon-btn:hover { color: var(--accent-bright); background: var(--surface-2); }

/* The document */
main { max-width: 760px; width: 100%; margin: 0 auto; padding: 36px 24px 96px; flex: 1; }
.sheet {
  background: var(--surface);
  border: 1.5px solid var(--ink-line);
  border-radius: var(--radius);
  padding: 40px 44px;
  box-shadow: var(--shadow);
}
.eyebrow {
  display: inline-block;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent-bright);
  background: var(--surface);
  border: 1.5px solid var(--accent-border);
  border-radius: 999px;
  padding: 5px 13px;
  margin-bottom: 18px;
}
h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 4.4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.14;
  margin-bottom: 10px;
  width: fit-content;
  background-image: linear-gradient(transparent 78%, var(--hl-mark) 78%, var(--hl-mark) 97%, transparent 97%);
  padding: 0 3px 2px;
}
.updated { font-family: var(--font-display); font-style: italic; color: var(--text-muted); font-size: 14px; margin-bottom: 26px; }
.lede { font-size: 16.5px; color: var(--text); margin-bottom: 22px; }
h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin: 34px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1.5px dashed var(--border-strong);
}
h3 { font-size: 15.5px; font-weight: 700; margin: 20px 0 6px; }
p, ul, ol, table { margin-bottom: 12px; font-size: 15px; }
ul, ol { padding-left: 22px; }
li { margin-bottom: 6px; }
li > ul { margin: 6px 0 0; }
code { font-family: var(--mono); font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.callout {
  margin: 16px 0 20px; padding: 14px 16px;
  background: var(--warning-bg); border: 1.5px solid var(--warning-border);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--warning);
}
.callout strong { display: block; margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.06em; font-size: 11.5px; }
.toc { margin: 0 0 24px; padding: 14px 18px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.toc ol { margin: 0; padding-left: 20px; font-size: 14px; columns: 2; column-gap: 24px; }
.toc li { margin-bottom: 3px; break-inside: avoid; }
.contact-card {
  margin-top: 8px; padding: 16px 18px;
  background: var(--surface-2); border: 1.5px solid var(--ink-line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  font-size: 15px;
}
.contact-card dt { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-top: 8px; }
.contact-card dt:first-child { margin-top: 0; }
.contact-card dd { margin: 0; }
.legal-nav { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 30px; padding-top: 18px; border-top: 3px double var(--ink-line); font-size: 14px; }

/* 404 */
.notfound { text-align: center; padding: 40px 0 20px; }
.notfound .code { font-family: var(--font-display); font-size: 96px; font-weight: 700; line-height: 1; color: var(--accent-bright); }
.notfound p { color: var(--text-muted); max-width: 42ch; margin: 12px auto 26px; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 28px;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1.5px solid var(--ink-line); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 15px; font-weight: 700; letter-spacing: 0.02em;
  text-decoration: none; cursor: pointer;
  box-shadow: 4px 4px 0 var(--accent);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s;
}
.btn-primary:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--accent); background: var(--btn-hover); }

/* Footer */
footer {
  text-align: center;
  padding: 28px 24px;
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font-display);
  font-style: italic;
  border-top: 3px double var(--ink-line);
  background: var(--surface);
}
.footer-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); margin-bottom: 6px; font-style: normal; }
.footer-brand svg { color: var(--text); }
.footer-brand .logo-check { color: var(--accent); }
.footer-links { margin-top: 8px; font-style: normal; font-family: var(--font); }
.footer-links a { color: var(--text-muted); text-decoration: none; margin: 0 6px; }
.footer-links a:hover { color: var(--accent-bright); text-decoration: underline; }

@media (max-width: 640px) {
  header { padding: 11px 16px; }
  .brand-tag { display: none; }
  main { padding: 22px 16px 64px; }
  .sheet { padding: 26px 20px; }
  .toc ol { columns: 1; }
  th, td { padding: 6px 6px; }
}
