/* ==========================================================================
   NearSearch — legal & policy documents
   The complete stylesheet for the pages in src/legal/*.html. Those files are
   plain, standalone HTML: this is the only stylesheet they load, so everything
   they need (tokens, page chrome, document typography, print) lives here.
   Edit the text in the .html files; edit the look here.
   ========================================================================== */

:root {
  --ink: #0f172a;
  --slate: #1e293b;
  --body-text: #334155;
  --muted: #5b6878;
  --bg: #f8fafc;
  --surface: #ffffff;
  --line: #e2e8f0;
  --accent: #dc2626;
  --accent-dark: #b91c1c;
  --accent-soft: #fef2f2;
  --green: #15803d;
  --gold: #d97706;
  --radius: 10px;
  --doc-rule: #dbe2ea;
  --doc-soft: #f1f5f9;
  --font-head: "Lexend", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-doc: "Source Serif 4", Charter, "Iowan Old Style", Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--body-text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3 {
  font-family: var(--font-head);
  color: var(--ink);
  line-height: 1.25;
  margin: 0 0 0.5rem;
}
img {
  max-width: 100%;
  height: auto;
  display: block;
}
.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1rem;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus {
  left: 0;
}
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Site header ─────────────────────────────────────────────────────────── */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  gap: 1rem;
}
.wordmark {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.wordmark .dot {
  color: var(--accent);
}
.crumbs {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}
.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
}
.crumbs li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.crumbs li + li::before {
  content: "\203A";
  color: var(--muted);
}
.crumbs a {
  color: var(--muted);
  text-decoration: none;
}
.crumbs a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}
.crumbs [aria-current] {
  color: var(--ink);
  font-weight: 600;
}

/* ── Document page ───────────────────────────────────────────────────────── */

.legal-doc {
  padding: 0 0 3.5rem;
}
.legal-shell {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Masthead — the "official record" block. */
.legal-masthead {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--ink);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 2rem 1.75rem 1.6rem;
  margin: 2rem 0 2.5rem;
}
.legal-masthead .kicker {
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.6rem;
}
.legal-masthead h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}
.legal-masthead .summary {
  font-family: var(--font-doc);
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--body-text);
  max-width: 68ch;
  margin: 0;
}
.legal-facts {
  display: grid;
  gap: 0.85rem 2.25rem;
  margin: 1.6rem 0 0;
  padding: 1.35rem 0 0;
  border-top: 1px solid var(--doc-rule);
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.legal-facts > div {
  min-width: 0;
}
.legal-facts dt {
  font-family: var(--font-head);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.25rem;
}
.legal-facts dd {
  margin: 0;
  font-size: 0.93rem;
  color: var(--ink);
  line-height: 1.5;
}

/* Two-column layout: sticky contents rail + the document. */
.legal-layout {
  display: grid;
  gap: 2.5rem;
  align-items: start;
}
@media (min-width: 1000px) {
  .legal-layout {
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 3.5rem;
  }
}

/* ── Table of contents ───────────────────────────────────────────────────── */

.legal-toc {
  min-width: 0;
}
@media (min-width: 1000px) {
  .legal-toc {
    position: sticky;
    top: 1.5rem;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
  }
}
.legal-toc h2 {
  font-family: var(--font-head);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--doc-rule);
}
.legal-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.1rem;
}
.legal-toc a {
  display: block;
  padding: 0.34rem 0.6rem;
  border-left: 2px solid transparent;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--muted);
  text-decoration: none;
  border-radius: 0 4px 4px 0;
}
.legal-toc a:hover {
  color: var(--ink);
  background: var(--doc-soft);
  border-left-color: var(--accent);
}
/* Part dividers anchor a long contents list (the EULA has 30+ entries). */
.legal-toc a.part {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--ink);
  font-size: 0.8rem;
  margin-top: 0.75rem;
}
.legal-toc li:first-child a.part {
  margin-top: 0;
}
/* Mobile: the contents collapse so the document starts higher up. */
.legal-toc details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.25rem 0.5rem;
}
.legal-toc summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 0.6rem;
  min-height: 44px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}
