/* ==========================================================================
   As First Printed - reader
   Palette and type per HANDOFF_2. Do not redesign.
   Three prohibitions: no simulated gilt, no leather texture images,
   no gold body text.
   ========================================================================== */

/* Self-hosted before launch. Nothing outside our control should be able to
   stall a page turn, and third-party font requests undermine the no-tracking
   position. Drop the woff2 files in /fonts/ and these take effect; until then
   the fallback stack carries the page. */
@font-face{font-family:"EB Garamond";src:url("/fonts/ebgaramond-400.woff2")format("woff2");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"EB Garamond";src:url("/fonts/ebgaramond-400i.woff2")format("woff2");font-weight:400;font-style:italic;font-display:swap}
@font-face{font-family:"EB Garamond";src:url("/fonts/ebgaramond-600.woff2")format("woff2");font-weight:600;font-style:normal;font-display:swap}
@font-face{font-family:"Lato";src:url("/fonts/lato-400.woff2")format("woff2");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"Lato";src:url("/fonts/lato-700.woff2")format("woff2");font-weight:700;font-style:normal;font-display:swap}

:root{
  --paper:#FAF6EC;
  --paper-alt:#F4EEE0;
  --paper-hover:#EEE5D1;
  --bark:#3E2C20;
  --leather:#8C6249;
  --leather-deep:#6B452F;
  --gilt:#A2833F;
  --gilt-text:#87682A;   /* darker than it looks like it should be. AA. */
  --gilt-light:#D2B77E;
  --label:#1E1B18;
  --ink:#2B2521;
  --body:#463E36;
  --muted:#6E6355;       /* likewise. do not lighten. */
  --hair:#DCD2BE;
  --maxw:68rem;

  --serif:"EB Garamond",Garamond,"Times New Roman",serif;
  --sans:"Lato",-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;

  --transport-h:8.6rem;
  --tap:44px;            /* minimum touch target, non-negotiable */
}

*,*::before,*::after{box-sizing:border-box}

html{-webkit-text-size-adjust:100%}

body{
  margin:0;
  background:var(--paper);
  color:var(--body);
  font:400 20px/1.78 var(--sans);
  padding-bottom:calc(var(--transport-h) + env(safe-area-inset-bottom,0px));
  overflow-wrap:break-word;
}
@media (max-width:52rem){ body{font-size:19px} }

button,input,select{font:inherit;color:inherit}

.sr{
  position:absolute;width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;
}

.skip{
  position:absolute;left:-9999px;top:0;z-index:60;
  background:var(--label);color:var(--gilt-light);
  padding:.7rem 1.1rem;text-decoration:none;
}
.skip:focus{left:.5rem;top:.5rem}

:where(a,button,input,select,[tabindex]):focus-visible{
  outline:2px solid var(--leather-deep);
  outline-offset:2px;
}

/* ---------- topbar ------------------------------------------------------- */

.topbar{
  position:sticky;top:0;z-index:30;
  display:flex;align-items:center;gap:1.2rem;
  padding:.55rem clamp(.75rem,3vw,1.5rem);
  background:var(--paper);
  border-bottom:1px solid var(--hair);
}

.wordmark{
  font-family:var(--serif);font-size:1.15rem;font-weight:600;
  letter-spacing:.16em;text-transform:uppercase;
  color:var(--ink);text-decoration:none;white-space:nowrap;
}

.doors{display:flex;margin-left:auto;border:1px solid var(--hair);background:var(--paper-alt)}
.door{
  min-height:var(--tap);padding:0 1.05rem;
  background:none;border:0;cursor:pointer;
  font-size:.82rem;font-weight:700;letter-spacing:.12em;text-transform:uppercase;
  color:var(--muted);
  transition:background .18s ease,color .18s ease;
}
.door[aria-selected="true"]{background:var(--paper);color:var(--ink);box-shadow:inset 0 -2px 0 var(--leather)}
.door:hover,.door:focus-visible{color:var(--ink);background:var(--paper-hover)}

.whereami{
  margin:0;min-width:5.6rem;text-align:right;
  font-size:.8rem;font-weight:700;letter-spacing:.18em;text-transform:uppercase;
  color:var(--gilt-text);
}
.whereami-page{font-family:var(--serif);font-size:1.25rem;letter-spacing:.04em;color:var(--ink);margin-left:.4rem}
@media (max-width:40rem){
  .whereami-label{display:none}
  .wordmark{font-size:.95rem;letter-spacing:.1em}
  .door{padding:0 .7rem;font-size:.72rem}
}

