/* The shared reading room. Book artwork is contained in the page images. */
:root {
  color-scheme: dark;
  color: #e8e6df;
  background: #000;
  font: 14px Arial, Helvetica, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: #000; }
body { overflow: hidden; }
button, a { color: inherit; font: inherit; touch-action: manipulation; }

.room {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100dvh;
  min-height: 360px;
  padding: 24px clamp(14px, 3vw, 44px) 20px;
  background: #000;
}

.book-header, .controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  width: min(100%, 1180px);
  margin: 0 auto;
}

.book-header h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: .04em;
  text-align: center;
}

.book-header a, .book-header span {
  color: #a6a59f;
  font-size: 10px;
  line-height: 1.4;
  text-decoration: none;
  letter-spacing: .06em;
}

.back-link { justify-self: start; white-space: nowrap; }
.book-header span { text-align: right; text-transform: uppercase; }
.book-header a:hover { color: #fff; }

.stage {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 16px 0;
  perspective: 1800px;
  background: #000;
}

.book-rig {
  --available-book-height: min(72dvh, 680px);
  display: grid;
  place-items: center;
  width: min(100%, calc(var(--available-book-height) * var(--page-ratio) * 2));
  height: var(--available-book-height);
  max-height: 100%;
  background: #000;
}

.book { position: relative; isolation: isolate; }
.book-page { position: relative; overflow: hidden; padding: 0; background: #000; }
.book-page img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; }

.book-page.--left::before,
.book-page.--right::before {
  content: '';
  position: absolute;
  inset-block: 0;
  z-index: 3;
  width: clamp(14px, 4%, 28px);
  pointer-events: none;
}
.book-page.--left::before { right: 0; background: linear-gradient(to left, #0004, #0001 42%, transparent); }
.book-page.--right::before { left: 0; background: linear-gradient(to right, #0004, #0001 42%, transparent); }

.controls { grid-template-columns: 48px 1fr 48px; max-width: 440px; }
.controls button {
  width: 46px;
  height: 42px;
  border: 1px solid #454545;
  border-radius: 50%;
  background: #000;
  cursor: pointer;
}
.controls button:hover:not(:disabled) { color: #fff; background: #151515; border-color: #96968f; }
.controls button:disabled { opacity: .28; cursor: default; }
.status { display: grid; gap: 5px; text-align: center; }
.status span { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.status small { color: #a6a59f; font-size: 9px; }
a:focus-visible, button:focus-visible { outline: 1px solid #e8e6df; outline-offset: 5px; }

@media (max-width: 700px) {
  .room { padding: 18px 10px 16px; }
  .book-header { grid-template-columns: auto minmax(0, 1fr); gap: 14px; }
  .book-header h1 { text-align: right; font-size: 13px; }
  .book-header #orientation { display: none; }
  .book-rig {
    --available-book-height: min(70dvh, 640px);
    width: min(100%, calc(var(--available-book-height) * var(--page-ratio)));
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
