/* =========================================================================
   print.css — print-only styles for andrusia.com
   Load AFTER main.css, e.g.:
     <link rel="stylesheet" href="/css/main.css">
     <link rel="stylesheet" href="/css/print.css" media="print">
   The media="print" on the <link> means this whole file is print-scoped,
   so the rules below don't need to sit inside @media print. It's kept
   inside the block anyway so the file is still correct if you ever inline
   it or concatenate stylesheets.
   ========================================================================= */

@media print {

  /* ---- Page geometry --------------------------------------------------
     Symmetric margins. (Tried recto/verso asymmetry via @page :left/:right
     but it read as lopsided rather than book-like for ad hoc printing.)
     Units are physical (mm) because vh/vw are unreliable in print.       */

  @page {
    margin: 20mm;
  }

  /* Page numbers via @page margin boxes. NOTE: no browser print engine
     implements @page margin boxes (Chrome/Firefox/Safari all ignore this).
     It's left here, disabled, for the day you render through Paged.js,
     WeasyPrint, or Prince. For browser printing, use the print dialog's
     "Headers and footers" option instead.
  @page :left  { @bottom-left  { content: counter(page); } }
  @page :right { @bottom-right { content: counter(page); } }
  */

  /* ---- Base --------------------------------------------------------- */

  html {
    color: black;
    background-color: transparent;
    padding: 0;
  }

  /* Page margins now come from @page, not from screen padding.
     Kill the screen padding-top (which existed only to clear the
     fixed header) and the horizontal padding (the @page handles it). */
  article {
    max-width: 80ch;   /* keep the ~80-char measure on paper too */
    margin: 0 auto;    /* center the measure; no gutter to preserve now */
    min-height: 0;
    padding: 0;
    font-size: 11pt;   /* real print size instead of screen em-scaling */
  }

  /* ---- Chrome we don't want on paper -------------------------------- */

  .noprint,
  .leftbar,            /* the TOC sidebar — never in print */
  .toc {
    display: none;
  }

  /* Header stays in print: keep the light gray band full-width and the
     logo on the right. It just can't be position:fixed (that stamps it on
     every page), so it becomes static and flows at the top of page 1.
     print-color-adjust:exact tells Chrome/Safari to actually paint the
     gray; Firefox still gates backgrounds behind the print dialog's
     "Background graphics" checkbox regardless.

     The band spans the full page width edge-to-edge by bleeding out past
     the @page margins with negative margins, then re-padding so the logo
     and name don't sit against the paper edge. */
  header {
    position: static;
    background-color: #F0F0F0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    margin-bottom: 3em;
    margin-left: -20mm;
    margin-right: -20mm;
    padding-left: 20mm;
    padding-right: 20mm;
    width: auto;
  }

  #linkback {
    display: none;     /* was position:fixed; would print on every page */
  }

  footer {
    background-image: none;
    height: auto;
  }

  /* ---- Typography & pagination -------------------------------------- */

  blockquote {
    background-color: transparent;
    break-inside: avoid;
    page-break-inside: avoid;   /* legacy alias for Safari insurance */
  }

  table,
  figure {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  p, h2, h3 {
    orphans: 3;
    widows: 3;
  }

  h1, h2, h3, h4 {
    break-after: avoid;
    page-break-after: avoid;
  }

  .asterism,
  .center-subhead {
    break-after: avoid;
    page-break-after: avoid;
  }

  /* ---- Footnotes ---------------------------------------------------- */

  .footnote {
    color: black;
    text-decoration: none;   /* was "no" — invalid, silently ignored */
  }

  /* Goldmark emits .footnote-backref for the return arrow; keep the old
     names too in case any legacy content uses them. */
  .footnote-back,
  .reversefootnote,
  .footnote-backref {
    display: none;
  }

  .footnotes {
    border-top: 0.25pt solid black;
  }

  /* ---- Images ------------------------------------------------------- */

  img {
    page-break-before: avoid;
    page-break-after: avoid;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .inline-image {
    max-height: 4in;   /* physical unit; vh is unreliable in print */
    padding-top: 0;
    padding-bottom: 0;
  }

  /* ---- Letter closing (keeps your screen offset, in inches) --------- */

  .letter-closing {
    margin-left: 3in;
  }

  /* ---- Optional: reveal link targets so the printed page is
     self-contained. Off by default — uncomment if you want it, and note
     it's scoped to article body links so nav/logo links stay clean.
  article a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 85%;
    word-break: break-all;
  }
  */

}
