/* THE JOURNAL v3 — a spiral-bound notebook with a kraft cover. Every piece is a real paper/photo/ink asset (assets/img/jr3).
   Pages are page-width containers (cqw units), so the layout scales with the book. */
.jr--nb .jr__stage { --p: clamp(250px, 32vw, 470px); --h: calc(var(--p) * 1.38); }
.jr--nb .jr__book { }
.jr--nb .jr__boardL, .jr--nb .jr__boardR { top: -3.4%; height: 106.8%; width: calc(var(--p) + 3.6%); background: #b98d5c url(../img/jr3/board.jpg) center / cover; box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 -2px 0 rgba(0,0,0,.28) inset, 0 12px 28px rgba(0,0,0,.5); }
.jr--nb .jr__boardR { left: calc(50% - .5%); border-radius: 2px 22px 22px 2px / 2px 22px 22px 2px; }
.jr--nb .jr__boardL { right: calc(50% - .5%); border-radius: 22px 2px 2px 22px / 22px 2px 2px 22px; }
.jr--nb .jr__front { border-radius: 1px 4px 4px 1px; } .jr--nb .jr__back { border-radius: 4px 1px 1px 4px; }
.jr--nb .jr__front:has(.face-cover) { overflow: visible; }
.jr--nb .face-cover.real { inset: -3.4% -3.6% -3.4% -.6%; border-radius: 3px 22px 22px 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.4), inset 0 0 0 .6cqw rgba(0,0,0,.35); }
.jr--nb .jr__front:has(.face-cover)::after { display: none; }
.jr--nb .jr__book[data-state="end"] .jr__boardR { opacity: 1; }

/* no spiral: the pages sit in a plain bound spine */
.jr--nb .jr__front::after { background: linear-gradient(90deg, rgba(0,0,0,.34), rgba(0,0,0,.1) 4%, transparent 14%), linear-gradient(270deg, rgba(0,0,0,.08), transparent 3%); }
.jr--nb .jr__back::after { background: linear-gradient(270deg, rgba(0,0,0,.34), rgba(0,0,0,.1) 4%, transparent 14%), linear-gradient(90deg, rgba(0,0,0,.08), transparent 3%); }

