/* =========================================================================
   print.css -- PAGED-MEDIA layer      (linked media="print")
   @page geometry + print overrides + page-break control. Print color
   translation and the appended glossary will be added here.
   The @media print wrapper is kept deliberately: redundant under a
   media="print" link, but keeps this file correct if loaded unscoped.
   ========================================================================= */
/* ---- print ---- */
@page{
  size:Letter;
  margin:0.7in 0.72in 0.78in;
  @bottom-center{content:counter(page);color:#888;font-family:Arial,sans-serif;font-size:9pt}
}
@media print{
  html{font-size:10.6pt}
  body{background:#fff}
  .page{max-width:none;margin:0;padding:0;box-shadow:none}
  /* Headings never orphan at a page bottom. (Per editor: NO forced page break
     before each major section -- continuous flow reads more like Pharr, and the
     readability gain didn't justify the whitespace.) */
  h2.h2{break-after:avoid}
  h3.h3,h4.h4,h5.h5,h6.h6{break-after:avoid}
  table.grid,.casetable,.scanrow,.callout,.note,.editnote,.edpanel,.edbox,.classlist,.braceitem,.footnote{break-inside:avoid}
  .ppsys .pptense,.ppgrid{break-inside:avoid}
  .sec{break-inside:auto}
  /* Long breakable tables (notably the deponent synopsis, taller than a page):
     let the table paginate, never split a row, and let Chromium repeat the
     <thead> on each continuation page (§6b clean row-breaks + repeated headers).
     The blanket break-inside:avoid above would otherwise pin it whole. */
  table.grid.synopsis{break-inside:auto}
  table.grid tr,table.synopsis tr,.casetable tr,table.vgrid tr{break-inside:avoid}
  /* keep a synopsis mood-subhead with at least its first form row */
  table.synopsis .syn-sechead{break-after:avoid}
  /* §6b TITLES & VERB-BLOCK INTROS STAY WITH THEIR TABLE.
     A verb block is: h3/h4 title -> .note "Principal Parts" (or PP inline in
     the title) -> invisible anchor-stub spans -> .vconj/.vconj4 table. The
     anchor-stubs (cross-ref targets, useless on paper) both sit between the
     intro and the table (defeating :has(+ table)) AND act as stray break
     points -- so drop them from print layout. Then the editor's two rules:
       (1) NEVER break after the title + principal parts. The intro's
           break-after:avoid chain (h3/h4 -> .note -> table, now adjacent)
           keeps the title + PP with the table's start; if the table won't fit
           in the space left, the whole intro is pulled forward with it.
       (2) Sub-conjugation breaks are fine SO LONG AS tense/voice/mood labels
           stay with their forms -- hence break-after:avoid on those labels.
     The 4-col grids (.vconj4: habeo/dico/audio) are taller than a page, so they
     MUST break. The break is made to fall BETWEEN tenses (before a tense title),
     never mid-tense (sg|pl): each tense block (.v4tblock) is display:contents on
     screen -- transparent to the grid -- but in print becomes a real subgrid box
     spanning all five columns, so break-inside:avoid can hold one whole tense
     together while the grid (.v4grid) itself fragments at tense boundaries. A
     little whitespace may precede the tense that didn't fit -- accepted, since a
     clean Pluperfect beats a split one (§6b). The header rows (voice/mood) ride
     with the first tense via break-after:avoid below.
     The 2-col verbs (.vconj) keep each tense whole via .vconj .vtense below.
     Long example lists (e.g. §123 Compounds of sum) flow + split. */
  .anchor-stub{display:none}
  .vconj4,.vconj4 .v4grid{break-inside:auto}
  .vconj4 .v4tblock{display:grid;grid-column:1 / 6;grid-template-columns:subgrid;break-inside:avoid}
  /* Close the grid cleanly where it breaks. The frame would otherwise live on
     the grid CONTAINER, which spans the page break -- so at a break Chromium
     reserves a row track for the next tense and trails the container's rules
     (left accent, divider, right edge) down through that blank slack with no
     bottom, reading as a sliced-off table. Move the frame onto the per-tense
     boxes instead: each .v4tblock carries the left accent + right edge + a bottom
     rule, so the last tense on a page frames itself and its closing rule hugs
     the forms, with clean blank space below. The tense's bottom rule also
     replaces the old inter-tense separator (.v4tense border-top), so the
     unbroken look is unchanged. The header band keeps the frame via its own edge
     cells. (#555 = the print-neutralised accent bar; var(--line) the frame.) */
  .vconj4 .v4grid{border:0}
  .vconj4 .v4tblock{border-left:3px solid #555;border-right:1px solid var(--line);
    border-bottom:1px solid var(--line)}
  .vconj4 .v4tense{border-top:0}
  .vconj4 .v4voice{border-top:1px solid var(--line)}
  .vconj4 .v4voice.corner,.vconj4 .v4col.corner{border-left:3px solid #555}
  .vconj4 .v4voice.pass,.vconj4 .v4col:has(+ .v4tblock){border-right:1px solid var(--line)}
  /* The voice (Active/Passive) and mood (Indicative/Subjunctive) header rows are
     grid items, and Chromium honors NO avoid-break on grid items (neither
     break-after on the header nor break-before on the first tense) -- so a header
     row landing at a page foot cannot be pulled to its table; it just strands.
     The only reliable lever is a FORCED break: start the whole verb (heading +
     principal-parts note + grid) on a fresh page. That keeps the header leading
     its first tense AND keeps the principal parts with the table (no break after
     them). .v4lead marks the three 4-col conjugation headings in index.html. */
  h3.h3.v4lead{break-before:page}
  table.grid.examplegrid{break-inside:auto}
  .note{break-after:avoid}
  /* A verb-block intro .sec must not only stay with its table (break-after) but
     also never split mid-prose and strand its heading at a page foot (the §125
     Possum bug: title + two lines alone atop an otherwise-blank page). These
     intros are short, so pinning them whole moves the whole intro to the table's
     page instead of leaving a fragment behind. */
  .sec:has(+ table),.sec:has(+ .anchor-stub + table),
  .sec:has(+ .anchor-stub + .anchor-stub + table),
  .sec:has(+ .vconj),.sec:has(+ .vconj4),.sec:has(+ .casetable),
  .sec:has(+ .ppsys),.sec:has(+ .classlist),.sec:has(+ .infforms),
  .sec:has(+ .scanblock){break-after:avoid;break-inside:avoid}
  .vt-label,.vt-title,.vt-gloss,.vmoodrow,.vmood,.v4tense,.v4voice,.v4col,
  .ppsys-head,.pptense-label,.pptense-gloss,.iff-head,.clhead,
  .vcol-label,.ppcol-label,table.grid caption,.casetable caption{break-after:avoid}
  .vconj .vtense{break-inside:avoid}
  /* .vconj is a CENTERED FLEX COLUMN on screen (core.css). Chromium fragments
     flex containers poorly: it won't begin one in the leftover space at a page
     foot, shoving the whole verb to the next page and stranding its §-intro on
     an otherwise-blank page (the §125 Possum bug). In print, lay it out as a
     normal block -- which fragments cleanly into leftover space -- and keep the
     screen's centering with auto margins on the (capped-width) tense blocks. */
  .vconj{display:block}
  .vconj > .vtense,.vconj > .vmoodrow,.vconj > .vt-label{margin-left:auto;margin-right:auto}
  /* prose: no single orphan/widow line stranded at a page edge */
  p,.sec,.subrules .sub{orphans:2;widows:2}
  .no-print{display:none}
  .indexcols{column-count:2}
}

/* =========================================================================
   §6c COLOUR TRANSLATION + PRINT TYPOGRAPHY   (approved Phase-2 specimen)
   Two jobs (DESIGN.md §6c):
   (1) Translate FUNCTIONAL colour. The screen's role colours (Latin blue,
       term magenta, headword green) and the tables' singular/plural blue/green
       banding collapse into near-identical greys when desaturated, so each
       distinction is re-encoded on a non-colour channel instead:
         .la  -> bold ROMAN        .hw -> bold ITALIC (short tokens)
         .term-> bold SMALL-CAPS    .gl -> italic
       and table banding -> tonal STEPS + heavier boundary rules + the existing
       reversed Sg./Pl. labels. (All-sans, no serif; italics kept to short
       spans -- equity evidence: long italic runs hurt dyslexic readers.)
   (2) PRESERVE the editorial voice. Ochre is KEPT (for colour output) AND
       backed by a non-colour channel so it survives a grayscale photocopy:
       a generated "EDITOR'S NOTE"/"EDITOR" label + the left bar (editor =
       solid + labelled; Pharr's own note = DOUBLE rule + unlabelled). Inline
       .ed adds a dotted underline. Labels are ::before generated content --
       presentation only, no markup/content change (single-source intact).
   media="print" means none of this reaches the screen edition.
   ========================================================================= */
@media print{
  /* === Neutralise ALL functional colour to grey/black; the ONLY colour kept
     in print is the editorial ochre (--edink/--edbg/--edbg-soft/--edrule/
     --edborder, left untouched). Overriding the colour TOKENS here catches
     every token-based use regardless of selector specificity -- including the
     lingering blue "Singular" header band -- so the rules below need only the
     few hard-coded (rgba/hex) colours. === */
  :root{
    --ink:#1a1a1a; --muted:#5b5b5b; --line:#cfcfcf; --grid-rule:#bdbdbd;
    --neutral-ink:#1f1f1f; --noneink:#6f6f6f; --markink:#1a1a1a; --warn:#000;
    --accent:#1a1a1a; --accent-deep:#000; --head:#1a1a1a; --head-blue:#2b2b2b;
    --num-green:#444; --num-green-deep:#2b2b2b; --la-green:#000;
    --term:#333; --term-deep:#000; --hwcol:#000;
    --fill1:#ececec; --fill2:#f7f7f7; --fill3:#f0f0f0; --fillrule:#f5f5f5;
    --syn-c0:#333;--syn-c0-deep:#2b2b2b;--syn-c0-bg:#f2f2f2;
    --syn-c1:#333;--syn-c1-deep:#2b2b2b;--syn-c1-bg:#f2f2f2;
    --syn-c2:#333;--syn-c2-deep:#2b2b2b;--syn-c2-bg:#f2f2f2;
    --syn-c3:#333;--syn-c3-deep:#2b2b2b;--syn-c3-bg:#f2f2f2;
  }
  /* ---- inline roles: all-sans, split by case x style x weight ---- */
  .la{color:#000;font-weight:700;font-style:normal}
  .hw{color:#000;font-weight:700;font-style:italic}
  .term{color:#000;font-weight:700;font-variant:small-caps;letter-spacing:.05em}
  .gl{color:#3a3a3a;font-style:italic}
  .noneform{color:#6f6f6f;font-style:italic}
  /* Latin is recoloured green inside plural cells on screen -> black in print */
  table.grid.paradigm td.pl-grp .la,
  table.grid.paradigm tr.pl-row td.numdata .la{color:#000}

  /* ---- headings: neutral ink; reversed h2 bar goes dark-neutral ---- */
  h1.h1,h3.h3,h4.h4,h5.h5{color:#000}
  h6.h6{color:#333}                 /* the deepest level stays a shade lighter */
  h2.h2{background:#222;color:#fff}
  h3.h3{border-bottom-color:#333}

  /* ---- editorial voice (ours): KEEP ochre + add redundant label/bar ---- */
  .ed{border-bottom:1px dotted #b89a2e}            /* dotted underline = the non-colour cue */
  .edpanel{position:relative;border-left-width:6px;padding-top:1.55rem}
  .edpanel::before{content:"EDITOR'S NOTE";position:absolute;top:.42rem;left:1.15rem;
    font-variant:small-caps;font-weight:800;letter-spacing:.12em;font-size:.62rem;color:var(--edink)}
  .edbox{position:relative;font-style:normal;border-left-width:5px;padding-top:1.25rem}
  .edbox::before{content:"EDITOR";position:absolute;top:.34rem;left:.8rem;
    font-variant:small-caps;font-weight:800;letter-spacing:.12em;font-size:.58rem;color:var(--edink)}

  /* Index: the dotted "clickable" hint is screen-only -- on paper it is noise.
     Our added entries keep the ochre AND take a left rule, so the editorial
     voice survives a grayscale photocopy (§6c) even at index type size. */
  /* On paper the three kinds keep their distinction the §6c way -- typography,
     not colour, since colour is what a photocopy destroys. Each mirrors the
     signature its kind already has in the body: .la -> bold, .term -> bold
     small-caps. So the index reads the same way the text does. */
  .idx .lemma-term{text-decoration:none;font-variant:small-caps;letter-spacing:.04em}
  .idx .lemma-plain,.idx .lemma-latin,.idx .lemma-english{color:#000}
  .idx .lemma-term{color:#000}
  .idx-added{border-left:2px solid var(--edrule);padding-left:.35rem;
    margin-left:-.35rem;text-indent:-.75rem}
  .idx-added .lemma{color:var(--edink)}

  /* ---- Pharr's own note: NOT ochre, unlabelled, DOUBLE-rule signature ---- */
  .editnote{background:#f4f4f4;border-color:#999;border-left:5px double #777;color:var(--ink)}
  .editnote b{color:#000}

  /* ---- paradigm tables: neutral dark headers/bands + tonal Sg./Pl. steps ---- */
  table.grid.paradigm thead th,
  table.grid.paradigm thead th.pl-thead,
  table.grid.paradigm thead th.sg-hdr,
  table.grid.paradigm thead th.pl-hdr,
  .numgroup thead .numhdr,
  .numgroup thead .numhdr.pl-start{background:#2b2b2b;color:#fff;border-color:#2b2b2b}
  table.grid.paradigm thead th.cornerhead{background:#fff;color:#000;border-color:#bdbdbd}
  table.grid.paradigm tr.numband td,
  table.grid.paradigm tr.numband.plural-start td{background:#4a4a4a;color:#fff;border-color:#2b2b2b}
  /* singular/plural body banding -> tonal steps (replaces blue/green rgba tints) */
  table.grid.paradigm tbody td.sg-grp,
  table.grid.paradigm tr.sg-row td.numdata{background:#fff}
  table.grid.paradigm tbody td.pl-grp,
  table.grid.paradigm tr.pl-row td.numdata{background:#ececec}
  table.grid.paradigm tbody tr:nth-child(even) td.sg-grp,
  table.grid.paradigm tr.sg-row:nth-of-type(even) td.numdata{background:#f6f6f6}
  table.grid.paradigm tbody tr:nth-child(even) td.pl-grp,
  table.grid.paradigm tr.pl-row:nth-of-type(even) td.numdata{background:#e3e3e3}
  /* neuter: faint tint + dotted inner edge as a non-hue marker */
  td.neut,th.neut{background:#f0f0f0;box-shadow:inset 0 0 0 1px #c4c4c4}
  /* generic grid zebra (blue-tinted on screen) -> neutral */
  table.grid tbody tr:nth-child(even){background:#f7f7f7}

  /* the Seven Cases set-piece */
  .casetable caption{background:#2b2b2b;color:#fff}
  .casetable caption .ct-sub{color:#dcdcdc}
  .casetable tr:nth-child(even){background:#f7f7f7}
  .casetable td.caselabel{background:#f0f0f0;border-right-color:#333}
  .casetable td.caselabel .case{color:#000}

  /* example / syntactic grids: term-magenta frame -> neutral */
  table.grid.examplegrid{border-left-color:#555}
  table.grid.examplegrid tbody tr:nth-child(even){background:#f5f5f5}

  /* verb grids (2-col + 4-col) */
  table.vgrid th{background:#ececec;color:#000}
  table.vgrid td.pers{background:#f2f2f2;color:#333}
  table.vgrid.act{border-left-color:#555}
  table.vgrid.pass{border-left-color:#333}
  /* (the 4-col left accent bar moved onto .v4tblock, in the pagination block) */
  .vconj4 .v4cell.v4pl,.vconj4 .v4colstack.v4pl .v4cell,
  .vconj4 .v4colstack.v4pl,.vconj4 .v4peri.v4pl{background:#ececec}
  .vconj4 .v4grp.v4pl,.vconj4 .v4grp.v4firstpl{background:#e3e3e3}
  .vconj .vt-peri .vperi-row.vperi-pl{background:#ececec}

  /* callouts / Pharr rule-notes: coloured left rules -> neutral */
  .callout{background:#f5f5f5;border-left-color:#555}
  .note{background:#f4f4f4;border-left-color:#555;color:var(--ink)}

  /* ---- synopsis: de-tint (approved); 4 classes carried by label + rule ---- */
  table.synopsis .syn-chdr,
  table.synopsis .syn-c0.syn-chdr,table.synopsis .syn-c1.syn-chdr,
  table.synopsis .syn-c2.syn-chdr,table.synopsis .syn-c3.syn-chdr{background:#2b2b2b;color:#fff}
  table.synopsis .syn-c0.syn-vhdr,table.synopsis .syn-c1.syn-vhdr,
  table.synopsis .syn-c2.syn-vhdr,table.synopsis .syn-c3.syn-vhdr{background:#f2f2f2}
  table.synopsis .syn-c0.syn-vhdr .la,table.synopsis .syn-c1.syn-vhdr .la,
  table.synopsis .syn-c2.syn-vhdr .la,table.synopsis .syn-c3.syn-vhdr .la{color:#000}
  table.synopsis .syn-c0.syn-form,table.synopsis .syn-c1.syn-form,
  table.synopsis .syn-c2.syn-form,table.synopsis .syn-c3.syn-form{background:#fff}
  table.synopsis tr:nth-child(even) .syn-form{background:#f7f7f7}
  table.synopsis .syn-c0.syn-form .la,table.synopsis .syn-c1.syn-form .la,
  table.synopsis .syn-c2.syn-form .la,table.synopsis .syn-c3.syn-form .la{color:#000}
  table.synopsis .syn-sechead td{background:#ececec;color:#000}

  /* ---- SVG braces + scansion marks: colour -> near-black (shape carries meaning) ---- */
  .braceitem .bsvg svg path,
  .ppgrid .ppbrace svg path,
  .vconj4 .v4peri .ppbrace svg path,
  .vconj .vt-peri .vperi .ppbrace svg path{stroke:#222}
  .ppsys{background:#f5f5f5;border-left-color:#555}
  .scan,.scanlat{color:#000}

  /* hard-coded (non-token) colour stragglers -> neutral */
  table.grid.paradigm thead th .gl,table.grid.paradigm tr.numband td .gl{color:#dcdcdc}
  table.grid.paradigm thead th .sn{color:#cfcfcf}
  .scanblock{background:#f7f7f7;border-color:#e2e2e2;border-left-color:#555}
  .vconj4 .v4cell.empty,.vconj4 .v4peri.empty,
  .vconj4 .v4cell.v4pl.empty,.vconj4 .v4peri.v4pl.empty,
  .vconj4 .v4colstack.v4pl .v4cell.empty{
    background:repeating-linear-gradient(135deg,#fafafa,#fafafa 6px,#ededed 6px,#ededed 12px)}

  /* section badges + inline pills: neutral (catch the many variants) */
  .secbadge,.rownum,.inlinebadge{color:#000 !important;background:#eee !important;border-color:#999 !important}

  /* links print as ink (xref underline already stripped in core) */
  a{color:var(--ink)}
}

/* =========================================================================
   §6d  PRINT GLOSSARY   (back matter: after the figures section, before the index)
   The glossary DOM is built at render time from data/glossary.json by
   build/glossary_print.js (run by build/render_pdf.py), through the shared
   defmarkup parser. It exists ONLY in the print render, so these rules need no
   screen counterpart. Two jobs mirror §6c: (1) editorial vs Pharr definitions
   are distinguished on a REDUNDANT, grayscale-safe channel -- an "Editor"
   label word + an ochre left bar, never colour alone; (2) § cross-references
   read as plain ink on paper yet stay live internal links in the on-screen PDF.
   Pagination (§6b): it flows out of Pharr's preceding figures glossary (no
   forced page break, per the edition's continuous-flow rule) and no entry
   splits or strands its headword.
   ========================================================================= */
@media print{
  .g-title{break-after:avoid}
  .g-intro{font-size:.84rem;color:#444;line-height:1.4;max-width:34em;margin:.35rem 0 1.15rem}
  .g-list{font-size:.93rem}

  /* one entry never splits across pages, and its headword never strands */
  .g-entry{break-inside:avoid;orphans:2;widows:2;margin:0 0 .62rem}
  .g-head{break-after:avoid;line-height:1.3}
  .g-term{font-weight:700;color:#000}
  .g-alt{font-style:italic;font-weight:400;color:#555}
  .g-def{margin-top:.04rem;line-height:1.4}
  .g-def .la{color:#000;font-weight:700}                 /* match §6c inline roles */
  .g-def .term{color:#000;font-weight:700;font-variant:small-caps;letter-spacing:.05em}

  /* source + primary-location tag: the WORD ("Editor"/"Pharr") carries the
     distinction in grayscale; § beside it is a live link. */
  .g-src{font-variant:small-caps;letter-spacing:.04em;font-size:.74rem;font-weight:600;
    color:#6a6a6a;margin-left:.55em;white-space:nowrap}
  .g-src .g-sec{color:inherit}

  /* EDITORIAL entry: ochre ink on the label + a solid ochre left bar. The bar
     and the label together are the non-colour redundancy (DESIGN.md §6c). */
  .g-entry.g-editorial{border-left:3px solid var(--edrule);padding-left:.6rem}
  .g-src.g-ed{color:var(--edink)}
  .g-src.g-ed .g-sec{color:var(--edink)}

  /* The editor's expansion of a terse Pharr definition. Ochre ink for the voice,
     PLUS an indent and a left rule so it survives grayscale (DESIGN.md §6c) --
     the reader of a photocopied handout must still see where Pharr stops and the
     editor starts. No preamble label; the rule carries it, as on screen. */
  .g-ed-exp{
    margin:.18rem 0 0 .5rem; padding-left:.5rem;
    border-left:2px solid var(--edrule);
    color:var(--edink); line-height:1.4;
  }
  .g-ed-exp .la{color:var(--edink);font-weight:700}
  .g-ed-exp .term{color:var(--edink);font-weight:700;font-variant:small-caps;letter-spacing:.05em}

  /* subclasses: named uses, each a live § link (e.g. ablative of means §331) */
  .g-subs{margin-top:.2rem;font-size:.86rem;line-height:1.45;color:#333}
  .g-subs-h{font-style:italic;color:#555}
  .g-sub{color:var(--ink);white-space:nowrap}
  .g-sub-sec{color:#666}

  /* "see" cross-references interfiled alphabetically */
  .g-see{break-inside:avoid;margin:0 0 .5rem;line-height:1.3}
  .g-see-term{font-weight:600;color:#222}
  .g-see-word{font-style:italic;color:#666}
  .g-see-to{font-weight:600;color:#000}

  /* every glossary link prints as ink, no underline -- reads as text, but the
     PDF keeps the internal anchor so it stays clickable on screen */
  .glossary a{color:var(--ink);text-decoration:none}
}

