
.frost-memory .frost-photo{padding:9px 9px 0;background:#fff9ea;box-shadow:0 7px 22px #14253426}
.frost-memory .story-photo{padding:0;border:0;width:100%;margin:0;box-shadow:none}
.frost-memory .frost-hint{color:#fff2d2;text-shadow:0 1px 6px #142337}
.frost-memory .frost-date{position:relative;inset:auto;display:block;min-height:36px;padding:7px 2px;text-align:center;color:#27445f;text-shadow:none;font:italic clamp(14px,2vw,20px)/1.2 "Segoe Script","Apple Chancery","Bradley Hand",Georgia,serif}
.birthday-flip{width:min(100%,440px);margin:auto;perspective:1000px}
.birthday-photo-card{display:grid;width:100%;aspect-ratio:4/3;padding:0;border:0;background:transparent;transform-style:preserve-3d;transition:transform .55s ease;cursor:pointer}
.birthday-photo-card.is-flipped{transform:rotateY(180deg)}
.birthday-photo-card:focus-visible{outline:2px solid #86682f;outline-offset:5px}
.birthday-photo-front,.birthday-photo-back{position:relative;grid-area:1/1;backface-visibility:hidden;border:1px solid #cbb278;box-shadow:0 5px 16px #26344729;min-width:0}
.birthday-photo-front img{display:block;width:100%;height:100%;object-fit:cover}
.birthday-photo-back{transform:rotateY(180deg);display:grid;place-items:center;padding:36px 19px 18px;color:#27394e;background:repeating-linear-gradient(0deg,#e5d6b9 0 1px,transparent 1px 25px),linear-gradient(120deg,#f9f0da,#efdfbd)}
.birthday-secret-note{font:italic clamp(17px,2.4vw,27px)/1.45 'Segoe Print','Apple Chancery','Bradley Hand',Georgia,serif}
.birthday-turn-cue{position:absolute;top:8px;right:8px;padding:5px 7px;color:#fff4d9;background:#142c46;border:1px solid #b99b61;font:11px var(--sans)}
@media(prefers-reduced-motion:reduce){.birthday-photo-card{transition:none}}

.modal-scrim .contents{max-height:calc(100dvh - 40px);overflow:auto;overscroll-behavior:contain}
.birthday-photo-card{touch-action:pan-y}

.postcard-message {
  position: absolute;
  top: max(126px, 29%);
  left: calc(50% + 16px);
  right: clamp(16px, 4vw, 48px);
  margin: 0;
  padding: 0 2px;
  background: repeating-linear-gradient(to bottom, transparent 0 calc(1.65em - 1px), #ad91564d calc(1.65em - 1px) 1.65em);
  color: #344b5b;
  font: italic clamp(14px, 2.2vw, 21px)/1.65 "Segoe Print", "Apple Chancery", "Bradley Hand", Georgia, serif;
}
@media (max-width: 600px) {
  .viewer-card-back.has-postcard-message { align-content: start; }
  .has-postcard-message .postcard-place,
  .has-postcard-message .postcard-note,
  .has-postcard-message .postcard-sign { width: auto; max-width: none; }
  .has-postcard-message .postcard-date:empty,
  .has-postcard-message .postcard-divider { display: none; }
  .has-postcard-message .postcard-place { padding-right: 65px; }
  .postcard-message { position: static; margin-top: 24px; }
}

@media (max-width: 767px) and (orientation: portrait) {
  .spread.single .leaf:is([data-page-type="dedication"], [data-page-type="story-text"], [data-page-type="letter"]) > .page-content {
    justify-content: center;
    justify-content: safe center;
    padding-bottom: clamp(12px, 4svh, 36px);
    overflow-y: auto;
  }

  .spread.single .leaf:is([data-page-type="dedication"], [data-page-type="story-text"], [data-page-type="letter"]) .title::before {
    content: "";
    display: block;
    width: 58px;
    height: 1px;
    margin: 0 0 13px;
    background: linear-gradient(90deg, #a48648, #c9b481 68%, transparent);
  }

  .spread.single .leaf:has(.frost-memory, .birthday-flip, .scratch-card) > .page-content {
    justify-content: safe center;
    overflow-y: auto;
  }

  .spread.single :is(.frost-memory, .birthday-flip, .scratch-card) {
    width: 92%;
    max-width: none;
    margin-inline: auto;
  }

  .spread.single .frost-memory, .spread.single .birthday-flip {
    margin-block: 0;
  }

  .spread.single .frost-memory .story-photo {
    max-width: none;
  }

  .spread.single .scratch-secret {
    min-height: clamp(230px, 39svh, 340px);
  }
}

.spread [data-page-type="story-photo"] :is(.frost-photo, .birthday-flip, .story-photo:not(.frost-photo *)) {
  rotate: var(--photo-tilt, -2deg);
  transition: rotate .35s ease, translate .35s ease;
}

.spread [data-page-type="story-photo"] :is(.birthday-flip, .story-photo[data-photo="sunday"]) {
  --photo-tilt: 1.8deg;
}

.spread [data-page-type="story-photo"] :is(.frost-photo, .birthday-flip, .story-photo:not(.frost-photo *)):is(:active, :focus-visible, :focus-within),
.spread [data-page-type="story-photo"] .birthday-flip:has(.is-flipped),
.spread [data-page-type="story-photo"] .frost-memory:is(.is-wiping, .is-cleared) .frost-photo {
  rotate: 0deg;
  translate: 0 -3px;
}

@media (hover: hover) {
  .spread [data-page-type="story-photo"] :is(.frost-photo, .birthday-flip, .story-photo:not(.frost-photo *)):hover {
    rotate: 0deg;
    translate: 0 -3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spread [data-page-type="story-photo"] :is(.frost-photo, .birthday-flip, .story-photo:not(.frost-photo *)) {
    transition: none;
  }
}

@media (max-width: 767px) and (orientation: portrait) {
  .spread.single .leaf {
    padding-block: clamp(12px, 2.2svh, 20px) 7px;
  }

  .spread.single {
    --paper-frame-inset: 12px;
  }

  .spread.single > .spread-content {
    grid-template-columns: minmax(0, 1fr);
  }

  .spread.single > .spread-content > .leaf {
    position: relative;
    width: 100%;
  }

  .spread.single > .spread-content > .leaf::after {
    inset: var(--paper-frame-inset);
    width: auto;
    height: auto;
    z-index: 0;
  }

  .spread.single > .spread-content > .leaf {
    padding-inline: var(--paper-frame-inset);
  }

  .spread.single > .spread-content > .leaf > .page-content {
    box-sizing: border-box;
    min-width: 0;
    padding-inline: 20px;
  }

  .spread.single > .spread-content > .leaf > .page-content * {
    box-sizing: border-box;
    max-width: 100%;
  }

  .spread.single .leaf[data-page-type="timeline"] > .page-content {
    justify-content: safe center;
    overflow-y: auto;
  }

  .spread.single .time-item {
    grid-template-columns: 2ch minmax(0, 1fr);
    column-gap: 10px;
  }

  .spread.single :is(.time-text, .days-since) {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .spread.single .days-together {
    flex-wrap: wrap;
  }

  .spread.single .leaf .body-copy,
  .spread.single .time-text {
    font-size: clamp(15px, 3.9vw, 17px);
    line-height: 1.7;
  }

  .spread.single .leaf:is([data-page-type="dedication"], [data-page-type="story-text"], [data-page-type="letter"]) > .page-content {
    padding-bottom: clamp(8px, 2.4svh, 20px);
  }

  .spread.single .leaf:is([data-page-type="dedication"], [data-page-type="story-text"], [data-page-type="letter"]) .title::before {
    margin-inline: auto;
    background: linear-gradient(90deg, transparent, #ad8b4d 28%, #ad8b4d 72%, transparent);
  }
}

@media (max-width: 767px) and (orientation: portrait) {
  .spread [data-page-type="story-photo"] :is(.frost-photo, .birthday-flip, .story-photo),
  .spread .photo-frame,
  .closed-cover .photo-frame {
    rotate: 0deg !important;
    translate: none !important;
    transition: none;
  }

  .spread .photo-frame,
  .spread .gallery figure:nth-child(odd) .photo-frame,
  .closed-cover .photo-frame {
    transform: none;
  }

  .spread.single .leaf[data-page-type="timeline"] .time-text {
    font-size: .95rem;
    line-height: 1.6;
  }
}

@media (max-width: 767px) and (orientation: portrait) {
  .spread.single::before,
  .album:has(.spread.single) > .page-flip-shadow {
    display: none;
  }

  .spread.single .leaf[data-page-type="timeline"] .days-since {
    padding-right: 12px;
  }
}

@media (width > 768px) {
  #spread:not(.single) :is(.photo-frame, .frost-photo, .birthday-flip) {
    rotate: 0deg;
    translate: none;
    transition: translate .35s ease, box-shadow .35s ease;
  }

  #spread:not(.single) .photo-frame,
  #spread:not(.single) .gallery figure:nth-child(odd) .photo-frame {
    transform: none;
  }

  #spread:not(.single) .frost-photo .photo-frame {
    transition: none;
  }

  #spread:not(.single) :is(.birthday-photo-front, .birthday-photo-back) {
    transition: box-shadow .35s ease;
  }
}

@media (width > 768px) and (hover: hover) {
  #spread:not(.single) :is(.photo-frame:not(.frost-photo *), .frost-photo, .birthday-flip):hover {
    translate: 0 -3px;
  }

  #spread:not(.single) :is(.photo-frame:not(.frost-photo *), .frost-photo):hover,
  #spread:not(.single) .birthday-flip:hover :is(.birthday-photo-front, .birthday-photo-back) {
    box-shadow: 0 10px 24px rgba(20, 37, 52, .23);
  }

  #spread:not(.single) .photo-frame:hover .landscape {
    transform: none;
  }
}

@media (width > 768px) and (prefers-reduced-motion: reduce) {
  #spread:not(.single) :is(.photo-frame, .frost-photo, .birthday-flip, .birthday-photo-front, .birthday-photo-back) {
    transition: none;
  }
}
