@font-face { font-family: "EB Garamond"; src: url(fonts/EBGaramond-var.woff2) format("woff2"); font-weight: 400 800; font-style: normal; font-display: block; }
@font-face { font-family: "EB Garamond"; src: url(fonts/EBGaramond-Italic-var.woff2) format("woff2"); font-weight: 400 800; font-style: italic; font-display: block; }

:root {
  --ink: #0c0a09;
  --left: #f24a1d;       /* one flood of ink on the left-hand page */
  --right: #f5f6f3;      /* a cold coated white on the right */
  --blue: #3b7aa8;       /* non-repro blue: what the camera does not see */
  --mark: #d6004c;       /* the proofreader's pencil */
  --sheet: #fbfcfd;
  --fs: 21px;
  --lead: 26px;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; overflow: hidden; background: var(--right); color: var(--ink); }
body {
  font: 400 var(--fs)/var(--lead) "EB Garamond", Garamond, serif;
  font-kerning: normal;
  font-feature-settings: "kern", "liga", "clig", "onum", "pnum";
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--ink); color: var(--right); }
.proofing ::selection { background: var(--mark); color: #fff; }

#spread { position: fixed; inset: 0; overflow: hidden; touch-action: none; background: var(--right); transition: background-color .45s var(--ease); }
#page-left { position: absolute; inset: 0 50% 0 0; background: var(--left); transition: background-color .45s var(--ease); }
.single #page-left { inset: 0; }

#title {
  position: absolute; font-weight: 400; font-style: italic; letter-spacing: -.035em; line-height: .8;
  font-feature-settings: "kern", "liga", "dlig", "swsh" 0; white-space: nowrap; user-select: text;
  transition: color .35s var(--ease);
}
#byline { position: absolute; white-space: nowrap; font-size: calc(var(--fs) * .86); line-height: var(--lead); }
.sc, .w.c { font-variant-caps: small-caps; font-feature-settings: "kern", "liga", "smcp", "onum"; letter-spacing: .045em; }
#caption { position: absolute; font-size: calc(var(--fs) * .78); line-height: 1.22; }
#caption .sc { letter-spacing: .04em; }
#initial { position: absolute; line-height: 1; pointer-events: none; font-weight: 400; transition: color .35s var(--ease); }

#words { position: absolute; inset: 0; contain: layout style; transition: color .35s var(--ease); }
.w { position: absolute; left: 0; top: 0; white-space: pre; transform-origin: 0 50%; will-change: auto; }
.w.i { font-style: italic; }
.w[hidden] { display: none; }

#figure { position: absolute; left: 0; top: 0; pointer-events: none; user-select: none; transform-origin: 0 0; will-change: transform; transition: opacity .35s var(--ease); }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity .3s var(--ease); }
#marks { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s var(--ease); font-size: 12.5px; line-height: 1; }
.m { position: absolute; left: 0; top: 0; white-space: nowrap; font-style: italic; color: var(--mark); font-feature-settings: "kern", "onum", "tnum"; }
.m.calm { color: #4d86b0; }
.m.num { font-style: normal; font-feature-settings: "kern", "onum", "tnum"; font-size: 11.5px; }
.m.r { width: 30px; text-align: right; }
.m.head-m { font-style: italic; font-size: 11.5px; letter-spacing: .01em; }
.m.head-m.r { width: 62px; }

.m.note { color: var(--mark); font-style: italic; font-size: 14px; text-shadow: 0 0 3px var(--sheet), 0 0 3px var(--sheet); }
.m.label { font-size: 13.5px; font-variant-caps: small-caps; font-style: normal; font-feature-settings: "kern", "smcp"; letter-spacing: .05em; background: var(--sheet); padding: 0 3px; }

#handle { position: absolute; left: 0; top: 0; background: none; border: 0; padding: 0; cursor: grab; pointer-events: none; opacity: 0; }
#handle:focus-visible { outline: none; }
/* Keyboard focus traces her own contour, not a box. */
#spread:has(#handle:focus-visible) #figure {
  filter: drop-shadow(2px 0 0 var(--ink)) drop-shadow(-2px 0 0 var(--ink)) drop-shadow(0 2px 0 var(--ink)) drop-shadow(0 -2px 0 var(--ink));
}

#caption, #press, .head { z-index: 3; }

/* Page furniture: running heads at the head, a hairline at the foot. */
.head {
  position: absolute; left: 0; top: 0; display: flex; align-items: baseline; gap: .7em; white-space: nowrap;
  font-size: calc(var(--fs) * .7); line-height: 1; letter-spacing: .01em; pointer-events: none;
  font-feature-settings: "kern", "liga", "onum", "pnum";
}
.head .sc { letter-spacing: .09em; }
.head .dot { width: .22em; height: .22em; border-radius: 50%; background: currentColor; align-self: center; transform: translateY(-.05em); }
#head-right { left: auto; }
.foot-rule { position: absolute; left: 0; top: 0; height: 0; border-top: 1px solid currentColor; opacity: .9; pointer-events: none; transition: border-color .35s var(--ease); }

