/* EasyRecon Legal Center — shared document shell.
   Brand-consistent with index.html (Inter, #2563eb, homepage ink/border/shadow
   tokens). Readability-first: quiet, printable, keyboard- and screen-reader-safe.
   No decorative animation. */

:root {
  --bg: #f7f9fc;
  --paper: #ffffff;
  --band: #eef2f8;
  --sunken: #f6f8fb;
  --ink-1: #0a1f3c;   /* strongest — display / headings */
  --ink-2: #29344a;   /* body text — darker than the old muted for legibility */
  --ink-3: #4d5b75;   /* secondary */
  --ink-4: #5b6577;   /* meta / labels — AA 5.0:1 on --bg */
  --line-soft: rgba(10, 37, 64, 0.07);
  --line: rgba(10, 37, 64, 0.12);
  --line-strong: rgba(10, 37, 64, 0.18);
  --brand: #2563eb;
  --brand-ink: #1d4ed8;
  --ok-bg: #eaf5ee; --ok-ink: #16743d; --ok-line: rgba(22, 116, 61, 0.30);
  --warn-bg: #fdf3e7; --warn-ink: #8f5300; --warn-line: rgba(143, 83, 0, 0.30);
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --shadow-card: 0 1px 2px rgba(15, 34, 67, 0.06), 0 4px 12px -4px rgba(15, 34, 67, 0.10);
  --shadow-float: 0 2px 6px rgba(15, 34, 67, 0.10), 0 14px 34px -12px rgba(15, 34, 67, 0.18);
  --measure: 36rem; /* ~72–75ch readable measure for Inter prose */
}

* { box-sizing: border-box; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand-ink); text-underline-offset: 2px; }
a:hover { color: var(--brand); }

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

.skip-link {
  position: absolute; left: 8px; top: -48px;
  background: var(--paper); color: var(--brand-ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  padding: 8px 14px; font-size: 14px; font-weight: 600;
  z-index: 20; transition: top 120ms ease;
}
.skip-link:focus { top: 8px; }

/* ── Top bar / breadcrumb (shared) ── */
.legal-shell { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.legal-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 0 16px; border-bottom: 1px solid var(--line-soft);
}
.brandmark {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 15px; color: var(--ink-1); text-decoration: none;
  letter-spacing: -0.01em;
}
.brandmark img { width: 22px; height: 22px; border-radius: 5px; display: block; }
.legal-breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-4); }
.legal-breadcrumb .sep { color: var(--line-strong); }
.back { color: var(--ink-3); text-decoration: none; font-weight: 500; }
.back:hover { color: var(--brand); text-decoration: underline; }

/* ── Document layout: content + sticky rail ── */
.legal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 232px;
  gap: 48px;
  align-items: start;
  padding: 34px 0 80px;
}
.legal-doc { min-width: 0; max-width: var(--measure); }

.doc-head { margin-bottom: 32px; }
.doc-type {
  display: inline-block; margin: 0 0 12px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--brand-ink);
}
.legal-doc h1 {
  font-size: clamp(32px, 4.6vw, 44px); line-height: 1.08; letter-spacing: -0.032em;
  color: var(--ink-1); margin: 0 0 16px;
}
.doc-intro { color: var(--ink-3); font-size: 17px; line-height: 1.55; margin: 0 0 24px; max-width: 40rem; }

/* Metadata card — a clean paper card whose internal hairlines are drawn on the
   cells themselves (not via a background showing through gaps). Empty grid
   tracks stay paper-white, so the block reads correctly at ANY cell count with
   no phantom gray cell, and cells stay wide enough that the email never breaks. */
