/* The unbound album is a readable contact sheet even without JavaScript. */
.scrapbook {
  --sand:#f0e8d9;
  --ivory:#fffaf0;
  --book-ink:var(--navy);
  background:var(--sand);
  color:var(--book-ink);
  scroll-margin-top:0;
}
.album-layout { padding:clamp(25px,4vw,54px) var(--edge); }
.album-layout h2 { text-align:center; color:var(--book-ink); margin-bottom:24px; }
.album-intro { text-align:center; color:var(--muted); font-size:clamp(14px,1.6vw,17px); }
.album-book { width:min(100%,880px); margin:auto; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
.album-leaf { display:contents; }
.album-face {
  position:relative; min-width:0; min-height:0; display:grid; place-items:center;
  gap:5%; padding:9% 9% 11%; background:var(--ivory); color:var(--book-ink);
}
.album-face[data-photos="2"] { grid-template-rows:repeat(2,minmax(0,1fr)); }
.album-photo { min-width:0; min-height:0; max-width:100%; height:100%; display:grid; align-content:center; justify-items:center; }
.open-photo {
  position:relative; display:block; max-width:100%; background:white; padding:3px;
  box-shadow:0 2px 4px #51483233; transform:rotate(-.7deg);
  -webkit-tap-highlight-color:transparent;
}
.album-photo:nth-of-type(even) .open-photo,.verso .album-photo:first-child .open-photo { transform:rotate(.7deg); }
.open-photo img { display:block; width:100%; height:auto; aspect-ratio:var(--ratio); object-fit:cover; }
.open-photo::after {
  content:""; position:absolute; width:29%; height:clamp(7px,1.1vw,13px); top:0; left:36%;
  background:#ead6a3dc; transform:translateY(-45%) rotate(-5deg);
  clip-path:polygon(2% 0,98% 0,96% 30%,100% 65%,97% 100%,0 100%,3% 60%,0 32%);
}
.verso .open-photo::after { background:#c2d5d0db; transform:translateY(-45%) rotate(6deg); }
.scrap-sticker {
  --overhang:clamp(-20px,-2vw,-8px);
  position:absolute; width:clamp(36px,9vw,105px); aspect-ratio:1; pointer-events:none;
  background-image:url('assets/album-doodles.webp'); background-size:400% 400%;
  filter:drop-shadow(0 1px 1px #58482926);
}
.is-bound .scrap-sticker { width:clamp(36px,22cqw,105px); --overhang:clamp(-20px,-4cqw,-8px); }
.sticker-rings { background-position:0% 0%; left:var(--overhang); bottom:var(--overhang); transform:rotate(-11deg); }
.sticker-pinwheel { background-position:33.333333% 0%; right:var(--overhang); top:var(--overhang); transform:rotate(13deg); }
.sticker-camera { background-position:66.666667% 0%; left:var(--overhang); top:var(--overhang); transform:rotate(-12deg); }
.sticker-jasmine { background-position:100% 0%; right:var(--overhang); bottom:var(--overhang); transform:rotate(14deg); }
.sticker-notebook { background-position:0% 33.333333%; left:var(--overhang); bottom:var(--overhang); transform:rotate(-13deg); }
.sticker-plane { background-position:33.333333% 33.333333%; right:var(--overhang); top:var(--overhang); transform:rotate(8deg); }
.sticker-marigolds { background-position:66.666667% 33.333333%; left:var(--overhang); top:var(--overhang); transform:rotate(11deg); }
.sticker-kolam { background-position:100% 33.333333%; right:var(--overhang); bottom:var(--overhang); transform:rotate(-8deg); }
.sticker-bus { background-position:0% 66.666667%; left:var(--overhang); top:var(--overhang); transform:rotate(-7deg); }
.sticker-charminar { background-position:33.333333% 66.666667%; right:var(--overhang); top:var(--overhang); transform:rotate(7deg); }
.sticker-cricket { background-position:66.666667% 66.666667%; left:var(--overhang); bottom:var(--overhang); transform:rotate(-12deg); }
.sticker-coffee { background-position:100% 66.666667%; right:var(--overhang); top:var(--overhang); transform:rotate(8deg); }
.sticker-paws { background-position:0% 100%; right:var(--overhang); top:var(--overhang); transform:rotate(14deg); }
.sticker-letter { background-position:33.333333% 100%; left:var(--overhang); top:var(--overhang); transform:rotate(-14deg); }
.sticker-shell { background-position:66.666667% 100%; right:var(--overhang); top:var(--overhang); transform:rotate(-12deg); }
.sticker-sun { background-position:100% 100%; right:var(--overhang); bottom:var(--overhang); transform:rotate(6deg); }
.folio { position:absolute; left:6%; bottom:3.5%; font:500 10px/1 var(--text); letter-spacing:.08em; color:#6d7061; }
.verso .folio { left:auto; right:6%; }
.cloth {
  grid-column:1/-1; overflow:hidden; color:#f0d49b; border-radius:2px 6px 6px 2px;
  background:linear-gradient(90deg,#111e36,#334965 2%,#192b48 4%,transparent 8%),
    repeating-linear-gradient(0deg,transparent 0 3px,#ffffff06 3px 4px),#223853;
}
.cloth::before {
  content:""; position:absolute; inset:6.5% 7% 6.5% 10%; border:1px solid #cfba8b9c;
  box-shadow:inset 0 0 0 3px #223853,inset 0 0 0 4px #cfba8b47; pointer-events:none;
}
.cover-inscription {
  position:absolute; inset:0; display:grid; place-items:center; border:0; background:transparent;
  color:inherit; padding:10% 10% 10% 13%;
}
.cover-inscription:focus-visible { outline:3px solid #fff4b2; outline-offset:-13px; }
.cover-lettering { display:grid; justify-items:center; gap:.08em; font:400 clamp(25px,4.7vw,66px)/1.02 var(--display); letter-spacing:-.05em; }
.cover-lettering small {
  display:flex; align-items:center; gap:.5em; color:#efd9ab;
  font:italic 400 .56em/1.3 Georgia,serif;
}
.cover-lettering small::before,.cover-lettering small::after { content:""; width:.9em; height:1px; background:currentColor; opacity:.7; }
/* Let the invitation scroll past the book just like any other section. */
.is-bound .album-layout {
  display:grid; justify-items:center; gap:clamp(16px,2.8svh,28px);
  padding:clamp(36px,5vw,76px) max(12px,3.7vw);
}
.album-controls {
  display:flex; align-items:baseline; justify-content:center; flex-wrap:wrap;
  gap:4px 14px; min-height:22px; font:400 13px/1.5 var(--text); text-align:center;
}
.album-status { color:#52615b; font-variant-numeric:tabular-nums; }
#turn-hint:not([hidden]) + .album-status { border-inline-start:1px solid #b2a892; padding-inline-start:14px; }
.album-desk { position:relative; }
.album-fallback { width:fit-content; margin:0 auto 16px; cursor:pointer; }
.is-bound .album-fallback { display:none; }
.is-bound .album-desk { touch-action:pan-y pinch-zoom; user-select:none; -webkit-user-select:none; }
.is-turning .open-photo { pointer-events:none; }
.album-status:empty { display:none; }
.page-corner {
  position:absolute; z-index:12; bottom:0; width:48px; height:48px; padding:0; border:0;
  background:transparent; color:#978564; cursor:pointer; border-radius:4px;
}
.previous-corner { left:0; }
.next-corner { right:0; }
.page-corner::before {
  content:""; position:absolute; inset:auto 0 0 auto; width:28px; height:28px;
  background:linear-gradient(135deg,transparent 43%,#b4a07a 49%,#ecdbb5 51%,#fcf0d2 73%,#e8dac1 100%);
  clip-path:polygon(100% 0,100% 100%,0 100%); border-bottom-right-radius:5px;
}
.previous-corner::before { left:0; right:auto; transform:scaleX(-1); }
@media (hover:hover) {
  .page-corner:hover::before { width:35px; height:35px; }
}
@media (prefers-reduced-motion:no-preference) {
  .page-corner::before { transition:width .18s, height .18s; }
}
.page-corner:focus-visible { outline:2px solid var(--book-ink); outline-offset:2px; }
.is-bound .album-layout h2 { margin:0; font-size:clamp(29px,3.5vw,50px); }
.is-bound .album-intro { margin-top:calc(-1 * clamp(8px,1.6svh,14px)); }
.is-bound .album-desk { width:min(100%,900px,max(300px,calc((100svh - 225px) * 1.62))); container-type:inline-size; }
.is-bound .album-book {
  /* Scale the camera with the book so a turning page stays about the book's height at any width. */
  display:block; width:100%; aspect-ratio:1.62; position:relative; perspective:500cqw;
}
.is-bound .album-leaf,.is-bound .last-page { position:absolute; inset:0 0 0 50%; width:50%; }
.is-bound .album-leaf { display:block; transform-origin:0 50%; transform-style:preserve-3d; }
.is-bound .album-leaf.is-left { transform:rotateY(-180deg); }
.is-bound .album-leaf.is-moving { will-change:transform; }
.is-bound .is-stacked { visibility:hidden; }
.is-bound .album-face {
  position:absolute; inset:0; container-type:size; border-radius:2px 6px 6px 2px;
  padding:0; gap:0; grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr);
  backface-visibility:hidden; -webkit-backface-visibility:hidden;
  box-shadow:inset 0 0 0 1px #b9aa8c80,1px 2px 0 #c5b99c,2px 3px 5px #372f2024;
}
.is-bound .album-face:not(.cloth) { background:linear-gradient(90deg,#d8ccba,transparent 5%),var(--ivory); }
.is-bound .album-leaf > .recto { transform:translateZ(.25px); }
.is-bound .album-face.verso {
  transform:rotateY(180deg) translateZ(.25px); border-radius:6px 2px 2px 6px;
  background:linear-gradient(270deg,#d8ccba,transparent 5%),var(--ivory);
}
.is-bound .is-moving > .album-face:not(.cloth)::after {
  content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none;
  background:linear-gradient(90deg,#533a2529,transparent 16%,transparent 87%,#b88a2d12);
}
.is-bound .is-moving > .verso::after { transform:scaleX(-1); }
.is-bound .album-leaf:not(.is-left):not(.is-moving) > .verso,
.is-bound .album-leaf.is-left:not(.is-moving) > .recto { visibility:hidden; }
.is-bound .last-page { inset:0 0 0 50%; }
.is-bound .album-photo { width:100%; height:100%; place-content:center; grid-template-columns:minmax(0,1fr); }
.is-bound .open-photo { width:min(83cqw,calc(var(--ratio) * 80cqh)); }
.is-bound .album-face[data-photos="2"] { grid-template-rows:4% 46% 46% 4%; }
.is-bound [data-photos="2"] .album-photo:first-of-type { grid-row:2; }
.is-bound [data-photos="2"] .album-photo:nth-of-type(2) { grid-row:3; }
.is-bound [data-photos="2"] .open-photo { width:min(83cqw,calc(var(--ratio) * 40cqh)); }
.scrapbook:not(.is-bound) .cloth { display:none; }
.scrapbook:not(.is-bound) .album-face { min-height:180px; padding:8%; }
@media (max-width:700px) {
  .is-bound .album-desk { width:100%; }
  .is-bound .album-book { aspect-ratio:1.48; }
  .cover-lettering { font-size:clamp(24px,6.3vw,40px); }
}
@media (max-height:540px) and (orientation:landscape) {
  .is-bound .album-layout { gap:9px; padding-block:18px; }
  .is-bound .album-layout h2 { font-size:23px; }
  .is-bound .album-desk { width:min(80%,calc((100svh - 150px) * 1.7)); }
  .is-bound .album-book { aspect-ratio:1.68; }
  .album-controls { display:flex; gap:12px; }
  .cover-lettering { font-size:clamp(18px,7vh,36px); }
}
