:root {
  color-scheme: light;
  --ink: #173f3d;
  --muted: #45625b;
  --teal: #075d5d;
  --teal-dark: #084747;
  --gold: #a17832;
  --gold-light: #d8c59a;
  --paper: #fffcf2;
  --display: "Cormorant Garamond", "Baskervville", "STIX Two Text", Georgia, serif;
  --text: "DM Sans", Roboto, system-ui, sans-serif;
  font-family: var(--text);
  color: var(--ink);
  background: #e5efea;
}

*, *::before, *::after { box-sizing: border-box; }
button { font: inherit; color: inherit; }
button:enabled { cursor: pointer; }
button:focus-visible {
  outline: 2px solid #166b64;
  outline-offset: 4px;
}
body {
  margin: 0;
  min-width: 0;
  min-height: 100svh;
  background:
    radial-gradient(ellipse at 50% 20%, #fffaf0 3%, #eff7ec 51%, #c5e7df 100%);
}
body::before {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% 28%, #bb9a4f80 1px, transparent 2px),
    radial-gradient(circle at 88% 27%, #bb9a4f80 1px, transparent 2px),
    radial-gradient(circle at 16% 74%, #bb9a4f60 1.5px, transparent 3px),
    radial-gradient(circle at 92% 64%, #bb9a4f60 1.5px, transparent 3px);
  content: "";
  pointer-events: none;
}
body:has(dialog[open]) { overflow: hidden; }

.reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: min(calc(100% - 36px), 1080px);
  min-height: 65px;
  margin-inline: auto;
  padding-block: 9px;
  border-bottom: 1px solid #b3945066;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  background: none;
  text-align: left;
  font: 400 clamp(17px, 3vw, 23px)/1.04 var(--display);
}
.brand em {
  font-size: .83em;
  color: #3b6b62;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  place-items: center;
  position: relative;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  border: 1px solid #b88e44;
  background: #f8f8eb;
  color: #9a7130;
}
.crescent {
  display: block;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  box-shadow: -3.4px 2.4px 0 .2px currentColor;
  transform: translate(1px, -2px) rotate(-20deg);
}
.sparkle {
  position: absolute;
  inset: 7px 6px auto auto;
  width: 8px;
  height: 8px;
  background: currentColor;
  clip-path: polygon(50% 0, 62% 37%, 100% 50%, 62% 62%, 50% 100%, 37% 62%, 0 50%, 37% 37%);
}
.contents-toggle,
.page-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 7px 16px;
  border: 1px solid #a9c8bb;
  border-radius: 100px;
  background: #fffff6;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
  white-space: nowrap;
  touch-action: manipulation;
}
.list-icon {
  width: 13px;
  height: 10px;
  border-block: 1.5px solid currentColor;
  background: linear-gradient(currentColor, currentColor) left center / 9px 1.5px no-repeat;
}
.reader {
  --sheet-width: min(100%, 486px, max(300px, calc((100svh - 174px) * .76325)));
  position: relative;
  width: min(calc(100% - 34px), 1060px);
  margin-inline: auto;
  padding-block: clamp(19px, 3vh, 34px) 16px;
}
.book {
  width: var(--sheet-width);
  margin-inline: auto;
  position: relative;
  aspect-ratio: 1080 / 1415;
  touch-action: pan-y pinch-zoom;
}
.book-deck {
  position: absolute;
  inset: 0;
  perspective: 2100px;
}
.paper {
  position: absolute;
  inset-block: 0;
  background: var(--paper);
  border-radius: 3px 8px 8px 3px;
  container-type: inline-size;
}
.paper.left-page { border-radius: 8px 3px 3px 8px; }
.page-slot {
  width: 100%;
  box-shadow:
    2px 3px 0 #faf6e8,
    3px 5px 0 #bfcabc,
    5px 7px 0 #faf6e8,
    6px 9px 0 #bfcabc,
    8px 11px 0 #f5f1de,
    9px 13px 0 #b6c1ae,
    8px 23px 40px #24494030;
  transform-origin: left center;
  backface-visibility: hidden;
}
.page-slot.right-page { right: 0; }
.page-slot.left-page {
  left: 0;
  box-shadow:
    -2px 3px 0 #faf6e8,
    -3px 5px 0 #bfcabc,
    -5px 7px 0 #faf6e8,
    -6px 9px 0 #bfcabc,
    -8px 11px 0 #f5f1de,
    -9px 13px 0 #b6c1ae,
    -8px 23px 40px #24494030;
}
.leaf {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
}
.leaf::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #153b3522, transparent 4%, transparent 97%, #fff8e536);
  content: "";
  pointer-events: none;
}
.left-page .leaf::after {
  background: linear-gradient(270deg, #153b3530, transparent 5%, transparent 97%, #fff8e536);
}
.illustration { background: #f4e3c3; }
.illustration.cover { background: #3eb6b5; }
.illustration.custom-creations { background: #067579; }
.image-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #f4eee0;
  cursor: zoom-in;
}
.image-button:focus-visible { outline-offset: -3px; z-index: 1; }
.creation-image,
.illustration-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}
.illustration .image-button { background: transparent; }
.illustration .image-button[data-open-book] { cursor: pointer; }
.magnifier {
  position: absolute;
  z-index: 1;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid #e7d7ab;
  border-radius: 50%;
  background: #fffdf3ee;
  color: var(--teal-dark);
  box-shadow: 0 1px 5px #17363020;
  pointer-events: none;
}
.illustration .magnifier { top: 8px; right: 8px; width: 32px; height: 32px; }
.magnifier::before,
.magnifier::after { position: absolute; content: ""; }
.magnifier::before {
  width: 9px;
  height: 9px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  transform: translate(-1px, -1px);
}
.magnifier::after {
  width: 5px;
  border-top: 1.5px solid currentColor;
  transform: translate(4px, 4px) rotate(45deg);
}

.product-page {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(6px, 2cqw, 10px);
  padding: clamp(13px, 4.25cqw, 25px);
  background:
    radial-gradient(ellipse at 80% 4%, #c9e8df, transparent 46%),
    radial-gradient(ellipse at 12% 98%, #dceee4, transparent 54%),
    var(--paper);
}
.product-page::before {
  position: absolute;
  inset: clamp(5px, 1.9cqw, 9px);
  border: 1px solid #c5a56b;
  border-radius: 4px;
  content: "";
  pointer-events: none;
}
.page-heading {
  display: flex;
  align-items: center;
  gap: clamp(8px, 3cqw, 15px);
  min-width: 0;
  padding: 0 0 clamp(5px, 1.4cqw, 9px);
}
.page-heading h2 {
  margin: 0;
  font: 400 clamp(22px, 6.8cqw, 35px)/.99 var(--display);
  letter-spacing: -.03em;
}
.page-ornament {
  flex: 1;
  position: relative;
  height: 1px;
  margin-right: 6px;
  background: linear-gradient(90deg, #c29a5580, #b5904f);
}
.page-ornament::after {
  position: absolute;
  top: -6px;
  right: -5px;
  width: 12px;
  height: 12px;
  background: #ad823b;
  content: "";
  clip-path: polygon(50% 0, 62% 37%, 100% 50%, 62% 62%, 50% 100%, 37% 62%, 0 50%, 37% 37%);
}
.folio {
  justify-self: center;
  color: #806033;
  font: 400 clamp(10px, 2.55cqw, 13px)/1 var(--display);
  font-variant-numeric: tabular-nums;
}
.product-grid {
  display: grid;
  grid-auto-rows: minmax(0, 1fr);
  gap: clamp(6px, 2.4cqw, 13px);
  min-height: 0;
}
.product {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.13fr);
  min-height: 0;
  overflow: hidden;
  border: 1px solid #dfcfad;
  border-radius: 5px 13px 5px 13px;
  background: #fffdf7;
  box-shadow: 0 2px 5px #3d5f4110;
}
.product .image-button { border-inline-end: 1px solid #e4d7b8; }
.product-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(3px, 1.4cqw, 7px);
  min-width: 0;
  min-height: 0;
  padding: clamp(6px, 2.5cqw, 13px);
}
.product-name {
  margin: 0;
  font: 400 clamp(16px, 5.15cqw, 28px)/1.02 var(--display);
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}
.product-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: clamp(10px, 2.5cqw, 13px);
  font-weight: 600;
  line-height: 1.21;
}
.price {
  display: inline-flex;
  align-items: baseline;
  gap: .28em;
  flex: none;
  width: max-content;
  max-width: 100%;
  padding: .24em .56em;
  border: 1px solid #c7a457;
  border-radius: 6px 2px 6px 2px;
  color: #fff1bf;
  background: #0b5f59;
  font: 700 clamp(14px, 4.1cqw, 21px)/1 var(--display);
  white-space: nowrap;
}
.price small {
  font: 500 .55em/1.1 var(--text);
  letter-spacing: 0;
}
.product-excerpt {
  min-height: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: clamp(11px, 2.7cqw, 14px);
  line-height: 1.35;
}
.product-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px clamp(6px, 2cqw, 10px);
  flex: none;
  max-width: 100%;
  margin-top: auto;
}
.product-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  max-width: 100%;
  min-height: 34px;
  margin: 0;
  padding: 1px 4px 1px 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  text-align: left;
  font-size: clamp(11px, 2.8cqw, 13px);
  font-weight: 700;
  line-height: 1.2;
  text-underline-offset: .21em;
}
.product-link:hover { text-decoration: underline; }
.arrow {
  display: block;
  width: 8px;
  height: 8px;
  flex: none;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.arrow-left { transform: rotate(-135deg); }
.product-link .arrow { width: 6px; height: 6px; }

.product-page[data-count="3"] .product-copy {
  gap: clamp(3px, 1cqw, 5px);
  padding: clamp(5px, 2cqw, 10px);
}
.product-page[data-count="3"] .product-name { font-size: clamp(15px, 4.65cqw, 23px); }
.product-page[data-count="3"] .product-excerpt { -webkit-line-clamp: 2; }
.product-page[data-count="3"] .product-link { min-height: 26px; }
.product-page[data-count="4"] .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.product-page[data-count="4"] .product {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
}
.product-page[data-count="4"] .product .image-button { border: 0; border-bottom: 1px solid #e4d7b8; }
.product-page[data-count="4"] .product-copy {
  padding: clamp(4px, 1.75cqw, 10px);
  gap: clamp(3px, .9cqw, 6px);
}
.product-page[data-count="4"] .product-name { font-size: clamp(15px, 4.3cqw, 22px); }
.product-page[data-count="4"] .product-excerpt,
.product-page[data-count="4"] .product-subtitle { display: none; }
.product-page[data-count="4"] .product-link { min-height: 27px; }

.product-page[data-count="1"] .product {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
}
.product-page[data-count="1"] .product .image-button { border: 0; }
.product-page[data-count="1"] .product-copy {
  padding: clamp(7px, 2.6cqw, 14px);
  border-top: 1px solid #e4d7b8;
}
.product-page[data-count="1"] .product-excerpt { -webkit-line-clamp: 2; }
.featured .product {
  border-color: #b9914f;
  background: #fffcf0;
}
.featured .product-name { font-size: clamp(20px, 6.3cqw, 33px); }
.featured .product .image-button {
  background: radial-gradient(ellipse at center, #fffcf0, #d9eee5);
}

.controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(8px, 2.7vw, 18px);
  width: var(--sheet-width);
  margin: 26px auto 0;
}
#previous { justify-self: start; }
#next { justify-self: end; }
.page-button { padding-inline: clamp(9px, 3vw, 18px); }
.page-button.primary {
  border-color: #075d5d;
  background: #075d5d;
  color: #fff9e5;
}
.page-button:disabled {
  opacity: .42;
  cursor: default;
}
.contents-toggle:enabled:hover,
.page-button:not(.primary):enabled:hover,
.icon-button:enabled:hover { background: #e4f1e9; }
.page-button.primary:enabled:hover { background: #084747; }
.page-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.gesture-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.swipe-hint { display: none; }
@media (pointer: coarse) {
  .keyboard-hint { display: none; }
  .swipe-hint { display: inline; }
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.flip-sheet {
  position: absolute;
  z-index: 3;
  inset-block: 0;
  left: 50%;
  width: 50%;
  transform-origin: left center;
  transform-style: preserve-3d;
  pointer-events: none;
  animation: turn-sheet 575ms cubic-bezier(.45, .08, .3, 1) both;
}
.flip-sheet.backwards { animation-direction: reverse; }
.flip-face {
  inset: 0;
  backface-visibility: hidden;
  box-shadow: 0 9px 24px #183e382e;
}
.flip-face.left-page { transform: rotateY(180deg); }
@keyframes turn-sheet {
  from { transform: rotateY(0); }
  to { transform: rotateY(-180deg); }
}
.turn-away,
.turn-back {
  z-index: 2;
  animation: turn-single-page 510ms cubic-bezier(.45, .08, .3, 1) both;
}
.turn-back { animation-direction: reverse; }
@keyframes turn-single-page {
  from { transform: rotateY(0); }
  to { transform: rotateY(-94deg); }
}

.dialog {
  width: min(calc(100% - 24px), 640px);
  max-height: calc(100dvh - 24px);
  padding: 0;
  overflow: hidden;
  border: 1px solid #be9c5a;
  border-radius: 12px;
  background: #fffcf2;
  color: var(--ink);
  box-shadow: 0 25px 76px #13342f55;
}
.dialog::backdrop { background: #102b2bc7; }
.dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px clamp(9px, 3vw, 23px);
  border-bottom: 1px solid #dccba5;
  background: #f4f7ec;
}
.dialog-header h2 {
  min-width: 0;
  margin: 0;
  font: 400 clamp(21px, 4vw, 32px)/1.08 var(--display);
  overflow-wrap: anywhere;
}
.icon-button {
  width: 44px;
  flex: 0 0 44px;
  padding: 0;
  font-size: 25px;
  font-weight: 500;
  line-height: 1;
}
.icon-button[aria-pressed="true"] { border-color: #699b8c; background: #d9ece3; }
.icon-button:disabled { opacity: .43; }
.contents-dialog { width: min(calc(100% - 24px), 460px); }
.contents-pages { overflow: auto; padding: 8px 12px 13px; }
.contents-entry {
  display: grid;
  grid-template-columns: 31px 1fr;
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 45px;
  padding: 7px 9px;
  border: 0;
  border-bottom: 1px solid #e9dcc2;
  background: none;
  color: var(--ink);
  font-size: 14px;
  text-align: left;
}
.contents-entry:last-child { border-bottom-color: transparent; }
.contents-entry:hover,
.contents-entry[aria-current="page"] { background: #e4f0e6; }
.contents-number { font: 400 16px/1 var(--display); color: #845d24; }

.detail-scroll { overflow: auto; overscroll-behavior: contain; }
.detail-content { padding: clamp(11px, 3vw, 22px); }
.detail-content > .image-button {
  height: clamp(160px, 36dvh, 300px);
  border-radius: 8px;
}
.detail-text { padding: 10px 1px 0; }
.detail-text .price { font-size: 22px; margin: 5px 0 4px; }
.detail-text p { margin: 10px 0; font-size: 15px; line-height: 1.56; }
.detail-text .detail-subtitle { margin: 0; color: var(--muted); font-weight: 600; }
.detail-text .detail-closing { font-weight: 650; }
.detail-text h3 { margin: 12px 0 5px; font: 400 22px/1.1 var(--display); }
.product-options {
  margin: 8px 0;
  padding: 5px 0 5px 12px;
  border-left: 2px solid #c7a457;
  font-size: 14px;
  line-height: 1.5;
}
.product-options dt { font-weight: 700; }
.product-options dd { margin: 0 0 8px; }
.product-options dd:last-child { margin-bottom: 0; }

.photo-viewer {
  width: min(calc(100% - 24px), 980px);
  height: min(calc(100dvh - 24px), 900px);
}
.photo-actions { display: flex; gap: 7px; }
.photo-window {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  overflow: auto;
  padding: 8px;
  background: #eaf1e7;
  overscroll-behavior: contain;
}
.photo-preview {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.photo-window.is-zoomed { display: block; }
.photo-window.is-zoomed .photo-preview {
  width: var(--photo-zoom-width);
  max-width: none;
  max-height: none;
  margin-inline: auto;
}

@media (min-width: 900px) and (min-height: 630px) {
  .reader { --sheet-width: min(50%, 486px, calc((100svh - 179px) * .76325)); }
  .book { width: calc(var(--sheet-width) * 2); aspect-ratio: 2160 / 1415; }
  .book-deck { transition: transform 575ms cubic-bezier(.45, .08, .3, 1); }
  .book-deck.front-cover { transform: translateX(-25%); }
  .book-deck.back-cover { transform: translateX(25%); }
  .page-slot { width: 50%; }
}

@media (max-width: 520px) {
  .reader-header { min-height: 62px; width: calc(100% - 26px); }
  .brand { gap: 8px; }
  .brand-mark { width: 31px; height: 31px; flex-basis: 31px; }
  .brand em { display: block; padding-top: 2px; }
  .contents-toggle { padding-inline: 10px; font-size: 12px; }
  .reader { width: calc(100% - 28px); }
  .controls { margin-top: 24px; }
}

@container (max-width: 345px) {
  .product-page[data-count="3"] .product-excerpt { display: none; }
  .product-page[data-count="3"] .product-name { font-size: clamp(14px, 4.55cqw, 16px); }
  .product-page[data-count="3"] .product-subtitle { font-size: 10px; }
  .product-page[data-count="3"] .product-link { font-size: 10px; }
  .product-page[data-count="4"] .product-name { font-size: clamp(13px, 4.5cqw, 15px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
