/* ═══════════════════════════════════════════════════════════════════════════
   Genesis — public pages
   ═══════════════════════════════════════════════════════════════════════════

   Design derives from the app's own system (lib/shared/theme/app_colors.dart),
   not from a generic web palette:

     · Pure grayscale surfaces, ONE accent — #0A84FF, the app's dark-mode blue.
       The app's palette file is explicit: "No purple, violet, teal, or
       decorative colors." An earlier version of this page used indigo, which
       was off-brand.
     · Inter, self-hosted. The app's design philosophy chooses Inter over
       Poppins because it was built for screens and its tabular figures align
       financial data. Both reasons apply here.
     · Zero external requests. A privacy policy that depends on a CDN is a
       privacy policy that can be down when a store reviewer loads it, and the
       CSP on these pages is default-src 'none'.

   The signature element is the ledger: a two-column balance of what stays on
   the device against what leaves it. Double-entry bookkeeping is what this app
   is built on, so its defining artifact is the honest way to state a privacy
   position — and unlike a prose list, a balance can be read in one glance.
   ═══════════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}

:root {
  /* Surfaces — the app's dark-mode tokens, verbatim. */
  --ink: #000000;
  --surface: #1c1c1e;
  --raised: #2c2c2e;
  --line: #3a3a3c;

  /* Text — the app's dark-mode text scale. */
  --text: #ebebf5;
  --muted: #8e8e93;
  --faint: #636366;

  /* The one accent. */
  --accent: #0a84ff;
  --accent-dim: rgba(10, 132, 255, 0.14);

  --measure: 68ch;
  --gutter: 3.5rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16.5px;
  line-height: 1.7;
  background: var(--ink);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Tabular figures everywhere: this is a finance product and its numbers
     should align in a column the way they do in the app. */
  font-variant-numeric: tabular-nums;
}

/* ── Shell ────────────────────────────────────────────────────────────── */

.shell {
  max-width: 940px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 2.5rem);
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  z-index: 20;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}
/* The mark is a balanced pair of rules — the ledger, at glyph scale. */
.wordmark::before {
  content: '';
  width: 15px;
  height: 11px;
  border-top: 2.5px solid var(--accent);
  border-bottom: 2.5px solid var(--text);
  flex: none;
  transform: translateY(-1px);
}

.masthead-nav {
  display: flex;
  gap: 1.6rem;
  font-size: 0.875rem;
}
.masthead-nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}
.masthead-nav a:hover,
.masthead-nav a[aria-current='page'] { color: var(--text); }

@media (max-width: 620px) {
  .masthead { flex-direction: column; align-items: flex-start; gap: 0.9rem; padding: 1.25rem 0; }
  .masthead-nav { gap: 1.1rem; font-size: 0.8125rem; }
}

/* ── Page head ────────────────────────────────────────────────────────── */

