/* The reader on a phone (mobile.js): a hamburger and the title on top, the contents, search and
   display options in a drawer, and at the bottom three buttons: Scan, Latijn, Vertaling. */
#mmenu,#mhome,#mdrawer,#mscrim,#mtabs,#mfind{display:none}
/* the place tapped in the text (reader.js, "a pinned place"): the same yellow as the line marked on the scan */
.l.pin .t{background:rgba(255,200,0,.32);box-shadow:0 0 0 2px rgba(255,200,0,.32);border-radius:2px;-webkit-box-decoration-break:clone;box-decoration-break:clone}
@media (max-width:700px){
  :root{--mbar:58px}
  .bar{padding:6px 10px;gap:8px}
  .bar .title{display:block;font-size:16px}
  /* the way back to the verse on the commentaries page (reader.js): beside the menu button, a finger high; the title takes what is left */
  .bar a.tocomm{display:inline-flex;align-items:center;gap:.3em;min-height:36px;max-width:50vw;padding:0 9px;overflow:hidden;text-overflow:ellipsis}
  #mmenu{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;order:-1}
  #mhome{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;color:var(--ink);text-decoration:none}
  .bar .optsbtn,.bar #pdf,.bar #setbtn{display:none}   /* their jobs are the drawer's and the bottom bar's now */
  #mhome svg,#mmenu svg,#mtabs svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round}
  #pdfclose,.pdfgrip{display:none}
  body.scanonly #mtabs{display:none}   /* only the scans (scan.js): nothing to switch between */
  body.scanonly .wrap{padding-bottom:24px}

  /* the bar below: Scan | Latijn | Vertaling */
  #mtabs{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:12;height:calc(var(--mbar) + env(safe-area-inset-bottom));
    padding-bottom:env(safe-area-inset-bottom);background:var(--paper);border-top:1px solid var(--rule);font-family:var(--sans)}
  #mtabs button{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;border:0;background:none;
    color:var(--muted);font:600 12px var(--sans);cursor:pointer;-webkit-tap-highlight-color:transparent}
  #mtabs button[hidden]{display:none}
  #mtabs button[aria-pressed="true"]{color:var(--accent);box-shadow:inset 0 2px 0 var(--accent)}
  .wrap{padding-bottom:calc(var(--mbar) + 24px + env(safe-area-inset-bottom))}

  /* the Latin alone, or the translation alone */
  body.m-tr .pair .la{display:none}
  body.m-tr .pair{background:none}
  body.m-tr .pair .tr{border-top:0}
  body.m-tr .pair.head{display:none}

  /* the scan fills the screen between the bar and the buttons; the text stays where it is under it */
  body.m-scan .pdfpane,body.pdf.m-scan .pdfpane{top:var(--mtop,52px);bottom:auto;border-width:0;
    height:calc(100vh - var(--mtop,52px) - var(--mbar) - env(safe-area-inset-bottom));
    height:calc(100dvh - var(--mtop,52px) - var(--mbar) - env(safe-area-inset-bottom))}
  body.m-scan .pdfview{min-height:0}
  body.m-scan .wrap{padding-bottom:calc(var(--mbar) + 24px)}
  .pdfview{overscroll-behavior:contain;touch-action:pan-x pan-y pinch-zoom}

  /* the size of the letters: the text of the pages follows --mfs (mobile.js) */
  #pages{font-size:calc(1em * var(--mfs,1))}

  /* the hits with the drawer shut (mobile.js): a small bar over the buttons below */
  #mfind.on{display:flex;align-items:center;gap:4px;position:fixed;z-index:12;left:50%;transform:translateX(-50%);
    bottom:calc(var(--mbar) + env(safe-area-inset-bottom) + 10px);padding:4px 4px 4px 14px;border:1px solid var(--rule);border-radius:22px;
    background:var(--paper);box-shadow:0 4px 14px rgba(0,0,0,.18);font:600 13px var(--sans);color:var(--muted);white-space:nowrap}
  body.mopen #mfind{display:none}
  body:has(#mfind.on) .wrap{padding-bottom:calc(var(--mbar) + 80px + env(safe-area-inset-bottom))}   /* the last lines clear of it */
  #mfind button{width:36px;height:36px;border:0;border-radius:50%;background:none;color:var(--ink);font:16px var(--sans);cursor:pointer}
  #mfind button:disabled{color:var(--rule)}
  #mfind span{margin-right:4px}

  /* the drawer */
  #mscrim{position:fixed;inset:0;z-index:20;background:rgb(0 0 0 / .4)}
  body.mopen #mscrim{display:block}
  #mdrawer{display:flex;flex-direction:column;gap:18px;position:fixed;top:0;bottom:0;left:0;z-index:21;width:min(88vw,360px);overflow:auto;
    padding:14px 16px calc(20px + env(safe-area-inset-bottom));background:var(--paper);border-right:1px solid var(--rule);
    transform:translateX(-102%);transition:transform .2s ease;font-family:var(--sans);font-size:15px;visibility:hidden}
  body.mopen #mdrawer{transform:none;visibility:visible}
  @media (prefers-reduced-motion:reduce){#mdrawer{transition:none}}
  /* nothing in it may be wider than the drawer: long titles wrap, the rows shrink */
  #mdrawer{overflow-x:hidden;overscroll-behavior:contain}
  #mdrawer *{min-width:0;max-width:100%}
  #mdrawer .find,#mdrawer .goto{width:100%}
  #mdrawer .goto{white-space:normal;flex-wrap:wrap}
  #mdrawer .sw{white-space:normal}
  #mdrawer .opts .seg button{white-space:normal}
  #mdrawer nav.toc,#mdrawer #toc,#mdrawer #toc *{white-space:normal;overflow-wrap:anywhere}
  #mdrawer .mhead{display:flex;align-items:center;justify-content:space-between}
  #mdrawer .mhead b{font:600 20px var(--sans)}   /* not the serif: its u looks like a v */
  /* the translation to choose: the Latin has its own button below, so no "Geen" */
  #mdrawer #lang button[data-l=""]{display:none}
  #mdrawer nav.toc small{display:none}   /* the scan numbers in the contents */
  #mdrawer .msec{display:flex;flex-direction:column;gap:10px}
  #mdrawer .msec:empty{display:none}
  #mdrawer .size{display:flex;align-items:center;gap:10px}
  #mdrawer .size button{flex:1;height:44px;border:1px solid var(--rule);border-radius:8px;background:var(--bg);color:var(--ink);font:600 20px var(--serif);cursor:pointer}
  #mdrawer .size button small{font:600 13px var(--sans);margin-left:2px}
  #mdrawer .size button:disabled{opacity:.4;cursor:default}
  #mdrawer .size output{flex:none;min-width:4ch;text-align:center;font:600 15px var(--sans);color:var(--muted)}
  #mdrawer h2{margin:0;font:600 11px var(--sans);text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}
  #mdrawer .find,#mdrawer .goto{height:44px}
  #mdrawer #q{width:auto;flex:1;font-size:16px}   /* 16px: iOS does not zoom in on the field */
  #mdrawer #go{font-size:16px;width:5ch}
  #mdrawer .goto>span:first-child,#mdrawer #gomax{display:inline}
  #mdrawer .find button{width:36px;height:36px}
  #mdrawer .find button:disabled{display:inline-block}
  /* the display options always open, in the drawer */
  #mdrawer .opts{display:flex;position:static;flex-direction:column;align-items:stretch;gap:14px;min-width:0;padding:0;border:0;box-shadow:none;background:none}
  #mdrawer .opts .seg button{height:40px}
  #mdrawer .sw{height:40px}
  #mdrawer .brand{align-self:flex-start;padding:6px 8px 6px 4px}
  #mdrawer .brand b{display:inline;font-size:15px}
  #mdrawer .brand::before{content:none}
  #mdrawer .brand img{height:28px}
  #mdrawer #setview{margin-top:14px;gap:14px}
  #mdrawer #setview h2{display:none}
  #mdrawer #theme,#mdrawer #dlbtn,#mdrawer #citebtn,#mdrawer #infobtn{width:44px;height:44px}
  /* the contents: always unfolded here, whatever the page remembers */
  #mdrawer nav.toc{position:static;max-height:none;border:0;padding:0;background:none}
  #mdrawer .toch{display:none}   /* its arrow stays: all sub-entries and the translated titles */
  #mdrawer #tocbody,body.notoc #mdrawer #tocbody{display:block;margin:0}
  #mdrawer #toc a{display:block;padding:9px 0;font-size:15px}
}
