/* ══════════════════════════════════════════════════════════════
   Vellum — the room the book sits in, and the controls around it.
   The book itself is drawn as geometry; see js/gl/scene.js.
   ══════════════════════════════════════════════════════════════ */

:root {
  --rubric: #8c3b2b;
}

/* ─────────────────────────── stage ─────────────────────────── */

.stage {
  position: relative;
  display: block;
  min-height: 0;
  overflow: hidden;
  /* the book handles every gesture itself — no browser scroll or pinch here */
  touch-action: none;
  overscroll-behavior: none;
  isolation: isolate;
  background: #08080b;
}

/* ─────────────────────────── the book canvas ─────────────────────────── */

/*
 * The book itself is no longer CSS. Boards, paper block, gutter, page shading
 * and the turn were all built here once; they are geometry in a WebGL scene
 * now (js/gl/scene.js), because a page painted with gradients cannot actually
 * bend and a page made of triangles can. What is left in this file is the room
 * the book sits in and the controls around it.
 */

.book {
  display: block;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* an off-screen copy of the spread, for screen readers and browser find */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* note pins, positioned over the canvas from their anchor word each frame */
.pins {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.pin {
  position: absolute;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  color: var(--rubric);
  filter: drop-shadow(0 1px 2px #0006);
  transition: transform .14s var(--ease);
}
.pin:hover { transform: translate(-50%, -50%) scale(1.16); }
.pin svg { width: 100%; height: 100%; }

/* Appears only once the book has been moved, so there is always a way back to
   square without having to hunt for one. */
.recentre {
  position: absolute;
  z-index: 21;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px 0 10px;
  border-radius: 999px;
  background: #1a1a20d9;
  border: 1px solid #ffffff1f;
  color: #d7d5df;
  font-size: 12.5px;
  font-weight: 550;
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px #0007;
  animation: recentre-in .22s var(--ease);
}
.recentre svg { width: 16px; height: 16px; }
.recentre:hover { background: #24242cee; color: #fff; }
@keyframes recentre-in { from { opacity: 0; transform: translate(-50%, -6px); } }

/* ─────────────────────────── page turners ─────────────────────────── */

.turner {
  position: absolute;
  z-index: 20;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #ffffff4d;
  background: #ffffff08;
  backdrop-filter: blur(6px);
  transition: color .16s var(--ease), background .16s var(--ease), opacity .2s var(--ease);
  opacity: 0;
}
.stage:hover .turner, .turner:focus-visible { opacity: 1; }
.turner svg { width: 24px; height: 24px; }
.turner:hover { color: #fff; background: #ffffff14; }
.turner:disabled { opacity: 0 !important; pointer-events: none; }
.turner--prev { left: 14px; }
.turner--next { right: 14px; }
@media (pointer: coarse) { .turner { opacity: .55; } }

/* ─────────────────────────── scrubber ─────────────────────────── */

.scrubber {
  position: absolute;
  z-index: 20;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  width: min(560px, 76vw);
  padding: 12px 0;
  opacity: 0;
  transition: opacity .22s var(--ease);
}
.stage:hover .scrubber, .scrubber.is-live { opacity: 1; }
@media (pointer: coarse) { .scrubber { opacity: .7; } }

.scrubber__track {
  position: relative;
  height: 4px;
  border-radius: 999px;
  background: #ffffff1a;
  cursor: pointer;
  touch-action: none;
}
.scrubber__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: #ffffff5e;
  width: 0;
}
.scrubber__knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 8px #0008;
  transition: transform .1s var(--ease);
}
.scrubber__track:hover .scrubber__knob, .scrubber.is-live .scrubber__knob {
  transform: translate(-50%, -50%) scale(1.25);
}
.scrubber__marks { position: absolute; inset: 0; pointer-events: none; }
.scrubber__marks i {
  position: absolute;
  top: -3px;
  width: 1px;
  height: 10px;
  background: #ffffff2e;
}
.scrubber__marks i.is-testament { background: #ffffff5c; height: 14px; top: -5px; }
.scrubber__bubble {
  position: absolute;
  bottom: 26px;
  left: 0;
  transform: translateX(-50%);
  background: #22222a;
  border: 1px solid #33333d;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 11.5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s var(--ease);
}
.scrubber.is-live .scrubber__bubble { opacity: 1; }

/* ─────────────────────────── drawing affordances ─────────────────────────── */

.stage.is-drawing .page { cursor: crosshair; }
.stage.is-drawing .turner { opacity: 0 !important; }

/* Apple Pencil hover preview */
.nib {
  position: fixed;
  z-index: 130;
  pointer-events: none;
  border-radius: 999px;
  border: 1.5px solid #ffffffcc;
  box-shadow: 0 0 0 1px #00000066;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity .12s linear;
}
