/* An open scrapbook: the complete photograph beside a little keepsake note. */
.photo-dialog {
  width: min(1040px, calc(100% - 48px));
  max-width: none;
  max-height: calc(100dvh - 40px);
  padding: 0;
  overflow: auto;
  border: 1px solid #d5d0b5;
  border-radius: 20px;
  background: #fbf6e9;
  box-shadow: 0 32px 110px #091b1770, 0 0 0 6px #f9f2df0c;
  scrollbar-width: thin;
  scrollbar-color: #87946d #f0ebdc;
}

.photo-dialog::backdrop {
  background: #12281fe3;
  backdrop-filter: blur(12px);
}

.photo-dialog .photo-viewer { padding: 0; }

.photo-dialog .photo-viewer-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  gap: 20px;
  min-height: 76px;
  margin: 0;
  padding: 13px 24px;
  border-bottom: 1px solid #51684d;
  background: #304d3b;
  color: #fff7df;
}

.photo-album-name { display: flex; align-items: center; gap: 15px; min-width: 0; }
.photo-album-name > svg { width: 28px; height: 31px; flex: none; color: #d4dcb0; rotate: -12deg; }
.photo-album-name > span { display: grid; gap: 3px; }
.photo-album-eyebrow { font-size: 8px; line-height: 1.4; letter-spacing: 1.8px; color: #d1d8b7; }
.photo-album-title { font: 500 22px/1.2 var(--serif); letter-spacing: -.45px; }

.photo-dialog button { transition: background .18s ease, border-color .18s ease, box-shadow .18s ease; }
.photo-dialog button:focus-visible { outline: 3px solid #b8834b; outline-offset: 3px; }
.photo-dialog .photo-close { width: 44px; height: 44px; border-color: #c4cfa957; background: #f7f3e80a; color: #fff7df; }
.photo-dialog .photo-close:hover { background: #f7f3e81c; border-color: #dce2c6; }
.photo-close svg { width: 19px; height: 19px; }

.photo-dialog .photo-content {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  overflow: hidden;
}

.photo-dialog .photo-stage {
  position: relative;
  min-width: 0;
  height: min(60dvh, 540px);
  padding: 26px;
  border-radius: 0;
  background: radial-gradient(ellipse at 35% 20%, #e7e4cd, transparent 80%), #d9ddc7;
}

.photo-dialog .photo-stage::before,
.photo-dialog .photo-stage::after {
  content: '';
  position: absolute;
  z-index: 1;
  width: 57px;
  height: 21px;
  top: 21px;
  background: #bda37666;
  border-inline: 1px dashed #eee1be96;
  pointer-events: none;
}

.photo-dialog .photo-stage::before { left: 16px; rotate: -35deg; }
.photo-dialog .photo-stage::after { right: 16px; rotate: 35deg; }
.photo-dialog .photo-stage img {
  width: auto;
  max-width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  padding: 9px;
  border: 1px solid #fffdf7;
  border-radius: 2px;
  background: #fffaf0;
  box-shadow: 0 7px 22px #414b3224;
}

.photo-dialog .photo-viewer-caption {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  padding: 35px 37px;
  border-left: 1px solid #c8ceb588;
  background: radial-gradient(ellipse at 90% 100%, #e9e7cf66, transparent 60%), #fbf6e9;
  text-align: left;
}

.photo-memory-note { position: relative; z-index: 1; }
.photo-memory-kicker { display: block; margin-bottom: 14px; font-size: 9px; line-height: 1.5; font-weight: 600; letter-spacing: 1.6px; color: #8c6845; }
.photo-dialog .photo-viewer-caption h2 { margin: 0; font: 500 clamp(32px, 3.7vw, 46px)/1.07 var(--serif); letter-spacing: -1.6px; color: #304d3b; text-wrap: balance; }
.photo-caption-rule { display: block; width: 33px; height: 2px; margin: 22px 0 18px; background: #b79864; border-radius: 50%; rotate: -3deg; }
.photo-dialog .photo-viewer-caption p { max-width: 28ch; margin: 0; font-size: 14px; line-height: 1.75; color: #6d735d; }
.photo-keepsake-stamp { display: grid; justify-items: center; align-content: center; gap: 5px; width: 85px; height: 85px; margin: 0 0 27px; border: 1px solid #899567; border-radius: 50%; outline: 1px dashed #89956788; outline-offset: -5px; color: #768455; rotate: -12deg; }
.photo-keepsake-stamp svg { width: 24px; height: 25px; }
.photo-keepsake-stamp > span { font-size: 5.5px; font-weight: 600; line-height: 1.3; letter-spacing: .75px; }
.photo-keepsake-signature { position: relative; z-index: 1; margin-top: 32px; font: 500 13px/1.5 var(--serif); color: #8c7454; }
.photo-keepsake-signature > span { margin-left: 3px; font-size: 18px; }
.photo-keepsake-leaf { position: absolute; right: -16px; bottom: -34px; width: 126px; height: 174px; color: #8f9c63; opacity: .15; rotate: -19deg; pointer-events: none; }

.photo-contact-sheet { display: flex; align-items: center; gap: 22px; padding: 12px 25px; border-top: 1px solid #d4d8be; border-bottom: 1px solid #dedbc8; background: #f0efdf; }
.photo-strip-label { flex: 0 0 105px; font: 500 14px/1.3 var(--serif); letter-spacing: -.2px; color: #798068; }
.photo-thumbs { position: relative; display: flex; gap: 7px; width: 100%; min-width: 0; padding: 4px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; scroll-padding-inline: 4px; }
.photo-thumbs::-webkit-scrollbar { display: none; }
.photo-dialog .photo-thumbs > button { position: relative; flex: 0 0 50px; width: 50px; height: 59px; padding: 3px; overflow: hidden; border: 1px solid #c4c7ad; border-radius: 5px; background: #fffbef; opacity: .65; transition: opacity .18s ease, border-color .18s ease, box-shadow .18s ease; }
.photo-thumbs > button img { width: 100%; height: 100%; object-fit: cover; border-radius: 2px; }
.photo-dialog .photo-thumbs > button:hover { opacity: 1; background: #fffbef; border-color: #8a9a6f; }
.photo-dialog .photo-thumbs > button[aria-current="true"] { opacity: 1; border-color: #38543f; box-shadow: 0 0 0 2px #38543f; }

.photo-viewer-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 25px; }
.photo-viewer-hint { font-size: 10px; line-height: 1.4; color: #8b8067; }
.photo-touch-hint { display: none; }
.photo-dialog .photo-viewer-nav { flex: none; gap: 15px; }
.photo-dialog .photo-viewer-nav > button { width: 40px; height: 40px; background: #f4f0e1; border-color: #b7c19f; }
.photo-dialog .photo-viewer-nav > button:hover { background: #dce5cc; border-color: #83966d; }
.photo-viewer-nav svg { width: 19px; height: 19px; }
.photo-viewer-nav [data-photo-prev] svg { rotate: 180deg; }
.photo-dialog .photo-viewer-nav > span { min-width: 47px; font-size: 10px; line-height: 1.4; font-weight: 600; letter-spacing: 1.4px; color: #6f775c; }

@media (max-width: 760px) {
  .photo-dialog { width: min(520px, calc(100% - 24px)); max-height: calc(100dvh - 24px); border-radius: 16px; }
  .photo-dialog .photo-viewer-bar { min-height: 65px; gap: 12px; padding: 10px 15px 10px 18px; }
  .photo-album-name { gap: 11px; }
  .photo-album-name > svg { width: 23px; height: 27px; }
  .photo-album-eyebrow { font-size: 6.5px; letter-spacing: 1.25px; }
  .photo-album-title { font-size: 19px; letter-spacing: -.55px; }
  .photo-dialog .photo-close { width: 40px; height: 40px; }
  .photo-dialog .photo-content { display: block; }
  .photo-dialog .photo-stage { height: min(40dvh, 380px); padding: 17px 22px; }
  .photo-dialog .photo-stage img { padding: 6px; }
  .photo-dialog .photo-stage::before, .photo-dialog .photo-stage::after { top: 12px; width: 44px; height: 17px; }
  .photo-dialog .photo-stage::before { left: 14px; }
  .photo-dialog .photo-stage::after { right: 14px; }
  .photo-dialog .photo-viewer-caption { min-height: 145px; padding: 19px 23px 21px; border-left: 0; border-top: 1px solid #c8ceb588; }
  .photo-memory-kicker { margin-bottom: 8px; font-size: 7px; line-height: 1.4; letter-spacing: 1.4px; }
  .photo-dialog .photo-viewer-caption h2 { font-size: clamp(27px, 7.5vw, 34px); line-height: 1.1; letter-spacing: -.9px; text-wrap: initial; }
  .photo-caption-rule { display: none; }
  .photo-dialog .photo-viewer-caption p { max-width: 32ch; margin-top: 9px; font-size: 11px; line-height: 1.65; }
  .photo-keepsake-stamp, .photo-keepsake-signature { display: none; }
  .photo-keepsake-leaf { right: -5px; bottom: -19px; width: 70px; height: 99px; opacity: .13; }
  .photo-contact-sheet { padding: 9px 13px; }
  .photo-strip-label { display: none; }
  .photo-thumbs { gap: 7px; }
  .photo-dialog .photo-thumbs > button { flex-basis: 44px; width: 44px; height: 51px; }
  .photo-viewer-footer { gap: 10px; padding: 10px 17px; }
  .photo-viewer-hint { font-size: 9px; }
  .photo-desktop-hint { display: none; }
  .photo-touch-hint { display: flex; gap: 6px; align-items: center; }
  .photo-touch-hint > span { font-size: 16px; }
  .photo-dialog .photo-viewer-nav { gap: 10px; }
  .photo-dialog .photo-viewer-nav > button { width: 40px; height: 40px; }
  .photo-dialog .photo-viewer-nav > span { min-width: 40px; font-size: 9px; }
}

@media (max-width: 360px) {
  .photo-dialog .photo-viewer-bar { padding-inline: 13px 11px; }
  .photo-album-name { gap: 8px; }
  .photo-album-title { font-size: 17px; }
  .photo-album-eyebrow { font-size: 6px; letter-spacing: 1px; }
  .photo-dialog .photo-viewer-caption { padding: 17px 19px; }
  .photo-dialog .photo-viewer-caption h2 { font-size: 27px; }
  .photo-viewer-footer { padding-inline: 14px; }
  .photo-dialog .photo-viewer-nav { gap: 7px; }
}

@media (max-width: 760px) and (max-height: 650px) {
  .photo-dialog .photo-stage { height: 34dvh; min-height: 150px; }
  .photo-dialog .photo-viewer-caption { min-height: 126px; padding-block: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .photo-dialog, .photo-dialog::backdrop { animation: none !important; }
  .photo-dialog button { transition: none; }
}

html[data-motion="off"] .photo-dialog button { transition: none; }
