/* ============================================================================
   EHE SITES - THE BOOK
   A flat-lay desk: one book in the middle, a few props around it.
   Geometry (--pw, --ph, --cs, --k, --div) is set by book.js on resize.
   ========================================================================== */

:root {
  --desk: #c9c8c4;
  --ink: #141413;
  --ink-2: #5d5b55;
  --ink-3: #8c8a83;
  --paper: #f4f1e8;
  --paper-edge: #e3dfd2;
  --lime: #d6f24a;
  --board: #222321;
  /* desk theme: everything that sits on the desk reads these (see [data-desk] below) */
  --grain: linear-gradient(transparent, transparent);
  --desk-ink: #2a2a28;
  --desk-line: rgba(20, 20, 19, .45);
  --chip-bg: #141413;
  --chip-fg: #f1f0ec;
  --ui: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --hand: "Caveat", "Comic Sans MS", cursive;
  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .07 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  --ease: cubic-bezier(.65, .02, .2, 1);

  --pw: 380px;
  --ph: 540px;
  --cs: .78;
  --k: 1;
  --div: 30;
  --px: 0;
  --py: 0;
}
:root[data-desk="wood"] {
  --desk: #a8794f;
  --grain: repeating-linear-gradient(92deg, rgba(60, 30, 10, .07) 0 2px, transparent 2px 11px, rgba(255, 230, 190, .05) 11px 13px, transparent 13px 23px);
  --desk-ink: #2b1d10;
  --desk-line: rgba(43, 29, 16, .5);
}
:root[data-desk="green"] {
  --desk: #2f4a3c;
  --desk-ink: #efe9d8;
  --desk-line: rgba(239, 233, 216, .45);
  --chip-bg: #f1ead6;
  --chip-fg: #141413;
}
:root[data-desk="night"] {
  --desk: #1c1c1a;
  --desk-ink: #d9d6cc;
  --desk-line: rgba(217, 214, 204, .4);
  --chip-bg: #e6e1d3;
  --chip-fg: #141413;
  --paper: #ebe6d8;
  --paper-edge: #d8d2c3;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  font-family: var(--ui);
  color: var(--ink);
  background: var(--noise), var(--grain), var(--desk);
  transition: background-color .4s;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
kbd { font-family: var(--ui); font-size: .85em; opacity: .55; margin-left: 4px; }

/* -------------------------------------------------------------- top bar -- */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start;
  padding: 14px 16px; pointer-events: none;
}
.bar > * { pointer-events: auto; }
.bar__left { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.bar__right { justify-self: end; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.mark {
  font-family: var(--ui); font-weight: 600; font-style: italic;
  font-size: 22px; letter-spacing: -.04em; text-decoration: none; line-height: 1;
  padding-top: 6px; color: var(--desk-ink);
}
.mark sup { font-size: .5em; font-style: normal; font-weight: 500; margin-left: 1px; }

.tag {
  display: inline-flex; align-items: center; gap: 2px;
  min-width: 124px; padding: 4px 8px;
  border: 0; border-radius: 0;
  background: var(--chip-bg); color: var(--chip-fg);
  font-family: var(--ui); font-size: 11px; font-weight: 500; letter-spacing: .01em;
  text-align: left; text-decoration: none; white-space: nowrap;
  transition: background .15s, color .15s;
}
.tag:hover, .tag:focus-visible { background: var(--lime); color: var(--ink); outline: none; }
.tag[hidden] { display: none; }
/* while reading, the buttons sit in one line so they stay clear of the pages */
.is-reading .bar__left, .is-reading .bar__right { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; }
.is-reading .bar__left { justify-content: flex-start; }
.is-reading .tag { min-width: 0; padding: 5px 10px; }
.tag--close { background: var(--lime); color: var(--ink); }
.tag--close:hover, .tag--close:focus-visible { background: var(--chip-bg); color: var(--chip-fg); }

/* ---------------------------------------------------------------- stage -- */
.stage { position: fixed; inset: 0; }

/* hover frame: thin outline + black tag, follows the hovered object */
.frame {
  position: fixed; z-index: 30; pointer-events: none;
  border: 1px solid var(--desk-line);
  opacity: 0; transition: opacity .12s;
}
.frame.is-on { opacity: 1; }
.frame__tag {
  position: absolute; left: -1px; top: 100%;
  background: var(--chip-bg); color: var(--chip-fg);
  font-size: 10.5px; font-weight: 500; padding: 2px 6px; white-space: nowrap;
}

/* ---------------------------------------------------------------- props -- */
.prop {
  --s: 1;
  position: absolute; z-index: 3;
  left: calc(50% + var(--x) * var(--k) * 1px);
  top: calc(50% + (var(--y) + var(--cyk, 0)) * var(--k) * 1px);
  width: calc(var(--w) * var(--k) * 1px);
  padding: 0; border: 0; background: none; display: block; text-decoration: none;
  transform:
    translate(-50%, -50%)
    translate(calc(var(--px) * var(--d) * 1px), calc(var(--py) * var(--d) * 1px))
    rotate(var(--r)) scale(var(--s));
  transition: transform .5s var(--ease), opacity .45s var(--ease);
  filter: drop-shadow(0 calc(10px * var(--k)) calc(12px * var(--k)) rgba(0, 0, 0, .22))
          drop-shadow(0 2px 2px rgba(0, 0, 0, .12));
  will-change: transform; -webkit-tap-highlight-color: transparent;
}
.prop svg { display: block; width: 100%; height: auto; }
.prop:hover, .prop:focus-visible { --s: 1.04; outline: none; }

.prop--polaroid { --x: -440; --y: -140; --w: 165; --r: -8deg; --d: 10; }
.prop--lens     { --x: -420; --y: 175;  --w: 230; --r: 0deg;  --d: 18; }
.prop--die      { --x: 420;  --y: -180; --w: 112; --r: 8deg;  --d: 13; }
.prop--notes    { --x: 430;  --y: 105;  --w: 165; --r: 5deg;  --d: 8; }
.prop--pencil   { --x: 360;  --y: 300;  --w: 270; --r: -16deg; --d: 22; }

.polaroid {
  display: block; background: #fbfbf8; padding: 8% 8% 0;
  aspect-ratio: .86; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);
}
.polaroid__photo { display: block; aspect-ratio: 1.09; overflow: hidden; background: #333; }
.polaroid__photo svg { width: 100%; height: 100%; }
.polaroid__note {
  display: block; text-align: center; font-family: var(--hand); font-weight: 700;
  font-size: calc(19px * var(--k)); color: #2c2c2a; padding-top: 6%;
}

.notes { position: relative; display: block; aspect-ratio: 1; }
.notes__sheet {
  position: absolute; inset: 0; background: #e8f37a;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .06);
}
.notes__sheet:nth-child(1) { transform: rotate(-5deg) translate(-3%, 3%); background: #dbe86a; }
.notes__sheet:nth-child(2) { transform: rotate(3deg) translate(2%, 1%); background: #e2ee70; }
.notes__sheet--top {
  background: linear-gradient(160deg, #f1fb8c, #e4f06f 70%, #d7e463);
  display: grid; place-items: center;
}
.notes__hand {
  font-family: var(--hand); font-weight: 500; color: #2b2b28; text-align: center;
  font-size: calc(26px * var(--k)); line-height: .95; transform: rotate(-4deg);
}
.notes__hand b { font-size: 1.9em; font-weight: 700; display: inline-block; }
.prop .notes__clip { position: absolute; width: 13%; left: 12%; top: -14%; filter: drop-shadow(1px 2px 1px rgba(0,0,0,.25)); }

/* ----------------------------------------------------------------- book -- */
.book {
  position: absolute; left: 50%; top: 50%; z-index: 5;
  width: calc(var(--pw) * 2); height: var(--ph);
  margin: calc(var(--ph) / -2) 0 0 calc(var(--pw) * -1);
  perspective: 2400px;
  transform: translateX(calc(var(--pw) * -.5 * var(--cs))) translateY(var(--cy, 0px)) scale(var(--cs));
  transition: transform 1s var(--ease);
}
.book[data-state="open"] { transform: translateY(var(--oy, 0px)); }
.single .book[data-state="open"] { transform: translateX(calc(var(--pw) * -.5)) translateY(var(--oy, 0px)); }

.spread { position: absolute; inset: 0; z-index: 1; perspective: 2600px; }
.page {
  position: absolute; top: 0; width: var(--pw); height: var(--ph);
}
.page--left  { left: 0; visibility: hidden; }
.page--right { left: var(--pw); }
.book.is-opened .page--left { visibility: visible; }
/* closed: the (invisible) open-book box is wider than the cover and would swallow clicks on the props */
.book:not(.is-open) { pointer-events: none; }
.book:not(.is-open) .cover, .book:not(.is-open) .tabs { pointer-events: auto; }
.single .page--left { display: none; }

/* page block thickness */
.page--right { box-shadow: 1px 1px 0 var(--paper-edge), 2px 2px 0 #d8d3c4, 3px 3px 0 var(--paper-edge), 4px 4px 0 #cfcaba, 6px 8px 22px rgba(0, 0, 0, .22); }
.page--left  { box-shadow: -1px 1px 0 var(--paper-edge), -2px 2px 0 #d8d3c4, -3px 3px 0 var(--paper-edge), -4px 4px 0 #cfcaba, -6px 8px 22px rgba(0, 0, 0, .22); }

/* ---------------------------------------------------------------- cover -- */
.cover {
  position: absolute; top: -4px; left: var(--pw); z-index: 6;
  width: calc(var(--pw) + 6px); height: calc(var(--ph) + 8px);
  padding: 0; border: 0; background: none;
  transform-origin: left center; transform-style: preserve-3d;
  transition: transform 1.15s var(--ease), opacity .4s;
}
.book.is-open .cover { transform: rotateY(-180deg); cursor: default; }
.book.is-opened .cover { z-index: 0; }
.single .book.is-opened .cover { opacity: 0; }
.cover__front, .cover__back {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 2px 6px 6px 2px;
}
.cover__front {
  display: block; overflow: hidden; text-align: left;
  background:
    linear-gradient(90deg, rgba(0,0,0,.45), rgba(255,255,255,.06) 2.2%, rgba(0,0,0,.18) 3.6%, transparent 6%),
    var(--noise),
    radial-gradient(120% 90% at 30% 10%, #3a3b38, var(--board) 60%, #171816);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), 10px 16px 30px rgba(0, 0, 0, .32), 2px 3px 4px rgba(0, 0, 0, .25);
  color: #e9e8e2;
  font-size: calc(var(--pw) / 30);
}
.cover__back {
  transform: rotateY(180deg);
  background: radial-gradient(rgba(214, 242, 74, .22) 1px, transparent 1.4px) 0 0 / 1.1em 1.1em, var(--board);
  font-size: calc(var(--pw) / 30);
}
.cover__vol {
  position: absolute; left: 3em; top: 2.6em;
  font-family: var(--ui); font-size: .62em; opacity: .55;
}
.cover__title {
  position: absolute; left: 2.6em; top: 4.6em; right: 4em;
  font-family: var(--serif); font-size: 3.3em; line-height: .95; letter-spacing: -.01em;
  color: #f2f1ea; text-shadow: 0 -1px 0 rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .06);
}
.cover__title em { color: var(--lime); }
.cover__label {
  position: absolute; left: 3em; bottom: 3.2em;
  display: flex; flex-direction: column; gap: .25em;
  padding: 1em 1.3em 1.1em; min-width: 14em;
  background: #f6f5ef var(--noise); color: var(--ink);
  font-family: var(--ui); font-size: .66em;
  transform: rotate(-1.5deg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(0, 0, 0, .05);
}
.cover__label b { font-family: var(--ui); font-size: 1.7em; letter-spacing: -.01em; font-weight: 700; }
.cover__band {
  position: absolute; top: -2%; bottom: -2%; right: 11%; width: 4.2%;
  background: linear-gradient(90deg, #a7be1f, var(--lime) 35%, #eefa9a 50%, var(--lime) 65%, #9cb31a);
  box-shadow: -2px 0 4px rgba(0, 0, 0, .35), 2px 0 3px rgba(0, 0, 0, .2);
  transition: transform .45s var(--ease), opacity .3s .1s;
}
.book.is-open .cover__band { transform: translateX(260%); opacity: 0; }

.book:not(.is-open) .cover:hover { transform: rotateY(-7deg); }

/* ----------------------------------------------------------------- tabs -- */
.tabs {
  position: absolute; z-index: 0; top: 0; height: var(--ph);
  left: calc(var(--pw) * 2 - 14px); width: 0;
}
.tab {
  --out: 0px;
  position: absolute; left: 0;
  top: calc(5% + var(--i) * 90% / var(--n, 10)); height: calc(74% / var(--n, 10));
  width: calc(22px + var(--pw) * .055);
  display: flex; align-items: center; justify-content: flex-end; padding: 0 6px 0 0;
  border: 0; border-radius: 0 5px 5px 0;
  background: linear-gradient(90deg, rgba(0,0,0,.12), transparent 30%), var(--c);
  color: rgba(0, 0, 0, .72);
  font-family: var(--ui); font-size: calc(var(--pw) / 46); font-weight: 500;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, .18);
  transform: translateX(var(--out));
  transition: transform .3s var(--ease);
}
.tab:hover, .tab:focus-visible, .tab.is-active { --out: 9px; outline: none; }
.tab.is-empty { opacity: .55; }
.tab__label {
  position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  background: var(--ink); color: #f1f0ec; font-family: var(--ui); font-size: 10.5px;
  padding: 2px 6px; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .12s;
}
.tab:hover .tab__label, .tab:focus-visible .tab__label { opacity: 1; }

/* ------------------------------------------------------------ open state -- */
.is-reading .prop { opacity: 0; pointer-events: none; --s: .92; }
.is-reading .caption, .is-reading .stamp { opacity: 0; pointer-events: none; }
.caption {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  margin: 0; width: min(460px, calc(100% - 32px)); text-align: center;
  font-size: 11.5px; line-height: 1.45; color: var(--desk-ink);
  transition: opacity .4s;
}

.pager {
  position: absolute; left: 50%; bottom: 16px; z-index: 20; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  width: min(560px, calc(100% - 32px));
}
.pager[hidden] { display: none; }
.pager__btn {
  flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: var(--chip-bg); color: var(--chip-fg); font-size: 15px; line-height: 1;
  transition: background .15s, color .15s;
}
.pager__btn:hover, .pager__btn:focus-visible { background: var(--lime); color: var(--ink); outline: none; }
.pager__btn:disabled { opacity: .25; pointer-events: none; }
.pager__mid { flex: 1; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.pager__label { font-family: var(--ui); font-size: 10.5px; color: var(--desk-ink); }
.pager__meta { display: flex; align-items: center; gap: 8px; }
.pager__sound { width: 22px; height: 22px; padding: 2px; border: 0; border-radius: 50%; background: none; color: var(--desk-ink); opacity: .6; }
.pager__sound svg { display: block; width: 100%; height: 100%; }
.pager__sound .snd-on, .pager__sound.is-on .snd-off { display: none; }
.pager__sound.is-on .snd-on { display: inline; }
.pager__sound.is-on { opacity: 1; }
.pager__sound:hover, .pager__sound:focus-visible { background: var(--lime); opacity: 1; outline: none; }
.rail { position: relative; width: 100%; height: 14px; }
.rail::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--desk-line); }
.rail__tick {
  position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
  border: 0; border-radius: 50%; padding: 0; background: var(--c);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .35);
}
.rail__tick:hover, .rail__tick:focus-visible { transform: scale(1.5); outline: none; }
.rail__dot {
  position: absolute; top: 50%; width: 2px; height: 14px; margin: -7px 0 0 -1px;
  background: var(--desk-ink); transition: left .5s var(--ease); pointer-events: none;
}

.stamp {
  position: absolute; right: 18px; bottom: 18px; width: 92px; z-index: 2;
  font-family: var(--serif); font-style: italic; font-size: 13px; fill: var(--desk-ink);
  animation: spin 40s linear infinite;
  transition: opacity .4s;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* desk colour picker: four swatches, bottom left */
.desk-pick { position: absolute; left: 18px; bottom: 18px; z-index: 25; display: flex; gap: 8px; padding: 6px; transition: opacity .4s; }
.desk-pick button {
  width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 0;
  background: var(--sw); box-shadow: 0 0 0 1px var(--desk-line), inset 0 0 0 1px rgba(255, 255, 255, .12);
  transition: transform .15s;
}
.desk-pick button:hover, .desk-pick button:focus-visible { transform: scale(1.18); outline: none; }
.desk-pick button[aria-checked="true"] { box-shadow: 0 0 0 2px var(--desk), 0 0 0 3.5px var(--desk-ink); }

/* ================================================================= PAGES == */
.pi {
  position: absolute; inset: 0; overflow: hidden;
  padding: 2.9em 2.7em 4.1em; /* PAD_Y in book.js = top + bottom */
  font-size: calc(var(--pw) / var(--div));
  line-height: 1.35;
  color: var(--ink);
  background: var(--noise), var(--paper);
}
.pi--l { background: linear-gradient(to left, rgba(0,0,0,.13), rgba(0,0,0,.03) 4%, transparent 9%), var(--noise), var(--paper); }
.pi--r { background: linear-gradient(to right, rgba(0,0,0,.13), rgba(0,0,0,.03) 4%, transparent 9%), var(--noise), var(--paper); }

.rh {
  position: absolute; top: 1.35em; left: 2.7em; right: 2.7em;
  display: flex; justify-content: space-between; gap: 1em;
  font-family: var(--ui); font-size: .58em; color: var(--ink-3);
  white-space: nowrap; overflow: hidden;
}
.pi--r .rh { flex-direction: row-reverse; }
.fo {
  position: absolute; bottom: 1.35em; font-family: var(--ui); font-size: .66em; color: var(--ink-2);
}
.pi--l .fo { left: 2.7em; }
.pi--r .fo { right: 2.7em; }

/* outer edge strip: click to turn. Everything between the strips is plain, selectable text */
.turn {
  position: absolute; top: 0; bottom: 0; width: 2.2em; z-index: 2;
  border: 0; padding: 0; background: transparent; cursor: pointer;
  transition: background .2s;
}
.turn--next { right: 0; cursor: e-resize; }
.turn--prev { left: 0; cursor: w-resize; }
.turn--next:hover { background: linear-gradient(to left, rgba(0,0,0,.06), transparent); }
.turn--prev:hover { background: linear-gradient(to right, rgba(0,0,0,.06), transparent); }
.single .pi .curl[data-flip="prev"] { left: 0; right: auto; }
.single .pi .curl[data-flip="next"] { right: 0; left: auto; }
.single .pi .curl[data-flip="prev"]:hover { background: linear-gradient(225deg, transparent 50%, #d9d4c5 50%, #f7f5ee 72%, #cbc6b6); box-shadow: 3px -3px 6px rgba(0,0,0,.08); }
.pi { -webkit-user-select: text; user-select: text; }
.e__link, .e__link img { -webkit-user-drag: none; }

/* corner curl = flip affordance */
.curl {
  position: absolute; bottom: 0; width: 3.2em; height: 3.2em; border: 0; padding: 0; z-index: 3;
  background: transparent; transition: background .25s, width .25s, height .25s;
}
.pi--r .curl { right: 0; }
.pi--l .curl { left: 0; }
.pi--r .curl:hover { width: 4.2em; height: 4.2em; background: linear-gradient(135deg, transparent 50%, #d9d4c5 50%, #f7f5ee 72%, #cbc6b6); box-shadow: -3px -3px 6px rgba(0,0,0,.08); }
.pi--l .curl:hover { width: 4.2em; height: 4.2em; background: linear-gradient(225deg, transparent 50%, #d9d4c5 50%, #f7f5ee 72%, #cbc6b6); box-shadow: 3px -3px 6px rgba(0,0,0,.08); }

/* --- entries ---------------------------------------------------------- */
.e { display: flex; align-items: center; height: 2.3em; position: relative; }
.e__link {
  flex: 1; min-width: 0; height: 100%;
  display: grid; grid-template-columns: 2.4em 1.3em minmax(0, max-content) minmax(1em, 1fr) auto;
  align-items: center; gap: .55em;
  text-decoration: none; color: inherit;
}
.e__n { font-family: var(--ui); font-size: .64em; color: var(--ink-3); }
.e__logo {
  width: 1.3em; height: 1.3em; border-radius: .28em; overflow: hidden;
  display: grid; place-items: center; background: #e7e3d8;
}
.e__logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mono-l { font-family: var(--ui); font-weight: 700; font-size: .7em; color: #fff; width: 100%; height: 100%; display: grid; place-items: center; }
.e__name {
  font-size: .84em; font-weight: 600; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: .05em .15em; margin: 0 -.15em;
  background-repeat: no-repeat; background-size: 0% 100%;
}
.e__dots { border-bottom: 1px dotted rgba(20, 20, 19, .35); height: 1px; align-self: center; margin-top: .45em; }
.e__host {
  font-family: var(--ui); font-size: .62em; color: var(--ink-2);
  max-width: 12em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.e__host::after { content: " \2197"; opacity: 0; transition: opacity .15s; }
/* single page (phones): the page is narrow, so the name gets the whole row */
.single .e__link { grid-template-columns: 2em 1.3em minmax(0, 1fr); }
.single .e__dots, .single .e__host { display: none; }
.e__link:hover .e__host::after, .e__link:focus-visible .e__host::after { opacity: 1; }
.e__link:hover .e__name, .e__link:focus-visible .e__name { text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 1px; }
.e__link:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
.badge {
  display: inline-block; vertical-align: .2em; margin-left: .45em;
  font-family: var(--ui); font-size: .58em; font-weight: 500;
  padding: .05em .35em; border: 1px solid currentColor; line-height: 1.3;
}
.badge--d { color: #1d4ed8; }
.e__save {
  flex: none; width: 1.6em; height: 1.6em; margin-left: .3em; padding: .25em;
  border: 0; background: none; color: var(--ink-3); opacity: .35; transition: opacity .15s, color .15s;
}
.e__save svg { width: 100%; height: 100%; display: block; }
.e:hover .e__save, .e__save:focus-visible, .e__save.is-on { opacity: 1; }
.e__save.is-on { color: var(--ink); }
.e__save.is-on path { fill: currentColor; }

.e.hl .e__name {
  background-image: linear-gradient(100deg, transparent .2em, rgba(214, 242, 74, .95) .25em, rgba(214, 242, 74, .95) calc(100% - .2em), transparent);
  animation: hl .7s .35s var(--ease) forwards;
}
@keyframes hl { to { background-size: 100% 100%; } }

.gh { padding: .55em 0 .55em; border-bottom: 1px solid var(--ink); margin-bottom: .2em; }
.gh__n { font-family: var(--ui); font-size: .62em; color: var(--ink-3); }
.gh__t { font-family: var(--serif); font-size: 1.55em; line-height: 1.05; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .4em; }
.gh__t small { white-space: nowrap; }
.gh__t small { font-family: var(--ui); font-size: .38em; color: var(--ink-3); }
.gh__d { font-family: var(--serif); font-style: italic; font-size: .82em; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc { height: 1.7em; font-family: var(--ui); font-size: .58em; color: var(--ink-3); border-bottom: 1px dotted rgba(20,20,19,.3); margin-bottom: .3em; display: flex; align-items: center; }

/* --- chapter opener ---------------------------------------------------- */
.op { display: flex; flex-direction: column; height: 100%; }
.op__ch { font-family: var(--ui); font-size: .64em; color: var(--ink-2); margin-top: 1.4em; }
.op__num {
  font-family: var(--serif); font-size: 8.4em; line-height: .82; letter-spacing: -.04em;
  color: var(--c); -webkit-text-stroke: .012em var(--ink); margin: .05em 0 .08em -.04em;
}
.op__t { font-family: var(--serif); font-size: 2.55em; line-height: .98; letter-spacing: -.01em; margin: 0; }
.op__b { font-family: var(--serif); font-style: italic; font-size: 1.05em; color: var(--ink-2); margin: .5em 0 0; }
.op__meta { font-family: var(--ui); font-size: .6em; color: var(--ink-3); margin: 1.3em 0 .5em; padding-bottom: .7em; border-bottom: 1px solid var(--ink); }
.op__secs { list-style: none; margin: 0; padding: 0; }
.op__secs.is-two { columns: 2; column-gap: 1.6em; }
.op__secs li { break-inside: avoid; }
.sec {
  width: 100%; display: grid; grid-template-columns: 2.4em minmax(0, max-content) minmax(.8em, 1fr) auto; gap: .45em; align-items: center;
  height: 1.85em; padding: 0; border: 0; background: none; text-align: left; color: inherit; font-size: .8em;
}
.op__secs.is-two .sec { font-size: .7em; grid-template-columns: 2.2em minmax(0, max-content) minmax(.5em, 1fr) auto; }
.sec__n { font-family: var(--ui); font-size: .8em; color: var(--ink-3); }
.sec__t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.sec__p { font-family: var(--ui); font-size: .8em; color: var(--ink-2); }
.sec__d { border-bottom: 1px dotted rgba(20,20,19,.35); height: 1px; margin-top: .4em; }
.sec:hover .sec__t, .sec:focus-visible .sec__t { text-decoration: underline; text-underline-offset: .2em; }
.sec:focus-visible { outline: 1px solid var(--ink); }
/* openers that would overflow their page (see measure() in book.js) */
.op.is-tight1 .op__ch, .op.is-tight2 .op__ch { margin-top: .4em; }
.op.is-tight1 .op__num { font-size: 5.6em; }
.op.is-tight1 .op__meta, .op.is-tight2 .op__meta { margin-top: .8em; }
.op.is-tight1 .sec { height: 1.6em; }
.op.is-tight2 .op__num, .op.is-tight3 .op__num { font-size: 3.8em; }
.op.is-tight2 .op__t, .op.is-tight3 .op__t { font-size: 2.1em; }
.op.is-tight2 .op__b, .op.is-tight3 .op__b { font-size: .92em; }
.op.is-tight2 .sec { height: 1.45em; }
.op.is-tight3 .op__ch { margin-top: 0; }
.op.is-tight3 .op__meta { margin-top: .6em; }
.measure { left: -10000px; visibility: hidden; pointer-events: none; }
.measure .op { height: auto; }
.op__empty { margin-top: auto; padding: 1.2em; border: 1px dashed var(--ink-3); font-family: var(--serif); font-style: italic; font-size: 1.05em; color: var(--ink-2); }

/* --- front matter ------------------------------------------------------ */
.tp { height: 100%; display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 3em; }
.tp__vol { font-family: var(--ui); font-size: .62em; color: var(--ink-2); }
.tp__t { font-family: var(--serif); font-size: 4.4em; line-height: .9; margin: .35em 0 .15em; letter-spacing: -.02em; }
.tp__s { font-family: var(--serif); font-style: italic; font-size: 1.35em; color: var(--ink-2); }
.tp__rule { width: 3em; height: 1px; background: var(--ink); margin: 2em 0; }
.tp__stats { display: flex; gap: 2.2em; }
.tp__stats b { display: block; font-family: var(--serif); font-size: 2.2em; font-weight: 400; line-height: 1; }
.tp__stats span { font-family: var(--ui); font-size: .58em; color: var(--ink-3); }
.tp__by { margin-top: auto; font-size: .78em; color: var(--ink-2); }
.tp__by b { display: block; color: var(--ink); font-weight: 600; font-size: 1.15em; }
.tp__ed { margin-top: .9em; font-family: var(--ui); font-size: .56em; color: var(--ink-3); }

.ht h2, .ct h2, .fin h2 { font-family: var(--serif); font-weight: 400; font-size: 2.3em; line-height: 1; margin: 1em 0 .7em; letter-spacing: -.01em; }
.ht__list { list-style: none; margin: 0; padding: 0; }
.ht__list li { display: grid; grid-template-columns: 7.5em 1fr; gap: 1em; padding: .65em 0; border-bottom: 1px dotted rgba(20,20,19,.3); font-size: .8em; }
.ht__list kbd { font-family: var(--ui); font-size: .82em; opacity: 1; margin: 0; color: var(--ink); }
.exlib {
  margin-top: 2.2em; padding: 1.2em 1.4em; border: 1px solid var(--ink); outline: 1px solid var(--ink); outline-offset: 3px;
  text-align: center;
}
.exlib small { display: block; font-family: var(--ui); font-size: .58em; color: var(--ink-2); }
.exlib span { display: block; font-family: var(--hand); font-size: 1.7em; line-height: 1.1; margin-top: .2em; }

.ct__row {
  width: 100%; display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto; gap: .2em .7em; align-items: baseline;
  height: 2.9em; padding: .45em 0 0; border: 0; border-bottom: 1px dotted rgba(20,20,19,.3); background: none; text-align: left; color: inherit;
}
.ct__n { font-family: var(--ui); font-size: .66em; color: var(--ink-3); }
.ct__t { font-family: var(--serif); font-size: 1.22em; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: .4em; }
.ct__t i { flex: none; width: .55em; height: .55em; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px rgba(0,0,0,.3); }
.ct__p { font-family: var(--ui); font-size: .7em; color: var(--ink-2); }
.ct__s { grid-column: 2 / 4; font-size: .6em; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct__row:hover .ct__t, .ct__row:focus-visible .ct__t { text-decoration: underline; text-underline-offset: .15em; text-decoration-thickness: 1px; }
.ct__row:focus-visible { outline: 1px solid var(--ink); }
.ct h2 { display: flex; align-items: baseline; justify-content: space-between; gap: .5em; }
.ct__seen { font-family: var(--ui); font-size: .26em; color: var(--ink-2); white-space: nowrap; }
.ct__ok { flex: none; font-family: var(--ui); font-size: .55em; font-weight: 700; color: var(--ink); width: 1.5em; height: 1.5em; display: inline-grid; place-items: center; border: 1px solid var(--ink); border-radius: 50%; transform: rotate(-8deg); }
.fr__row {
  width: 100%; height: 2.4em; display: grid; grid-template-columns: 1.3em minmax(0, 1fr) auto; gap: .6em; align-items: center;
  padding: 0; border: 0; border-bottom: 1px dotted rgba(20, 20, 19, .3); background: none; text-align: left; color: inherit;
}
.fr__t { min-width: 0; font-size: .84em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr__t small { font-weight: 400; color: var(--ink-3); margin-left: .6em; font-size: .85em; }
.fr__row:hover .fr__t, .fr__row:focus-visible .fr__t { text-decoration: underline; text-underline-offset: .2em; }
.fr__row:focus-visible { outline: 1px solid var(--ink); }

.fin { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.fin h2 { font-style: italic; font-size: 5em; margin: 0; }
.fin p { font-family: var(--serif); font-style: italic; font-size: 1.1em; color: var(--ink-2); margin: .3em 0 2em; }
.fin__links { display: flex; flex-direction: column; gap: .5em; font-size: .8em; }
.fin__links a { text-decoration: none; border-bottom: 1px solid var(--ink); }
.fin__links a:hover { background: var(--lime); }

.endpaper { position: absolute; inset: 0; background: radial-gradient(rgba(214, 242, 74, .22) 1px, transparent 1.4px) 0 0 / 1.1em 1.1em, var(--board); font-size: calc(var(--pw) / 30); }

/* ---------------------------------------------------------------- leaves -- */
.leaf {
  position: absolute; top: 0; z-index: 10; width: var(--pw); height: var(--ph);
  transform-style: preserve-3d; pointer-events: none; will-change: transform;
}
.leaf--r { left: var(--pw); transform-origin: left center; }
.leaf--l { left: 0; transform-origin: right center; }
.lf { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.lf--back { transform: rotateY(180deg); }
.lf__shade { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; }
.leaf--r .lf--front .lf__shade, .leaf--l .lf--back .lf__shade { background: linear-gradient(to left, rgba(0,0,0,.28), rgba(0,0,0,.05) 60%); }
.leaf--l .lf--front .lf__shade, .leaf--r .lf--back .lf__shade { background: linear-gradient(to right, rgba(0,0,0,.28), rgba(0,0,0,.05) 60%); }
.lf--blank { background: var(--noise), var(--paper); }

/* ---------------------------------------------------------------- sheet -- */
.sheet { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.sheet[hidden] { display: none; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(40, 40, 37, .38); animation: fade .2s; }
@media (min-width: 860px) { .sheet__backdrop { backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); } }
.sheet__card {
  position: relative; width: min(560px, 100%); max-height: min(78vh, 720px);
  display: flex; flex-direction: column;
  background:
    linear-gradient(90deg, transparent 46px, rgba(220, 80, 80, .45) 46px, rgba(220, 80, 80, .45) 47px, transparent 47px),
    repeating-linear-gradient(to bottom, transparent 0 31px, rgba(80, 130, 190, .2) 31px 32px),
    #fbfaf5;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .3), 0 2px 6px rgba(0, 0, 0, .15);
  animation: rise .28s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) rotate(-.6deg); } }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 10px 62px; }
.sheet__head .tag { min-width: 0; }
.sheet__title { font-family: var(--serif); font-size: 28px; line-height: 1; }
.sheet__body { overflow-y: auto; padding: 0 16px 18px 62px; }
.sheet__input {
  width: 100%; border: 0; border-bottom: 1.5px solid var(--ink); background: transparent; border-radius: 0;
  font-family: var(--ui); font-size: 16px; padding: 8px 0; outline: none; color: var(--ink);
}
.notes-pad { padding-top: 0; }
.note-text {
  display: block; width: 100%; min-height: 288px; max-height: 52vh; resize: vertical;
  border: 0; padding: 0; margin: 0; background: transparent; color: var(--ink);
  font-family: var(--hand); font-size: 23px; line-height: 32px; outline: none;
}
.note-text::placeholder { color: var(--ink-3); opacity: .7; }
.sheet__hint { font-family: var(--ui); font-size: 10.5px; color: var(--ink-3); margin: 8px 0 6px; }
.hit {
  width: 100%; display: grid; grid-template-columns: 38px 22px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  min-height: 44px; padding: 6px 4px; border: 0; border-bottom: 1px dotted rgba(20, 20, 19, .25); background: none; text-align: left; color: inherit;
  font-size: 15px;
}
.hit:hover, .hit:focus-visible, .hit.is-sel { background: rgba(214, 242, 74, .55); outline: none; }
.hit__n { font-family: var(--ui); font-size: 10.5px; color: var(--ink-3); }
.hit .e__logo { width: 22px; height: 22px; border-radius: 5px; }
.hit .mono-l { font-size: 11px; }
.hit__t { min-width: 0; }
.hit__t b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hit__t span { display: block; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hit__p { font-family: var(--ui); font-size: 11px; color: var(--ink-2); }
.sheet__empty { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--ink-2); padding: 18px 0; line-height: 1.35; }
.about p { font-family: var(--serif); font-size: 19px; line-height: 1.4; margin: 0 0 14px; }
.about__links { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.about__links .tag { min-width: 0; }
.tp__pf { display: inline-block; margin-top: .35em; font-family: var(--ui); font-size: .85em; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--ink); }
.tp__pf:hover, .tp__pf:focus-visible { background: var(--lime); outline: none; }

/* ------------------------------------------------------------ add a site -- */
.add { display: grid; gap: 12px; padding-top: 4px; }
.fld { display: grid; gap: 2px; min-width: 0; margin: 0; padding: 0; border: 0; }
.fld > span { font-family: var(--ui); font-size: 10px; color: var(--ink-3); }
.fld input, .fld select {
  width: 100%; min-width: 0; padding: 5px 0 4px;
  border: 0; border-bottom: 1.5px solid var(--ink); border-radius: 0;
  background: transparent; color: var(--ink);
  font-family: var(--serif); font-size: 21px; line-height: 1.15;
}
.fld select { font-family: var(--ui); font-size: 14px; padding: 7px 0 6px; cursor: pointer; }
.fld input::placeholder { color: var(--ink-3); opacity: .65; }
.fld input:focus, .fld select:focus { outline: none; background: rgba(214, 242, 74, .3); }
.fld-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fld-row[hidden] { display: none; }
.add__msg { margin: 0; font-family: var(--serif); font-style: italic; font-size: 17px; line-height: 1.3; color: #b42318; }
.add__msg:empty { display: none; }
.linkish { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.tag--go { justify-self: start; min-width: 0; padding: 8px 14px; font-size: 12.5px; }
.mine { margin-top: 20px; padding-top: 12px; border-top: 1px dashed rgba(20, 20, 19, .4); }
.mine__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.mine__head b { font-family: var(--serif); font-weight: 400; font-size: 21px; }
.mine__head .tag { min-width: 0; }
.mine__row { display: grid; grid-template-columns: minmax(0, 1fr) 30px; align-items: center; }
.mine__x { height: 30px; border: 0; background: none; color: var(--ink-2); font-size: 20px; line-height: 1; cursor: pointer; }
.mine__x:hover, .mine__x:focus-visible { color: #b42318; outline: none; }
.mine__note { margin: 10px 0 0; font-size: 12px; line-height: 1.45; color: var(--ink-2); }
.mine__note code { font-family: var(--ui); font-size: 11px; padding: 0 3px; background: rgba(0, 0, 0, .06); }
.mine__note a { color: inherit; }

/* ------------------------------------------------------------ responsive -- */
@media (max-width: 859px) {
  .mark { font-size: 19px; }
  .prop--polaroid { --x: -215; --y: calc(var(--chh) + 135); --w: 150; --r: -9deg; }
  .prop--lens     { --x: -50;  --y: calc(var(--chh) + 150); --w: 185; }
  .prop--die      { --x: 100;  --y: calc(var(--chh) + 120); --w: 96; }
  .prop--notes    { --x: 228;  --y: calc(var(--chh) + 140); --w: 140; }
  .prop--pencil   { display: none; }
  .stamp { display: none; }
  .caption { font-size: 11px; bottom: calc(18px + env(safe-area-inset-bottom)); }
  .tab__label { display: none; }
  .pager { bottom: calc(12px + env(safe-area-inset-bottom)); }
  .desk-pick { left: 50%; transform: translateX(-50%); bottom: calc(58px + env(safe-area-inset-bottom)); }
  .is-reading .desk-pick { opacity: 0; pointer-events: none; }
  .fld-row { grid-template-columns: 1fr; gap: 12px; }
  /* phones: one slim row of buttons, logo tucked away */
  .bar { grid-template-columns: 1fr auto; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; }
  .mark { display: none; }
  .bar__left, .bar__right { flex-direction: row; flex-wrap: nowrap; gap: 3px; }
  .tag, .is-reading .tag { min-width: 0; padding: 6px 8px; font-size: 11.5px; }
  .tag .lg, .tag kbd, .is-reading #navRandom { display: none; }
}
@media (max-width: 859px) and (max-height: 720px) {
  .caption { display: none; }
  .desk-pick { bottom: calc(10px + env(safe-area-inset-bottom)); }
}
@media (max-height: 640px) and (min-width: 860px) {
  .caption { display: none; }
}

.no-anim .book, .no-anim .prop, .no-anim .cover { transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
  .stamp { animation: none; }
}