.page-head { padding: clamp(3.5rem, 9vw, 6.5rem) 0 clamp(2rem, 4vw, 3rem); }

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.page-title {
  font-size: clamp(2.5rem, 7vw, 4.25rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.038em;
  margin-bottom: 1.25rem;
}

.standfirst {
  font-size: clamp(1.0625rem, 2.2vw, 1.25rem);
  line-height: 1.6;
  color: var(--muted);
  max-width: 54ch;
}
.standfirst strong { color: var(--text); font-weight: 600; }

/* Hero qualifiers: free / no account / platforms. These answer "what will
   this cost me" before the reader has to ask, so unlike .stamp they are meant
   to be read rather than merely available. */
.page-head .stamp {
  margin-top: 2.25rem;
  gap: 0.5rem 0.75rem;
  align-items: center;
}
.page-head .stamp span {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
}

.stamp {
  margin-top: 2rem;
  font-size: 0.8125rem;
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

/* ── The ledger — the signature element ───────────────────────────────── */

.ledger {
  margin: clamp(2.5rem, 6vw, 4rem) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 2.25rem 0 0;
}

.ledger-head {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 0 clamp(1.25rem, 4vw, 2.75rem);
  padding-bottom: 1rem;
}

.ledger-head span {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.ledger-head .col-keep { color: var(--accent); }
.ledger-rule { background: var(--line); grid-column: 2; }

/* Explicit column placement. The divider spans the full row, which makes it a
   definitely-positioned item; without stating the columns for its siblings too,
   auto-placement flows them around it and shifts every item one track over. */
.ledger-head > span:first-child,
.ledger-body > .ledger-col:first-child { grid-column: 1; }
.ledger-head > span:last-child,
.ledger-body > .ledger-col:last-child { grid-column: 3; }

/* A `1fr` track refuses to shrink below its content's min-content width, which
   lets a long unbroken item push the columns out of balance. */
.ledger-col, .ledger-head > span { min-width: 0; }

.ledger-body {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 0 clamp(1.25rem, 4vw, 2.75rem);
}

.ledger-col { display: flex; flex-direction: column; }

/* Shown only in the stacked layout — see the max-width: 700px block. */
.col-label { display: none; }

.ledger-item {
  padding: 0.72rem 0;
  border-top: 1px solid rgba(58, 58, 60, 0.5);
  font-size: 0.9375rem;
  line-height: 1.45;
}
.ledger-item:first-child { border-top: 0; }
.ledger-item small {
  display: block;
  color: var(--faint);
  font-size: 0.8125rem;
  margin-top: 0.15rem;
}

.ledger-foot {
  border-top: 1px solid var(--line);
  margin-top: 1.5rem;
  padding: 1.5rem 0 2.25rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.ledger-foot .balance-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.ledger-foot .balance-value {
  font-size: clamp(1rem, 2.4vw, 1.1875rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

@media (max-width: 700px) {
  .ledger { padding-top: 0; }
  /* The shared two-track header cannot follow columns that no longer sit side
     by side; each column labels itself instead. */
  .ledger-head { display: none; }
  .ledger-body { grid-template-columns: 1fr; gap: 0; }
  .ledger-rule { display: none; }
  .ledger-body > .ledger-col:first-child,
  .ledger-body > .ledger-col:last-child { grid-column: 1; }

  .col-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
    padding: 2.25rem 0 0.75rem;
  }
  .ledger-col:first-child .col-label { padding-top: 1.75rem; color: var(--accent); }
  /* The label starts the group, so the first item must not draw a rule above
     it — otherwise the heading looks detached from its own list. */
  .col-label + .ledger-item { border-top: 0; }
}

/* Load-in: the two columns resolve outward from the rule, the way a balance
   settles. One orchestrated moment; nothing else on the page animates. */
@media (prefers-reduced-motion: no-preference) {
  .ledger-item {
    opacity: 0;
    animation: settle 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }
  .ledger-col:first-of-type .ledger-item { --dir: -10px; }
  .ledger-col:last-of-type .ledger-item { --dir: 10px; }
  .ledger-item:nth-child(1) { animation-delay: 0.06s; }
  .ledger-item:nth-child(2) { animation-delay: 0.12s; }
  .ledger-item:nth-child(3) { animation-delay: 0.18s; }
  .ledger-item:nth-child(4) { animation-delay: 0.24s; }
  .ledger-item:nth-child(5) { animation-delay: 0.3s; }
  .ledger-item:nth-child(6) { animation-delay: 0.36s; }
  .ledger-item:nth-child(7) { animation-delay: 0.42s; }
  .ledger-foot { opacity: 0; animation: settle 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.5s forwards; }
}

@keyframes settle {
  from { opacity: 0; transform: translateX(var(--dir, 0)); }
  to   { opacity: 1; transform: none; }
}

/* ── Prose ────────────────────────────────────────────────────────────── */

.prose { padding-bottom: 4rem; }

/* Sections carry a number in the gutter. Legal documents genuinely are cited
   by section ("see section 7"), so the number is wayfinding, not ornament. */
.clause {
  display: grid;
  grid-template-columns: var(--gutter) 1fr;
  gap: 0 1rem;
  padding: 2.5rem 0;
  border-top: 1px solid var(--line);
}
.clause:first-of-type { border-top: 0; }

.clause-no {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--faint);
  padding-top: 0.42rem;
  letter-spacing: 0.02em;
}

.clause-body { max-width: var(--measure); min-width: 0; }

.clause-body h2 {
  font-size: clamp(1.25rem, 2.6vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.25;
  margin-bottom: 0.9rem;
}
.clause-body h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.75rem 0 0.5rem;
}
.clause-body p { margin-bottom: 1rem; color: var(--muted); }
.clause-body p strong { color: var(--text); font-weight: 600; }
.clause-body > p:last-child { margin-bottom: 0; }

.clause-body ul { list-style: none; margin: 0 0 1rem; }
.clause-body li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.6rem;
  color: var(--muted);
}
.clause-body li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 1px;
  background: var(--faint);
}
.clause-body li strong { color: var(--text); font-weight: 600; }

@media (max-width: 620px) {
  .clause { grid-template-columns: 1fr; gap: 0; padding: 2rem 0; }
  .clause-no { padding-top: 0; margin-bottom: 0.5rem; }
}

/* ── Notes — used sparingly, for the things people get wrong ──────────── */

.note {
  border-left: 2px solid var(--accent);
  background: var(--accent-dim);
  border-radius: 0 10px 10px 0;
  padding: 1.15rem 1.35rem;
  margin: 1.5rem 0;
}
.note p { color: var(--text); margin-bottom: 0.6rem; }
.note p:last-child { margin-bottom: 0; }
.note-quiet {
  border-left-color: var(--line);
  background: var(--surface);
}
.note-quiet p { color: var(--muted); }
.note-quiet p strong { color: var(--text); }

/* ── Tables ───────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; margin: 1.25rem 0 1.5rem; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  min-width: 460px;
}
th {
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0 1.25rem 0.65rem 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td {
  padding: 0.85rem 1.25rem 0.85rem 0;
  border-bottom: 1px solid rgba(58, 58, 60, 0.45);
  color: var(--muted);
  vertical-align: top;
}
td:first-child { color: var(--text); }
tr:last-child td { border-bottom: 0; }

/* ── Actions ──────────────────────────────────────────────────────────── */

.action-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0 0.5rem; }

/* Paragraph following an action row needs its own breathing room. Lives here
   rather than as a style attribute: the CSP is style-src 'self' and blocks
   inline styles outright, which is how this was caught. */
.clause-body p.after-actions { margin-top: 1.25rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--accent);
  color: #fff;
  padding: 0.8rem 1.4rem;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: transform 0.12s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--muted); filter: none; }

/* ── Index-only: route cards ──────────────────────────────────────────── */

.routes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  margin: 1rem 0 4rem;
}
.route {
  background: var(--ink);
  padding: 1.6rem 1.5rem;
  text-decoration: none;
  display: block;
  transition: background 0.15s ease;
}
.route:hover { background: var(--surface); }
.route-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.route-name::after { content: '→'; color: var(--faint); font-weight: 400; }
.route:hover .route-name::after { color: var(--accent); }
.route-desc { font-size: 0.875rem; color: var(--muted); line-height: 1.5; }

/* ── Links ────────────────────────────────────────────────────────────── */

a { color: var(--accent); }
.clause-body a,
.standfirst a { text-decoration-thickness: 1px; text-underline-offset: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ── Colophon ─────────────────────────────────────────────────────────── */

.colophon {
  border-top: 1px solid var(--line);
  padding: 2.5rem 0 4rem;
  color: var(--faint);
  font-size: 0.875rem;
}
.colophon-nav { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-bottom: 1.25rem; }
.colophon-nav a { color: var(--muted); text-decoration: none; }
.colophon-nav a:hover { color: var(--text); }
.colophon p { margin-bottom: 0.35rem; }