.doc-meta {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0; margin: 0; padding: 0;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden;
}
.doc-meta > div {
  background: var(--paper); padding: 13px 16px; margin: 0;
  border-top: 1px solid var(--line-soft); border-left: 1px solid var(--line-soft);
}
.doc-meta > div:nth-child(-n+2) { border-top: 0; }
.doc-meta > div:nth-child(odd) { border-left: 0; }
.doc-meta dt {
  font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-4); margin: 0 0 3px;
}
.doc-meta dd { margin: 0; font-size: 14px; color: var(--ink-1); font-weight: 500; overflow-wrap: anywhere; }
.doc-meta dd a { font-weight: 500; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; flex: none; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; padding: 2px 10px; border-radius: var(--r-pill);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-current { background: var(--ok-bg); color: var(--ok-ink); box-shadow: inset 0 0 0 1px var(--ok-line); }
.badge-review { background: var(--warn-bg); color: var(--warn-ink); box-shadow: inset 0 0 0 1px var(--warn-line); }

/* Mobile "On this page" — native disclosure, no focus trap */
.toc-mobile { display: none; margin: 22px 0 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--paper); }
.toc-mobile > summary {
  cursor: pointer; padding: 13px 16px; font-weight: 600; font-size: 14.5px; color: var(--ink-1);
  list-style: none; display: flex; align-items: center; justify-content: space-between;
}
.toc-mobile > summary::-webkit-details-marker { display: none; }
.toc-mobile > summary::after { content: "▾"; color: var(--ink-4); transition: transform 150ms ease; }
.toc-mobile[open] > summary::after { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .toc-mobile > summary::after { transition: none; } }
.toc-mobile nav { padding: 4px 8px 12px; border-top: 1px solid var(--line-soft); }
.toc-mobile ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc-mobile li { margin: 0; }
.toc-mobile a { display: block; padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink-3); text-decoration: none; font-size: 14px; }
.toc-mobile a:hover { background: var(--sunken); color: var(--brand-ink); }

/* ── Sections (always visible; never accordion) ── */
.legal-doc section {
  padding: 30px 0 4px;
  border-top: 1px solid var(--line-soft);
  scroll-margin-top: 84px;
}
.legal-doc section:first-of-type { border-top: 0; padding-top: 8px; }
.legal-doc h2 {
  font-size: 21px; line-height: 1.3; letter-spacing: -0.017em; color: var(--ink-1);
  margin: 0 0 14px; scroll-margin-top: 84px;
}
.legal-doc h3 { font-size: 16px; color: var(--ink-1); margin: 18px 0 8px; }
.legal-doc p { margin: 0 0 12px; color: var(--ink-2); }
.legal-doc ul { margin: 0 0 6px; padding-left: 20px; }
.legal-doc li { color: var(--ink-2); margin: 0 0 8px; }
.legal-doc li:last-child { margin-bottom: 0; }
.legal-doc a { color: var(--brand-ink); }

/* Section anchor link (copyable, keyboard reachable) */
.anchor {
  margin-left: 8px; font-weight: 600; color: var(--line-strong); text-decoration: none;
  opacity: 0; transition: opacity 120ms ease; font-size: 0.8em;
}
h2:hover .anchor, h2:focus-within .anchor, .anchor:focus { opacity: 1; color: var(--brand); }
@media (hover: none) { .anchor { opacity: 1; color: var(--ink-4); } }
@media (prefers-reduced-motion: reduce) { .anchor { transition: none; } }

/* Contact / questions block — quiet, no sales CTA */
.doc-contact {
  margin-top: 30px; padding: 22px 24px !important;
  background: var(--sunken); border: 1px solid var(--line-soft); border-radius: var(--r-md);
  border-top: 1px solid var(--line-soft) !important;
}
.doc-contact h2 { margin-top: 0; font-size: 18px; }
.doc-contact p { color: var(--ink-3); margin-bottom: 0; }

.to-top {
  display: inline-block; margin-top: 26px; font-size: 14px; color: var(--ink-4); text-decoration: none;
}
.to-top:hover { color: var(--brand); }
.to-top::before { content: "↑ "; }

/* ── Desktop "On this page" rail ── */
.toc-rail { position: sticky; top: 24px; align-self: start; }
.toc-rail .toc-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink-4); margin: 0 0 10px; padding-left: 12px;
}
.toc-rail-body { border-left: 2px solid var(--line-soft); max-height: calc(100vh - 80px); overflow-y: auto; }
.toc-rail ol { list-style: none; margin: 0; padding: 0; }
.toc-rail li { margin: 0; }
.toc-rail a {
  display: block; padding: 5px 12px; margin-left: -2px;
  border-left: 2px solid transparent; color: var(--ink-4); text-decoration: none;
  font-size: 13px; line-height: 1.4; transition: color 120ms ease, border-color 120ms ease;
}
.toc-rail a:hover { color: var(--brand-ink); }
.toc-rail a[aria-current="true"] { color: var(--brand-ink); border-left-color: var(--brand); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .toc-rail a { transition: none; } }

