/* The interactive workspace page: one picture filling the whole window, with
   the header on top (it inverts over the picture like on the other pages). */

.page-workspace {
  overflow: hidden;
  height: 100vh;
  height: 100svh;
}

/* The black strip sits on top of the picture (the picture itself still fills
   the whole window, so the dots keep their places). */
.page-workspace .site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
}

.ws {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #111;
  cursor: ew-resize;
  touch-action: none; /* swiping looks around instead of scrolling */
}

.ws__status {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 1.25rem;
  z-index: 10;
  margin: 0;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.ws__status.is-done {
  opacity: 0;
}

/* ---- On the About page: the picture sits behind, the page slides over it ---- */

.has-workspace .site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
}

.ws--behind {
  touch-action: pan-y; /* on a phone, a vertical swipe still scrolls the page */
}

/* The transparent opening where you see the picture. Together with the header
   it is exactly one screen tall. */
.ws-hero {
  position: relative;
  height: calc(100vh - var(--hv-header, 4rem));
  height: calc(100svh - var(--hv-header, 4rem));
  touch-action: pan-y;
  cursor: ew-resize;
}

.ws-hero .ws__status {
  position: absolute;
  bottom: 1.25rem;
}

.ws-hero__cue {
  position: absolute;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 30;
}

/* While the picture is still loading, the "Loading" note takes this spot. */
.ws-hero:has(.ws__status:not(.is-done):not(:empty)) .ws-hero__cue {
  display: none;
}

