/* PHOTOS · styles for the full-screen views in zshoots/modes/*.js (Mood board canvas, Scrapbook book) */

.mb:focus,
.bk:focus {
  outline: none !important;
}

/* ======================================================================
   Mood board (drawn on a canvas)
   ====================================================================== */
.mb {
  position: relative;
  height: var(--zs-avail, calc(100dvh - 150px));
  overflow: hidden;
  border-radius: 18px;
  background: radial-gradient(120% 90% at 50% 0%, #15161d, #08090c 70%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), 0 30px 80px -30px rgba(0, 0, 0, .8);
  outline: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  color: #ecebe6;
}

.mb-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, .1) 1px, transparent 1.5px);
  pointer-events: none;
}

.mb-canvas {
  position: absolute;
  inset: 0;
  display: block;
  cursor: grab;
}

.mb.is-panning .mb-canvas {
  cursor: grabbing;
}

/* Mood chips: jump straight to a colour */
.mb-moods {
  position: absolute;
  left: 12px;
  top: 12px;
  right: 228px;
  z-index: 2;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.mb-moods::-webkit-scrollbar {
  display: none;
}

.mb-mood {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px 0 9px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 99px;
  background: rgba(14, 14, 18, .72);
  color: rgba(236, 235, 230, .85);
  font: 600 12px var(--font-ui);
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}

.mb-mood:hover {
  border-color: var(--c);
  background: rgba(30, 30, 36, .9);
}

.mb-mood i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 10px var(--c);
}

.mb-mood small {
  font-weight: 500;
  color: rgba(236, 235, 230, .45);
}

.mb-controls {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 99px;
  background: rgba(14, 14, 18, .82);
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .8);
  transform: translateX(-50%);
}

.mb-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 99px;
  background: transparent;
  color: rgba(236, 235, 230, .75);
  cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .15s ease;
}

.mb-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}

.mb-btn:active {
  transform: scale(.92);
}

.mb-btn svg {
  width: 16px;
  height: 16px;
}

.mb-zoom {
  flex: none;
  min-width: 44px;
  font: 600 11px var(--font-mono, monospace);
  text-align: center;
  color: rgba(236, 235, 230, .6);
}

.mb-sep {
  flex: none;
  width: 1px;
  height: 20px;
  margin: 0 3px;
  background: rgba(255, 255, 255, .1);
}

.mb-scale input {
  width: 80px;
  accent-color: #ecebe6;
}

.mb-map {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 2;
  width: 200px;
  height: 130px;
  border-radius: 10px;
  background: rgba(8, 8, 11, .82);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1), 0 10px 30px -10px rgba(0, 0, 0, .8);
  cursor: pointer;
}

@media (max-width: 760px) {
  .mb-moods {
    right: 12px;
    top: auto;
    bottom: 62px;
  }

  .mb-map {
    width: 112px;
    height: 73px;
  }

  .mb-scale,
  .mb-sep {
    display: none;
  }
}

/* ======================================================================
   Memory book
   ====================================================================== */
