/* Therapy Center: the legal pages (card #21): the Patient Notices, the Notice of Privacy Practices, the Statement of
   Client Rights and Responsibilities, the Website Privacy Policy, the Terms of Use and the Accessibility Statement.
   Builds on the tokens in /assets/css/site.css; no new colours: every colour here is a role token whose pair is in
   tools/check-contrast.py (text, heading, muted and link on the page, the surface and the tint; the accent and the
   heading as marks on them). The layout follows the template practice's legal pages:
   a title block, a sticky contents list beside the article on wide screens, short numbered sections, a contact block.
   The print block at the end prints each page as a clean document: no header, menus, contents list or footer; headings
   kept with their text; each notice on the Patient Notices page on a new sheet. */

/* ======================================================================
   1. The title block: the legal entity, the title, the dates
   ====================================================================== */
.legal-hero .page-hero__text { max-width: var(--measure); }
.legal-entity {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-label);
}
.legal-hero .page-title { font-size: var(--step-4); }
.legal-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 1rem 0 0;
  padding-top: 0.85rem;
  border-top: 2px solid var(--color-accent);
  font-size: var(--step--1);
  color: var(--color-muted);
}
/* The header federal law requires to open the Notice of Privacy Practices (45 CFR 164.520(b)(1)(i)). */
.legal-required {
  max-width: var(--measure);
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  border: 2px solid var(--color-heading);
  border-radius: var(--radius-xs);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 700;
  line-height: 1.45;
  color: var(--color-heading);
}

/* ======================================================================
   2. The layout: the contents list and the article
   ====================================================================== */
.legal-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-l); align-items: start; }
@media (min-width: 1024px) {
  .legal-layout { grid-template-columns: 250px minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem); }
  .legal-toc { position: sticky; top: calc(var(--header-h) + 1.5rem); max-height: calc(100vh - var(--header-h) - 3rem); overflow-y: auto; }
}
.legal-toc {
  padding: var(--space-m);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.legal-toc__title {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-label);
}
.legal-toc__list { margin: 0; padding-left: 1.4rem; font-size: 0.9375rem; line-height: 1.4; }
.legal-toc__list a { display: block; padding-block: 0.35rem; }

.legal-body > h2:first-child, .legal-body > p:first-child + h2 { margin-top: 0.5em; }
.legal-body h2 { font-size: var(--step-2); scroll-margin-top: calc(var(--header-h) + 1rem); }
.legal-body h3 { font-size: var(--step-1); }
.legal-body ul ul { margin-top: 0.5em; }
.legal-body li + li { margin-top: 0.4em; }
.legal-version { color: var(--color-muted); font-size: var(--step--1); }
.legal-summary-title { margin-top: 0; }

/* ======================================================================
   3. Cards, call-outs, the contact block
   ====================================================================== */
/* The CMS model notice, set apart as the document it is. */
.legal-card {
  padding: clamp(1rem, 0.6rem + 1.6vw, 1.75rem);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 5px solid var(--color-heading);
  border-radius: var(--radius-sm);
}
.legal-card > * + * { margin-top: 0.85em; }
.legal-card .legal-card__title { margin-top: 0; font-size: var(--step-1); }

.legal-callout {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  background: var(--color-tint);
  border-radius: var(--radius-sm);
  color: var(--color-text);
}
.legal-callout .icon { flex: none; margin-top: 0.1em; color: var(--color-heading); }

/* The Privacy Officer's contact block: one card, the same on every page that names her. */
.legal-contact-card {
  max-width: 34rem;
  padding: var(--space-m);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-accent);
  border-radius: var(--radius-sm);
}
.legal-contact-card > * + * { margin-top: 0.75em; }
.legal-contact-card p { margin-bottom: 0; }
.legal-contact-card__title { font-family: var(--font-display); font-weight: 600; color: var(--color-heading); }

/* ======================================================================
   4. Print: a clean document
   ====================================================================== */
@media print {
  .site-header, .site-footer, .mobile-bar, .skip-link, .breadcrumbs-wrap, .legal-toc { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .legal-hero { padding-block: 0 0.5rem; }
  .legal-hero .page-title { font-size: 22pt; }
  .legal-layout { display: block; }
  .legal-section { padding: 0; }
  .legal-body, .legal-hero .page-hero__text, .legal-required { max-width: none; }
  .legal-body h2, .legal-body h3, .legal-card__title { break-after: avoid; page-break-after: avoid; }
  .legal-body p, .legal-body li { orphans: 3; widows: 3; }
  .legal-card, .legal-callout, .legal-contact-card, .legal-required { break-inside: avoid; page-break-inside: avoid; }
  /* The Patient Notices page is a set of separate notices: each starts on a new sheet, so one can be posted alone. */
  .legal-body--notices > h2 { break-before: page; page-break-before: always; }
  .legal-body--notices > h2:first-child { break-before: auto; page-break-before: auto; }
  /* A link's address follows its words on paper, except links within the page and phone or mail links. */
  .legal-body a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; word-break: break-all; }
}