/* Captions. The second state is the key to the marks. */
#caption .cap-key { display: none; }
.proofing #caption .cap-photo { display: none; }
.proofing #caption .cap-key { display: inline; }
.cap-key .short { display: none; }
.cap-key .sw { display: inline-block; width: 1.5em; height: .5em; margin-right: .4em; vertical-align: .1em; }
.cap-key .sw.grid { background: repeating-linear-gradient(90deg, var(--blue) 0 2px, transparent 2px 5px); height: 1px; vertical-align: .3em; }
.cap-key .sw.pencil { background: var(--mark); height: 2px; border-radius: 1px; vertical-align: .25em; margin-left: .2em; }

/* The press: who sets the page, the marks, the rules. Set in small capitals, like the folio line. */
#press {
  position: absolute; display: flex; align-items: center; gap: .85em; white-space: nowrap;
  font-size: calc(var(--fs) * .7); line-height: 1;
  font-variant-caps: all-small-caps; letter-spacing: .07em; font-feature-settings: "kern", "c2sc", "smcp", "onum";
}
#press button, #press a {
  appearance: none; background: none; border: 0; color: inherit; font: inherit; letter-spacing: inherit; font-variant-caps: inherit;
  font-feature-settings: inherit; cursor: pointer; text-decoration: none; position: relative; padding: 0;
  display: inline-flex; align-items: center; gap: .5em; height: 2.4em;
}
#press svg { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 1.15; stroke-linecap: round; stroke-linejoin: round; flex: none; }

#press .set { position: relative; display: inline-flex; align-items: stretch; box-shadow: inset 0 0 0 1px currentColor; border-radius: 1px; }
#press .set button { padding: 0 .72em; z-index: 1; transition: color .3s var(--ease); }
#press .set button[aria-pressed="true"] { color: var(--right); cursor: default; }
#press .set .ink {
  position: absolute; top: 0; bottom: 0; left: 0; width: var(--ink-w, 0); transform: translateX(var(--ink-x, 0));
  background: var(--ink); border-radius: 1px;
}
html.live #press .set .ink { transition: transform .42s var(--ease), width .42s var(--ease); }
#press .set button:not([aria-pressed="true"]):hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .28em; }

#press .marks { padding: 0 .7em 0 .6em; box-shadow: inset 0 0 0 1px transparent; border-radius: 1px; transition: background-color .3s var(--ease), color .3s var(--ease), box-shadow .3s var(--ease); }
#press .marks:hover { box-shadow: inset 0 0 0 1px currentColor; }
#press .marks[aria-pressed="true"] { background: var(--mark); color: #fff; box-shadow: inset 0 0 0 1px var(--mark); }
#press .short { display: none; }
.head .rules { pointer-events: auto; color: inherit; text-decoration: none; display: inline-flex; align-items: baseline; gap: .35em; padding: 10px 6px; margin: -10px -6px; }
.head .rules i { font-size: 1.12em; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .22em; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); transition: text-decoration-color .3s var(--ease); }
.head .rules:hover i { text-decoration-color: currentColor; }
.head .rules svg { width: 1.1em; height: 1.1em; align-self: center; fill: none; stroke: currentColor; stroke-width: 1.15; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--ease); }
.head .rules:hover svg { transform: translateX(3px); }
#press :focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.proofing #press .marks:focus-visible { outline-color: var(--mark); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

#folio { position: absolute; display: flex; align-items: flex-end; gap: .55em; pointer-events: none; z-index: 3; }
#colour { font-size: calc(var(--fs) * 3.4); line-height: .78; font-feature-settings: "kern", "onum", "tnum"; letter-spacing: -.02em; min-width: 1.5em; text-align: right; order: 2; }
#gap { font-size: calc(var(--fs) * .7); line-height: 1.2; text-align: right; font-feature-settings: "kern", "onum", "pnum"; white-space: nowrap; order: 1; padding-bottom: .1em; }
#gap > i { opacity: .72; }
#greedy b { font-weight: 400; font-feature-settings: "kern", "onum", "tnum"; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: normal; }

/* Proofreader's marks: the plate comes off and the page goes to a blueline. */
.proofing #spread, .proofing #page-left { background: var(--sheet); }
.proofing .head, .proofing .foot-rule { color: var(--blue); }
.proofing #words, .proofing #initial, .proofing #title { color: var(--blue); }
.proofing #figure { opacity: .13; }
.proofing #overlay, .proofing #marks { opacity: 1; }
.proofing #page-left { background: var(--sheet); }

@media (max-width: 859px), (max-aspect-ratio: 105/100) {
  #press { gap: .9em; font-size: 14.5px; }
  #press .long { display: none; }
  #press .short { display: inline; }
  .cap-key .short { display: inline; }
  .cap-key .long { display: none; }
  .head { font-size: 11.5px; }
  #colour { font-size: 46px; }
  #gap { font-size: 12.5px; }
  #gap > i, #gap br { display: none; }
  #greedy i { font-style: italic; }
  .m.num, .m.head-m { font-size: 10px; }
  .m.r, .m.head-m.r { width: 27px; }
  #caption { font-size: 12.8px; }
  .m { font-size: 10.5px; }
}

body.dragging, body.dragging * { cursor: grabbing !important; user-select: none; }
.over #spread { cursor: grab; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 1ms !important; }
}