.bk {
  --paper: #f4ecdc;
  --paper-2: #ebe0c9;
  --ink: #2d2a6e;
  --hand: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive;
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  gap: 12px;
  height: var(--zs-avail, calc(100dvh - 150px));
  padding: 22px 18px 12px;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 18px;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Aged wood desk */
.bk-desk {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: #3a2618;
  background-image:
    radial-gradient(90% 70% at 50% 45%, rgba(255, 210, 150, .16), transparent 70%),
    repeating-linear-gradient(92deg, rgba(0, 0, 0, .14) 0 2px, transparent 2px 9px, rgba(255, 220, 170, .04) 9px 11px, transparent 11px 23px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .35' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .12 0 0 0 0 .06 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #4a3020, #2c1c11);
  box-shadow: inset 0 0 120px rgba(0, 0, 0, .55);
}

.bk-book {
  --left-stack: 6;
  --right-stack: 6;
  --flip: 0;
  position: relative;
  align-self: center;
  width: min(100%, calc((var(--zs-avail, 100dvh - 150px) - 104px) * 1.44));
  max-width: 1180px;
  aspect-ratio: 1.44;
  perspective: 2600px;
}

.bk.is-single .bk-book {
  width: min(100%, calc((var(--zs-avail, 100dvh - 150px) - 104px) * .72));
  aspect-ratio: .72;
}

/* Stitched leather cover peeking out around the pages */
.bk-cover {
  position: absolute;
  inset: -14px -16px;
  border-radius: 14px;
  background:
    radial-gradient(120% 90% at 30% 20%, rgba(255, 255, 255, .08), transparent 60%),
    linear-gradient(135deg, #5b2e22, #3c1c15);
  box-shadow: 0 40px 70px -24px rgba(0, 0, 0, .85), 0 12px 24px -10px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.bk-cover::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1.5px dashed rgba(240, 210, 170, .45);
  border-radius: 10px;
}

/* Paper edges: a stack of sheets on each side, thicker where more pages remain */
.bk-block {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  box-shadow:
    calc(var(--right-stack) * 1px) 2px 0 -1px var(--paper-2),
    calc(var(--right-stack) * .66px) 1px 0 -1px #ddd0b5,
    calc(var(--left-stack) * -1px) 2px 0 -1px var(--paper-2),
    calc(var(--left-stack) * -.66px) 1px 0 -1px #ddd0b5;
}

.bk.is-single .bk-block {
  box-shadow: calc(var(--right-stack) * 1px) 2px 0 -1px var(--paper-2), calc(var(--right-stack) * .66px) 1px 0 -1px #ddd0b5;
}

.bk-spread {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.bk.is-single .bk-spread {
  grid-template-columns: 1fr;
}

.bk-page {
  position: relative;
  overflow: hidden;
  background-color: var(--paper);
  background-image:
    radial-gradient(130% 100% at 50% 50%, transparent 60%, rgba(120, 90, 40, .16)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .35 0 0 0 0 .2 0 0 0 .12 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  container-type: inline-size;
}

/* The curve of the paper into the spine */
.bk-page.is-left {
  border-radius: 4px 0 0 4px;
  box-shadow: inset -34px 0 40px -26px rgba(70, 45, 15, .45);
}

.bk-page.is-right {
  border-radius: 0 4px 4px 0;
  box-shadow: inset 34px 0 40px -26px rgba(70, 45, 15, .45);
}

.bk.is-single .bk-page.is-right {
  border-radius: 4px;
  box-shadow: inset 22px 0 30px -24px rgba(70, 45, 15, .4);
}

.bk-spine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 40px;
  margin-left: -20px;
  background: linear-gradient(90deg, transparent, rgba(60, 35, 10, .22) 45%, rgba(255, 255, 255, .25) 50%, rgba(60, 35, 10, .22) 55%, transparent);
  pointer-events: none;
}

.bk.is-single .bk-spine {
  display: none;
}

.bk-num {
  position: absolute;
  bottom: 2.5%;
  font: 600 2.6cqw var(--hand);
}

.bk-page.is-left .bk-num { left: 5%; }
.bk-page.is-right .bk-num { right: 5%; }

/* ---------- Photos on the page ---------- */
.bk-photo {
  position: absolute;
  margin: 0;
  transform: rotate(var(--tilt));
  filter: drop-shadow(0 6px 8px rgba(60, 40, 10, .32)) drop-shadow(0 1px 1px rgba(60, 40, 10, .3));
  cursor: zoom-in;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), filter .35s ease, opacity .3s ease;
}

.bk-photo:hover,
.bk-photo:focus-visible {
  z-index: 3;
  outline: none;
  transform: rotate(var(--tilt)) translateY(-3px) scale(1.02);
  filter: drop-shadow(0 14px 16px rgba(60, 40, 10, .4)) drop-shadow(0 1px 1px rgba(60, 40, 10, .3));
}

.bk-photo.is-lifted {
  opacity: 0;
}

.bk-photo.is-selected .bk-print {
  outline: 4px solid var(--accent);
  outline-offset: 3px;
}

.bk-print {
  position: relative;
  display: block;
  overflow: hidden;
}

.bk-print img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Matte print sheen */
.bk-print::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, rgba(255, 255, 255, .14), transparent 40%, transparent 70%, rgba(0, 0, 0, .06));
  pointer-events: none;
}

.bk-photo.is-polaroid {
  padding: 4% 4% 15%;
  background: #fbfaf6;
}

.bk-photo.is-square {
  padding: 3.5%;
  background: #efe6d2;
  box-shadow: inset 0 0 0 1px rgba(120, 90, 40, .15);
}

/* Matte clipping with a deckled, hand-cut edge */
.bk-photo.is-clip .bk-print {
  clip-path: polygon(0 1%, 4% 0, 12% 1.2%, 22% 0, 35% .8%, 48% 0, 60% 1%, 73% .2%, 86% 1.2%, 100% 0, 99.2% 12%, 100% 26%, 99% 40%, 100% 55%, 99.3% 70%, 100% 86%, 99% 100%, 85% 99.2%, 70% 100%, 56% 99%, 40% 100%, 26% 99.2%, 12% 100%, 0 99%, .8% 84%, 0 70%, 1% 55%, 0 40%, .7% 25%, 0 12%);
}

.bk-cap {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 2%;
  overflow: hidden;
  font: 600 3.2cqw var(--hand);
  line-height: 1.3;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.bk-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  margin: -9px 0 0 -5px;
  border-left: 14px solid rgba(255, 255, 255, .92);
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .6));
}

