/* ─────────────────────────────────────────────────────────────────
   TalkPat legal pages
   Structure: each clause pairs a formal statement (main column)
   with a one-line plain-language gloss (margin) — the app's own
   micro-reflection device, applied to a contract.
   ───────────────────────────────────────────────────────────────── */

:root {
  --paper:   #f3f3f6;
  --card:    #fafafc;
  --ink:     #1b1922;
  --muted:   #625e70;
  --faint:   #8b8798;
  --rule:    #dcd9e3;
  --accent:  #5e4670;
  --gloss-bg:#eceaf2;
  --flag:    #f7e6a8;
  --flag-ink:#5c4508;

  --display: "Charter", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --body:    system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --util:    ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --measure: 33rem;
  --gloss:   11rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:   #14131a;
    --card:    #1c1a24;
    --ink:     #e8e6ec;
    --muted:   #a09bad;
    --faint:   #7d788a;
    --rule:    #2e2b38;
    --accent:  #bda3d4;
    --gloss-bg:#1f1c28;
    --flag:    #43380f;
    --flag-ink:#f2dd93;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: calc(var(--measure) + var(--gloss) + 6rem);
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

/* ── masthead ───────────────────────────────────────────────── */
.crumbs {
  font-family: var(--util);
  font-size: 0.6875rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 2.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  align-items: baseline;
}
.crumbs .mark { color: var(--ink); letter-spacing: 0.06em; }
.crumbs a { color: var(--faint); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

.masthead { border-bottom: 1px solid var(--rule); padding-bottom: 1.5rem; margin-bottom: 2.5rem; }

h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 6vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 0.7rem;
  max-width: 24ch;
}

.dateline { font-family: var(--util); font-size: 0.75rem; color: var(--faint); margin: 0; }

/* ── opening summary ────────────────────────────────────────── */
.opening {
  max-width: var(--measure);
  margin: 0 0 3.5rem;
  font-family: var(--display);
  font-size: 1.1875rem;
  line-height: 1.55;
}
.opening p { margin: 0 0 1rem; }
.opening p:last-child { margin-bottom: 0; }
.opening .kicker {
  display: block;
  font-family: var(--util);
  font-size: 0.6875rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.9rem;
}

/* ── clauses ────────────────────────────────────────────────── */
.clause {
  display: grid;
  grid-template-columns: var(--gloss) minmax(0, 1fr);
  column-gap: 3rem;
  padding: 2rem 0;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 1.5rem;
}

.clause .gloss {
  font-family: var(--display);
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--muted);
  margin: 0;
  align-self: start;
}
.clause .gloss .n {
  display: block;
  font-family: var(--util);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  color: var(--faint);
  margin-bottom: 0.5rem;
}
.clause .gloss .n a { color: inherit; text-decoration: none; }
.clause .gloss .n a:hover { color: var(--accent); }

.clause .text { max-width: var(--measure); }

.clause h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.375rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: -0.2rem 0 0.9rem;
}

.clause h3 {
  font-family: var(--util);
  font-weight: 500;
  font-size: 0.6875rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.75rem 0 0.6rem;
}

p { margin: 0 0 0.9rem; }
p:last-child { margin-bottom: 0; }
ul { margin: 0 0 0.9rem; padding-left: 1.15rem; }
li { margin-bottom: 0.45rem; }
li:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration: underline; text-underline-offset: 0.15em; text-decoration-thickness: 1px; }
strong { font-weight: 600; }
em { font-style: italic; }

/* ── emphasis block: safety, emergencies ────────────────────── */
.notice {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  padding: 1.1rem 1.25rem;
  margin: 1.25rem 0;
}
.notice p { margin-bottom: 0.7rem; }
.notice p:last-child { margin-bottom: 0; }

/* ── data table ─────────────────────────────────────────────── */
.data { width: 100%; border-collapse: collapse; font-size: 0.9375rem; margin: 0.4rem 0 1.1rem; }
.data th, .data td {
  text-align: left;
  vertical-align: top;
  padding: 0.65rem 1rem 0.65rem 0;
  border-bottom: 1px solid var(--rule);
}
.data th {
  font-family: var(--util);
  font-weight: 500;
  font-size: 0.625rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom-color: var(--ink);
}
.data td:first-child { padding-right: 1.25rem; }

/* ── placeholder flag ───────────────────────────────────────── */
.fill {
  background: var(--flag);
  color: var(--flag-ink);
  font-family: var(--util);
  font-size: 0.8125em;
  padding: 0.05em 0.35em;
  border-radius: 2px;
}

.allcaps { font-size: 0.9375rem; line-height: 1.55; }

/* ── footer ─────────────────────────────────────────────────── */
.foot {
  border-top: 1px solid var(--rule);
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  font-family: var(--util);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
}
.foot a { color: var(--faint); }

/* ── index ──────────────────────────────────────────────────── */
.docs { list-style: none; padding: 0; margin: 3rem 0 0; max-width: var(--measure); }
.docs li { border-top: 1px solid var(--rule); }
.docs li:last-child { border-bottom: 1px solid var(--rule); }
.docs a { display: block; padding: 1.5rem 0; text-decoration: none; color: inherit; }
.docs .t { font-family: var(--display); font-size: 1.375rem; display: block; margin-bottom: 0.3rem; }
.docs a:hover .t { color: var(--accent); }
.docs .d { color: var(--muted); font-size: 0.9375rem; }

/* ── narrow: gloss becomes a tinted band above the clause ───── */
@media (max-width: 46rem) {
  .clause { grid-template-columns: 1fr; row-gap: 1.1rem; }
  .clause .gloss {
    background: var(--gloss-bg);
    padding: 0.85rem 1rem;
    border-radius: 3px;
    font-size: 1rem;
  }
  .clause h2 { margin-top: 0; }
}

/* ── print ──────────────────────────────────────────────────── */
@media print {
  :root { --paper:#fff; --card:#fff; --gloss-bg:#fff; --ink:#000; --muted:#333; --faint:#555; --rule:#bbb; --accent:#000; }
  .crumbs, .foot { display: none; }
  .clause { break-inside: avoid; }
  a { text-decoration: none; }
}

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