.legal-toc summary::-webkit-details-marker {
  display: none;
}
.legal-toc summary::after {
  content: "+";
  font-size: 1.25rem;
  color: var(--muted);
}
.legal-toc details[open] summary::after {
  content: "\2013";
}
.legal-toc details .legal-toc-list {
  padding: 0 0 0.6rem;
}
@media (min-width: 1000px) {
  .legal-toc details {
    background: none;
    border: 0;
    padding: 0;
  }
  .legal-toc summary {
    display: none;
  }
}

/* ── Document body ───────────────────────────────────────────────────────── */

.legal-body {
  font-family: var(--font-doc);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--body-text);
  max-width: 74ch;
  min-width: 0;
  /* Long URLs and email addresses must never widen the page on a phone. */
  overflow-wrap: break-word;
}
.legal-body > section {
  scroll-margin-top: 1.5rem;
}
.legal-body h2 {
  font-family: var(--font-head);
  font-size: clamp(1.2rem, 2.4vw, 1.45rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 3.25rem 0 1rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--doc-rule);
  scroll-margin-top: 1.5rem;
}
.legal-body > section:first-child h2 {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.legal-body h3 {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 2rem 0 0.6rem;
  scroll-margin-top: 1.5rem;
}
.legal-body p {
  margin: 0 0 1.1rem;
}
.legal-body strong {
  color: var(--ink);
  font-weight: 600;
}
.legal-body a {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-word;
}
.legal-body a:hover {
  color: var(--ink);
}
.legal-body ul,
.legal-body ol {
  margin: 0 0 1.2rem;
  padding-left: 1.35rem;
}
.legal-body li {
  margin-bottom: 0.55rem;
}
.legal-body li::marker {
  color: var(--muted);
}

/* Hanging clause numbers (9.1, 29.2, …). */
.legal-body ol.clauses {
  list-style: none;
  padding-left: 0;
}
.legal-body ol.clauses > li {
  display: grid;
  grid-template-columns: 3.1rem 1fr;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}
.legal-body ol.clauses > li > .n {
  font-family: var(--font-head);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  padding-top: 0.15rem;
}

/* Section-opening statement — the answer to "what does this say?". */
.legal-lede {
  font-size: 1.1rem;
  color: var(--ink);
  border-left: 3px solid var(--accent);
  padding-left: 1.1rem;
  margin: 0 0 1.4rem;
}

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

.legal-table {
  overflow-x: auto;
  margin: 0 0 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.legal-table table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.55;
}
/* Captions name the table for screen readers; the heading above already says
   the same thing on screen. */
.legal-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.legal-table th,
.legal-table td {
  text-align: left;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.legal-table thead th {
  font-family: var(--font-head);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--doc-soft);
  border-bottom: 1px solid var(--doc-rule);
  white-space: nowrap;
}
.legal-table tbody th {
  font-weight: 600;
  color: var(--ink);
}
.legal-table tbody tr:last-child th,
.legal-table tbody tr:last-child td {
  border-bottom: 0;
}
.legal-table .yes {
  color: var(--green);
  font-weight: 600;
  white-space: nowrap;
}

/* ── Callouts ────────────────────────────────────────────────────────────── */

.legal-note,
.legal-warn {
  border: 1px solid var(--line);
  border-left: 4px solid var(--slate);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.05rem 1.25rem;
  margin: 0 0 1.5rem;
}
.legal-note > :last-child,
.legal-warn > :last-child {
  margin-bottom: 0;
}
.legal-note .label,
.legal-warn .label {
  display: block;
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.legal-warn {
  border-left-color: var(--gold);
  background: #fffbeb;
}
.legal-warn .label {
  color: #92400e;
}

/* Uppercase statutory blocks (warranty disclaimer, liability cap). */
.legal-allcaps {
  font-family: var(--font-body);
  font-size: 0.88rem;
  line-height: 1.7;
  letter-spacing: 0.01em;
  color: var(--slate);
  background: var(--doc-soft);
  border: 1px solid var(--doc-rule);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin: 0 0 1.5rem;
}

/* ── Definition list (defined terms, contact routes) ─────────────────────── */

.legal-dl {
  margin: 0 0 1.5rem;
}
.legal-dl dt {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--ink);
  font-size: 0.97rem;
  margin-top: 1.35rem;
}
.legal-dl dt:first-child {
  margin-top: 0;
}
.legal-dl dd {
  margin: 0.15rem 0 0;
}

/* ── Numbered steps ──────────────────────────────────────────────────────── */

.legal-steps {
  list-style: none;
  counter-reset: step;
  margin: 0 0 1.5rem;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}
/* The marker is positioned, not a grid cell — a grid `li` would make every
   inline child (text node, <strong>, …) its own grid item and stack them. */
.legal-steps li {
  counter-increment: step;
  position: relative;
  margin: 0;
  padding-left: 2.6rem;
  min-height: 1.75rem;
}
.legal-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.06em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-head);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */

