/* ─────────────────────────────────────────
   legal.css — Legal & Policy pages
   Layered on public-sector.css (--ps-*) + platform.css (plat-*).
   Covers: /legal/ hub + the individual document pages.
   ───────────────────────────────────────── */

/* ── Smooth in-page anchoring (respecting reduced motion) ── */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ═══════════════════════════════════════════
   COMPACT PAGE HEAD (no full-bleed image hero)
   ═══════════════════════════════════════════ */
.lg-head {
  position: relative;
  padding: calc(var(--ps-nav-height) + 4.5rem) 0 3.5rem;
  background:
    radial-gradient(120% 100% at 50% 0%, var(--ps-bg-3) 0%, var(--ps-bg) 60%);
  border-bottom: 1px solid var(--ps-border);
  overflow: hidden;
}
.lg-head::before {
  /* faint tactical grid wash */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--ps-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--ps-border) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.18;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.7), transparent 80%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.7), transparent 80%);
  pointer-events: none;
}
.lg-head__inner { position: relative; max-width: 900px; }

.lg-head__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--ps-font-head);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ps-sage);
  margin-bottom: 1.25rem;
}
.lg-head__eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--ps-sage);
}

.lg-head__title {
  font-family: var(--ps-font-head);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  color: var(--ps-white);
  margin: 0 0 1rem;
  letter-spacing: -0.01em;
}

.lg-head__sub {
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  color: var(--ps-text-2);
  line-height: 1.6;
  max-width: 60ch;
  margin: 0 0 1.5rem;
}

.lg-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-family: var(--ps-font-head);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  color: var(--ps-text-3);
}
.lg-head__meta strong {
  color: var(--ps-tan);
  font-weight: 600;
}

/* ═══════════════════════════════════════════
   DOCUMENT LAYOUT — sticky TOC + article
   ═══════════════════════════════════════════ */
.lg-layout {
  padding: 3.5rem 0 5.5rem;
  background: var(--ps-bg);
}
.lg-layout__grid {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 3.5rem;
  align-items: start;
}

/* ── Table of contents ── */
.lg-toc {
  position: sticky;
  top: calc(var(--ps-nav-height) + 1.5rem);
  max-height: calc(100vh - var(--ps-nav-height) - 3rem);
  overflow-y: auto;
  padding-right: 0.5rem;
}
.lg-toc__title {
  font-family: var(--ps-font-head);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ps-text-3);
  margin: 0 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--ps-border);
}
.lg-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.lg-toc__link {
  display: flex;
  gap: 0.55rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border-left: 2px solid transparent;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--ps-text-2);
  transition: color 200ms ease, background 200ms ease, border-color 200ms ease;
}
.lg-toc__link:hover {
  color: var(--ps-text);
  background: var(--ps-bg-3);
}
.lg-toc__link.is-active {
  color: var(--ps-tan);
  border-left-color: var(--ps-tan);
  background: var(--ps-bg-3);
}
.lg-toc__num {
  color: var(--ps-sage);
  font-family: var(--ps-font-head);
  font-weight: 600;
  font-size: 0.78rem;
  flex-shrink: 0;
}
/* Sub-document group header inside the TOC (e.g. "Appendix A", "Schedule A") */
.lg-toc__group {
  margin: 1.25rem 0 0.4rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--ps-border);
}
.lg-toc__group:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.lg-toc__group a {
  display: block;
  padding: 0 0.6rem;
  font-family: var(--ps-font-head);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ps-sage);
  transition: color 200ms ease;
}
.lg-toc__group a:hover { color: var(--ps-tan); }

/* ── Article prose ── */
.lg-doc {
  max-width: 72ch;
  font-family: var(--ps-font-body);
  color: var(--ps-text);
  font-size: 1rem;
  line-height: 1.75;
}
.lg-doc > p {
  margin: 0 0 1.15rem;
  color: #C9C6BE;               /* slightly softened body for long-form reading */
}
.lg-doc strong { color: var(--ps-text); font-weight: 600; }
.lg-doc em { font-style: italic; }
.lg-doc u { text-decoration: none; }   /* underlined run-in titles read cleaner un-underlined */
.lg-doc a {
  color: var(--ps-tan);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(196,175,135,0.4);
  transition: text-decoration-color 200ms ease;
}
.lg-doc a:hover { text-decoration-color: var(--ps-tan); }

.lg-doc ul, .lg-doc ol { margin: 0 0 1.15rem; padding-left: 1.5rem; }
.lg-doc li { margin-bottom: 0.5rem; color: #C9C6BE; }

/* ── Section start (run-in numbered heading) ── */
.lg-doc .lg-sec {
  scroll-margin-top: calc(var(--ps-nav-height) + 1.5rem);
  margin-top: 2.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--ps-border);
  color: var(--ps-text);
}
.lg-doc .lg-sec:first-child { margin-top: 0; padding-top: 0; border-top: none; }
/* the leading bold/underlined title in a section paragraph → tan, heading-like */
.lg-doc .lg-sec > strong:first-child,
.lg-doc .lg-sec > u:first-child {
  color: var(--ps-tan);
  font-family: var(--ps-font-head);
  font-weight: 600;
  font-size: 1.05rem;
}

/* ── Real headings (security page uses h3) ── */
.lg-doc h2, .lg-doc h3 {
  scroll-margin-top: calc(var(--ps-nav-height) + 1.5rem);
  font-family: var(--ps-font-head);
  color: var(--ps-white);
  line-height: 1.25;
}
.lg-doc h2 {
  font-size: 1.35rem;
  margin: 2.75rem 0 1rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--ps-border);
}
.lg-doc h3 {
  font-size: 1.15rem;
  color: var(--ps-tan);
  margin: 2.25rem 0 0.85rem;
}
.lg-doc h2:first-child, .lg-doc h3:first-child { margin-top: 0; padding-top: 0; border-top: none; }

