/* ============================================================================
   CareLink — legal pages (privacy policy, terms and conditions)
   ----------------------------------------------------------------------------
   Deliberately plain: no hero, no card shell, no decorative background — just
   a readable measure of text on white. The document body is generated markup
   with its own inline styles, so the .prose rules below have to override with
   !important; that is contained to this file.
   ========================================================================== */

.legal {
  padding-block: var(--cl-space-7) var(--cl-space-8);
  background: var(--cl-surface);
}

/* ── Layout ───────────────────────────────────────────────────────────────
   Single column by default; the index becomes a second column once there is
   room for it beside a comfortable reading measure.
   ------------------------------------------------------------------------ */

.legal__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--cl-space-6);
}

.legal__main {
  min-width: 0;
  max-width: var(--cl-container-narrow);
}

@media (min-width: 1024px) {
  .legal__layout {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: var(--cl-space-8);
  }
}

/* ── Table of contents ────────────────────────────────────────────────────
   Sticky rather than fixed: it holds position while the document scrolls, but
   still scrolls away with its column at the end of the page instead of
   floating over the footer. Below 1024px the document's own inline table of
   contents does the job, so the sidebar stays out of the way.
   ------------------------------------------------------------------------ */

.toc {
  display: none;
}

@media (min-width: 1024px) {
  .toc {
    display: block;
    grid-row: 1;
  }

  .toc__inner {
    position: sticky;
    top: calc(var(--cl-header-h) + var(--cl-space-5));
    max-height: calc(100vh - var(--cl-header-h) - var(--cl-space-8));
    overflow-y: auto;
    padding-right: var(--cl-space-2);
    border-left: 2px solid var(--cl-border);
  }
}

.toc__title {
  margin: 0 0 var(--cl-space-3) var(--cl-space-4);
  color: var(--cl-text);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* The document's headings are all-caps, which needs a smaller size and a little
   extra tracking to stay readable stacked in a narrow column. */
.toc__link {
  display: block;
  padding: 5px var(--cl-space-3) 5px var(--cl-space-4);
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--cl-text-weak);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  line-height: 1.4;
  transition: color var(--cl-transition-control), border-color var(--cl-transition-control);
}

.toc__link:hover {
  color: var(--cl-navy);
  text-decoration: none;
}

.toc__link[aria-current='true'] {
  border-left-color: var(--cl-navy);
  color: var(--cl-navy);
  font-weight: 600;
}

.legal__back {
  display: inline-flex;
  align-items: center;
  gap: var(--cl-space-2);
  margin-bottom: var(--cl-space-5);
  color: var(--cl-text-weak);
  font-size: 0.875rem;
  font-weight: 600;
}

.legal__back:hover {
  color: var(--cl-navy);
  text-decoration: none;
}

/* ── Prose ────────────────────────────────────────────────────────────────── */

.prose {
  color: var(--cl-text-weak);
  font-size: 1rem;
}

.prose [data-custom-class='body'],
.prose [data-custom-class='body'] * {
  background: transparent !important;
}

.prose [data-custom-class='title'],
.prose [data-custom-class='title'] *,
.prose h1 {
  font-family: 'Raleway', sans-serif !important;
  font-size: clamp(1.875rem, 4vw, 2.25rem) !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  color: var(--cl-text) !important;
  margin: 0 0 var(--cl-space-2) !important;
}

.prose [data-custom-class='subtitle'],
.prose [data-custom-class='subtitle'] * {
  font-family: 'Roboto', sans-serif !important;
  font-size: 0.9375rem !important;
  color: var(--cl-text-weak) !important;
}

.prose [data-custom-class='heading_1'],
.prose [data-custom-class='heading_1'] *,
.prose h2 {
  font-family: 'Raleway', sans-serif !important;
  font-size: 1.3125rem !important;
  font-weight: 800 !important;
  line-height: 1.3 !important;
  color: var(--cl-text) !important;
  margin-top: var(--cl-space-7) !important;
  margin-bottom: var(--cl-space-3) !important;
}

.prose [data-custom-class='heading_2'],
.prose [data-custom-class='heading_2'] *,
.prose h3 {
  font-family: 'Raleway', sans-serif !important;
  font-size: 1.0625rem !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  color: var(--cl-text) !important;
  margin-top: var(--cl-space-5) !important;
  margin-bottom: var(--cl-space-2) !important;
}

.prose [data-custom-class='body_text'],
.prose [data-custom-class='body_text'] *,
.prose div,
.prose p,
.prose li,
.prose span {
  font-family: 'Roboto', sans-serif !important;
  font-size: 1rem !important;
  line-height: 1.75 !important;
  color: var(--cl-text-weak) !important;
}

.prose [data-custom-class='link'],
.prose [data-custom-class='link'] *,
.prose a {
  color: var(--cl-navy) !important;
  font-weight: 600;
  word-break: break-word;
}

.prose ul,
.prose ol {
  padding-left: 1.35rem;
  margin: var(--cl-space-4) 0;
}

.prose li {
  margin-bottom: var(--cl-space-2);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
}

.prose td,
.prose th {
  border: 1px solid var(--cl-border);
  padding: var(--cl-space-3);
}

.prose bdt {
  display: inline;
}

/* ── Embed mode ───────────────────────────────────────────────────────────
   ?embed=1 renders the document bare for in-app WebViews: no site chrome,
   no page padding.
   ------------------------------------------------------------------------ */

body.embed-mode .site-header,
body.embed-mode .site-footer,
body.embed-mode legal-toc,
body.embed-mode .legal__back {
  display: none;
}

body.embed-mode .legal {
  padding: 0;
}

body.embed-mode .container {
  max-width: none;
  padding-inline: 0;
}

body.embed-mode .legal__layout {
  grid-template-columns: minmax(0, 1fr);
}

body.embed-mode .legal__main {
  max-width: none;
}