/* pages + pieces */
.jr--nb .pgbg { position: absolute; inset: 0; background-size: cover; background-position: center; overflow: hidden; }
.jr--nb .pgbg::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 40; background: radial-gradient(120% 100% at 50% 40%, transparent 62%, rgba(25,15,5,.18)); }
.jr--nb .pc { position: absolute; transform: rotate(var(--r, 0deg)); transition: transform .3s cubic-bezier(.2,1,.3,1); }
.jr--nb .pc img { display: block; width: 100%; height: auto; }
.jr--nb .pc a, .jr--nb .pc button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.jr--nb .pt, .jr--nb .nn, .jr--nb .rz, .jr--nb .sk, .jr--nb .ln { filter: drop-shadow(0 .12cqw .12cqw rgba(0,0,0,.4)) drop-shadow(.3cqw .7cqw .7cqw rgba(0,0,0,.28)); }
.jr--nb .rz { filter: drop-shadow(0 .1cqw .1cqw rgba(0,0,0,.45)) drop-shadow(.3cqw .6cqw .5cqw rgba(0,0,0,.3)); }
.jr--nb .stk { filter: drop-shadow(0 .1cqw .1cqw rgba(0,0,0,.4)) drop-shadow(.25cqw .5cqw .5cqw rgba(0,0,0,.3)); }
.jr--nb .tp { filter: drop-shadow(.12cqw .25cqw .25cqw rgba(0,0,0,.35)); pointer-events: none; }
.jr--nb .dl, .jr--nb .cr { pointer-events: none; }
.jr--nb .pc.is-link:hover { transform: rotate(calc(var(--r) * .3)) translateY(-.9cqw) scale(1.03); z-index: 45 !important; }
.jr--nb .stk:hover { transform: rotate(calc(var(--r) - 4deg)) scale(1.07); }
.jr--nb .pc a:focus-visible, .jr--nb .pc button:focus-visible { outline: 2px solid #ff4f9a; outline-offset: 3px; }
.jr--nb .openhint { position: absolute; left: 28%; bottom: 2%; width: 40%; z-index: 40; transform: rotate(-2deg); background: none !important; padding: 0; }
.jr--nb .openhint img { display: block; width: 100%; height: auto; filter: drop-shadow(.3cqw .7cqw .7cqw rgba(0,0,0,.5)); }
.jr--nb .openhint .m { display: none; } .jr__strip .openhint .m { display: block; } .jr__strip .openhint .d { display: none; }
.jr--nb .jr__nav { color: #f5f0e6; }
@media (prefers-reduced-motion: reduce) { .jr--nb .pc { transition: none; } }
@media (max-width: 720px) { .jr--nb .jr__strip .jr__face::before { display: none; } .jr--nb .jr__strip .jr__face { box-shadow: 0 10px 24px rgba(0,0,0,.5), 0 0 0 4px #b98d5c; } }

/* plain torn paper layered behind photos, and torn strips that run along a page edge */
.jr--nb .pa { filter: drop-shadow(0 .1cqw .1cqw rgba(0,0,0,.3)) drop-shadow(.25cqw .5cqw .5cqw rgba(0,0,0,.22)); pointer-events: none; }
.jr--nb .edge { position: absolute; left: -4%; width: 108%; height: auto; z-index: 2; pointer-events: none; filter: drop-shadow(0 -.2cqw .4cqw rgba(0,0,0,.25)); }
.jr--nb .edge--bottom { bottom: -5%; }
.jr--nb .pt { filter: drop-shadow(0 .12cqw .12cqw rgba(0,0,0,.4)) drop-shadow(.3cqw .7cqw .7cqw rgba(0,0,0,.28)); }

.jr--nb .qt { filter: drop-shadow(.1cqw .2cqw .2cqw rgba(0,0,0,.18)); pointer-events: none; }

/* scroll entrance: --jr-s is set by journal.js (0.5 → 1) */
.jr--nb .jr__stage { transform: scale(var(--jr-s, 1)); transform-origin: 50% 40%; transition: transform .12s linear; will-change: transform; }
@media (prefers-reduced-motion: reduce) { .jr--nb .jr__stage { transform: none; transition: none; } }

/* hover cursor hints: the half you rest on is the way the book turns */
.jr--nb .jr__book[data-hover="next"] { cursor: e-resize; } .jr--nb .jr__book[data-hover="prev"] { cursor: w-resize; } .jr--nb .jr__book[data-hover="open"] { cursor: pointer; }

/* ---- photography page: a camera pops up, then five polaroids fold out of its slot one after another ---- */
.jr--nb .cs2-cam { position: absolute; z-index: 8; display: block; height: auto; transform-origin: 50% 90%; transform: translateY(40%) scale(.2) rotate(-12deg); opacity: 0;
  transition: transform .45s cubic-bezier(.2,1.5,.35,1) .1s, opacity .15s ease .1s; filter: drop-shadow(0 .2cqw .2cqw rgba(0,0,0,.5)) drop-shadow(.6cqw 1.2cqw 1.4cqw rgba(0,0,0,.5)); }
.jr--nb .cs2-frame { position: absolute; display: block; transform-origin: 50% 0; opacity: 0;
  transform: translate(var(--tx), var(--ty)) perspective(800px) rotateX(-92deg) scale(.3) rotate(var(--r, 0deg));
  transition: transform .5s cubic-bezier(.3,1.25,.4,1) var(--d, .6s), opacity .15s ease var(--d, .6s);
  filter: drop-shadow(0 .15cqw .15cqw rgba(0,0,0,.5)) drop-shadow(.5cqw 1cqw 1.2cqw rgba(0,0,0,.45)); }
.jr--nb .cs2-frame img { display: block; width: 100%; height: auto; }
.jr--nb .cs2-frame:hover { filter: drop-shadow(0 .2cqw .2cqw rgba(0,0,0,.55)) drop-shadow(.7cqw 1.5cqw 1.6cqw rgba(0,0,0,.55)) brightness(1.04); z-index: 9 !important; }
.jr--nb .jr__leaf.is-flipped .cs2-cam { transform: none; opacity: 1; }
.jr--nb .jr__leaf.is-flipped .cs2-frame { transform: translate(0, 0) perspective(800px) rotateX(0deg) scale(1) rotate(var(--r, 0deg)); opacity: 1; }
.jr__strip .cs2-cam { transform: none; opacity: 1; transition: none; } .jr__strip .cs2-frame { transform: rotate(var(--r, 0deg)); opacity: 1; transition: none; }

/* ---- coffee-cup page: paper slips rise out of the cup ---- */
.jr--nb .cs-cup { position: absolute; aspect-ratio: 766 / 862; z-index: 6; }
.jr--nb .cs-cup > img, .jr--nb .cs-cupfront { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.jr--nb .cs-cupfront img { width: 100%; height: 100%; display: block; }
.jr--nb .cs-cup > img, .jr--nb .cs-cupfront img { filter: drop-shadow(0 .25cqw .3cqw rgba(0,0,0,.25)); }
.jr--nb .cs-cupfront { z-index: 5; } .jr--nb .cs-cupback { z-index: 1; }
.jr--nb .cs-title { position: absolute; z-index: 7; display: block; transform: rotate(-4deg) scale(.4); opacity: 0; transition: transform .6s cubic-bezier(.2,1.4,.35,1) .9s, opacity .2s ease .9s; filter: drop-shadow(.2cqw .5cqw .5cqw rgba(0,0,0,.3)); }
.jr--nb .cs-title img { width: 100%; height: auto; display: block; }
.jr--nb .jr__leaf.is-flipped + .jr__leaf .cs-title { transform: rotate(-4deg); opacity: 1; }
.jr--nb .cs-strip { position: absolute; z-index: 3; display: block; transform-origin: 50% 100%; transform: rotate(var(--a, 0deg)) translateY(110%);
  transition: transform .7s cubic-bezier(.25,1.4,.4,1) var(--d, .3s); filter: drop-shadow(.15cqw .35cqw .4cqw rgba(0,0,0,.3)); }
.jr--nb .cs-strip img { width: 100%; height: 100%; display: block; }
.jr--nb .jr__leaf.is-flipped + .jr__leaf .cs-strip { transform: rotate(var(--a, 0deg)); }
.jr--nb .cs-strip:hover { transform: rotate(var(--a, 0deg)) translateY(-3%) !important; transition: transform .3s ease !important; }
.jr__strip .cs-strip { transform: rotate(var(--a, 0deg)); transition: none; } .jr__strip .cs-title { transform: rotate(-4deg); opacity: 1; transition: none; }
@media (prefers-reduced-motion: reduce) { .jr--nb .cs2-cam, .jr--nb .cs2-frame, .jr--nb .cs-strip, .jr--nb .cs-title { transition: none; } }

/* book-review page: slips and the ransom title sit like paper on the shelf drawing; exec licences are plain tilted cards */
.jr--nb .rz { filter: drop-shadow(0 .1cqw .1cqw rgba(0,0,0,.45)) drop-shadow(.3cqw .6cqw .5cqw rgba(0,0,0,.3)); }

/* ---- bookshelf page: skinny spines with a title label; a book pops out on hover and opens its review ---- */
.jr--nb .bshelf { position: absolute; left: 4cqw; right: 4cqw; top: 19cqw; bottom: 5cqw; z-index: 5; display: flex; flex-direction: column; justify-content: space-between; padding: 3cqw 1.2cqw 4.8cqw;
  background: linear-gradient(180deg, #ecdab4, #dcc293); border: 2.2cqw solid #84532d; border-radius: 1cqw; box-shadow: inset 0 0 3.4cqw rgba(60,30,10,.5), .5cqw 1.4cqw 1.8cqw rgba(0,0,0,.4); }
.jr--nb .bsr { position: relative; display: flex; align-items: flex-end; justify-content: center; gap: .55cqw; height: 31cqw; }
.jr--nb .bsr::after { content: ""; position: absolute; left: -1.4cqw; right: -1.4cqw; bottom: -3.6cqw; height: 3.6cqw; z-index: 0; border: .4cqw solid #1a1410; border-radius: .4cqw;
  background: repeating-linear-gradient(97deg, rgba(60,25,5,.22) 0 .22cqw, transparent .22cqw 2.8cqw), linear-gradient(#bd7f48, #9a6334); box-shadow: 0 1.2cqw 1.4cqw rgba(0,0,0,.35); }
.jr--nb .bk { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; flex: none; width: var(--w); height: var(--h); box-sizing: border-box; padding: 4.4cqw .5cqw; color: #2a1a14; text-decoration: none;
  background-color: var(--c); border: .4cqw solid #1a1410; border-radius: var(--rad, 1cqw) var(--rad, 1cqw) .3cqw .3cqw; transform-origin: 50% 100%;
  box-shadow: inset .4cqw 0 0 rgba(255,255,255,.2), inset -.6cqw 0 .7cqw rgba(0,0,0,.2); background-repeat: no-repeat;
  transition: transform .3s cubic-bezier(.2,1.5,.4,1), box-shadow .3s; }
.jr--nb .bk span { writing-mode: vertical-rl; display: block; max-height: 100%; box-sizing: border-box; padding: .7cqw .15cqw; overflow: hidden; background: rgba(255,248,236,.92); border: .25cqw solid #1a1410; border-radius: .9cqw;
  font: 700 var(--fs, 2.8cqw)/1.04 "Caveat", "Gochi Hand", cursive; letter-spacing: .02em; text-align: center; }
.jr--nb .bk--band { background-image: linear-gradient(rgba(255,255,255,.55), rgba(255,255,255,.55)), linear-gradient(rgba(255,255,255,.55), rgba(255,255,255,.55)); background-size: 100% .8cqw, 100% .8cqw; background-position: 0 1.6cqw, 0 calc(100% - 1.6cqw); }
.jr--nb .bk--dot { background-image: radial-gradient(circle at 50% 2.5cqw, rgba(255,255,255,.75) 0 .8cqw, #1a1410 .85cqw 1.1cqw, transparent 1.15cqw), radial-gradient(circle at 50% calc(100% - 2.3cqw), rgba(255,255,255,.75) 0 .8cqw, #1a1410 .85cqw 1.1cqw, transparent 1.15cqw); }
.jr--nb .bk--stripe { background-image: repeating-linear-gradient(0deg, rgba(0,0,0,.3) 0 .35cqw, transparent .35cqw 1cqw), repeating-linear-gradient(0deg, rgba(0,0,0,.3) 0 .35cqw, transparent .35cqw 1cqw); background-size: 100% 3cqw, 100% 3cqw; background-position: 0 .6cqw, 0 calc(100% - .6cqw); }
.jr--nb .bk--star { background-image: radial-gradient(circle at 50% 2.4cqw, #f6d54a 0 .75cqw, transparent .8cqw), radial-gradient(circle at 50% calc(100% - 2.2cqw), #f6d54a 0 .75cqw, transparent .8cqw); }
.jr--nb .bk::before { content: attr(data-r); position: absolute; left: 50%; top: -3.6cqw; padding: .3cqw 1.2cqw; border-radius: 2cqw; background: #1a1410; color: #fff; font: 600 2.3cqw "IBM Plex Mono", monospace; white-space: nowrap; opacity: 0; transform: translate(-50%, 1.4cqw) scale(.6); transition: opacity .2s, transform .3s cubic-bezier(.2,1.5,.4,1); pointer-events: none; }
.jr--nb .bk:hover, .jr--nb .bk:focus-visible { z-index: 10; transform: translateY(-5.2cqw) scale(1.1); box-shadow: inset .4cqw 0 0 rgba(255,255,255,.2), inset -.6cqw 0 .7cqw rgba(0,0,0,.2), 1.1cqw 2cqw 1.8cqw rgba(0,0,0,.42); outline: none; }
.jr--nb .bk:hover::before, .jr--nb .bk:focus-visible::before { opacity: 1; transform: translate(-50%, 0) scale(1); }
@media (prefers-reduced-motion: reduce) { .jr--nb .bk, .jr--nb .bk::before { transition: none; } }

/* ---- book stack page: hand-lettered horizontal spines; hover slides a book out and shows its rating ---- */
.jr--nb .bstack { position: absolute; left: 0; right: 0; top: 29cqw; bottom: 4cqw; z-index: 5; display: flex; flex-direction: column; justify-content: center; }
.jr--nb .sp { position: relative; flex: none; display: flex; align-items: center; box-sizing: border-box; width: var(--w); height: calc(var(--h) * .9); margin: -.2cqw 0 0 var(--o);
  padding: 0 2.6cqw; overflow: visible; background-color: var(--bg); border: .45cqw solid #14110f; border-radius: .8cqw; text-decoration: none; color: #14110f;
  box-shadow: .5cqw .8cqw 1cqw rgba(0,0,0,.28), inset 0 .3cqw 0 rgba(255,255,255,.22), inset 0 -.4cqw .6cqw rgba(0,0,0,.14);
  transition: transform .32s cubic-bezier(.2,1.4,.4,1), box-shadow .3s; }
.jr--nb .sp > i, .jr--nb .sp > b, .jr--nb .sp .frame > i { font-style: normal; font-weight: 400; line-height: 1; white-space: nowrap; flex: none; position: relative; z-index: 1; }
.jr--nb .sp .frame { display: flex; align-items: center; gap: 1.2cqw; padding: .8cqw 2cqw; border: .5cqw double #b8893a; background: rgba(255,255,255,.45); }
.jr--nb .sp .sq { flex: none; width: 4cqw; height: 4cqw; margin-left: 2cqw; border: .45cqw solid #14110f; background: #fff; }
.jr--nb .sp .sq.round { border-radius: 50%; }
.jr--nb .sp .orn { flex: none; align-self: stretch; width: 4cqw; margin: 1.2cqw 0; border: .4cqw solid #d6453d; border-radius: .6cqw; opacity: .85; }
.jr--nb .sp .lab { flex: none; margin: 0 2cqw; padding: .5cqw 1.2cqw; background: #fff; border: .35cqw solid #14110f; font: 700 2cqw/1.1 "Bebas Neue", sans-serif; letter-spacing: .1em; text-align: center; text-transform: uppercase; }
.jr--nb .sp::after { content: attr(data-r); position: absolute; right: 1.4cqw; top: 50%; z-index: 3; padding: .5cqw 1.2cqw; transform: translateY(-50%) scale(0); transform-origin: center;
  background: #fffaf0; border: .4cqw solid #14110f; border-radius: 999px; font: 700 3.2cqw/1 "Caveat", cursive; color: #14110f; transition: transform .25s cubic-bezier(.2,1.6,.4,1); pointer-events: none; }
@media (hover: hover) {
  .jr--nb .sp:hover, .jr--nb .sp:focus-visible { z-index: 6; transform: translateX(7cqw) rotate(-1.4deg) scale(1.03); box-shadow: 1.2cqw 1.8cqw 1.8cqw rgba(0,0,0,.36), inset 0 .3cqw 0 rgba(255,255,255,.22); outline: none; }
  .jr--nb .sp:hover::after, .jr--nb .sp:focus-visible::after { transform: translateY(-50%) scale(1); }
}
.jr--nb .sp:active { transform: translateX(2cqw) scale(.99); }
@media (prefers-reduced-motion: reduce) { .jr--nb .sp, .jr--nb .sp::after { transition: none; } }

/* ---- back-cover patch: turns the book back to its cover ---- */
.jr--nb .jr__boardR .jr__backpatch { position: absolute; left: 24%; top: 32%; width: 52%; padding: 0; border: 0; background: none; cursor: pointer; transform: rotate(-6deg);
  filter: drop-shadow(0 .5cqw .6cqw rgba(0,0,0,.4)); transition: transform .3s cubic-bezier(.2,1.5,.4,1); }
.jr--nb .jr__boardR .jr__backpatch img { display: block; width: 100%; height: auto; }
.jr--nb .jr__boardR .jr__backpatch:hover, .jr--nb .jr__boardR .jr__backpatch:focus-visible { transform: rotate(4deg) scale(1.08); outline: none; }
@media (prefers-reduced-motion: reduce) { .jr--nb .jr__boardR .jr__backpatch { transition: none; } }

/* only the face that is turned toward the reader takes clicks and hovers (the hidden side's pieces used to sit on top of it) */
.jr--nb .jr__leaf.is-flipped > .jr__front, .jr--nb .jr__leaf:not(.is-flipped) > .jr__back { pointer-events: none; }

/* hover without flicker: pieces that move/rotate/scale on hover get an invisible halo so they can't slide out from under the cursor and bounce */
/* the halo lives INSIDE the link (a / button), never on the .pc wrapper: a wrapper pseudo-element sits on top of the link and swallowed every click */
.jr--nb .pc > a, .jr--nb .pc > button { position: relative; display: block; }
.jr--nb .pc > a::before, .jr--nb .pc > button::before, .jr--nb .cs-strip::before { content: ""; position: absolute; inset: -1cqw; }
.jr--nb .sp::before { content: ""; position: absolute; top: -.3cqw; bottom: -.3cqw; left: -8.5cqw; right: -1cqw; }
.jr--nb .sp { transition-duration: .22s; }

/* belt and braces for backface-visibility: Safari and some GPUs let sticker pieces (anything with a filter) show through a turned page as a mirrored copy,
   so each face is also switched off outright, at the half-way point of the 1s page turn */
.jr__leaf > .jr__front { visibility: visible; transition: visibility 0s linear .38s; }
.jr__leaf > .jr__back { visibility: hidden; transition: visibility 0s linear .38s; }
.jr__leaf.is-flipped > .jr__front { visibility: hidden; }
.jr__leaf.is-flipped > .jr__back { visibility: visible; }
@media (prefers-reduced-motion: reduce) { .jr__leaf > .jr__front, .jr__leaf > .jr__back { transition-delay: 0s; } }

/* page-turn stacking fixes
   1. The z-index swap that moves a turning page above/below its neighbours used to fire at .45s, but the page passes the 90-degree
      (edge-on) point at ~.38s of the 1s turn. For ~70ms the page was on the new side but still stacked under the page already there,
      so it vanished behind it and popped back (the "pages overlapping" flicker). Swap at the true half-way point instead.
   2. Safari only honours backface-visibility reliably on a face that has its own 3D layer, otherwise the turned-over cover/page
      shows through as a mirrored copy on top of the next page. Give each front face its own layer. */
.jr__leaf { transition: transform 1s cubic-bezier(.5,.04,.2,1), z-index 0s .38s; }
.jr__front { transform: translateZ(.1px); -webkit-transform: translateZ(.1px); }
.jr__leaf { -webkit-transform-style: preserve-3d; }