/* ---------- notices ------------------------------------------------------ */

.notice{
  max-width:44rem;margin:1rem auto;padding:.85rem 1.1rem;
  background:var(--paper-alt);border-left:3px solid var(--leather);
  font-size:.95rem;color:var(--body);
}
.notice-block{display:block}

.linkish{
  background:none;border:0;padding:.35rem .2rem;margin-left:.6rem;cursor:pointer;
  color:var(--leather-deep);text-decoration:underline;text-underline-offset:3px;
  font-size:.95rem;
}
.linkish.quiet{color:var(--muted)}

/* ---------- stage -------------------------------------------------------- */

.stage{
  max-width:var(--maxw);margin:0 auto;
  padding:1.4rem clamp(.75rem,3vw,1.5rem) 2rem;
}
.stage:focus{outline:none}
.view[hidden]{display:none}

/* door one: the leaf */

.leaf{margin:0;text-align:center}
.leaf img{
  display:block;margin:0 auto;
  width:min(100%,calc(var(--zoom,1) * 46rem));
  height:auto;background:var(--paper-alt);
  border:1px solid var(--hair);
  box-shadow:0 1px 0 var(--hair);
}
.leaf img[data-empty]{min-height:60vh}
.leaf-caption{
  margin:.9rem 0 0;
  font-size:.8rem;font-weight:700;letter-spacing:.18em;text-transform:uppercase;
  color:var(--muted);
}
.leaf-missing{max-width:36rem}

/* door two: the text */

.prose{max-width:46rem;margin:0 auto}

.prose .pagemark{
  display:flex;align-items:center;gap:.9rem;
  margin:2.6rem 0 1.4rem;
  font-size:.8rem;font-weight:700;letter-spacing:.24em;text-transform:uppercase;
  color:var(--gilt-text);
}
.prose .pagemark::after{content:"";flex:1;height:1px;background:var(--gilt);opacity:.55}
.prose .pagemark:first-child{margin-top:.4rem}
.prose .pagemark .misnumbered{
  color:var(--muted);letter-spacing:.1em;text-transform:none;font-weight:400;
  font-family:var(--serif);font-style:italic;
}

.prose p{margin:0 0 1.15rem;font-family:var(--serif);font-size:1.16em;line-height:1.72}

/* The marked sentence. The tint and the leather rule must be the same box: an
   outer spread shadow made the tint larger than the element, so the rule floated
   free of the block it belonged to. Padding does the same job honestly. */
.seg{display:block;padding:.15rem .6rem .15rem .95rem;margin:0 -.6rem 0 -.95rem;
  border-left:3px solid transparent;
  transition:background-color .3s ease,border-color .3s ease}
.seg.on{background:var(--paper-hover);border-left-color:var(--leather)}

/* ---------- transport ---------------------------------------------------- */

.transport-wrap{
  position:fixed;left:0;right:0;bottom:0;z-index:40;
  background:var(--paper);
  border-top:1px solid var(--hair);
  padding-bottom:env(safe-area-inset-bottom,0px);
}
.transport{max-width:var(--maxw);margin:0 auto;padding:.5rem clamp(.6rem,3vw,1.5rem) .6rem}
.transport-row{display:flex;align-items:center;gap:.6rem}
/* The right hand group was running into the left one at narrow widths, so the
   Captions label overlapped the zoom buttons. Let the groups wrap as a unit and
   never shrink below their content. */
.transport-aux{margin-top:.4rem;justify-content:space-between;flex-wrap:wrap;
  gap:.5rem 1rem;row-gap:.5rem}
.grouplet{display:flex;align-items:center;gap:.35rem;flex:0 0 auto;min-width:0}

.ctl{
  min-width:var(--tap);min-height:var(--tap);
  display:inline-flex;align-items:center;justify-content:center;gap:.15rem;
  background:none;border:1px solid transparent;cursor:pointer;
  color:var(--ink);border-radius:2px;
  transition:background .18s ease;
}
.ctl:hover,.ctl:focus-visible{background:var(--paper-hover)}
.ctl svg{width:24px;height:24px;fill:currentColor}
/* The "15" sits inside the circular arrow, so it needs centring on the icon
   rather than on the button, and it must not inherit the button's line box. */
