/*
 * The legal pages, styled to look like the app rather than like a contract.
 *
 * Standalone CSS, not the app's theme.css: these are static files that must
 * render for a crawler and for someone with JavaScript off, so they carry their
 * own copy of the handful of tokens they use. That is a deliberate duplication -
 * importing the app's stylesheet would pull a bundle and a build step into two
 * documents whose whole job is to be plain HTML that always loads.
 */

:root {
  color-scheme: light dark;

  --bg-base: #e9dfc9;
  --bg-raised: #fffcf5;
  --ink: #2b2519;
  --ink-2: #5c5240;
  --ink-muted: #675c4a;
  --moss: #4f8340;
  --moss-deep: #38602d;
  --border-soft: #d8c6a2;
  --hairline: #2b251914;
  --shadow: #2b251914;

  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --ui: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-base: #191d1a;
    --bg-raised: #232a25;
    --ink: #ede7d8;
    --ink-2: #bcb5a4;
    --ink-muted: #a09c8c;
    --moss: #7fae5f;
    --moss-deep: #9cc47c;
    --border-soft: #3a453b;
    --hairline: #ede7d814;
    --shadow: #00000040;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: clamp(1.5rem, 5vw, 4rem) 1.25rem clamp(3rem, 8vw, 6rem);
  background: var(--bg-base);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 1rem;
  line-height: 1.65;
  /* The app's paper grain, at a fraction of the strength: enough to stop a wall
     of text reading as a blank browser default, not enough to cost legibility. */
  background-image: radial-gradient(circle at 20% 15%, #ffffff10, transparent 55%);
}

main {
  max-width: 44rem;
  margin: 0 auto;
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: clamp(1.5rem, 5vw, 3.25rem);
  box-shadow: 0 1px 2px var(--shadow), 0 12px 32px -18px var(--shadow);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 2.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--hairline);
}

.brand a {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.brand a:hover { color: var(--moss-deep); }

.brand span {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

h1 {
  font-family: var(--display);
  font-size: clamp(1.9rem, 5vw, 2.5rem);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

.updated {
  margin: 0 0 2.5rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

h2 {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 600;
  margin: 2.5rem 0 0.75rem;
  color: var(--ink);
}

h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.75rem 0 0.5rem;
}

p, li { color: var(--ink-2); }
p { margin: 0 0 1rem; }

ul { margin: 0 0 1rem; padding-left: 1.25rem; }
li { margin-bottom: 0.5rem; }

li::marker { color: var(--moss); }

a { color: var(--moss-deep); text-underline-offset: 0.15em; }

strong { color: var(--ink); font-weight: 650; }

/* The short version, up top, because almost nobody reads the long one. */
.summary {
  background: color-mix(in srgb, var(--moss) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--moss) 25%, transparent);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin: 0 0 2.5rem;
}

.summary h2 { margin-top: 0; font-size: 1.05rem; }
.summary ul { margin-bottom: 0; }
.summary li:last-child { margin-bottom: 0; }

/* Wide content must scroll inside itself rather than push the page sideways. */
.table-wrap { overflow-x: auto; margin: 0 0 1.25rem; }

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 30rem;
  font-size: 0.925rem;
}

th, td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}

th {
  font-weight: 650;
  color: var(--ink);
  white-space: nowrap;
}

td { color: var(--ink-2); }

/*
 * Below about 40rem a two-column table stops being a table.
 *
 * The scroll container keeps it from breaking the page, but a phone reader
 * still gets the second column clipped off the edge and has to swipe each row
 * to read the half that explains the first. Both tables here are really
 * label/explanation pairs, so on a narrow screen they become exactly that -
 * stacked, first cell as the heading, no horizontal movement at all.
 */
@media (max-width: 40rem) {
  table { min-width: 0; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tr { display: block; padding: 0.9rem 0; border-bottom: 1px solid var(--hairline); }
  tr:last-child { border-bottom: 0; }

  td { display: block; border: 0; padding: 0; }
  td:first-child {
    font-weight: 650;
    color: var(--ink);
    margin-bottom: 0.3rem;
  }
  td + td { color: var(--ink-2); }
}

footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.875rem;
  color: var(--ink-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

a:focus-visible, .brand a:focus-visible {
  outline: 2px solid #bf6440;
  outline-offset: 3px;
  border-radius: 3px;
}