/* Washi tape: translucent and patterned */
.bk-tape {
  position: absolute;
  z-index: 2;
  width: 34%;
  height: 11%;
  min-height: 14px;
  background:
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .35) 0 4px, transparent 4px 9px),
    var(--tape);
  opacity: .82;
  mix-blend-mode: multiply;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
  clip-path: polygon(2% 0, 98% 4%, 100% 50%, 97% 100%, 3% 96%, 0 52%);
}

.bk-tape.t-top {
  left: 33%;
  top: -5%;
  transform: rotate(var(--tr));
}

.bk-tape.t-side {
  right: -9%;
  bottom: 12%;
  width: 24%;
  transform: rotate(-58deg);
}

.bk-pin {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 1.5%;
  width: 4.5cqw;
  height: 4.5cqw;
  max-width: 22px;
  max-height: 22px;
  margin-left: -2.25cqw;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #d8d8dc 22%, #8b8c94 60%, #4a4b52);
  box-shadow: 1px 3px 4px rgba(0, 0, 0, .45);
}

.bk-corner {
  position: absolute;
  z-index: 2;
  width: 12%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #2a2420 50%, transparent 50%);
  opacity: .88;
}

.bk-corner.c1 { left: -2%; top: -2%; }
.bk-corner.c2 { right: -2%; top: -2%; transform: rotate(90deg); }
.bk-corner.c3 { right: -2%; bottom: -2%; transform: rotate(180deg); }
.bk-corner.c4 { left: -2%; bottom: -2%; transform: rotate(270deg); }

/* ---------- Handwriting, doodles, stamps ---------- */
.bk-note {
  position: absolute;
  z-index: 1;
  font: 700 4.2cqw/1 var(--hand);
  white-space: nowrap;
  color: var(--ink);
  transform: rotate(var(--r));
}

.bk-note small {
  font-size: .7em;
  font-weight: 500;
  opacity: .8;
}

.bk-note.is-small {
  font-size: 3.4cqw;
  font-weight: 500;
}

.bk-doodle {
  position: absolute;
  width: 7cqw;
}

.bk-heart,
.bk-star {
  display: block;
  width: 100%;
  fill: none;
  stroke: #c0394f;
  stroke-width: 2;
  stroke-linejoin: round;
  opacity: .8;
}

.bk-star {
  stroke: #c9902a;
}

