/*
 * Print stylesheet for the published legal documents — web/privacy.html,
 * web/terms.html and web/consumer-health-data.html.
 *
 * Why this exists
 * ---------------
 * The counsel-style PDFs under "Documents/Miredain LLC/A La Carte/" are the
 * copies that get sent to app stores, reviewers, and anyone who asks for the
 * policy as a document. Until 2026-08-14 there was no committed source for
 * them: they were Chromium print-to-PDF output (the originals carry
 * Producer "Skia/PDF"), but the HTML that produced them was never saved. So
 * every revision risked either being re-typed by hand or being re-exported
 * from a layout nobody could reproduce.
 *
 * This file IS that layout, recovered from the August 3 PDFs by measuring
 * their type sizes, margins, rules, and colours. Together with
 * web/tools/build_legal_pdfs.py it makes the PDF a build artefact of the
 * committed HTML instead of a separate document that drifts.
 *
 * ⚠ The direction of travel is HTML -> PDF, never the reverse. The repo
 * copies are authoritative (see the docblock in mobile/app/profile/privacy.tsx
 * and docs/legal_ai_training_stance.md). Re-transcribing a PDF back over the
 * HTML silently reverts whatever the last revision changed.
 *
 * Screen rendering is untouched: everything here is inside @media print, and
 * the pages link it with media="print".
 *
 * The running header (mark + wordmark) and the footer (document name, page
 * N of M) are NOT here — CSS margin boxes are unsupported in Chromium, so
 * they are headerTemplate/footerTemplate in the build script.
 */

@page {
  size: letter;
  /* Left/right 0.9in reproduces the originals' 64.8pt text column. The top
     margin holds the running header; the bottom holds the footer. */
  margin: 0.95in 0.9in 0.9in;
}

@media print {
  /* ---- page ---------------------------------------------------------- */

  html,
  body {
    background: #fff !important;
  }

  body {
    /* Georgia is what the originals embedded, at 14px/1.77 with justified,
       hyphenated body copy. */
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 14px;
    line-height: 1.77;
    color: #2a2a26;
    text-align: justify;
    -webkit-hyphens: auto;
    hyphens: auto;
  }

  /* Site chrome is screen-only: the capybara header bar and the site footer
     are replaced by the running header/footer from the build script. */
  body > header,
  body > footer {
    display: none !important;
  }

  main {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  /* ---- masthead ------------------------------------------------------ */

  .eyebrow {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11.3px;
    letter-spacing: 0.14em;
    line-height: 1.4;
    color: #6b6b62;
    text-align: left;
    margin: 0 0 10px;
  }

  h1 {
    /* The document title is "A La Carte — Privacy Policy", not the page's
       "Privacy Policy" — the web page already says which product it is in the
       eyebrow and the browser tab, a standalone document cannot. The full
       title is carried on data-print-title so the copy stays in the HTML. */
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 33.3px;
    font-weight: 400;
    line-height: 1.2;
    color: #2a2a26;
    text-align: left;
    margin: 0 0 16px;
  }

  h1[data-print-title] {
    font-size: 0;
  }

  h1[data-print-title]::after {
    content: attr(data-print-title);
    font-size: 33.3px;
  }

  /* The August 3 originals read "EFFECTIVE DATE: AUGUST 3, 2026" here, and
     this line reads "EFFECTIVE AUGUST 13, 2026" — the word "date" is gone
     deliberately. It could be put back with a ::before, but a legal document
     should not contain words that exist only in a stylesheet: they survive no
     grep, appear in no diff, and are invisible to the parity test. Every word
     in the PDF comes from the HTML. */
  .effective {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11.3px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #6b6b62;
    text-align: left;
    border-bottom: 1.5px solid #2a2a26;
    padding-bottom: 14px;
    margin: 0 0 26px;
  }

  /* ---- sections ------------------------------------------------------ */

  h2 {
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    color: #2a2a26;
    text-align: left;
    border-top: 1px solid #dcdcd6;
    padding-top: 22px;
    margin: 26px 0 12px;
    /* A heading stranded at the foot of a page reads as a mistake in a
       document that will be printed and filed. */
    break-after: avoid-page;
    break-inside: avoid-page;
  }

  /* Whatever comes first after the masthead sits under its rule already and
     takes none of its own — the Summary in the policy, § 1 in the Terms.
     Matching on the element after .effective rather than on "first h2 in
     main" matters: the policy's Summary heading is nested inside .summary,
     so a :first-of-type rule silently strips the rule from § 1 instead. */
  .summary h2,
  .effective + h2 {
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
  }

  /* The tinted summary card is screen furniture; in the document the summary
     is simply the first section. */
  .summary {
    background: none;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin: 0 0 26px;
  }

  p {
    margin: 0 0 12px;
    orphans: 2;
    widows: 2;
  }

  ul {
    margin: 0 0 12px 22px;
  }

  li {
    margin-bottom: 6px;
    break-inside: avoid-page;
  }

  /* ---- emphasis and links -------------------------------------------- */

  strong {
    font-weight: 700;
  }

  /* Bold, not italic: Georgia Italic was never embedded in the originals and
     a muted grey italic disappears in a printed or faxed copy. The line
     naming the superseded version is the one line a reader checks first. */
  .supersedes {
    font-style: normal;
    font-weight: 700;
    font-size: inherit;
    color: #2a2a26;
    margin: 0 0 12px;
  }

  .lead {
    font-weight: 700;
  }

  a {
    color: #4a7c59;
    text-decoration: underline;
  }

  /* ---- the Terms § 3 food-safety warning ------------------------------ */

  /* Terracotta on cream is the App's warning colour and it prints muddy. The
     document uses the warm gold that the rest of the brand's print work uses,
     and keeps the block bold so it survives a black-and-white printer. */
  .notice {
    background: #fbf6e9;
    border: 1px solid #e3d4ac;
    border-left: 4px solid #c99f52;
    border-radius: 0;
    padding: 18px 22px 6px;
    margin: 0 0 16px;
    font-weight: 700;
    /* Never split the food-safety warning across a page. Half of it at the
       foot of one page reads as the whole of it. */
    break-inside: avoid-page;
  }

  .notice p:last-child {
    margin-bottom: 12px;
  }

  /* ---- contact block -------------------------------------------------- */

  .addr {
    font-style: normal;
  }

  /* The contact block closes every document and is six short lines. Left to
     break, it strands "Email: …" and "In the App: …" alone on a page of their
     own — which is what the consumer health data policy did on its first
     build, and a final page carrying nothing but an email address reads as a
     printing accident in a document that gets filed and handed over.
     ⚠ It has to be a wrapper with break-inside. `break-after: avoid-page` on
     .addr is the obvious fix and Chromium silently ignores it — the address
     and the two lines after it still landed on separate pages.
     The Privacy Policy and the Terms have no wrapper: their contact blocks
     already fall well clear of a break, and adding one there would drag two
     of the four files that must stay in step into a PDF-tooling change for a
     layout problem they do not have. */
  .contact {
    break-inside: avoid-page;
  }
}