/* Sub-document / exhibit heading (e.g. "Appendix A", "Schedule A — Support Schedule") */
.lg-doc h2.lg-exhibit {
  color: var(--ps-tan);
  font-size: 1.55rem;
  margin-top: 3.75rem;
  padding-top: 2.25rem;
  border-top: 2px solid var(--ps-border-2);
}

/* ── Tables (e.g. MSA support SLA matrix) ── */
.lg-doc .lg-tablewrap { overflow-x: auto; margin: 0 0 1.5rem; }
.lg-doc table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  font-size: 0.9rem;
  border: 1px solid var(--ps-border-2);
}
.lg-doc th, .lg-doc td {
  border: 1px solid var(--ps-border-2);
  padding: 0.75rem 0.9rem;
  text-align: left;
  vertical-align: top;
}
.lg-doc thead th, .lg-doc td:first-child p:first-child strong {
  color: var(--ps-tan);
}
.lg-doc td p { margin: 0 0 0.5rem; }
.lg-doc td p:last-child { margin-bottom: 0; }
.lg-doc td { background: var(--ps-bg-2); color: #C9C6BE; }

/* ═══════════════════════════════════════════
   SIBLING DOCUMENT NAV (foot of each doc)
   ═══════════════════════════════════════════ */
.lg-more {
  border-top: 1px solid var(--ps-border);
  background: var(--ps-bg-2);
  padding: 3.5rem 0;
}
.lg-more__title {
  font-family: var(--ps-font-head);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ps-text-3);
  margin: 0 0 1.5rem;
}
.lg-more__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.75rem;
}
.lg-more__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--ps-border);
  border-radius: 8px;
  background: var(--ps-bg-3);
  font-family: var(--ps-font-head);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ps-text);
  transition: border-color 200ms ease, background 200ms ease, color 200ms ease;
}
.lg-more__link:hover {
  border-color: var(--ps-tan-dark);
  color: var(--ps-tan);
  background: var(--ps-bg-4);
}
.lg-more__link svg { flex-shrink: 0; color: var(--ps-sage); }

/* ═══════════════════════════════════════════
   HUB PAGE — /legal/
   ═══════════════════════════════════════════ */
.lg-hub { padding: 3.5rem 0 5.5rem; background: var(--ps-bg); }
.lg-hub__lead {
  max-width: 68ch;
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.7;
  color: var(--ps-text-2);
  margin: 0 0 3rem;
}
.lg-hub__group-title {
  font-family: var(--ps-font-head);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ps-sage);
  margin: 2.5rem 0 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--ps-border);
}
.lg-hub__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: stretch;   /* equal-height cards across each 2-up row */
}
.lg-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.5rem 1.5rem 1.35rem;
  border: 1px solid var(--ps-border);
  border-radius: 10px;
  background: var(--ps-bg-2);
  transition: border-color 200ms ease, background 200ms ease, transform 200ms ease;
}
.lg-card:hover {
  border-color: var(--ps-tan-dark);
  background: var(--ps-bg-3);
}
.lg-card__icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--ps-bg-4);
  border: 1px solid var(--ps-border-2);
  color: var(--ps-sage);
  margin-bottom: 0.35rem;
}
.lg-card__title {
  font-family: var(--ps-font-head);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ps-white);
  margin: 0;
}
.lg-card__title a { color: inherit; }
.lg-card__title a::after { content: ""; position: absolute; inset: 0; }  /* full-card click */
.lg-card__desc {
  font-size: 0.925rem;
  line-height: 1.6;
  color: var(--ps-text-2);
  margin: 0;
}
.lg-card__meta {
  margin-top: auto;
  padding-top: 0.5rem;
  font-family: var(--ps-font-head);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--ps-text-3);
}
.lg-card__cue {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: auto;          /* pin CTA to the card's bottom → equal-height rows read evenly */
  padding-top: 0.9rem;
  font-family: var(--ps-font-head);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ps-tan);
}
.lg-card__meta + .lg-card__cue { margin-top: 0; }  /* meta already pinned; keep CTA snug beneath it */

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 640px) {
  .lg-hub__grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .lg-layout__grid { grid-template-columns: 1fr; gap: 2rem; }
  .lg-toc {
    position: static;
    max-height: none;
    padding: 1.25rem 1.25rem 0.5rem;
    border: 1px solid var(--ps-border);
    border-radius: 10px;
    background: var(--ps-bg-2);
  }
  .lg-doc { max-width: none; }
}

/* ═══════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════ */
@media print {
  .ps-nav, .ps-footer, .lg-toc, .lg-more, .lg-head::before { display: none !important; }
  body { background: #fff; color: #111; }
  .lg-head, .lg-layout, .lg-hub { background: #fff; padding: 0; }
  .lg-head__title, .lg-doc h2, .lg-doc h3 { color: #000; }
  .lg-doc, .lg-doc > p, .lg-doc li, .lg-doc td { color: #111; }
  .lg-layout__grid { display: block; }
  .lg-doc { max-width: none; font-size: 11pt; line-height: 1.5; }
  .lg-doc a { color: #111; text-decoration: underline; }
  .lg-doc .lg-sec, .lg-doc h2 { border-top-color: #ccc; }
}