.bk-ticket {
  position: absolute;
  display: grid;
  gap: 1px;
  padding: 1.2cqw 2.4cqw;
  background: #e9c873;
  color: #5a3a12;
  font: 600 1.9cqw var(--font-mono, monospace);
  letter-spacing: .06em;
  transform: rotate(var(--r));
  box-shadow: 0 3px 6px rgba(60, 40, 10, .3);
  -webkit-mask: radial-gradient(circle at 0 50%, transparent 1.4cqw, #000 1.5cqw) left / 51% 100% no-repeat, radial-gradient(circle at 100% 50%, transparent 1.4cqw, #000 1.5cqw) right / 51% 100% no-repeat;
  mask: radial-gradient(circle at 0 50%, transparent 1.4cqw, #000 1.5cqw) left / 51% 100% no-repeat, radial-gradient(circle at 100% 50%, transparent 1.4cqw, #000 1.5cqw) right / 51% 100% no-repeat;
}

.bk-ticket b {
  font-size: 2.3cqw;
  letter-spacing: .2em;
}

.bk-ticket span {
  font: 700 3.2cqw var(--hand);
  letter-spacing: 0;
}

.bk-stamp {
  position: absolute;
  display: grid;
  place-items: center;
  width: 15cqw;
  aspect-ratio: 1;
  border: 2px solid rgba(160, 40, 50, .55);
  border-radius: 50%;
  color: rgba(160, 40, 50, .6);
  text-align: center;
  transform: rotate(var(--r));
  box-shadow: inset 0 0 0 3px transparent, inset 0 0 0 4px rgba(160, 40, 50, .35);
}

.bk-stamp span {
  max-width: 80%;
  font: 700 1.6cqw var(--font-mono, monospace);
  letter-spacing: .08em;
}

.bk-stamp b {
  font: 700 3cqw var(--font-mono, monospace);
}

.bk-smudge {
  position: absolute;
  width: 14cqw;
  height: 9cqw;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(120, 90, 50, .14), transparent);
  pointer-events: none;
}

/* Title and closing pages */
.bk-title {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.2cqw;
  padding: 10%;
  text-align: center;
  color: var(--ink);
}

.bk-title-small {
  font: 500 4cqw var(--hand);
  opacity: .7;
}

/* Headings take the book's ink, not the site look's text colour (zui.css colours every h2) */
.bk :is(h1, h2, h3, p) {
  color: inherit;
}

.bk-title h2 {
  margin: 0;
  font: 700 10cqw/1 var(--hand);
  letter-spacing: 0;
}

.bk-title p {
  margin: 0;
  font: 500 4.4cqw var(--hand);
  opacity: .8;
}

.bk-title-meta {
  font: 600 2.2cqw var(--font-mono, monospace);
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .55;
}

.bk-title .bk-heart,
.bk-title .bk-star {
  width: 9cqw;
  margin-top: 2cqw;
}

/* ---------- Index tabs ---------- */
.bk-tabs {
  position: absolute;
  top: 0;
  bottom: 0;
  right: calc(var(--right-stack) * -1px - 30px);
  width: 34px;
}

.bk-tab {
  position: absolute;
  right: 0;
  width: 34px;
  height: 58px;
  padding: 0;
  border: none;
  border-radius: 0 7px 7px 0;
  background: var(--tab);
  box-shadow: 2px 2px 4px rgba(0, 0, 0, .3);
  color: #4a3420;
  font: 700 12px var(--hand);
  writing-mode: vertical-rl;
  cursor: pointer;
  transition: transform .25s ease;
}

.bk-tab:hover {
  transform: translateX(3px);
}

.bk-tab.is-past {
  opacity: .55;
}

/* ---------- The turning leaf ---------- */
.bk-leaf {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 4;
  width: 50%;
  transform-style: preserve-3d;
  pointer-events: none;
}

.bk-leaf.is-fwd {
  left: 50%;
  transform-origin: 0 50%;
}

.bk-leaf.is-back {
  left: 0;
  transform-origin: 100% 50%;
}

.bk.is-single .bk-leaf {
  left: 0;
  width: 100%;
  transform-origin: 0 50%;
}

.bk-face {
  position: absolute;
  inset: 0;
  display: grid;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.bk-face > .bk-page {
  height: 100%;
}

.bk-face.is-back {
  transform: rotateY(180deg);
}

/* Light sliding across the curling page */
.bk-face::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, calc(var(--p, 0) * .28)), rgba(255, 255, 255, calc((1 - var(--p, 0)) * var(--p, 0) * .9)) 55%, rgba(0, 0, 0, .05));
  pointer-events: none;
}

