/* State Board Prep — legal pages.
   Tokens mirror the app's Palette.swift; Geist is self-hosted from the app's
   own font files so no visitor request ever reaches a third-party font CDN. */

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  --surface: #FAF7F4;
  --ink: #1F1A1D;
  --ink-2: #5E5559;
  --plum: #5B2C4A;
  --plum-deep: #46213A;
  --on-plum: #FAF7F4;
  --on-plum-2: rgba(250, 247, 244, 0.8);
  --hair: #E3DBD4;
  --hair-on-plum: rgba(250, 247, 244, 0.24);

  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --measure: 68ch;
  --gutter: 16px;
  --page: 1120px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 24px;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.62;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
}

/* ---------- Links & focus ---------- */

a {
  color: var(--plum);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 2px; }

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--surface);
  z-index: 10;
}
.skip:focus { top: 12px; }

/* ---------- Masthead ---------- */

.masthead {
  border-bottom: 2px solid var(--ink);
}

.masthead__inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 18px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand img { display: block; }

.doc-switch {
  display: flex;
  gap: 24px;
}
.doc-switch a {
  color: var(--ink-2);
  font-weight: 500;
  font-size: 0.9375rem;
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.doc-switch a:hover { color: var(--ink); }
.doc-switch a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--plum);
}

/* ---------- Document head ---------- */

