/* Booklet view. Sizes inside the book use em, and booklet.js sets the book's font-size from
   its width, so a spread keeps the same proportions on any screen.
   Pages are moved by booklet.js every frame, so nothing here uses a CSS transition on transform. */

/* The stage: a quiet, slightly deeper band that sets the book off from the page */
#booklet {
  margin: 0 calc(50% - 50vw); padding: 4.5rem 0 3rem;
  /* A polished mahogany table top (photograph), with the light pooled over the book and the edges
     falling away, so the type beside the book stays easy to read */
  background-color: #3a1608;
  background-image:
    radial-gradient(120% 95% at 50% 35%, rgba(20,6,2,0.18) 0%, rgba(20,6,2,0.42) 55%, rgba(12,3,1,0.78) 100%),
    url("table-mahogany.jpg");
  background-size: 100% 100%, cover; background-position: center, center;
}
@media (min-width: 768px) { #booklet { padding: 6rem 0 3.5rem; } }

.bk-book {
  position: relative; margin: 0 auto;
  width: min(80vw, calc(80vh * 1.62)); height: 80vh;        /* the book fills about 80% of the screen */
  perspective: 3200px; perspective-origin: 50% 42%;
  touch-action: pan-y; overscroll-behavior-x: contain;
  user-select: none; -webkit-user-select: none; cursor: grab;
  opacity: 0; transform: translateY(18px) scale(0.985);
  transition: opacity 900ms ease, transform 1100ms cubic-bezier(0.22, 1, 0.36, 1);
}
.bk-open .bk-book { opacity: 1; transform: none; }
.bk-book:active { cursor: grabbing; }
@media (max-width: 767px) { .bk-book { width: 94vw; height: calc(94vw * 0.72); } }

/* The shadow under the book is a plain blurred layer. A filter on the book itself would have to be
   re-rendered on every frame of a page turn, which is what makes a flip stutter. */
.bk-book::before {
  content: ""; position: absolute; left: 3%; right: 3%; bottom: -3.2%; height: 9%;
  background: radial-gradient(50% 100% at 50% 0%, rgba(15, 4, 1, 0.9), rgba(15, 4, 1, 0) 72%);
  filter: blur(14px); z-index: 0; pointer-events: none; left: calc(var(--bk-left, 0%) + 1.5%);
}
.bk-book::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  box-shadow: 0 1px 2px rgba(40,30,20,0.25), 0 18px 40px -12px rgba(40,30,20,0.35);
  left: var(--bk-left, 0%); border-radius: 5px;
}
/* Closed: only the cover is there, so the shadows and the fold belong to the right half alone */
.bk-gutter { transition: opacity 600ms ease; }
.bk-closed .bk-gutter { opacity: 0; }