.bk-leaf.is-back .bk-face.is-front::after,
.bk-leaf.is-fwd .bk-face.is-back::after {
  background: linear-gradient(270deg, rgba(0, 0, 0, calc(var(--p, 0) * .28)), rgba(255, 255, 255, calc((1 - var(--p, 0)) * var(--p, 0) * .9)) 55%, rgba(0, 0, 0, .05));
}

/* The shadow the lifted page throws on the page underneath */
.bk-book.is-flipping .bk-spread::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: linear-gradient(90deg, rgba(40, 25, 5, calc(var(--flip) * .35)), transparent 70%);
  pointer-events: none;
}

.bk-book.flip-fwd .bk-spread::after { left: 50%; }
.bk-book.flip-back .bk-spread::after { left: 0; transform: scaleX(-1); }
.bk.is-single .bk-book.is-flipping .bk-spread::after { left: 0; width: 100%; }

/* ---------- Bar under the book ---------- */
.bk-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 99px;
  background: rgba(30, 18, 10, .6);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(255, 230, 200, .1);
  color: #f2e6d2;
}

.bk-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.bk-btn:hover:not(:disabled) {
  background: rgba(255, 230, 200, .12);
}

.bk-btn:disabled {
  opacity: .3;
  cursor: default;
}

.bk-btn svg {
  width: 17px;
  height: 17px;
}

.bk-where {
  min-width: 92px;
  font: 600 16px var(--hand);
  text-align: center;
}

/* ---------- Lifted photo ---------- */
.bk-inspect {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
}

.bk-inspect[hidden] {
  display: none;
}

.bk-lift-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 60% at 50% 45%, rgba(255, 225, 180, .12), rgba(10, 6, 2, .72));
  opacity: 0;
  transition: opacity .45s ease;
}

.bk-inspect.is-up .bk-lift-backdrop {
  opacity: 1;
}

.bk-lift {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 14px;
  perspective: 1600px;
}

.bk-lift-card {
  position: relative;
  width: min(calc(var(--ar) * (var(--zs-avail, 100dvh - 150px) - 120px)), 78vw, 980px);
  aspect-ratio: var(--ar);
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.2, .8, .2, 1);
  cursor: pointer;
}

/* No filter on the card: a filter flattens 3D and the back would never show */
.bk-inspect.is-up .bk-lift-face {
  box-shadow: 0 40px 60px -20px rgba(0, 0, 0, .6);
}

.bk-lift-card.is-turned {
  transform: rotateY(180deg) !important;
}

.bk-lift-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 10px solid #fbfaf6;
  background: #fbfaf6;
}

.bk-lift-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bk-edge {
  position: absolute;
  left: 8px;
  bottom: 4px;
  font: 700 10px var(--font-mono, monospace);
  letter-spacing: .14em;
  color: rgba(255, 140, 40, .85);
  text-shadow: 0 0 4px rgba(255, 120, 20, .6);
}

/* The back of the print: paper, pencil and a lab stamp */
.bk-lift-face.is-back {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 7%;
  box-sizing: border-box;
  transform: rotateY(180deg);
  background-color: #f3ead8;
  background-image: repeating-linear-gradient(0deg, transparent 0 27px, rgba(80, 100, 160, .12) 27px 28px);
  color: var(--ink);
}

.bk-back-date {
  font: 700 clamp(22px, 3.4vw, 40px)/1.1 var(--hand);
}

.bk-back-time,
.bk-back-place {
  font: 500 clamp(18px, 2.4vw, 28px) var(--hand);
}

