:root {
  --desk: #e3d9ca;
  --reader-ink: #293d3d;
}

html { scroll-behavior: auto; }
body {
  color: var(--reader-ink);
  background: radial-gradient(ellipse at 50% 18%, #f0e8dc, var(--desk) 75%);
}
[hidden] { display: none !important; }

.book {
  min-height: calc(100svh - 77px);
  padding: 24px 16px 27px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 24px;
}

.leaf {
  display: flex;
  position: relative;
  width: max-content;
  box-shadow: 0 2px 4px #49331c37, 0 8px 0 -4px #e6d8c3,
    0 10px 0 -4px #c8b8a0, 0 23px 44px -20px #36230b77;
}
.leaf .page { zoom: var(--page-scale, .75); }
.leaf:not(.paired) .page { border-radius: 2px 5px 5px 2px; }

@media (min-width: 1081px) {
  .paired:after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(50% - 20px);
    width: 40px;
    background: linear-gradient(90deg, transparent, #42321c24 49%, #42321c36 50%, #fff6df25 55%, transparent);
    pointer-events: none;
  }
}

.reader-controls {
  position: sticky;
  z-index: 10;
  bottom: 0;
  min-height: 77px;
  padding: 8px max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: minmax(0, 7.5rem) minmax(7rem, 11.75rem) minmax(0, 7.5rem);
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 3vw, 20px);
  background: #f6efe4f7;
  border-top: 1px solid #cdbda5;
}
.reader-controls button {
  min-height: 44px;
  padding: 4px 8px;
  color: #263d3e;
  border: 1px solid #ae9980;
  border-radius: 2px;
  background: #fcf8ef;
  font: 400 17px Text, Georgia, serif;
}
.reader-controls button:hover:not(:disabled) { background: #ede1d0; }
.reader-controls button:disabled { opacity: .48; cursor: default; }
.reader-index { text-align: center; }
.reader-index p { margin: 0 0 3px; font: 400 16px Text, Georgia, serif; }
.reader-index div { display: flex; justify-content: center; gap: 14px; }
.reader-index a { font: 600 11px Sans, sans-serif; text-underline-offset: 3px; }
.contents a:hover { text-decoration: underline; text-underline-offset: .16em; }
:focus-visible { outline: 2px solid #9a5e45; outline-offset: 3px; }

@media (prefers-reduced-motion: no-preference) {
  .turn-forward .page:last-child { animation: turn-from-right 420ms ease-out both; transform-origin: left center; }
  .turn-back .page:first-child { animation: turn-from-left 420ms ease-out both; transform-origin: right center; }
  .turn-forward .page:last-child,
  .turn-back .page:first-child { z-index: 1; }
  @keyframes turn-from-right {
    from { transform: perspective(1700px) rotateY(-20deg); opacity: .76; }
    to { transform: perspective(1700px) rotateY(0); opacity: 1; }
  }
  @keyframes turn-from-left {
    from { transform: perspective(1700px) rotateY(20deg); opacity: .76; }
    to { transform: perspective(1700px) rotateY(0); opacity: 1; }
  }
}

@media (max-width: 1080px) {
  .book { padding: 15px 12px 20px; }
  .leaf .page:is(.intro, .contents, .kitchen-guide, .chapter, .recipe, .map-page, .map-key) {
    zoom: 1;
    width: var(--mobile-page-width, min(calc(100vw - 24px), 650px));
    height: auto;
    min-height: clamp(480px, 114vw, 780px);
    padding: clamp(23px, 6vw, 57px) clamp(20px, 6vw, 63px) 64px;
  }
  .page .folio { bottom: 23px; }
  .left .folio { left: 23px; }
  .right .folio { right: 23px; }
  .page h2, .recipe h2.long { font-size: clamp(36px, 9vw, 62px); }
  .intro-copy, .chapter .chapter-copy { font-size: 17px; }
  .intro .window, .chapter .chapter-window, .map-page .divider { display: none; }
  .chapter { justify-content: start; }
  .contents-grid { gap: 0; grid-template-columns: 1fr; }
  .toc-row { font-size: 16px; padding: 8px 0; }
  .equipment-grid { grid-template-columns: 1fr; }
  .equipment-tile { grid-template-columns: 73px 1fr; min-height: 0; }
  .tool-icon { width: 73px; height: 84px; }
  .equipment-icon { width: 72px; }
  .map-entries { margin-top: 24px; }
  .map-entry { grid-template-columns: 42px 1fr; gap: 10px; }
  .map-entry > svg { width: 40px; height: 40px; }
  .recipe .split { display: block; }
  .recipe .split .method { padding: 0; border: 0; margin-top: 26px; }
  .recipe .flow-columns { column-count: 1; }
  .recipe-body { font-size: 17px; line-height: 1.53; }
  .recipe .ingredient, .recipe .step, .recipe .bullet { margin-bottom: 6px; }
  .leaf .page:not([hidden]) { animation-name: var(--mobile-turn, none); }
  .turn-forward { --mobile-turn: turn-from-right; }
  .turn-back { --mobile-turn: turn-from-left; }
  .turn-forward .page:not([hidden]),
  .turn-back .page:not([hidden]) { animation-duration: 420ms; animation-timing-function: ease-out; }
}

@media (prefers-reduced-motion: reduce) {
  .leaf .page { animation: none !important; }
}

@media screen and (max-width: 650px) {
  .leaf #back-cover {
    zoom: 1;
    width: var(--mobile-page-width);
    height: auto;
    padding: 44px clamp(31px, 8.2vw, 52px) 38px;
  }
  #back-cover .cover-frame { inset: 12px; }
  #back-cover .cover-frame:before { inset: 3px; }
  #back-cover .cover-frame:after { inset: 6px; }
  #back-cover .table-window {
    position: relative;
    inset: auto;
    width: 78%;
    max-width: 310px;
    height: auto;
    aspect-ratio: 1;
    margin: 0 auto;
    padding: 4px;
  }
  #back-cover .table-window img { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); }
  #back-cover .jacket-copy { position: static; margin: 27px auto 0; }
  #back-cover .jacket-copy h2 { font-size: clamp(28px, 6.6vw, 37px); }
  #back-cover .jacket-break { display: none; }
  #back-cover .jacket-bridge { margin-top: 12px; font-size: 18px; }
  #back-cover .jacket-copy .divider { width: 39px; margin: 18px auto; }
  #back-cover .jacket-description { font-size: 16px; line-height: 1.5; max-width: 400px; }
  #back-cover .jacket-edition { position: static; margin-top: 29px; font-size: 11px; }
}

/* Fit all seven contents groups on the facing page at full book size. */
@media print, (min-width: 1081px) {
  #contents .contents-group { margin-bottom: 14px; }
  #contents .contents-section { padding-bottom: 5px; margin-bottom: 5px; }
  #contents .toc-row { padding-block: 2px; }
  html[lang|="ar"] #contents .toc-row { font-size: 16px; line-height: 1.25; }
}

@media screen and (max-width: 1080px) {
  html[lang="en"] #recipe-35 .status { top: auto; }
  #recipe-35 > .family-credit,
  #recipe-05 > .family-credit {
    position: static;
    margin: 20px 0 0;
  }
}
