/* The menu on screens 640px and wider: Classic ("paper" in the code), the menu cards on parchment,
 * and the header's book button that switches to Storybook ("scroll"). The Storybook book itself is
 * css/page-curl-book.css and js/page-curl-book.js, loaded by js/menu-book.js when it's chosen.
 * index.html loads this file with media="(min-width: 640px)", so phones never wait for it.
 *
 * The paper textures are SVG noise filters rather than pictures.
 */

:root {
  --parch: #f1e9da;
  --mb-ink-line: rgba(92, 66, 38, 0.28);
  /* Fine paper tooth: tiny bumps lit from the upper left. */
  --mb-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280'%3E%3Cfilter id='a' x='0' y='0' width='1' height='1'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeDiffuseLighting surfaceScale='1.5' diffuseConstant='1' lighting-color='white'%3E%3CfeDistantLight azimuth='225' elevation='60'/%3E%3C/feDiffuseLighting%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 .33 0 0 0 0 .23 0 0 0 0 .12 -.6 0 0 0 .524'/%3E%3C/filter%3E%3Cfilter id='b' x='0' y='0' width='1' height='1'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeDiffuseLighting surfaceScale='1.5' diffuseConstant='1' lighting-color='white'%3E%3CfeDistantLight azimuth='225' elevation='60'/%3E%3C/feDiffuseLighting%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 .99 0 0 0 0 .95 .6 0 0 0 -.51'/%3E%3C/filter%3E%3Crect width='280' height='280' filter='url(%23a)'/%3E%3Crect width='280' height='280' filter='url(%23b)'/%3E%3C/svg%3E");
  /* Soft, pale watercolor washes, with no hard dried edges. */
  --mb-wash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1400' height='1100'%3E%3Cfilter id='w' x='0' y='0' width='1' height='1'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.0022 .003' numOctaves='3' seed='14' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 .8 0 0 0 0 .66 0 0 0 0 .45 2.6 0 0 0 -1.42'/%3E%3CfeGaussianBlur stdDeviation='22'/%3E%3C/filter%3E%3Crect width='1400' height='1100' filter='url(%23w)'/%3E%3C/svg%3E");
}

/* ---------- The book switch in the header: Classic (spine) or Storybook (open) ---------- */
/* Placed with the other header icons in css/dark-mode.css. Storybook needs a computer-size screen, so
   the switch shows from 960px. */
.book-btn { /* hidden below 960px by css/styles.css */
  position: relative; flex: none; width: 7.4px; height: 44px; margin: 0; padding: 0; /* the spine's width, so the gaps around it are even */
  border: 0; background: transparent; color: var(--rose); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
@media (min-width: 960px) { .book-btn { display: block; } }
[data-storybook="off"] .book-btn { display: none; }
.book-btn::after { content: ""; position: absolute; inset: 0 -10px; } /* larger hit area */
.book-btn .book {
  position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; max-width: none; overflow: visible;
  fill: currentColor; transform: translate(-50%, -50%);
  transition: transform .28s cubic-bezier(0.34, 1.56, 0.64, 1); /* same spring as the menu's rosebud buttons */
}
@media (hover: hover) { .book-btn:hover .book { transform: translate(-50%, -50%) scale(1.35); } }
.book-btn:active .book { transform: translate(-50%, -50%) scale(0.94); }
.book-btn:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; border-radius: 8px; }
/* Resting states; the transition between them is animateBook() in js/menu-book.js. */
.bk-lift, .bk-spine, .bk-cover, .bk-page { transform-box: view-box; transform-origin: 0 0; }
.bk-cover, .bk-page { opacity: 0; }
.menu-book .bk-spine { opacity: 0; }
.menu-book .bk-page { opacity: 1; }

/* ---------- Parchment (Classic, and behind the Storybook book) ---------- */
/* The glow from the upper left starts just below the top edge, so the paper meets the scalloped edge
   in one flat tan with no seam. The grain sits on top so it matches the scallops' grain. */
.menu-paper .menu {
  background-color: var(--parch);
  background-image:
    var(--mb-grain),
    linear-gradient(to bottom, rgb(241, 233, 218) 0px, rgba(241, 233, 218, 0.55) 50px, rgba(241, 233, 218, 0) 170px),
    radial-gradient(110% 70% at 18% 0%, rgba(255, 252, 244, 0.7), rgba(255, 252, 244, 0) 62%),
    radial-gradient(150% 120% at 50% 42%, rgba(122, 90, 50, 0) 64%, rgba(122, 90, 50, 0.08) 100%),
    var(--mb-wash);
  background-size: 280px 280px, 100% 100%, 100% 100%, 100% 100%, 1400px 1100px;
  background-position: 0 0, 0 0, 0 0, 0 0, -220px -80px;
  background-repeat: repeat, no-repeat, no-repeat, no-repeat, repeat;
}
/* The scalloped edges become the same paper. */
.menu-paper .menu::before,
.menu-paper .menu::after {
  background-color: var(--parch);
  background-image: var(--mb-grain);
  background-size: 280px 280px;
  background-repeat: repeat;
}
.menu-paper .menu::before {
  -webkit-mask: radial-gradient(circle at 12px 12px, #000 11.5px, transparent 12px) 0 0 / 24px 12px repeat-x;
  mask: radial-gradient(circle at 12px 12px, #000 11.5px, transparent 12px) 0 0 / 24px 12px repeat-x;
}
.menu-paper .menu::after {
  -webkit-mask: radial-gradient(circle at 12px 0, #000 11.5px, transparent 12px) 0 0 / 24px 12px repeat-x;
  mask: radial-gradient(circle at 12px 0, #000 11.5px, transparent 12px) 0 0 / 24px 12px repeat-x;
}
.menu-paper .menu .group-head { border-bottom-color: var(--mb-ink-line); }
