* { box-sizing: border-box; }
:root {
  --paper-shadow-rgb: 20 44 77;
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #18304c;
  background: #e6eef8;
}
body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: radial-gradient(ellipse at top, #f3f8fe, #d9e6f5);
  overflow-x: clip;
}
header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .8rem max(1rem, calc((100% - 66rem) / 2));
}
h1 { margin: 0; font: 500 clamp(1.25rem, 3.5vw, 1.85rem)/1.1 Georgia, serif; }
main { display: grid; align-content: center; justify-items: center; padding: .6rem 1rem; }
#binder {
  --book-height: clamp(16rem, 63svh, 35rem);
  position: relative;
  width: min(100%, 66rem);
  perspective: 1500px;
  touch-action: none;
  user-select: none;
}
.spread {
  position: relative;
  display: grid;
  min-height: var(--book-height);
  border: 6px solid #1e3c65;
  border-radius: .7rem;
  background: #1e3c65;
  box-shadow: 0 15px 28px #19395f35;
}
.pages {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
}
.sheet { min-width: 0; position: relative; }
.details {
  background: linear-gradient(270deg, #d4e2f3, #f7fbff 8%);
  display: grid;
  align-content: center;
  padding: clamp(1.65rem, 5vw, 4.5rem);
  border-radius: .25rem 0 0 .25rem;
}
.category { color: #466181; font-size: .875rem; }
h2 { font: 500 clamp(2.35rem, 7vw, 5.5rem)/.95 Georgia, serif; margin: .35rem 0 .7rem; overflow-wrap: anywhere; }
.description { margin: 0; max-width: 30ch; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.price-row { margin-top: 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: .65rem; }
.price { margin: 0; font-size: 1.2rem; font-weight: 650; color: #234d84; }
.favorite-button {
  display: grid; place-items: center; flex: 0 0 44px; padding: 0;
  color: #375a83; border-color: #a9bfd9; border-radius: 50%;
}
.favorite-button svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round;
}
.favorite-button:hover { border-color: currentColor; }
.favorite-button[aria-pressed="true"] { color: #b82638; border-color: #ce7782; background: #fff0ef; }
.favorite-button[aria-pressed="true"] svg { fill: currentColor; }
.contact-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .9rem; }
.contact-link {
  display: inline-flex; justify-content: center; align-items: center; min-height: 44px;
  padding: .45rem .95rem; border: 1px solid #2e568c; border-radius: .4rem;
  color: #1f4e88; background: #f9fcff; font-size: .9rem; font-weight: 600; text-decoration: none;
}
.contact-link:last-child { color: #f9fcff; background: #1f4e88; }
.contact-link[href]:hover { box-shadow: inset 0 0 0 1px currentColor; }
.contact-link:disabled { opacity: 1; border-color: #aebfd4; color: #486181; background: #e5edf7; }
.contact-status { margin: .45rem 0 0; font-size: .875rem; color: #486181; }
.contact-link:focus-visible { outline: 2px solid #234d84; outline-offset: 3px; }
.preview {
  display: grid;
  place-items: center;
  background: linear-gradient(90deg, #c9dbef, #e6f0fb 8%);
  padding: clamp(1rem, 3vw, 2rem);
  border-radius: 0 .25rem .25rem 0;
}
.gallery { width: 100%; min-width: 0; display: grid; justify-items: center; gap: .5rem; }
.gallery-stage { display: grid; place-items: center; container-type: size; width: 100%; height: clamp(8rem, 41svh, 25rem); }
.gallery-frame {
  position: relative;
  width: min(100cqw, calc(100cqh * var(--photo-ratio, 1)));
  aspect-ratio: var(--photo-ratio, 1);
}
.gallery img { width: 100%; height: 100%; object-fit: contain; display: block; }
.photo-zoom {
  position: absolute; right: .2rem; bottom: .2rem;
  display: grid; place-items: center; width: 44px; padding: 0;
  border: 0; border-radius: 50%; color: #f9fcff; background: transparent;
}
.photo-zoom svg {
  width: 32px; height: 32px; padding: 7px; border-radius: 50%;
  background: #132c51a6; fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.photo-zoom:is(:hover, :focus-visible) svg { background: #132c51; }
.photo-controls { display: flex; gap: .3rem; align-items: center; font-size: .875rem; font-variant-numeric: tabular-nums; }
.photo-controls button { min-width: 44px; padding-inline: .35rem; font-size: 1.2rem; }
.photo-placeholder { color: #4a688b; font: italic 1.25rem Georgia, serif; padding: 1rem; text-align: center; }
.book-cover {
  display: block;
  position: relative;
  width: calc((100% - 12px) / 2);
  min-height: var(--book-height);
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: .3rem .85rem .85rem .3rem;
  background: #132949;
  box-shadow: .45rem .25rem 0 -.11rem #b7cde7, .65rem .45rem 0 -.08rem #203d64, 0 20px 33px #142e5350;
}
.cover-print {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: clamp(.6rem, 2svh, 1.3rem);
  width: 100%;
  height: 100%;
  min-height: inherit;
  border-radius: inherit;
  padding: 1.55rem;
  color: #eaf5ff;
  text-align: center;
  background:
    linear-gradient(90deg, #0a183366 0 3%, #b5d9ff38 3.1%, transparent 5% 92%, #07152f45 100%),
    repeating-linear-gradient(130deg, #cee6ff0d 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at 68% 17%, #315d91, #14294b 74%);
}
.cover-print::before {
  content: '';
  position: absolute;
  inset: .9rem .8rem .9rem 1.35rem;
  border: 1px solid #b5d6fa8c;
  outline: 1px solid #b5d6fa48;
  outline-offset: .25rem;
  border-radius: .12rem .45rem .45rem .12rem;
  pointer-events: none;
}
.cover-logo { width: min(44%, 10rem, 21svh); height: auto; }
.cover-title { max-width: 12ch; font: 500 clamp(1.8rem, 4.2vw, 3.75rem)/.98 Georgia, serif; text-wrap: balance; }
.cover-action {
  color: #c8e3ff; font-size: .875rem; line-height: 1.4;
  border-bottom: 1px solid #b5d6fa8c; padding: .3rem .1rem;
}
.book-cover:hover .cover-action, .book-cover:focus-visible .cover-action { color: #ffffff; border-color: #ffffff; }
.cover-transition { touch-action: none; }
.rings { position: absolute; z-index: 2; inset: 0; pointer-events: none; }
.rings i {
  position: absolute;
  left: 50%;
  width: 2.15rem;
  height: .6rem;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 2px solid #6581a4;
  background: linear-gradient(#e6f1ff, #607da3 56%, #b9cde5);
  box-shadow: 0 2px 3px #152f5177;
}
.rings i:nth-child(1) { top: 17%; }
.rings i:nth-child(2) { top: 38%; }
.rings i:nth-child(3) { top: 61%; }
.rings i:nth-child(4) { top: 82%; }
.paper-turn, .paper-mesh, .paper-segment {
  position: absolute;
  transform-style: preserve-3d;
  pointer-events: none;
}
.paper-turn {
  z-index: 1;
  inset: 0;
}
.paper-segment {
  top: 0;
  height: 100%;
}
.paper-face, .paper-underneath, .paper-shadow, .paper-print, .paper-light {
  position: absolute;
}
.paper-face, .paper-light {
  inset: 0;
}
.paper-face {
  background: #e5effa;
  backface-visibility: hidden;
  overflow: hidden;
}
.paper-reverse { transform: rotateY(180deg); }
.paper-print { top: 0; height: 100%; }
.paper-print > *, .paper-underneath > * { width: 100%; height: 100%; }
.paper-underneath { overflow: hidden; }
.paper-shadow {
  background: linear-gradient(90deg, transparent, #17365988 40%, #17365988 60%, transparent);
  filter: blur(12px);
  border-radius: .55rem;
}
footer { display: flex; gap: clamp(.25rem, 1.5vw, .75rem); flex-wrap: wrap; justify-content: center; align-items: center; padding: .55rem .75rem max(.8rem, env(safe-area-inset-bottom)); }
footer[hidden] { display: flex; visibility: hidden; }
button {
  border: 1px solid #7695b9;
  border-radius: .4rem;
  background: #f9fcff;
  color: #254264;
  font: inherit;
  font-size: .9rem;
  min-height: 44px;
  padding: .35rem .8rem;
  cursor: pointer;
}
button:disabled { opacity: .48; cursor: default; }
button:focus-visible { outline: 2px solid #234d84; outline-offset: 3px; }
output { min-width: 2.9rem; text-align: center; font-variant-numeric: tabular-nums; }
@media (orientation: portrait), (max-width: 599px) {
  main { padding: .5rem .75rem; }
  #binder { width: min(100%, 34rem); --book-height: clamp(31rem, calc(100svh - 7.5rem), 40rem); }
  .book-cover, .spread { width: 100%; height: var(--book-height); }
  .cover-title { font-size: clamp(1.9rem, 8.4vw, 3.5rem); }
  .spread { padding-left: 14px; }
  .pages { min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: 43% minmax(0, 1fr); }
  .preview { grid-row: 1; min-height: 0; padding: .65rem; border-radius: .2rem .2rem 0 0; background: #e6f0fb; }
  .gallery { height: 100%; min-height: 0; grid-template-rows: minmax(0, 1fr) auto; }
  .gallery-stage { height: 100%; min-height: 0; }
  .details { display: flex; flex-direction: column; min-height: 0; padding: .85rem 1.15rem 1rem; border-radius: 0 0 .2rem .2rem; background: #f7fbff; }
  .details > :not(.description) { flex: none; }
  h2 { font-size: clamp(1.45rem, 7vmin, 2.8rem); margin: .25rem 0 .45rem; }
  .description {
    min-height: 0; max-width: 42ch; overflow-y: auto; overscroll-behavior-y: contain;
    scrollbar-width: thin; scrollbar-color: #7695b9 transparent;
  }
  .description:focus-visible { outline: 2px solid #234d84; outline-offset: 2px; }
  .price-row { margin-top: .7rem; }
  .rings i { left: 15px; width: 1.45rem; }
  footer button { padding-inline: .5rem; font-size: .8rem; }
}
@media (orientation: landscape) and (min-width: 600px) {
  .pages > .details { grid-column: 1; grid-row: 1; }
  .pages > .preview { grid-column: 2; grid-row: 1; }
}
.photo-viewer {
  width: min(calc(100% - 1.5rem), 68rem);
  height: min(90dvh, 58rem);
  padding: 0;
  border: 1px solid #52769f;
  border-radius: 1rem;
  background: #142740;
  color: #eff6ff;
  box-shadow: 0 1.2rem 4rem #07142395;
}
.photo-viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.photo-viewer::backdrop { background: #091729d9; }
body:has(.photo-viewer[open]) { overflow: hidden; }
.viewer-bar, .viewer-tools { display: flex; align-items: center; gap: .5rem; padding: .65rem .8rem; }
.viewer-bar { justify-content: space-between; border-bottom: 1px solid #304861; }
.viewer-bar h2 { margin: 0; font: 500 clamp(.95rem, 3.8vw, 1.35rem)/1.25 system-ui, sans-serif; }
.viewer-tools { justify-content: center; border-top: 1px solid #304861; }
.photo-viewer button { min-width: 44px; border-color: #6486ad; background: #243e60; color: #eff6ff; }
.photo-viewer button:hover:not(:disabled) { background: #345783; }
.photo-viewer :focus-visible { outline: 2px solid #9bcaff; outline-offset: -3px; }
.viewer-viewport { overflow: auto; overscroll-behavior: contain; background: #0c192c; }
.viewer-viewport.is-zoomed { cursor: grab; }
.viewer-viewport.is-dragging { cursor: grabbing; }
.viewer-canvas {
  display: flex; width: max-content; height: max-content; min-width: 100%; min-height: 100%; padding: 12px;
}
.viewer-canvas img { display: block; flex: none; margin: auto; user-select: none; }
