/* #notas scene: the reader's desk. An open Bible (John 3:9-21, NAA, baked by
   web/scripts/bake-notas.mjs) on oak, a few verses already marked, notes in the
   margins in the reader's hand (Caveat), post-its with #tags, and six highlighters
   in the app's colours (sprites of the model in web/scripts/pens-studio.js).
   notas.js draws the ink with the app's marker geometry, multiplied into the
   paper; the washes below are the page without scripts. Phones first: one page,
   the pens a tray under it; from 1180 px the desk is the canvas s03 spread,
   laid out in design pixels of a 1440 px stage (--u). */

/* Caveat (OFL, web/shared/fonts/Caveat-OFL.txt), only this scene's hand. */
@font-face {
  font-family: "Caveat";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url(/shared/fonts/Caveat-normal-500-700-latin.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}

.l-notes {
  /* The app's highlight washes (tokens highlightColors.light). */
  --hl-red: #f8ded8;
  --hl-ochre: #f0e4c2;
  --hl-slate: #d8dfe3;
  --hl-sage: #d9e6d2;
  --hl-orange: #f6d6b8;
  --hl-lilac: #e3d9ec;
  --paper-ink: #2a1e14;
  --pen-ink: #7a2b23;
  --u: 1px;
  position: relative;
  overflow: hidden;
  color: #e9dfcf;
  /* Oak planks (gen-covers.py) under a warm lamp, dark at the room's edges. */
  background:
    radial-gradient(
      ellipse 70% 60% at 62% 42%,
      rgb(255 214 160 / 0.2),
      rgb(255 214 160 / 0) 70%
    ),
    radial-gradient(
      ellipse 120% 90% at 55% 45%,
      rgb(10 6 3 / 0) 40%,
      rgb(10 6 3 / 0.72)
    ),
    url("/media/wood/desk.webp") center / cover,
    #2a1c12;
  padding: 64px 16px 72px 28px;
}

.l-notes-desk {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.l-notes .l-eb {
  color: #e3a093;
}
.l-notes .l-h2 {
  color: #f6ecdc;
}
.l-notes .l-lede {
  color: #cdbfa9;
}
.l-notes-try {
  margin: 14px 0 0;
  font-size: 17px;
  color: #b3a48d;
}

/* ── The Bible ──────────────────────────────────────────────────────────── */
.l-notes-book {
  position: relative;
  /* The block of pages under the open leaf: its edges and the leather beyond. */
  padding: 0 7px 9px 0;
  border-radius: 4px 8px 8px 4px;
  background: url("/media/covers/comentarios.webp") center / cover, #5b2a22;
  box-shadow:
    0 2px 2px rgb(0 0 0 / 0.5),
    0 26px 40px -14px rgb(0 0 0 / 0.75);
}
/* One page on phones: the two leaves are one sheet, the second continuing
   the first, with the stack of leaves under it at the fore-edge and foot. */
.l-notes .spread {
  position: relative;
  display: grid;
  color: var(--paper-ink);
  background:
    url("/media/paper/page.webp") center / 100% 100%,
    #f3e8d2;
  box-shadow:
    1px 1px 0 #e6d8bb,
    2px 2px 0 #d9c7a3,
    3px 3px 0 #e9dcc0,
    4px 4px 0 #cdb991,
    5px 5px 0 #e2d2b0,
    6px 6px 1px #b9a37b;
}
.l-notes .pg {
  position: relative;
  padding: 26px 20px 22px 50px;
}
.l-notes .pg.l {
  padding-bottom: 0;
}
.l-notes .pg.r {
  padding-top: 0;
}
.l-notes .pg.r .rh {
  display: none;
}
.l-notes .rh {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #cdbb98;
  font-family: var(--font-roman);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #5a4a3c;
}
.l-notes .txt {
  position: relative;
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.62;
  text-align: justify;
  /* No automatic hyphens: a word split over two lines would give its verse one
     box across both (notas.js measures words), so words wrap whole. */
  hyphens: manual;
}
.l-notes .pg.r .txt {
  padding-top: 34px;
}
.l-notes .txt sup {
  margin-right: 2px;
  font-size: 0.62em;
  color: var(--accent);
}
.l-notes .v {
  /* Never positioned: its words measure against the text block (notas.js). */
  border-radius: 2px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.l-notes.inked .v {
  cursor: pointer;
}
.l-notes.inked .v:hover {
  outline: 1px dashed rgb(133 54 46 / 0.35);
  outline-offset: 1px;
}
.l-notes .v:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* The scriptless page: the marks as washes. */
.l-notes .v[data-hl="red"] {
  background: var(--hl-red);
}
.l-notes .v[data-hl="ochre"] {
  background: var(--hl-ochre);
}
.l-notes .v[data-hl="slate"] {
  background: var(--hl-slate);
}
.l-notes .v[data-hl="sage"] {
  background: var(--hl-sage);
}
.l-notes .v[data-hl="orange"] {
  background: var(--hl-orange);
}
.l-notes .v[data-hl="lilac"] {
  background: var(--hl-lilac);
}
.l-notes.inked .v[data-hl] {
  background: none;
}
/* A pen underline under verse 17. */
.l-notes .v.u {
  text-decoration: underline;
  text-decoration-color: rgb(160 48 36 / 0.85);
  text-decoration-thickness: 1.6px;
  text-underline-offset: 4px;
}

/* The ink layer notas.js lays over the words, multiplied into the paper and
   the print alike, as pigment is (the letters stay dark through it). */
.l-notes .ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  mix-blend-mode: multiply;
}
.l-notes .ink .lifting {
  opacity: 0;
  transition: opacity 0.4s ease-out;
}

/* The reader's hand in the margins. */
.l-notes .hand {
  font-family: "Caveat", cursive;
  font-weight: 600;
  color: var(--pen-ink);
  white-space: nowrap;
}
.l-notes .note {
  position: absolute;
  z-index: 2;
  line-height: 1;
  pointer-events: none;
}
.l-notes .note.n14 {
  left: 30px;
  top: var(--note-top, 240px);
  font-size: 19px;
  transform: rotate(-90deg) translateX(-100%);
  transform-origin: left top;
}
.l-notes .note.n16 {
  right: 18px;
  top: var(--note-top, 34px);
  /* In the gap the second leaf opens with, above verse 16. */
  margin-top: -34px;
  font-size: 22px;
  transform: rotate(-3deg);
}
.l-notes .note svg {
  display: none;
}
.l-notes .cred {
  margin: 18px 0 0;
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.4;
  color: #8a7a64;
}
.l-notes .ribbon {
  position: absolute;
  left: 16px;
  top: -6px;
  width: 7px;
  height: 92px;
  background: linear-gradient(90deg, #6d2a22, #93392f 45%, #6d2a22);
  box-shadow: 1px 2px 3px rgb(0 0 0 / 0.3);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 92%, 0 100%);
}

/* ── Post-its ───────────────────────────────────────────────────────────── */
.l-notes-posts {
  order: 4;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.l-notes .post {
  --r: 0deg;
  position: relative;
  padding: 16px 14px 18px;
  font-family: "Caveat", cursive;
  font-weight: 600;
  font-size: 21px;
  line-height: 1.15;
  color: #2a221b;
  /* Paper grain under the dye; the glued strip at the top is a shade darker. */
  background:
    linear-gradient(rgb(0 0 0 / 0.06) 0 20px, rgb(0 0 0 / 0) 20px),
    url("/media/paper/page.webp") center / cover,
    var(--post);
  background-blend-mode: multiply;
  box-shadow:
    0 1px 1px rgb(0 0 0 / 0.35),
    0 12px 14px -10px rgb(0 0 0 / 0.6);
  transform: rotate(var(--r));
  transform-origin: 50% 0;
}
.l-notes .post .tag {
  display: block;
  margin-top: 6px;
  font-size: 0.86em;
  color: var(--accent);
}
.l-notes .post.p1 {
  --post: #f6e27a;
  --r: -3deg;
}
.l-notes .post.p2 {
  --post: #f4b9c0;
  --r: 2.5deg;
}
.l-notes .post.p3 {
  --post: #b9dcef;
  --r: 1.5deg;
}
.l-notes .post.p4 {
  --post: #c9e4b4;
  --r: -2deg;
}
/* The free edge lifts and settles in the room's air; the glued strip stays. */
.l-notes.in .post {
  animation: l-notes-breathe 4.6s ease-in-out infinite;
}
.l-notes.in .post.p2 {
  animation-delay: -1.2s;
}
.l-notes.in .post.p3 {
  animation-delay: -2.6s;
}
.l-notes.in .post.p4 {
  animation-delay: -3.5s;
}
@keyframes l-notes-breathe {
  0%,
  100% {
    transform: rotate(var(--r)) perspective(500px) rotateX(0deg);
    box-shadow:
      0 1px 1px rgb(0 0 0 / 0.35),
      0 12px 14px -10px rgb(0 0 0 / 0.6);
  }
  50% {
    transform: rotate(var(--r)) perspective(500px) rotateX(9deg);
    box-shadow:
      0 1px 1px rgb(0 0 0 / 0.25),
      0 18px 18px -10px rgb(0 0 0 / 0.5);
  }
}

/* ── Highlighters ───────────────────────────────────────────────────────── */
/* Phones: a tray of pens standing tip up under the page. */
.l-notes-pens {
  /* The tray sits right under the page, the post-its after it. */
  order: 3;
  display: flex;
  justify-content: space-between;
  height: 200px;
  padding: 0 4px;
}
.l-notes .pen {
  position: relative;
  flex: 0 0 48px;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.l-notes .pen img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 196px;
  height: auto;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-90deg);
  filter: drop-shadow(1px 0 1px rgb(0 0 0 / 0.55))
    drop-shadow(6px 0 8px rgb(0 0 0 / 0.4));
  transition:
    transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.l-notes .pen[aria-pressed="true"] img {
  transform: translate(-50%, calc(-50% - 18px)) rotate(-90deg) scale(1.05);
  filter: drop-shadow(1px 0 1px rgb(0 0 0 / 0))
    drop-shadow(16px 0 16px rgb(0 0 0 / 0.38));
}
.l-notes .pen:focus-visible {
  outline: 2px solid #e3c37a;
  outline-offset: 2px;
}

/* Phones and tablets: the page holds only the verses that carry marks (14-21),
   so it reads as one page of a book, not a scroll of the chapter; the narrow
   column is set ragged right (justified, it opens rivers between the words);
   the site's own ribbon already runs down the left edge, so the book's goes. */
@media (max-width: 1179px) {
  .l-notes .v[data-v="9"],
  .l-notes .v[data-v="10"],
  .l-notes .v[data-v="11"],
  .l-notes .v[data-v="12"],
  .l-notes .v[data-v="13"] {
    display: none;
  }
  .l-notes .txt {
    text-align: left;
  }
  .l-notes .ribbon {
    display: none;
  }
}

/* ── The desk (from 1180 px): canvas s03 on a 1440 px stage ──────────── */
@media (min-width: 1180px) {
  .l-notes {
    padding: 0;
    container-type: inline-size;
  }
  .l-notes-desk {
    --u: calc(min(100cqw, 1440px) / 1440);
    max-width: none;
    width: calc(1440 * var(--u));
    height: calc(900 * var(--u));
    display: block;
  }
  .l-notes-copy {
    position: absolute;
    left: calc(120 * var(--u));
    top: calc(90 * var(--u));
    z-index: 4;
    width: calc(330 * var(--u));
  }
  .l-notes .l-h2 {
    font-size: calc(48 * var(--u));
  }
  .l-notes .l-lede {
    font-size: calc(20 * var(--u));
  }
  .l-notes-try {
    font-size: calc(17 * var(--u));
  }

  .l-notes-book {
    position: absolute;
    left: calc(468 * var(--u));
    top: calc(92 * var(--u));
    width: calc(880 * var(--u));
    padding: calc(8 * var(--u)) calc(10 * var(--u)) calc(12 * var(--u));
    border-radius: calc(8 * var(--u));
    transform: rotate(-1.6deg);
  }
  .l-notes .spread {
    grid-template-columns: 1fr 1fr;
    height: calc(680 * var(--u));
    background: none;
    box-shadow: none;
  }
  .l-notes .pg {
    background:
      url("/media/paper/page.webp") center / 100% 100%,
      #f3e8d2;
    padding: calc(34 * var(--u)) calc(40 * var(--u)) calc(30 * var(--u))
      calc(74 * var(--u));
    box-shadow:
      calc(-1 * var(--u)) calc(1 * var(--u)) 0 #e6d8bb,
      calc(-2 * var(--u)) calc(2 * var(--u)) 0 #d9c7a3,
      calc(-3 * var(--u)) calc(3 * var(--u)) 0 #e9dcc0,
      calc(-4 * var(--u)) calc(4 * var(--u)) 0 #cdb991,
      calc(-5 * var(--u)) calc(5 * var(--u)) 1px #b9a37b;
    border-radius: calc(5 * var(--u)) 0 0 calc(5 * var(--u));
  }
  .l-notes .pg.r {
    padding: calc(34 * var(--u)) calc(128 * var(--u)) calc(30 * var(--u))
      calc(40 * var(--u));
    border-radius: 0 calc(5 * var(--u)) calc(5 * var(--u)) 0;
    box-shadow:
      calc(1 * var(--u)) calc(1 * var(--u)) 0 #e6d8bb,
      calc(2 * var(--u)) calc(2 * var(--u)) 0 #d9c7a3,
      calc(3 * var(--u)) calc(3 * var(--u)) 0 #e9dcc0,
      calc(4 * var(--u)) calc(4 * var(--u)) 0 #cdb991,
      calc(5 * var(--u)) calc(5 * var(--u)) 1px #b9a37b;
  }
  .l-notes .pg.r .rh {
    display: flex;
  }
  /* The leaves bow down into the gutter: shade along the fold, a soft rise
     where each page curls up out of it, and the fore-edges catching light. */
  .l-notes .pg::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
  }
  .l-notes .pg.l::after {
    background: linear-gradient(
      90deg,
      rgb(255 250 235 / 0.18) 0,
      rgb(255 250 235 / 0) 6%,
      rgb(0 0 0 / 0) 72%,
      rgb(255 248 230 / 0.22) 84%,
      rgb(90 60 30 / 0.08) 94%,
      rgb(60 38 18 / 0.38) 100%
    );
  }
  .l-notes .pg.r::after {
    background: linear-gradient(
      270deg,
      rgb(255 250 235 / 0.18) 0,
      rgb(255 250 235 / 0) 6%,
      rgb(0 0 0 / 0) 72%,
      rgb(255 248 230 / 0.22) 84%,
      rgb(90 60 30 / 0.08) 94%,
      rgb(60 38 18 / 0.38) 100%
    );
  }
  .l-notes .rh {
    margin-bottom: calc(12 * var(--u));
    padding-bottom: calc(6 * var(--u));
    font-size: calc(13 * var(--u));
  }
  .l-notes .txt,
  .l-notes .pg.r .txt {
    padding-top: 0;
    font-size: calc(16.5 * var(--u));
  }
  .l-notes .note.n14 {
    top: var(--note-top, calc(330 * var(--u)));
    left: calc(26 * var(--u));
    font-size: calc(24 * var(--u));
  }
  .l-notes .note.n16 {
    right: calc(14 * var(--u));
    width: calc(104 * var(--u));
    white-space: normal;
    text-align: center;
    top: var(--note-top, calc(64 * var(--u)));
    margin-top: 0;
    font-size: calc(27 * var(--u));
    line-height: 0.95;
    transform: rotate(6deg);
  }
  .l-notes .note svg {
    display: block;
    width: calc(70 * var(--u));
    height: calc(40 * var(--u));
    margin: calc(4 * var(--u)) 0 0 calc(-6 * var(--u));
    fill: none;
    stroke: var(--pen-ink);
    stroke-width: 1.6;
    stroke-linecap: round;
    transform: scaleY(-1);
  }
  .l-notes .cred {
    position: absolute;
    left: calc(40 * var(--u));
    right: calc(40 * var(--u));
    bottom: calc(26 * var(--u));
    font-size: calc(9.5 * var(--u));
  }
  .l-notes .ribbon {
    left: 50%;
    right: auto;
    top: calc(-8 * var(--u));
    width: calc(7 * var(--u));
    height: calc(130 * var(--u));
    margin-left: calc(-3 * var(--u));
  }

  .l-notes-posts {
    display: block;
  }
  .l-notes .post {
    position: absolute;
    z-index: 5;
    padding: calc(16 * var(--u)) calc(16 * var(--u)) calc(18 * var(--u));
    font-size: calc(23 * var(--u));
    background:
      linear-gradient(
        rgb(0 0 0 / 0.06) 0 calc(22 * var(--u)),
        rgb(0 0 0 / 0) calc(22 * var(--u))
      ),
      url("/media/paper/page.webp") center / cover,
      var(--post);
    background-blend-mode: multiply;
  }
  .l-notes .post.p1 {
    --r: 4deg;
    left: calc(1262 * var(--u));
    top: calc(420 * var(--u));
    width: calc(156 * var(--u));
  }
  .l-notes .post.p2 {
    --r: 5deg;
    left: calc(1228 * var(--u));
    top: calc(30 * var(--u));
    width: calc(156 * var(--u));
  }
  .l-notes .post.p3 {
    --r: -3deg;
    left: calc(1090 * var(--u));
    top: calc(772 * var(--u));
    width: calc(184 * var(--u));
  }
  .l-notes .post.p4 {
    --r: 8deg;
    left: calc(640 * var(--u));
    top: calc(590 * var(--u));
    width: calc(128 * var(--u));
    font-size: calc(21 * var(--u));
  }

  /* The pens lie side by side on the desk under the copy, tips to the left. */
  .l-notes-pens {
    position: absolute;
    left: calc(110 * var(--u));
    top: calc(560 * var(--u));
    z-index: 6;
    display: block;
    width: calc(470 * var(--u));
    height: calc(300 * var(--u));
    padding: 0;
    transform: rotate(-9deg);
  }
  .l-notes .pen {
    position: absolute;
    left: 0;
    width: calc(420 * var(--u));
    height: calc(46 * var(--u));
    min-height: 44px;
  }
  .l-notes .pen:nth-child(1) {
    top: calc(0 * var(--u));
    left: calc(14 * var(--u));
  }
  .l-notes .pen:nth-child(2) {
    top: calc(46 * var(--u));
    left: calc(0 * var(--u));
  }
  .l-notes .pen:nth-child(3) {
    top: calc(92 * var(--u));
    left: calc(22 * var(--u));
  }
  .l-notes .pen:nth-child(4) {
    top: calc(138 * var(--u));
    left: calc(6 * var(--u));
  }
  .l-notes .pen:nth-child(5) {
    top: calc(184 * var(--u));
    left: calc(30 * var(--u));
  }
  .l-notes .pen:nth-child(6) {
    top: calc(230 * var(--u));
    left: calc(10 * var(--u));
  }
  .l-notes .pen img {
    width: calc(420 * var(--u));
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 calc(2 * var(--u)) calc(1.5 * var(--u)) rgb(0 0 0 / 0.55))
      drop-shadow(calc(-4 * var(--u)) calc(8 * var(--u)) calc(9 * var(--u)) rgb(0 0 0 / 0.38));
  }
  /* Picked up: off the desk towards the page, its shadow left behind. */
  .l-notes .pen[aria-pressed="true"] img {
    transform: translate(calc(-50% + 34 * var(--u)), calc(-50% - 16 * var(--u)))
      rotate(2deg) scale(1.05);
    filter: drop-shadow(0 calc(2 * var(--u)) calc(1.5 * var(--u)) rgb(0 0 0 / 0))
      drop-shadow(calc(-10 * var(--u)) calc(26 * var(--u)) calc(20 * var(--u)) rgb(0 0 0 / 0.34));
  }
}

@media (prefers-reduced-motion: reduce) {
  .l-notes.in .post {
    animation: none;
  }
  .l-notes .pen img {
    transition: none;
  }
}
