:root {
  --ink: #2a1711;
  --gold: #c69a55;
  --paper: #f6f0e7;
  --line: rgba(220, 182, 112, .24);
}

* {
  box-sizing: border-box;
}

body {
  background: #000;
}

.flipbook-experience {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #000;
  overflow: hidden;
}

.book-header,
.reader-footer {
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px clamp(18px, 4vw, 60px);
  color: #832729;
  background: #ffffff;
  border-color: var(--line);
}

.book-header {
  min-height: 58px;
  border-bottom: 1px solid var(--line);
}

.reader-footer {
  min-height: 50px;
  border-top: 1px solid var(--line);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: .18em;
}

.brand-lockup img{
  height: 80px;
}

.brand-name {
  font-size: clamp(15px, 2vw, 20px);
  font-weight: bold;
}

.brand-rule {
  width: 1px;
  height: 20px;
  background: var(--gold);
}

.brand-subtitle {
  font-size: 10px;
  letter-spacing: .28em;
}

.header-actions {
  display: flex;
  gap: 6px;
}

.icon-button,
.footer-action,
.page-nav,
.zoom-toolbar button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(238, 212, 168, .32);
  border-radius: 50%;
  font-size: 22px;
}

.reader-shell {
  min-height: 0;
  position: relative;
  display: flex;
  background: #ffffff;
  /* background: radial-gradient(ellipse at center, #1b1b1b 0, #060606 57%, #000 100%); */
}

.reader-area {
  min-width: 0;
  flex: 1;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.reader-area::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, #fff, transparent 10%, transparent 90%, #fff);
  opacity: .48;
}

.zoom-scroller {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 8px 58px;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.zoom-scroller::-webkit-scrollbar {
  display: none;
}

/* StPageFlip sizes itself from this host. A 2:1 host makes a true desktop spread. */
.book-stage {
  width: min(calc(100vw - 116px), calc((100dvh - 106px)*2));
  height: min(calc((100vw - 116px)/2), calc(100dvh - 106px));
  transform-origin: center;
  transition: transform .25s ease;
  filter: drop-shadow(0 20px 22px rgba(0, 0, 0, .75));
}

.page {
  background: var(--paper);
  overflow: hidden !important;
  min-height: auto !important;
}

.page canvas {
  display: block;
  width: 100%;
  height: auto;
  /* object-fit: contain; */
  background: var(--paper);
}

.page-loading {
  height: 100%;
  display: grid;
  place-items: center;
  color: #9a7c56;
  font-size: 11px;
  letter-spacing: .2em;
}

.page-nav {
  position: absolute;
  z-index: 3;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 64px;
  color: #832729;
  font-size: 54px;
  line-height: .7;
  opacity: .8;
  text-shadow: 0 2px 8px #000;
}

.page-nav:hover {
  opacity: 1;
}

.previous {
  left: 4px;
}

.next {
  right: 4px;
}

.thumbnails {
  position: absolute;
  z-index: 4;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  overflow: hidden;
  background: #ffffff;
  transition: width .25s ease;
  border-right: 1px solid transparent;
}

.thumbnails.is-open {
  width: min(258px, 76vw);
  border-color: var(--line);
  box-shadow: 10px 0 30px rgba(0, 0, 0, .7);
}

.thumbnail-list {
  height: 100%;
  overflow-y: auto;
  padding: 18px 16px;
}

.thumbnail {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0 0 13px;
  padding: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: #e3d0ae;
  text-align: left;
  cursor: pointer;
}

.thumbnail.is-active {
  border-color: var(--gold);
  background: rgba(198, 154, 85, .1);
}

.thumbnail canvas {
  width: 68px;
  height: 68px;
  object-fit: cover;
  background: #ede1cf;
}

.thumbnail span {
  font-size: 11px;
  letter-spacing: .12em;
  color: #832729;
}

.page-status {
  font-size: 13px;
  letter-spacing: .13em;
  color: #832729;
}

.status-divider {
  padding: 0 8px;
  color: #832729;
}

.footer-action {
  font-size: 11px;
  letter-spacing: .12em;
  color: #832729;
}

.footer-action:first-child {
  visibility: hidden;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: #832729;
  background: #ffffff;
  transition: opacity .55s, visibility .55s;
}

.loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid #832729;
  border-radius: 50%;
  font-size: 25px;
  color: #832729;
}

.loading-screen p {
  margin: 8px 0 0;
  letter-spacing: .16em;
  font-size: 13px;
}

.loading-progress {
  font-size: 11px;
  color: #832729;
}

.zoom-dialog {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: 0;
  background: #000;
  color: #f5e8d1;
}

.zoom-dialog::backdrop {
  background: #000;
}

.zoom-toolbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: .12em;
}

.zoom-toolbar button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  font-size: 20px;
}

.zoom-canvas-wrap {
  height: calc(100dvh - 58px);
  overflow: auto;
  display: grid;
  place-items: start center;
  padding: 24px;
}

.zoom-canvas-wrap canvas {
  max-width: none;
  background: var(--paper);
  box-shadow: 0 12px 40px #000;
}

@media (max-width:700px) {

  .desktop-control,
  .footer-action span {
    display: none;
  }

  .book-header {
    min-height: auto;
    padding: 13px 18px;
  }

  .brand-lockup img {
    height: 50px;
  }

  .reader-footer {
    min-height: 54px;
    padding: 10px 18px;
  }

  .footer-action:first-child {
    visibility: visible;
  }

  .zoom-scroller {
    padding: 14px 36px;
  }

  .book-stage {
    width: calc(100vw - 72px);
    height: calc(100vw - 72px);
    max-width: 560px;
    max-height: 560px;
  }

  .reader-area,
  .book-stage,
  #flipbook {
    touch-action: none;
  }

  .flipbook-experience{
    min-height:auto;
  }

  .reader-area::after {
    display: none;
  }

  .page-nav {
    width: 34px;
    font-size: 42px;
  }

  .previous {
    left: 0;
  }

  .next {
    right: 0;
  }

  .brand-name {
    font-size: 16px;
  }

  .brand-subtitle {
    font-size: 8px;
  }

  .thumbnails.is-open {
    width: 220px;
  }
}

@media (prefers-reduced-motion:reduce) {

  .book-stage,
  .thumbnails,
  .loading-screen {
    transition: none;
  }
}