.bk-back-cap {
  font: 500 clamp(16px, 2vw, 24px) var(--hand);
  opacity: .85;
}

.bk-back-tech {
  margin-top: 8px;
  font: 500 clamp(10px, 1.1vw, 13px)/1.6 var(--font-mono, monospace);
  color: rgba(45, 42, 60, .7);
}

.bk-back-stamp {
  align-self: flex-end;
  padding: 4px 8px;
  border: 1.5px solid rgba(160, 40, 50, .55);
  font: 700 11px var(--font-mono, monospace);
  letter-spacing: .14em;
  color: rgba(160, 40, 50, .65);
  transform: rotate(-6deg);
}

.bk-lift-tools {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 99px;
  background: rgba(30, 18, 10, .75);
  opacity: 0;
  transition: opacity .3s ease .2s;
}

.bk-inspect.is-up .bk-lift-tools {
  opacity: 1;
}

.bk-lift-tools button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: 99px;
  background: transparent;
  color: #f2e6d2;
  font: 600 12.5px var(--font-ui);
  cursor: pointer;
}

.bk-lift-tools button:hover {
  background: rgba(255, 230, 200, .12);
}

.bk-lift-tools svg {
  width: 15px;
  height: 15px;
}

@media (max-width: 760px) {
  .bk {
    padding: 18px 10px 10px;
  }

  .bk-tabs {
    display: none;
  }

  .bk-cover {
    inset: -8px -9px;
  }
}

/* ---------- Book looks: desk ---------- */
.bk[data-desk="linen"] .bk-desk {
  background-color: #d8cdb9;
  background-image:
    radial-gradient(90% 70% at 50% 45%, rgba(255, 255, 255, .35), transparent 70%),
    repeating-linear-gradient(0deg, rgba(120, 100, 70, .1) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(120, 100, 70, .1) 0 1px, transparent 1px 3px);
  box-shadow: inset 0 0 120px rgba(90, 70, 40, .35);
}