/* ══════════ Legal Center index ══════════ */
.center { max-width: 960px; margin: 0 auto; padding: 8px 0 88px; }
.center-head { padding: 30px 0 4px; }
.center-head h1 {
  font-size: clamp(32px, 5vw, 46px); line-height: 1.08; letter-spacing: -0.035em;
  color: var(--ink-1); margin: 0 0 14px;
}
.center-lede { font-size: 17px; color: var(--ink-3); max-width: 42rem; margin: 0 0 8px; }
.center-entity { font-size: 14px; color: var(--ink-4); margin: 14px 0 0; }

.center-group { margin-top: 40px; }
.center-group > h2 {
  font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-4); margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft);
}
.doc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.doc-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; text-decoration: none; color: inherit;
  box-shadow: var(--shadow-card); transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}
.doc-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-float); border-color: var(--line-strong); }
.doc-card:focus-visible { transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .doc-card, .doc-card:hover, .doc-card:focus-visible { transform: none; transition: none; } }
.doc-card .card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.doc-card h2, .doc-card h3 { margin: 0; font-size: 17px; color: var(--ink-1); letter-spacing: -0.01em; font-weight: 600; }
.doc-card p { margin: 0; color: var(--ink-3); font-size: 14.5px; line-height: 1.55; }
.doc-card .card-meta { margin-top: auto; padding-top: 4px; font-size: 12.5px; color: var(--ink-4); }
.card-static { cursor: default; }
.card-static:hover { transform: none; box-shadow: var(--shadow-card); border-color: var(--line); }

.center-contact {
  margin-top: 40px; padding: 22px 24px;
  background: var(--sunken); border: 1px solid var(--line-soft); border-radius: var(--r-md);
}
.center-contact h2 { margin: 0 0 6px; font-size: 17px; color: var(--ink-1); }
.center-contact p { margin: 0; color: var(--ink-3); font-size: 14.5px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .legal-layout { grid-template-columns: 1fr; gap: 0; padding-top: 26px; }
  .toc-rail { display: none; }
  .toc-mobile { display: block; }
  .doc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .doc-meta { grid-template-columns: 1fr; }
  .doc-meta > div { border-left: 0; border-top: 1px solid var(--line-soft); }
  .doc-meta > div:first-child { border-top: 0; }
}
@media (max-width: 400px) {
  .legal-shell, .center { padding-left: 18px; padding-right: 18px; }
  .brandmark span.brandmark-tag { display: none; }
}

/* ── Print / PDF ── */
@media print {
  :root { --bg: #fff; }
  body { background: #fff; color: #000; font-size: 11.5pt; line-height: 1.45; }
  .legal-shell, .center { max-width: none; padding: 0; }
  .skip-link, .toc-rail, .toc-mobile, .to-top, .anchor, .legal-breadcrumb, .legal-topbar .brandmark img { display: none !important; }
  .legal-layout { display: block; padding: 0; }
  .legal-doc { max-width: none; }
  .legal-topbar { border-bottom: 1px solid #000; padding: 0 0 8px; margin-bottom: 12px; }
  .doc-print-url { display: block !important; font-size: 9pt; color: #000; margin-top: 4px; }
  .doc-meta { border: 1px solid #999; }
  .doc-meta > div { background: #fff; }
  .legal-doc section, .legal-doc h2 { page-break-inside: avoid; break-inside: avoid; }
  .legal-doc h1, .legal-doc h2 { color: #000; }
  a { color: #000; text-decoration: underline; }
  .doc-contact, .center-contact { background: #fff; border: 1px solid #999; }
  .badge { box-shadow: none; border: 1px solid #999; }
}
.doc-print-url { display: none; }