.page {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.doc-head {
  padding: 56px 0 40px;
  max-width: 52rem;
}

.doc-head h1 {
  margin: 0;
  font-size: clamp(2.75rem, 8vw, 5rem);
  line-height: 0.98;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.doc-meta {
  margin: 20px 0 0;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.lead {
  margin: 24px 0 0;
  max-width: 40rem;
  font-size: 1.25rem;
  line-height: 1.5;
}

/* ---------- Summary block (the one loud element) ---------- */

.summary {
  background: var(--plum);
  color: var(--on-plum);
  padding: 32px 24px;
  margin: 0 calc(var(--gutter) * -1);
}

.summary h2 {
  margin: 0 0 8px;
  font-size: 1.375rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.summary > p {
  margin: 0 0 24px;
  max-width: 40rem;
  color: var(--on-plum-2);
}

.summary a { color: var(--on-plum); }
.summary :focus-visible { outline-color: var(--on-plum); }

.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.5;
}

.ledger th,
.ledger td {
  text-align: left;
  vertical-align: top;
  padding: 16px 24px 16px 0;
  border-top: 1px solid var(--hair-on-plum);
}

.ledger thead th {
  border-top: 0;
  padding-top: 0;
  padding-bottom: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--on-plum-2);
}

.ledger tbody th {
  font-weight: 700;
  width: 30%;
}

.ledger td { color: var(--on-plum-2); }
.ledger td strong { color: var(--on-plum); font-weight: 500; }

.summary-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: 48rem;
}
.summary-list li {
  padding: 14px 0;
  border-top: 1px solid var(--hair-on-plum);
  color: var(--on-plum-2);
}
.summary-list li strong { color: var(--on-plum); font-weight: 500; }

@media (max-width: 719px) {
  .ledger thead { display: none; }
  .ledger,
  .ledger tbody,
  .ledger tr,
  .ledger th,
  .ledger td { display: block; width: auto; }
  .ledger tr {
    border-top: 1px solid var(--hair-on-plum);
    padding: 16px 0;
  }
  .ledger th,
  .ledger td {
    border-top: 0;
    padding: 0;
  }
  .ledger tbody th { width: auto; margin-bottom: 8px; }
  .ledger td + td { margin-top: 8px; }
  .ledger td::before {
    content: attr(data-label) ": ";
    color: var(--on-plum);
    font-weight: 500;
  }
}

@media (min-width: 720px) {
  .summary { margin: 0; padding: 40px 40px 32px; }
}

/* ---------- Body: contents + clauses ---------- */

.doc-body {
  padding: 48px 0 80px;
}

.toc {
  margin-bottom: 40px;
  font-size: 0.9375rem;
}

.toc h2 {
  margin: 0 0 12px;
  font-size: 0.9375rem;
  font-weight: 700;
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.toc li {
  counter-increment: toc;
  display: flex;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--hair);
  line-height: 1.4;
}
.toc li::before {
  content: counter(toc);
  min-width: 1.5em;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.toc a {
  color: var(--ink);
  text-decoration: none;
}
.toc a:hover { color: var(--plum); text-decoration: underline; }

@media (min-width: 1000px) {
  .doc-body {
    display: grid;
    grid-template-columns: 240px minmax(0, var(--measure));
    gap: 72px;
    align-items: start;
  }
  .toc {
    position: sticky;
    top: 24px;
    margin-bottom: 0;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
  }
}

.clauses {
  max-width: var(--measure);
  counter-reset: clause;
}

.clause {
  counter-increment: clause;
  padding: 32px 0;
  border-top: 1px solid var(--hair);
}
.clause:first-child {
  border-top: 2px solid var(--ink);
}

.clause h2 {
  display: flex;
  gap: 14px;
  margin: 0 0 16px;
  font-size: 1.375rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.clause h2::before {
  content: counter(clause);
  min-width: 1.4em;
  color: var(--ink-2);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.clause h3 {
  margin: 28px 0 8px;
  font-size: 1.0625rem;
  line-height: 1.4;
  font-weight: 700;
}

.clause p,
.clause ul,
.clause ol { margin: 0 0 16px; }
.clause > :last-child { margin-bottom: 0; }

.clause ul,
.clause ol { padding-left: 1.25em; }
.clause li { margin-bottom: 8px; }
.clause li::marker { color: var(--ink-2); }

.clause strong { font-weight: 700; }

/* A plain two-column record of data, purpose and legal basis. */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 16px;
  font-size: 0.9375rem;
  line-height: 1.5;
}
.data-table th,
.data-table td {
  text-align: left;
  vertical-align: top;
  padding: 12px 16px 12px 0;
  border-top: 1px solid var(--hair);
}
.data-table thead th {
  border-top: 2px solid var(--ink);
  font-weight: 700;
}

@media (max-width: 719px) {
  .data-table thead { display: none; }
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td { display: block; width: auto; }
  .data-table tr { border-top: 1px solid var(--hair); padding: 12px 0; }
  .data-table td { border-top: 0; padding: 0 0 6px; }
  .data-table td::before {
    content: attr(data-label) ": ";
    font-weight: 700;
  }
}

/* ---------- Footer ---------- */

.site-foot {
  border-top: 2px solid var(--ink);
}
.site-foot__inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 24px var(--gutter) 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  justify-content: space-between;
  color: var(--ink-2);
  font-size: 0.875rem;
}
.site-foot p { margin: 0; }
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

/* ---------- Home ---------- */

.home {
  padding: 56px 0 80px;
}
.home h1 {
  margin: 0;
  font-size: clamp(2.75rem, 8vw, 5rem);
  line-height: 0.98;
  font-weight: 700;
  letter-spacing: -0.04em;
  max-width: 14ch;
}
.home .lead { margin-bottom: 48px; }

.doc-links {
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: 48rem;
  border-top: 2px solid var(--ink);
}
.doc-links li { border-bottom: 1px solid var(--hair); }
.doc-links a {
  display: block;
  padding: 20px 0;
  color: var(--ink);
  text-decoration: none;
}
.doc-links a:hover .doc-links__title { color: var(--plum); text-decoration: underline; }
.doc-links__title {
  display: block;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.doc-links__desc {
  display: block;
  margin-top: 4px;
  color: var(--ink-2);
}

/* ---------- Print ---------- */

@media print {
  body { background: #fff; font-size: 11pt; }
  .skip, .doc-switch, .toc, .site-foot { display: none; }
  .masthead { border-bottom: 1pt solid #000; }
  .summary {
    background: #fff;
    color: #000;
    border: 1pt solid #000;
    margin: 0;
    padding: 16pt;
  }
  .summary > p, .ledger td, .ledger thead th, .summary-list li { color: #000; }
  .ledger th, .ledger td, .summary-list li { border-color: #999; }
  .doc-body { display: block; padding-top: 24pt; }
  .clause { break-inside: avoid-page; }
  a { color: #000; }
}