/* The stage: the book, with the description laid over its empty left half while it is closed */
.bk-stage { position: relative; width: fit-content; margin: 0 auto; }
.bk-intro {
  position: absolute; left: 0; top: 0; width: 50%; height: 100%; z-index: 2; box-sizing: border-box;
  padding: 2em 7em 2em 1em; display: flex; align-items: center; overflow: hidden;
  transition: opacity 700ms ease; color: #262626;
}
.bk-intro.off { opacity: 0; pointer-events: none; }
.bk-intro-in { width: 100%; }
.bk-intro h4 { margin: 2em 0 0; font-family: "Playfair Display", Baskerville, Georgia, serif; font-weight: 400; font-size: 2.3em; line-height: 1.35; color: #15130f; text-wrap: balance; }
.bk-intro .bk-rule { margin: 2.4em 0 0; }
.bk-intro p { margin: 1.4em 0 0; font-size: 1.12em; line-height: 1.95; font-weight: 300; color: #4d483f; max-width: 34em; }
.bk-intro p:first-of-type { margin-top: 2.2em; }
@media (max-width: 767px) {
  /* On a phone the halves are too small to read in: the description sits above the cover instead */
  .bk-intro { position: static; width: auto; height: auto; padding: 0 1.25rem 2rem; font-size: 13px !important; display: block; }
  .bk-intro.off { display: none; }
  .bk-intro-in { font-size: 1em !important; }
}

/* Page edges: a thin stack on each side that grows as pages are turned onto it */
.bk-edge { transition: opacity 500ms ease; position: absolute; top: 0.6%; bottom: 0.6%; z-index: 0; pointer-events: none;
  background: repeating-linear-gradient(to right, #f4f1ea 0, #f4f1ea 1px, #cfc9bd 1px, #cfc9bd 2px); }
.bk-edge-l { right: 100%; border-radius: 2px 0 0 2px; box-shadow: -1px 1px 3px rgba(40,30,20,0.25); }
.bk-edge-r { left: 100%;  border-radius: 0 2px 2px 0; box-shadow: 1px 1px 3px rgba(40,30,20,0.25); }

.bk-leaf {
  position: absolute; left: 50%; top: 0; width: 50%; height: 100%;
  transform-origin: left center; transform-style: preserve-3d;
}
.bk-leaf.turning { will-change: transform; }
.bk-face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: #fbfaf7; }
.bk-front { border-radius: 0 5px 5px 0; }
.bk-back { transform: rotateY(180deg); border-radius: 5px 0 0 5px; }

/* Lighting. .bk-shade darkens a face as it lifts; .bk-cast is the shadow a turning page throws on
   the page below. Both are driven each frame by booklet.js. */
.bk-shade { position: absolute; inset: 0; opacity: 0; pointer-events: none;
  background: linear-gradient(to right, rgba(20,14,8,0.55), rgba(20,14,8,1)); }
.bk-back .bk-shade { background: linear-gradient(to left, rgba(20,14,8,0.55), rgba(20,14,8,1)); }
.bk-cast { position: absolute; top: 0; bottom: 0; width: 50%; opacity: 0; pointer-events: none; z-index: 1900; }
.bk-cast-l { left: 0; } .bk-cast-r { left: 50%; }

/* The fold: shading that deepens towards the spine on both pages, with a fine crease */
.bk-spine-r, .bk-spine-l { position: absolute; top: 0; bottom: 0; width: 13%; pointer-events: none; }
.bk-spine-r { left: 0;  background: linear-gradient(to right, rgba(30,20,10,0.26) 0%, rgba(30,20,10,0.10) 18%, rgba(30,20,10,0.03) 55%, transparent 100%); }
.bk-spine-l { right: 0; background: linear-gradient(to left,  rgba(30,20,10,0.30) 0%, rgba(30,20,10,0.12) 18%, rgba(30,20,10,0.03) 55%, transparent 100%); }
.bk-gutter { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; z-index: 5000; pointer-events: none;
  background: linear-gradient(to right, rgba(0,0,0,0.22), rgba(255,255,255,0.10)); }

/* Photo page */
.bk-photo { position: absolute; inset: 0; display: block; background: #d9d6d0; }
.bk-img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.bk-veil { position: absolute; inset: 0; background: rgba(0,0,0,0.10); }

/* Text page: warm paper with a faint fibre grain */
.bk-paper {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: 5.2em 6.4em 4.6em 7.4em; color: #262626; text-decoration: none;
  background-color: #fbfaf6;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.45  0 0 0 0 0.38  0 0 0 0 0.28  0 0 0 0.055 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.bk-cover { padding: 0; cursor: pointer; color: #fff; background: #2a2622; }
.bk-cover .bk-img { position: absolute; inset: 0; transition: transform 1600ms cubic-bezier(0.22,1,0.36,1); }
.bk-cover-veil { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(20,14,8,0.50), rgba(20,14,8,0.34) 45%, rgba(20,14,8,0.62)); }
.bk-cover-in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 5em; }
.bk-eyebrow { font-size: 0.8em; letter-spacing: 0.38em; text-transform: uppercase; color: #8d867b; }
.bk-cover .bk-eyebrow { color: rgba(255,255,255,0.82); }
.bk-wordmark { margin: 3.2em 0 0; display: flex; justify-content: center; filter: drop-shadow(0 2px 18px rgba(0,0,0,0.45)); }
.bk-wordmark img { height: 11em !important; width: auto; }
.bk-wordmark > div { font-size: 0.62em; }
.bk-wordmark > span { font-size: 7.6em !important; }
.bk-wordmark > span img { height: 0.61em !important; }
.bk-wordmark > span img + img { height: 0.23em !important; }
.bk-rule { width: 3.2em; height: 1px; background: #c9c2b5; margin: 3em auto 2.4em; flex: none; }
.bk-cover .bk-rule { background: rgba(255,255,255,0.55); }
.bk-rule-left { margin: 2.2em 0 0; }
.bk-meta { margin-top: 1.2em; font-size: 0.8em; letter-spacing: 0.32em; text-transform: uppercase; color: rgba(255,255,255,0.8); }
.bk-hint { position: absolute; left: 0; right: 0; bottom: 4.2em; display: flex; align-items: center; justify-content: center; gap: 1.1em;
  font-size: 0.78em; letter-spacing: 0.36em; text-transform: uppercase; color: rgba(255,255,255,0.85); }
.bk-hint i { display: block; width: 3.4em; height: 1px; background: currentColor; transition: width 600ms cubic-bezier(0.22,1,0.36,1); }
.bk-cover:hover .bk-hint i { width: 5.4em; }

.bk-head { display: flex; justify-content: space-between; font-size: 0.78em; letter-spacing: 0.34em; text-transform: uppercase; color: #8d867b; }
.bk-title { margin: 3em 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4em 1.1em; font-weight: 400; color: #15130f; }
.bk-jp { font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif; font-size: 3.3em; line-height: 1.1; }
.bk-en { font-family: "Playfair Display", Baskerville, Georgia, serif; font-size: 1.12em; letter-spacing: 0.34em; text-transform: uppercase; }
.bk-title .bk-en:only-child { font-size: 1.9em; }
.bk-desc { margin: 2.2em 0 0; font-size: 1.1em; line-height: 1.95; font-weight: 300; color: #4d483f; max-width: 33em;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.bk-close { margin-top: 2.8em; flex: 1 1 0; min-height: 0; overflow: hidden; background: #e6e3dd; box-shadow: 0 0 0 1px rgba(60,45,25,0.08); }
.bk-foot { padding-top: 2.2em; flex: none; }
.bk-chips { display: flex; align-items: center; gap: 0.7em; }
.bk-chip { width: 3.3em; height: 3.3em; overflow: hidden; background: #e6e3dd; flex: none; box-shadow: 0 0 0 1px rgba(60,45,25,0.10); }
.bk-more { font-size: 0.85em; letter-spacing: 0.1em; color: #8d867b; margin-left: 0.4em; }
.bk-foot-row { margin-top: 1.6em; display: flex; justify-content: space-between; align-items: center;
  font-size: 0.78em; letter-spacing: 0.32em; text-transform: uppercase; color: #6f695f; }
.bk-cta { display: inline-flex; align-items: center; gap: 1em; color: #15130f; }
.bk-cta i { display: block; width: 3.2em; height: 1px; background: currentColor; transition: width 500ms cubic-bezier(0.22,1,0.36,1); }
.bk-paper:hover .bk-cta i { width: 5em; }

@media (max-width: 767px) {
  .bk-paper { padding: 4em 4em 3.4em 5em; }
  .bk-desc { -webkit-line-clamp: 4; }
}

/* Catalogue download: above the book, at its top right corner */
.bk-dl-wrap { position: absolute; right: 0; bottom: 100%; margin-bottom: 1.1rem; z-index: 3; }
.bk-dl { display: inline-flex; align-items: center; gap: 0.9rem; font-size: 10.5px; letter-spacing: 0.28em; text-transform: uppercase; color: #15130f; text-decoration: none; text-align: left; transition: opacity 300ms ease; }
.bk-dl svg { width: 12px; height: auto; flex: none; }
.bk-dl em { display: block; margin-top: 0.35rem; font-style: normal; font-size: 9.5px; letter-spacing: 0.18em; color: #8d867b; }
.bk-dl:hover { opacity: 0.6; }
@media (max-width: 767px) { .bk-dl-wrap { position: static; margin: 0 1.25rem 1.25rem; text-align: right; } }
/* On the black table everything around the book is set in light ink */
.bk-intro { color: #f3ece4; text-shadow: 0 1px 14px rgba(20,6,2,0.85); }
.bk-intro .bk-eyebrow { color: rgba(233,230,224,0.6); }
.bk-intro h4 { color: #f6f3ee; }
.bk-intro p { color: rgba(233,230,224,0.78); }
.bk-intro .bk-rule { background: rgba(233,230,224,0.35); }
.bk-dl { color: #f1eee8; }
.bk-dl em { color: rgba(233,230,224,0.55); }
#booklet [data-bk] { color: rgba(233,230,224,0.6); }
#booklet button[data-bk]:hover { color: #fff; }
.bk-book::after { box-shadow: 0 1px 2px rgba(0,0,0,0.6), 0 22px 50px -12px rgba(0,0,0,0.85); }

/* A crisp book: no stack of loose page edges at the sides, just clean pages with barely rounded corners */
.bk-edge { display: none; }

/* Page arrows: one at each side of the book, level with its middle */
.bk-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 4; padding: 1.25rem 0.75rem !important; transition: color 300ms ease, opacity 400ms ease, transform 500ms cubic-bezier(0.22,1,0.36,1); }
.bk-nav-prev { right: 100%; margin-right: clamp(0.5rem, 2.2vw, 2.5rem); }
.bk-nav-next { left: 100%; margin-left: clamp(0.5rem, 2.2vw, 2.5rem); }
.bk-nav-prev:not(:disabled):hover { transform: translate(-5px, -50%); }
.bk-nav-next:not(:disabled):hover { transform: translate(5px, -50%); }
.bk-nav:disabled { opacity: 0 !important; pointer-events: none; }
@media (max-width: 767px) {
  /* no room beside the book on a phone: the arrows drop to either side of the page count */
  .bk-nav { top: 100%; transform: none !important; margin: 1.1rem 0 0 !important; padding: 0.75rem !important; }
  .bk-nav-prev { right: auto; left: 12%; } .bk-nav-next { left: auto; right: 12%; }
}

/* Tomita orange accents in the booklet */
.bk-hint i { background: #fc8702; }
.bk-cta i { background: #fc8702; }
.bk-dl svg { color: #fc8702; }
#booklet button[data-bk]:hover { color: #fc8702; }

/* The side arrows must read clearly against the wood: bright ink, a slightly heavier line,
   and a soft dark pill behind them so the grain never swallows the stroke */
#booklet .bk-nav { color: #fff8ee; background: rgba(18, 7, 2, 0.42); border: 1px solid rgba(255, 248, 238, 0.28); border-radius: 999px;
  padding: 0.95rem 1.15rem !important; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7); transition: color 300ms ease, background-color 400ms ease, border-color 400ms ease, opacity 400ms ease, transform 500ms cubic-bezier(0.22,1,0.36,1); }
#booklet .bk-nav svg { display: block; stroke-width: 1.6; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6)); }
#booklet .bk-nav:hover { color: #fff; background: #fc8702; border-color: #fc8702; }