.legal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  margin: 0 0 1.5rem;
}
.legal-card > :last-child {
  margin-bottom: 0;
}
.legal-card .org {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--ink);
  font-size: 1.02rem;
}
.legal-card address {
  font-style: normal;
  margin: 0.5rem 0 0.9rem;
  color: var(--body-text);
}

.legal-routes {
  display: grid;
  gap: 0.85rem;
  margin: 0 0 1.5rem;
}
@media (min-width: 640px) {
  .legal-routes {
    grid-template-columns: 1fr 1fr;
  }
}
.legal-routes .route {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.05rem 1.2rem;
}
.legal-routes .route h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}
.legal-routes .route p {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--muted);
}
.legal-routes .route p + p {
  margin-top: 0.5rem;
}

/* ── Model withdrawal form ───────────────────────────────────────────────── */

.legal-form {
  background: var(--surface);
  border: 1px solid var(--doc-rule);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
  margin: 0 0 1.5rem;
  font-family: var(--font-body);
  font-size: 0.94rem;
  line-height: 1.9;
}
.legal-form p {
  margin: 0 0 0.9rem;
}
.legal-form .fill {
  color: var(--muted);
}
.legal-form hr {
  border: 0;
  border-top: 1px dashed var(--doc-rule);
  margin: 1.1rem 0;
}
/* A ruled blank to write on. A run of underscores would be one unbreakable
   word and would push the page wider than a phone screen. */
.legal-form .blank {
  display: inline-block;
  vertical-align: baseline;
  min-width: 6rem;
  width: 11rem;
  max-width: 100%;
  border-bottom: 1px solid var(--muted);
  margin-bottom: 0.15rem;
}
.legal-form .blank-wide {
  width: 100%;
}

/* ── Cross-document nav + footer ─────────────────────────────────────────── */

.legal-related {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 2rem 0;
}
.legal-related h2 {
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
}
.legal-related ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.legal-related a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.4rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
}
.legal-related a:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

footer.site {
  background: var(--slate);
  color: #cbd5e1;
  padding: 2rem 0;
  font-size: 0.9rem;
}
footer.site a {
  color: #e2e8f0;
}
footer.site .wordmark {
  color: #fff;
}
footer.site p {
  margin: 0.6rem 0 0;
}
.footer-legal {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.footer-legal ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}
.footer-legal a {
  font-size: 0.85rem;
  color: #94a3b8;
  text-decoration: none;
}
.footer-legal a:hover {
  color: #fff;
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ── Print: legal pages get printed and filed ────────────────────────────── */

@media print {
  header,
  .legal-toc,
  .legal-related,
  footer.site,
  .skip-link {
    display: none !important;
  }
  .legal-doc {
    background: #fff;
    padding: 0;
  }
  .legal-shell {
    max-width: none;
    padding: 0;
  }
  .legal-masthead {
    border: 0;
    border-bottom: 2px solid #000;
    border-radius: 0;
    margin: 0 0 1.5rem;
    padding: 0 0 1rem;
  }
  .legal-layout {
    display: block;
  }
  .legal-body {
    max-width: none;
    font-size: 10.5pt;
    line-height: 1.55;
    color: #000;
  }
  .legal-body h2 {
    margin-top: 1.4rem;
    padding-top: 0.7rem;
    break-after: avoid;
  }
  .legal-body h3 {
    break-after: avoid;
  }
  .legal-table,
  .legal-note,
  .legal-warn,
  .legal-card,
  .legal-form,
  .legal-allcaps {
    break-inside: avoid;
  }
  .legal-table {
    border-color: #000;
  }
  a {
    color: #000;
  }
}