/* The white sheet that slides over the picture. */
.ws-sheet {
  position: relative;
  z-index: 1;
  background: var(--color-paper, #fff);
  border-radius: var(--radius-image, 12px) var(--radius-image, 12px) 0 0;
  /* shadow along the top edge, and along the bottom where the playground begins */
  box-shadow: 0 -14px 28px -12px rgba(0, 0, 0, 0.28), 0 14px 28px -10px rgba(0, 0, 0, 0.22);
  padding-bottom: var(--page-inset, 0.875rem);
}

/* The page's own white sheet (see playground.css) is also the layer that
   would put the picture on top of the playground at the bottom of the page,
   so on this page it is not a separate layer: only the .ws-sheet above is
   white, and the playground sits over the picture. */
.has-workspace .page-shell--over {
  position: static;
  z-index: auto;
  background: transparent;
  box-shadow: none;
}

.has-workspace .cp--reveal {
  background: var(--color-paper, #fff);
}

/* The playground only shows once the picture is fully covered (workspace.js
   adds "ws-covered"); the picture is hidden then, so they never overlap. */
.has-workspace .cp--reveal {
  visibility: hidden;
}

.has-workspace.ws-covered .cp--reveal {
  visibility: visible;
}

.has-workspace.ws-covered .ws--behind {
  visibility: hidden;
}


/* ---- The "i" button and the little window it opens ---- */

.ws-info__btn {
  position: absolute;
  right: calc(var(--page-inset, 0.875rem) + 2rem);
  bottom: 1.25rem;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  color: #fff;
  border: 3px solid currentColor;
  border-radius: 0; /* a sharp square, like the logo */
  cursor: pointer;
  z-index: 30; /* above the soft blur along the bottom of the screen */
  mix-blend-mode: difference; /* inverts over the picture, like the menu */
  transition: transform 0.2s ease;
}

.ws-info__btn:hover {
  transform: scale(1.1); /* grows a little, like the menu items */
}

.ws-info__btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

.ws-info__btn svg {
  width: 1.4rem;
  height: 1.4rem;
}

@media (max-width: 640px) {
  .ws-info__btn {
    right: calc(var(--page-inset, 0.875rem) + 1rem);
    width: 2.4rem;
    height: 2.4rem;
  }
}

/* The window sits above the "i" button, lined up with the right margin. It is
   part of the opening screen, so it scrolls with the page, and the page can be
   scrolled while it is open. */
.ws-info {
  position: absolute;
  right: calc(var(--page-inset, 0.875rem) + 2rem);
  bottom: calc(1.25rem + 2.75rem + 0.75rem);
  z-index: 30;
  width: min(22rem, calc(100vw - 2 * var(--page-inset, 0.875rem) - 2rem));
  max-height: calc(100% - 2rem - 4.5rem);
  display: flex;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.97);
  transform-origin: bottom right; /* grows out of the button */
  transition: opacity 0.22s ease, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.3s;
}

.ws-info.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.22s ease, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (max-width: 640px) {
  .ws-info {
    right: calc(var(--page-inset, 0.875rem) + 1rem);
    bottom: calc(1.25rem + 2.4rem + 0.75rem);
    width: min(22rem, calc(100vw - 2 * var(--page-inset, 0.875rem) - 1rem));
  }
}

.ws-info__card {
  position: relative;
  width: 100%;
  overflow: auto;
  padding: 1.5rem;
  background: var(--color-paper, #fff);
  color: var(--color-ink, #111);
  border-radius: var(--radius-image, 14px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.ws-info__title {
  margin: 0 2.5rem 0.5rem 0;
  font-family: var(--font-display, inherit);
  font-size: 1.35rem;
  line-height: 1.2;
}

.ws-info__text {
  margin: 0 0 1.1rem;
  line-height: 1.5;
}

.ws-info__photo {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: calc(var(--radius-image, 14px) - 4px);
  background: #e7e7e7;
}

.ws-info__photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ws-info__ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: #8a8a8a;
}

.ws-info__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  color: inherit;
  border: 2px solid currentColor;
  border-radius: 0;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.ws-info__close:hover {
  transform: scale(1.1);
}

.ws-info__close svg {
  width: 1rem;
  height: 1rem;
}

/* ---- The dots pinned to things in the room -------------------------------
   The dots live in a layer over the picture and are moved by
   assets/js/workspace.js, which keeps each one on its own item as the room
   turns. Hovering a dot opens its card; clicking brings the item to the
   middle and holds the room still until you close it. */

.ws-spots {
  position: fixed;
  inset: 0;
  z-index: 16; /* over the picture and the soft blur, under the menu */
  pointer-events: none; /* only the dots themselves can be clicked */
  opacity: 0;
  transition: opacity 0.8s ease;
}

.ws-spots.is-ready {
  opacity: 1;
}

.ws-spot {
  /* A point with no size of its own: the dot and the card hang off it, so
     neither is trapped inside a box. */
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  --x: -100px; /* where its item is on the screen, set by workspace.js */
  --y: -100px;
  --spot-near: 1; /* 1 in the middle of the window, smaller towards the edges */
}

/* While one dot is open the others step back. */
.ws-spots.has-pinned .ws-spot:not(.is-pinned) {
  opacity: 0.35;
}

.ws-spot.is-pinned {
  z-index: 3;
}

.ws-spot:hover,
.ws-spot:focus-within {
  z-index: 2;
}

/* ---- The dot ---- */
.ws-spot__dot {
  position: absolute;
  top: 0;
  left: 0;
  width: 1rem;
  height: 1rem;
  padding: 0;
  background: #fff;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  opacity: calc(0.35 + 0.65 * var(--spot-near));
  transform: translate(calc(var(--x) - 50%), calc(var(--y) - 50%)) scale(var(--spot-near));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 2px 12px rgba(0, 0, 0, 0.55);
  transition: opacity 0.25s ease;
}

.ws-spot__dot:hover,
.ws-spot__dot:focus-visible,
.ws-spot.is-pinned .ws-spot__dot {
  transform: translate(calc(var(--x) - 50%), calc(var(--y) - 50%)) scale(calc(var(--spot-near) * 1.4));
  opacity: 1;
}

.ws-spot__dot:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

/* The ring that keeps pulsing out of the dot. */
.ws-spot__dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  animation: ws-ping 2.6s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}

.ws-spot.is-pinned .ws-spot__dot::after {
  animation: none;
}

@keyframes ws-ping {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  70%,
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

/* ---- The words ----
   No card and no panel: the words are written out in the air over the room,
   with a small looping video or a few photos under them. They hang to the
   right of the dot, or to the left when there is no room (workspace.js adds
   "is-left"), . */
.ws-spot__card {
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: 16rem;
  opacity: 0;
  visibility: hidden;
  --card-x: 1.75rem; /* its distance from the dot */
  --card-y: -50%;
  transform: translate(calc(var(--card-x) - 6px), var(--card-y));
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.4s;
}

.ws-spot.is-left .ws-spot__card {
  --card-x: calc(-100% - 1.75rem);
  transform: translate(calc(var(--card-x) + 6px), var(--card-y));
  text-align: right;
}

.ws-spot.is-pinned .ws-spot__card,
.ws-spot:focus-within .ws-spot__card {
  opacity: 1;
  visibility: visible;
  transform: translate(var(--card-x), var(--card-y));
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (hover: hover) {
  .ws-spot:hover .ws-spot__card {
    opacity: 1;
    visibility: visible;
    transform: translate(var(--card-x), var(--card-y));
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
}

.ws-spot__title,
.ws-spot__text {
  margin: 0;
  color: #fff;
  /* keeps the words readable over the bright parts of the room */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 2px 16px rgba(0, 0, 0, 0.75), 0 0 36px rgba(0, 0, 0, 0.6);
}

/* Your pixel typeface (also declared in playground.css; the same file). */
@font-face {
  font-family: "DMTO Pixel";
  src: url("../fonts/DMTOPixel.woff2") format("woff2"),
       url("../fonts/DMTOPixel.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.ws-spot__title {
  font-family: "DMTO Pixel", var(--font-display, sans-serif);
  font-size: 1.5rem;
  line-height: 1.1;
  min-height: 1.1em; /* keeps the line from jumping while it is written */
}

/* "Open page >" under the words, for dots that lead somewhere. */
.ws-spot__go {
  display: inline-block;
  margin-top: 0.6rem;
  min-height: 1.1em;
  color: #fff;
  font-family: "DMTO Pixel", var(--font-display, sans-serif);
  font-size: 1.1rem;
  line-height: 1.1;
  text-decoration: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 2px 16px rgba(0, 0, 0, 0.75), 0 0 36px rgba(0, 0, 0, 0.6);
}

.ws-spot__go--hint {
  margin-bottom: 0;
}

a.ws-spot__go:hover,
a.ws-spot__go:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.ws-spot__go.is-typing::after {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 1em;
  margin-left: 0.12em;
  background: #fff;
  vertical-align: -0.14em;
  animation: ws-caret 1s steps(1) infinite;
}

.ws-spot__text {
  margin-top: 0.3rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* The little bar that blinks at the end of the line being written. */
.ws-spot__title.is-typing::after,
.ws-spot__text.is-typing::after {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 1em;
  margin-left: 0.12em;
  background: #fff;
  vertical-align: -0.14em;
  animation: ws-caret 1s steps(1) infinite;
}

@keyframes ws-caret {
  50% {
    opacity: 0;
  }
}

/* ---- The video or photos under the words ---- */
.ws-spot__media {
  position: relative;
  width: 11rem;
  margin-top: 0.85rem;
  overflow: hidden;
  border-radius: calc(var(--radius-image, 14px) - 4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  pointer-events: none; /* nothing here can be clicked */
}

.ws-spot.is-left .ws-spot__media {
  margin-left: auto; /* stays under the words when they are right-aligned */
}

.ws-spot__media--photos {
  aspect-ratio: 4 / 3;
}

.ws-spot__media--video {
  aspect-ratio: 16 / 9;
}

.ws-spot__shot,
.ws-spot__media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

.ws-spot__media iframe,
.ws-win__body iframe,
.ws-lightbox__media iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* The photos cross-fade from one to the next. */
.ws-spot__shot {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ws-spot__shot.is-on {
  opacity: 1;
}

/* On a phone the words sit along the bottom of the window instead of beside
   the dot, where there is no room for them. */
@media (max-width: 640px) {
  .ws-spot__card,
  .ws-spot.is-left .ws-spot__card {
    position: fixed;
    top: auto;
    left: var(--page-inset, 0.875rem);
    right: var(--page-inset, 0.875rem);
    bottom: calc(var(--page-inset, 0.875rem) + 0.5rem);
    width: auto;
    text-align: left;
    --card-x: 0;
    --card-y: 12px;
    transform: translate(0, var(--card-y));
  }

  .ws-spot.is-pinned .ws-spot__card,
  .ws-spot:focus-within .ws-spot__card {
    --card-y: 0;
  }

  .ws-spot.is-left .ws-spot__media {
    margin-left: 0;
  }


  .ws-spot__dot {
    width: 1.25rem;
    height: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ws-spot__dot::after {
    animation: none;
  }
}

/* ---- Placing new dots (open the page with ?place at the end) ---- */
.ws-place {
  display: none;
}

.ws-placing .ws-place {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 40;
  display: block;
  width: min(22rem, calc(100vw - 2rem));
  max-height: 60vh;
  overflow: auto;
  padding: 0.9rem 1rem;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  border-radius: 12px;
  font-size: 0.8rem;
  line-height: 1.45;
}

.ws-placing .ws {
  cursor: crosshair;
}

.ws-place h2 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
}

.ws-place p {
  margin: 0 0 0.6rem;
  opacity: 0.75;
}

.ws-place__readout,
.ws-place__list {
  display: block;
  margin: 0 0 0.6rem;
  padding: 0.5rem 0.6rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  white-space: pre-wrap;
}

.ws-place button {
  margin-right: 0.4rem;
  padding: 0.35rem 0.8rem;
  background: #fff;
  color: #111;
  border: 0;
  border-radius: 7px;
  font: inherit;
  cursor: pointer;
}


/* While the laptop is showing a dot's picture or video, nothing is shown
   under the dot's words. */
.ws-spots.on-laptop .ws-spot__media {
  display: none;
}

/* A dot's picture or video, as a little window that pops up on the laptop's
   screen (in the style of the Mac the laptop is). */
.ws-screen__quad > .ws-feature {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ws-screen__quad > .ws-feature.is-on {
  opacity: 1;
}

.ws-win {
  width: 62%;
  overflow: hidden;
  border-radius: 12px;
  background: #1e1e1e;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 22px 60px rgba(0, 0, 0, 0.55), 0 6px 14px rgba(0, 0, 0, 0.35);
  transform: translateY(14px) scale(0.9);
  transition: transform 0.4s cubic-bezier(0.2, 1.25, 0.35, 1);
}

.ws-feature.is-on .ws-win {
  transform: none;
}

.ws-win__bar {
  position: relative;
  display: flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  background: linear-gradient(#e9e9e9, #d8d8d8);
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
}

.ws-win__lights {
  display: flex;
  gap: 8px;
}

.ws-win__lights i {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.2);
}

.ws-win__lights i:nth-child(2) {
  background: #febc2e;
}

.ws-win__lights i:nth-child(3) {
  background: #28c840;
}

.ws-win__title {
  position: absolute;
  left: 0;
  right: 0;
  padding: 0 80px;
  overflow: hidden;
  color: #3c3c3c;
  font: 600 13px/34px -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-win__body {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}

.ws-win__body--photos {
  aspect-ratio: 4 / 3;
}

.ws-win__body video,
.ws-win__body .ws-spot__shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ws-screen--feature .ws-screen__quad {
  background: transparent;
}

/* The thermos, drawn again over the monitor's video. */
.ws-front {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---- The two screens: a video or picture bent onto each one ---- */
.ws-screens {
  position: fixed;
  inset: 0;
  z-index: 15; /* over the picture, under the dots */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.ws-screens.is-ready {
  opacity: 1;
}

.ws-screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.ws-screen__quad {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  overflow: hidden;
  background: #000;
  /* a little less bright than the file, like the screens in the picture */
  filter: brightness(0.93) contrast(1.02);
}

.ws-screen__quad video,
.ws-screen__quad img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- A dot's picture or video, big in the middle of the window ---- */
.ws-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 1.25rem 2rem;
  background: rgba(8, 8, 8, 0.62);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}

.ws-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease;
}

.ws-lightbox__close {
  position: absolute;
  top: var(--page-inset, 0.875rem);
  right: var(--page-inset, 0.875rem);
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.ws-lightbox__stage {
  display: flex;
  justify-content: center;
  width: 100%;
  transform: scale(0.96);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ws-lightbox.is-open .ws-lightbox__stage {
  transform: none;
}

.ws-lightbox .ws-lightbox__media {
  --aspect: 1.7778;
  width: min(92vw, calc(72vh * var(--aspect)));
  margin: 0;
  aspect-ratio: var(--aspect);
  border-radius: var(--radius-image, 14px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.ws-lightbox__title,
.ws-lightbox__text {
  max-width: min(92vw, 40rem);
  margin: 0;
  color: #fff;
  text-align: center;
}

.ws-lightbox__title {
  margin-top: 1.4rem;
  font-family: "DMTO Pixel", var(--font-display, sans-serif);
  font-size: 1.75rem;
  line-height: 1.1;
}

.ws-lightbox__text {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.ws-lightbox__title:empty,
.ws-lightbox__text:empty {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .ws-lightbox,
  .ws-lightbox__stage {
    transition: none;
  }
}


/* ---- The notebook flipbook ---- */
.ws-book {
  --page-ratio: 0.6526; /* width / height of one page (set by the script) */
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3.5rem 1.25rem 1.25rem;
  background: rgba(8, 8, 8, 0.7);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}

.ws-book.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease;
}

.ws-book__close {
  position: absolute;
  top: var(--page-inset, 0.875rem);
  right: var(--page-inset, 0.875rem);
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.ws-book__desk {
  perspective: 2600px;
  perspective-origin: 50% 40%;
  display: flex;
  justify-content: center;
  width: 100%;
  transform: scale(0.94);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ws-book.is-open .ws-book__desk {
  transform: none;
}

/* The open book: two pages side by side. Its height is whatever fits. */
.ws-book__book {
  --h: min(calc(100vh - 9rem), calc(94vw / (var(--page-ratio) * 2)));
  position: relative;
  height: var(--h);
  width: calc(var(--h) * var(--page-ratio) * 2);
  transform-style: preserve-3d;
  filter: drop-shadow(0 22px 40px rgba(0, 0, 0, 0.55));
}

.ws-book__base,
.ws-book__leaf {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
}

.ws-book__base {
  left: 0;
  z-index: 0;
  background: #f2efe6;
  border-radius: 6px 0 0 6px;
  overflow: hidden;
}

.ws-book__leaf {
  left: 50%;
  transform-origin: 0 50%;
  transform-style: preserve-3d;
  transition: none;
}

.ws-book__leaf.is-turning {
  transition: transform 0.9s cubic-bezier(0.45, 0.05, 0.25, 1);
}

.ws-book__leaf.is-flipped {
  transform: rotateY(-180deg);
}

.ws-book__face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #f2efe6;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.ws-book__face--front {
  border-radius: 0 6px 6px 0;
}

.ws-book__face--back {
  transform: rotateY(180deg);
  border-radius: 6px 0 0 6px;
}

.ws-book__face img,
.ws-book__base img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* A shadow that sweeps over a page while it turns. */
.ws-book__face::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0) 60%);
  opacity: 0;
  pointer-events: none;
}

.ws-book__face--back::after {
  background: linear-gradient(270deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0) 60%);
}

.ws-book__leaf.is-turning .ws-book__face::after {
  animation: ws-book-shade 0.9s ease-in-out;
}

@keyframes ws-book-shade {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* The soft crease down the middle. */
.ws-book__gutter {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 1.6rem);
  width: 3.2rem;
  z-index: 500;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.16) 48%, rgba(0,0,0,0.22) 50%, rgba(0,0,0,0.16) 52%, rgba(0,0,0,0) 100%);
}

.ws-book__bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  color: #fff;
  font-family: "DMTO Pixel", var(--font-display, sans-serif);
  font-size: 1.1rem;
}

.ws-book__nav {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1.4rem;
  cursor: pointer;
}

.ws-book__nav:disabled {
  opacity: 0.3;
  cursor: default;
}

.ws-book__count {
  min-width: 8rem;
  text-align: center;
}

/* One page at a time on a narrow portrait screen. */
.ws-book.is-single .ws-book__book {
  --h: min(calc(100vh - 10rem), calc(92vw / var(--page-ratio)));
  width: calc(var(--h) * var(--page-ratio));
}

.ws-book.is-single .ws-book__leaf {
  left: 0;
  width: 100%;
}

.ws-book.is-single .ws-book__gutter {
  display: none;
}

.ws-book.is-single .ws-book__face--front {
  border-radius: 6px;
}

.ws-book.is-single .ws-book__leaf.is-flipped {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease 0.5s;
}

.ws-book.is-single .ws-book__leaf.is-turning.is-flipped {
  transition: transform 0.9s cubic-bezier(0.45, 0.05, 0.25, 1), opacity 0.35s ease 0.5s;
}

@media (prefers-reduced-motion: reduce) {
  .ws-book,
  .ws-book__desk,
  .ws-book__leaf.is-turning {
    transition: none;
  }
  .ws-book__leaf.is-turning .ws-book__face::after {
    animation: none;
  }
}