.bk[data-desk="slate"] .bk-desk {
  background-color: #2b3035;
  background-image:
    radial-gradient(90% 70% at 50% 40%, rgba(255, 255, 255, .08), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.6' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .8 0 0 0 0 .85 0 0 0 0 .9 0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.bk[data-desk="cork"] .bk-desk {
  background-color: #b5875a;
  background-image:
    radial-gradient(90% 70% at 50% 45%, rgba(255, 230, 190, .22), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='turbulence' baseFrequency='.35' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .2 0 0 0 0 .08 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  box-shadow: inset 0 0 120px rgba(70, 40, 10, .4);
}

.bk[data-desk="marble"] .bk-desk {
  background-color: #ece9e3;
  background-image:
    linear-gradient(118deg, transparent 38%, rgba(140, 135, 128, .28) 39%, transparent 41%),
    linear-gradient(64deg, transparent 58%, rgba(150, 145, 138, .2) 59%, transparent 60.5%),
    linear-gradient(150deg, transparent 18%, rgba(160, 155, 148, .16) 19%, transparent 20%),
    radial-gradient(90% 70% at 50% 40%, #fbfaf8, #dedad3);
  box-shadow: inset 0 0 100px rgba(90, 85, 75, .22);
}

/* ---------- Cover ---------- */
.bk[data-cover="navy"] .bk-cover { background: radial-gradient(120% 90% at 30% 20%, rgba(255, 255, 255, .08), transparent 60%), linear-gradient(135deg, #24345a, #121b33); }
.bk[data-cover="forest"] .bk-cover { background: radial-gradient(120% 90% at 30% 20%, rgba(255, 255, 255, .08), transparent 60%), linear-gradient(135deg, #2b4a36, #16281c); }
.bk[data-cover="tan"] .bk-cover { background: radial-gradient(120% 90% at 30% 20%, rgba(255, 255, 255, .1), transparent 60%), linear-gradient(135deg, #a77b4f, #6f4c2f); }
.bk[data-cover="black"] .bk-cover { background: radial-gradient(120% 90% at 30% 20%, rgba(255, 255, 255, .07), transparent 60%), linear-gradient(135deg, #2a2a2a, #0e0e0e); }

/* ---------- Paper ---------- */
.bk[data-paper="white"] { --paper: #fbfbf8; --paper-2: #e8e7e2; }
.bk[data-paper="kraft"] { --paper: #c8a476; --paper-2: #a9855a; }
.bk[data-paper="black"] { --paper: #201f1d; --paper-2: #2e2c29; }

.bk[data-paper="grid"] .bk-page {
  background-image:
    linear-gradient(rgba(70, 110, 170, .14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70, 110, 170, .14) 1px, transparent 1px),
    radial-gradient(130% 100% at 50% 50%, transparent 60%, rgba(120, 90, 40, .16));
  background-size: 4.5cqw 4.5cqw, 4.5cqw 4.5cqw, auto;
}

.bk[data-paper="kraft"] .bk-page {
  background-image:
    radial-gradient(130% 100% at 50% 50%, transparent 55%, rgba(80, 50, 20, .25)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .22 0 0 0 0 .1 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.bk[data-paper="black"] .bk-page {
  background-image: radial-gradient(130% 100% at 50% 50%, transparent 55%, rgba(0, 0, 0, .45));
}

.bk[data-paper="black"] .bk-page.is-left { box-shadow: inset -34px 0 40px -26px rgba(0, 0, 0, .7); }
.bk[data-paper="black"] .bk-page.is-right { box-shadow: inset 34px 0 40px -26px rgba(0, 0, 0, .7); }

/* ---------- Ink ---------- */
.bk[data-ink="navy"] { --ink: #2d2a6e; }
.bk[data-ink="black"] { --ink: #1d1d1f; }
.bk[data-ink="sepia"] { --ink: #6b4423; }
.bk[data-ink="red"] { --ink: #a3242f; }
.bk[data-ink="white"] { --ink: #f1ede4; }

.bk-num {
  color: var(--ink);
  opacity: .5;
}

/* Wide handwriting runs smaller so it fits the same space */
.bk[data-font="homemade"] :is(.bk-note, .bk-cap, .bk-title-small, .bk-title h2, .bk-title p, .bk-where, .bk-tab, .bk-num, .bk-ticket span, .bk-back-date, .bk-back-time, .bk-back-place, .bk-back-cap) {
  font-size-adjust: .34;
}

.bk[data-font="shadows"] :is(.bk-note, .bk-cap, .bk-title h2, .bk-back-date) {
  font-weight: 400;
}

/* ---------- Bar extras ---------- */
.bk-bar-sep {
  width: 1px;
  height: 20px;
  margin: 0 2px;
  background: rgba(255, 230, 200, .18);
}

.bk-btn.is-label {
  display: inline-flex;
  gap: 6px;
  width: auto;
  padding: 0 12px;
  border-radius: 99px;
  font: 600 12.5px var(--font-ui);
}

.bk-btn[aria-expanded="true"] {
  background: #f2e6d2;
  color: #2b1d12;
}

/* ---------- Style panel ---------- */
.bk-style {
  position: absolute;
  left: 50%;
  bottom: 64px;
  z-index: 15;
  display: grid;
  gap: 10px;
  width: min(600px, calc(100% - 24px));
  max-height: calc(100% - 96px);
  padding: 14px 16px;
  box-sizing: border-box;
  overflow-y: auto;
  border-radius: 18px;
  background: rgba(32, 21, 13, .95);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(255, 230, 200, .1);
  color: #f2e6d2;
  transform: translateX(-50%);
  animation: bkPanel .3s cubic-bezier(.2, .8, .2, 1) both;
}

.bk-style-note {
  font-size: 12px;
  color: rgba(242, 230, 210, .7);
}

.bk-style[hidden] {
  display: none;
}

@keyframes bkPanel {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.bk-style-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bk-style-head b {
  font-size: 15px;
}

.bk-style-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 10px;
}

.bk-style-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(242, 230, 210, .55);
}

.bk-style-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.bk-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px 0 6px;
  border: 1px solid rgba(255, 230, 200, .12);
  border-radius: 99px;
  background: rgba(255, 230, 200, .05);
  color: inherit;
  font: 600 12px var(--font-ui);
  cursor: pointer;
}

.bk-opt:hover {
  background: rgba(255, 230, 200, .12);
}

.bk-opt.is-on {
  border-color: #f2e6d2;
  background: rgba(255, 230, 200, .16);
}

.bk-opt:not(:has(i)) {
  padding: 0 12px;
}

.bk-opt i {
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 17px;
  line-height: 1;
}

.bk-chip {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
}

.is-desk-walnut { background: linear-gradient(135deg, #5a3b25, #2c1c11); }
.is-desk-linen { background: #d8cdb9; }
.is-desk-slate { background: #2b3035; }
.is-desk-cork { background: radial-gradient(circle at 30% 30%, #c99a69, #9c6f45); }
.is-desk-marble { background: linear-gradient(135deg, #f5f3ef 45%, #b8b3ab 50%, #f5f3ef 55%); }
.is-cover-oxblood { background: #5b2e22; }
.is-cover-navy { background: #24345a; }
.is-cover-forest { background: #2b4a36; }
.is-cover-tan { background: #a77b4f; }
.is-cover-black { background: #1a1a1a; }
.is-paper-cream { background: #f4ecdc; }
.is-paper-white { background: #fbfbf8; }
.is-paper-kraft { background: #c8a476; }
.is-paper-grid { background: #f4ecdc linear-gradient(rgba(70, 110, 170, .3) 1px, transparent 1px) 0 0 / 5px 5px; }
.is-paper-black { background: #201f1d; }
.is-ink-navy { background: #2d2a6e; }
.is-ink-black { background: #1d1d1f; }
.is-ink-sepia { background: #6b4423; }
.is-ink-red { background: #a3242f; }
.is-ink-white { background: #f1ede4; }

.bk-style-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 230, 200, .1);
}

.bk-style-foot small {
  flex: 1;
  min-width: 180px;
  font-size: 12px;
  color: rgba(242, 230, 210, .6);
}

.bk-link {
  border: none;
  background: none;
  color: #f2e6d2;
  font: 600 12.5px var(--font-ui);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.bk-save {
  height: 32px;
  padding: 0 14px;
  border: none;
  border-radius: 99px;
  background: #f2e6d2;
  color: #2b1d12;
  font: 700 12.5px var(--font-ui);
  cursor: pointer;
}

/* ---------- Full screen over the album (app.js .zs-immersive): the view fills the window ---------- */
.zs-immersive-body .mb,
.zs-immersive-body .bk {
  border-radius: 0;
  box-shadow: none;
}

/* Room for the title and close button along the top */
.zs-immersive-body .bk {
  padding: calc(58px + env(safe-area-inset-top)) 24px calc(14px + env(safe-area-inset-bottom));
}

/* The book fits under the title row and above its own bar */
.zs-immersive-body .bk-book {
  width: min(100%, calc((var(--zs-avail) - 142px) * 1.44));
  max-width: none;
}

.zs-immersive-body .bk.is-single .bk-book {
  width: min(100%, calc((var(--zs-avail) - 142px) * .72));
}

.zs-immersive-body .mb-moods,
.zs-immersive-body .mb-map {
  top: calc(60px + env(safe-area-inset-top));
}

.zs-immersive-body .mb-controls {
  bottom: calc(14px + env(safe-area-inset-bottom));
}

@media (max-width: 760px) {
  .zs-immersive-body .bk {
    padding: calc(56px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
  }

  .zs-immersive-body .mb-moods {
    top: auto;
    bottom: calc(62px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 760px) {
  .bk-style-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .bk-btn.is-label span {
    display: none;
  }

  .bk-btn.is-label {
    width: 34px;
    padding: 0;
    justify-content: center;
  }
}