#back15{position:relative}
#back15 svg{width:26px;height:26px}
.ctl-sub{position:absolute;top:50%;left:50%;transform:translate(-50%,-38%);
  font-size:.52rem;font-weight:700;letter-spacing:0;line-height:1;pointer-events:none}

.ctl-primary{
  background:var(--label);color:var(--gilt-light);
  border-color:var(--label);
  min-width:52px;min-height:52px;
}
.ctl-primary:hover,.ctl-primary:focus-visible{background:var(--bark);border-color:var(--bark)}

.ctl.small{min-width:var(--tap);min-height:var(--tap);border-color:var(--hair);font-size:1.1rem}
.ctl.wide{padding:0 .8rem;font-size:.78rem;font-weight:700;letter-spacing:.12em;
  text-transform:uppercase;white-space:nowrap}
.ctl[aria-pressed="true"]{background:var(--bark);color:var(--gilt-light);border-color:var(--bark)}
.ctl[disabled]{opacity:.4;cursor:default}
.ctl[disabled]:hover{background:none}

.scrub{flex:1;min-width:6rem}
.times{
  display:flex;justify-content:space-between;margin:.1rem 0 0;
  font-size:.72rem;letter-spacing:.08em;color:var(--muted);font-variant-numeric:tabular-nums;
}

input[type=range]{
  -webkit-appearance:none;appearance:none;width:100%;height:var(--tap);
  background:none;cursor:pointer;margin:0;
}
input[type=range]::-webkit-slider-runnable-track{height:3px;background:var(--hair)}
input[type=range]::-moz-range-track{height:3px;background:var(--hair)}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;width:15px;height:15px;border-radius:50%;
  background:var(--leather-deep);border:0;margin-top:-6px;
}
input[type=range]::-moz-range-thumb{
  width:15px;height:15px;border-radius:50%;background:var(--leather-deep);border:0;
}

.segment{
  margin:0;max-width:13rem;flex:0 1 auto;
  font-family:var(--serif);font-size:.98rem;color:var(--muted);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
@media (max-width:52rem){ .segment{display:none} }

.pagejump input{
  width:4.2rem;min-height:var(--tap);text-align:center;
  background:var(--paper-alt);border:1px solid var(--hair);
  font-family:var(--serif);font-size:1.05rem;color:var(--ink);
  font-variant-numeric:tabular-nums;
}
.pick select{
  min-height:var(--tap);padding:0 .4rem;
  background:var(--paper-alt);border:1px solid var(--hair);color:var(--ink);
  font-size:.85rem;
}
.resync{font-size:.8rem;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--gilt-text)}

/* One control, two jobs, and it says which. In the facsimile it resizes the sheet;
   in the readable text it resizes the type. It used to disappear entirely in the
   text view, which left no way at all to enlarge the reading, on a site whose
   readers are largely over sixty. */
.zoomer{display:inline-flex;align-items:center;gap:.35rem}
.zoom-label{font-size:.7rem;font-weight:700;letter-spacing:.14em;text-transform:uppercase;
  color:var(--muted);white-space:nowrap;margin-right:.1rem}
@media (max-width:34rem){.zoom-label{display:none}}

/* Reader-set text size for the readable view. */
.prose{font-size:calc(1em * var(--textscale,1))}

/* ---------- captions ----------------------------------------------------- */

video::cue,audio::cue{background:rgba(30,27,24,.86);color:#F2E9D6;font-family:inherit}

.caption-bar{
  position:fixed;left:50%;transform:translateX(-50%);
  bottom:calc(var(--transport-h) + env(safe-area-inset-bottom,0px) + .8rem);
  z-index:35;max-width:min(46rem,92vw);
  padding:.6rem 1rem;background:rgba(30,27,24,.9);color:#F2E9D6;
  font-family:var(--serif);font-size:1.12rem;line-height:1.45;text-align:center;
  pointer-events:none;
}
.caption-bar:empty{display:none}

/* ---------- motion ------------------------------------------------------- */

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.001ms!important;animation-iteration-count:1!important;
    transition-duration:.001ms!important;scroll-behavior:auto!important;
  }
}
