/* Shared styling for the generated legal pages (privacy.html, terms.html).
   Tokens mirror the :root block in index.html, which mirrors DESIGN.md §2–§4.
   Never introduce raw hex values outside the :root block below. */

:root {
  color-scheme: light;
  /* DESIGN.md §2 — color tokens */
  --background: #FFFFFF;
  --surface: #F8F6F1;
  --surface-sunken: #F2EFE8;
  --divider: #E8E4DC;
  --outline: #D6CFC1;
  --ink: #2C2A26;
  --ink-muted: #6A665C;
  --ink-subtle: #6F6A5F;
  --ink-faint: #B5AD9D;
  --accent: #6B8E6B;
  --accent-deep: #4A6B4A;
  --accent-soft: #D8E3D6;
  --warning: #D4B46A;
  --warning-bg: #FDF6E8;
  --warning-ink: #6A5A2C;
  --info-bg: #F4F1EC;
  /* DESIGN.md §3 — type */
  --serif: "Iowan Old Style", "New York", "Palatino", "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Helvetica Neue", sans-serif;
  /* DESIGN.md §4 — spacing & radii */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 22px; --s6: 28px; --s7: 40px; --s8: 56px;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --shadow-card: 0 4px 24px rgba(40, 35, 25, 0.06);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft); color: var(--accent-deep); }

a { color: var(--accent-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }

img, svg { max-width: 100%; display: block; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 var(--s5); }

/* ---------- Nav (matches index.html) ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--divider);
}
.nav-inner { display: flex; align-items: center; gap: var(--s5); min-height: 64px; }
.brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  text-decoration: none;
  color: var(--ink);
  margin-right: auto;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  overflow: hidden;
  flex: none;
  box-shadow: 0 1px 4px rgba(40, 35, 25, 0.12);
}
.brand-mark img { width: 100%; height: 100%; display: block; }
.brand-name { font-family: var(--serif); font-size: 21px; font-weight: 600; }
.nav-back { font-size: 15px; color: var(--ink-subtle); text-decoration: none; }
.nav-back:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Document ---------- */
.doc-head {
  border-bottom: 1px solid var(--divider);
  padding: var(--s8) 0 var(--s6);
  background: var(--surface);
}
.eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent-deep);
  display: block;
  margin-bottom: var(--s4);
}

.doc {
  /* A comfortable measure — this is long-form reading for older eyes. */
  max-width: 74ch;
  margin: 0 auto;
  padding: var(--s7) var(--s5) var(--s8);
}

.doc h1, .doc h2, .doc h3 {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
  text-align: left; /* DESIGN.md §5.2 — no center-aligned headlines anywhere */
  text-wrap: balance;
}
.doc h1 { font-size: 40px; line-height: 1.15; margin-bottom: var(--s4); }
.doc h2 {
  font-size: 26px;
  line-height: 1.25;
  margin-top: var(--s8);
  margin-bottom: var(--s4);
  padding-top: var(--s5);
  border-top: 1px solid var(--divider);
}
.doc h3 { font-size: 20px; line-height: 1.3; margin-top: var(--s6); margin-bottom: var(--s3); }
.doc-head h1 { font-size: 44px; }

.doc p { margin-bottom: var(--s4); }
.doc ul, .doc ol { margin: 0 0 var(--s4) var(--s5); }
.doc li { margin-bottom: var(--s2); }
.doc li > ul, .doc li > ol { margin-top: var(--s2); }
.doc strong { font-weight: 600; }
.doc code {
  font-size: 0.9em;
  background: var(--surface-sunken);
  border-radius: var(--r-sm);
  padding: 2px 6px;
}
.doc blockquote {
  border-left: 3px solid var(--accent-soft);
  padding-left: var(--s4);
  margin: 0 0 var(--s4);
  color: var(--ink-muted);
}
.doc hr { border: 0; border-top: 1px solid var(--divider); margin: var(--s7) 0; }
.doc em { font-style: italic; }

/* The document leads with a metadata block (app, bundle ID, dates). */
.doc-meta {
  background: var(--info-bg);
  border-radius: var(--r-md);
  padding: var(--s4) var(--s5);
  margin-bottom: var(--s6);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-muted);
}
.doc-meta strong { color: var(--ink); }

/* Tables carry the GDPR legal-basis and retention matrices — they must stay
   readable on a phone, so they scroll inside their own container. */
.table-scroll {
  overflow-x: auto;
  margin-bottom: var(--s5);
  border: 1px solid var(--divider);
  border-radius: var(--r-md);
  -webkit-overflow-scrolling: touch;
}
.doc table { border-collapse: collapse; width: 100%; font-size: 15px; }
.doc th, .doc td {
  text-align: left;
  vertical-align: top;
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--divider);
}
.doc th {
  background: var(--surface-sunken);
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.doc tbody tr:last-child td { border-bottom: 0; }

/* ---------- Footer (matches index.html) ---------- */
footer {
  border-top: 1px solid var(--divider);
  padding: var(--s7) 0 var(--s8);
  background: var(--background);
}
.foot-inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s6);
  justify-content: space-between;
  align-items: flex-start;
}
.foot-brand { display: flex; align-items: center; gap: var(--s3); }
.foot-links { display: flex; flex-wrap: wrap; gap: var(--s5); }
.foot-links a { font-size: 14px; color: var(--ink-subtle); text-decoration: none; }
.foot-links a:hover { color: var(--ink); text-decoration: underline; }
.foot-legal { width: 100%; font-size: 13px; color: var(--ink-faint); margin-top: var(--s5); }

@media (max-width: 700px) {
  .doc { padding-top: var(--s6); }
  .doc h1, .doc-head h1 { font-size: 32px; }
  .doc h2 { font-size: 23px; }
}
