/* ============================================================
   pub.css v2 - shared Print + Listen layer for evangillissie.com
   Loaded on every publication page.

   Screen: styles the reading toolbar (Listen / Print / voice / rate /
           progress) and the "now reading" marker.
   Print : strips chrome and omitted modules to one clean sheet, but
           keeps the article masthead so the piece prints with its title.

   Content contract (set per page):
     [data-pub]        the readable / printable content root
     .pub-omit         hidden in print AND skipped by the reader
     [data-pub-audio]  optional narration file (Listen plays it instead)
   ============================================================ */

/* ---------- screen: reading toolbar ---------- */
.pub-tools{
  display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;
  margin:1.4rem 0 2rem;
  font-family:'IBM Plex Mono',ui-monospace,Menlo,monospace;
}
.pub-btn{
  display:inline-flex;align-items:center;gap:.5rem;
  padding:.5rem .95rem;font:inherit;
  font-size:.72rem;font-weight:500;letter-spacing:.1em;text-transform:uppercase;
  color:inherit;background:transparent;cursor:pointer;
  border:1px solid currentColor;border-radius:2px;
  opacity:.72;transition:opacity .18s ease,background-color .18s ease;
}
.pub-btn:hover,.pub-btn:focus-visible{opacity:1;}
.pub-btn .pub-ic{width:.85rem;height:.85rem;flex:none;fill:var(--brass,currentColor);}
.pub-listen[aria-pressed="true"]{opacity:1;}

/* voice picker - the visitor's own device voices, best first */
.pub-voice{
  font:inherit;font-size:.68rem;letter-spacing:.04em;
  max-width:13rem;padding:.38rem .5rem;
  color:inherit;background:transparent;cursor:pointer;
  border:1px solid currentColor;border-radius:2px;
  opacity:.62;transition:opacity .18s ease;
}
.pub-voice:hover,.pub-voice:focus-visible{opacity:1;}
.pub-voice option{color:#111;background:#fff;}

.pub-rate{display:inline-flex;align-items:center;gap:.3rem;font-size:.68rem;opacity:.7;}
.pub-rate button{
  font:inherit;font-size:.68rem;background:transparent;border:0;color:inherit;
  cursor:pointer;padding:.2rem .3rem;opacity:.6;text-transform:uppercase;letter-spacing:.06em;
}
.pub-rate button[aria-pressed="true"]{opacity:1;text-decoration:underline;text-underline-offset:3px;}

.pub-time{
  font-size:.66rem;letter-spacing:.06em;opacity:.5;
  font-variant-numeric:tabular-nums;white-space:nowrap;
}
.pub-progress{
  position:relative;flex:1 1 4rem;min-width:3rem;height:2px;
  background:currentColor;opacity:.16;overflow:hidden;border-radius:2px;
  cursor:pointer;
}
.pub-progress i{position:absolute;inset:0 100% 0 0;background:var(--brass,currentColor);opacity:1;transition:right .25s ease;}

/* the block currently being spoken */
.pub-reading{box-shadow:-0.7rem 0 0 -0.28rem var(--brass,currentColor);transition:box-shadow .2s ease;}

@media (prefers-reduced-motion:reduce){
  .pub-progress i,.pub-reading{transition:none;}
}

/* print-only helpers */
.print-only{display:none;}
.screen-only{display:revert;}

/* ---------- print: one clean sheet ---------- */
@media print{
  @page{margin:19mm 17mm;}

  html,body{
    background:#fff !important;color:#111 !important;
    font-family:'Spectral',Georgia,'Times New Roman',serif !important;
    font-size:11.5pt !important;line-height:1.5 !important;
  }
  *{
    background:transparent !important;box-shadow:none !important;text-shadow:none !important;
    color:#111 !important;filter:none !important;
  }

  /* hide chrome, the toolbar, and everything marked for omission */
  .pub-tools,.skip,
  header,.topbar,nav,footer,
  .site-band,.subscribe,.colophon,
  .pub-omit,[data-pub-omit],.no-print,[data-no-print],
  .hero-iris,svg.hero-iris,
  script,style,noscript,iframe,video,audio,canvas{
    display:none !important;
  }

  /* ...but the article masthead is the title block, not site chrome.
     Without this the essays print untitled, because the h1, dek and
     byline all live inside <header class="masthead">. Keep the words,
     drop the artwork. */
  header.masthead,header.hero{display:block !important;}
  header.masthead svg,header.hero svg,
  header.masthead img,header.hero img,
  header.masthead canvas,header.hero canvas,
  header.masthead .pub-omit,header.hero .pub-omit{display:none !important;}
  /* genuine site chrome stays hidden even if it is a header */
  header.topbar,header.rail,header.egsb{display:none !important;}

  /* let content breathe full width */
  main,article,section,.wrap,.pub,[data-pub]{
    max-width:none !important;width:auto !important;
    margin:0 !important;padding:0 !important;float:none !important;
    position:static !important;overflow:visible !important;
  }

  h1,h2,h3,h4{font-family:'Fraunces',Georgia,serif !important;color:#111 !important;line-height:1.15;break-after:avoid;page-break-after:avoid;}
  h1{font-size:22pt;margin:0 0 .3rem;}
  h2{font-size:15pt;margin:1.4em 0 .3em;}
  h3{font-size:12.5pt;margin:1.2em 0 .3em;}
  p{margin:0 0 .7em;}
  p,li,blockquote{orphans:3;widows:3;}
  blockquote{margin:1em 0;padding-left:1em;border-left:2px solid #999 !important;font-style:italic;break-inside:avoid;page-break-inside:avoid;}
  figure,table,pre,img{break-inside:avoid;page-break-inside:avoid;}
  img{max-width:100% !important;height:auto !important;}
  a{color:#111 !important;text-decoration:none !important;}
  hr{border:0;border-top:1px solid #bbb !important;margin:1.2em 0;}

  .print-only{display:block !important;}
  .screen-only{display:none !important;}
}
