/* Shared album details and gentle motion. */
.mobile-only, .story-controls { display: none; }
.memory-page, .portrait-scene { display: contents; }
@media (min-width: 701px) {
  .memory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 830px; margin-inline: auto; }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.memory-page:nth-child(2) .memory-card { transform: rotate(2deg); top: 17px; }
.memory-page:nth-child(3) .memory-card { transform: rotate(-2deg); }
.memory-page:nth-child(2) .photo-placeholder { background: #e2e4d9; }
.memory-page:nth-child(3) .photo-placeholder { background: #e9dcd5; }
.memory-page:nth-child(2) .placeholder-flower { color: #8b947c; }
.memory-page:nth-child(3) .placeholder-flower { color: #b08d7e; }
.wish-strip { padding: 38px 25px 32px; }
.wish-content { width: min(100%, 780px); text-align: center; }
.wish-content .eyebrow { font: 600 9px var(--sans); letter-spacing: 1.8px; color: var(--wine); margin: 0 0 20px; max-width: none; }
.wish-choices { display: flex; justify-content: center; gap: 18px; margin: 0 0 20px; }
.wish-choice { display: flex; align-items: center; gap: 10px; padding: 10px 17px; border: 1px solid #d5c6b8; border-radius: 50px; background: transparent; color: #927a68; transition: background .25s, color .25s, transform .25s, box-shadow .25s; }
.wish-choice svg { width: 24px; height: 28px; }
.wish-choice span { font-size: 11px; }
.wish-choice[aria-pressed="true"] { color: var(--wine); background: #fff9f0; border-color: #c9a4a5; box-shadow: 0 4px 12px #793c4a08; }
.wish-choice:hover { transform: translateY(-3px); }
.wish-content .wish-message { max-width: 700px; min-height: 76px; margin: 0 auto; display: grid; align-content: center; font: italic 29px/1.35 var(--serif); }
.wish-invitation { display: block; margin-top: 15px; color: #978173; font-size: 20px; }
.envelope { perspective: 800px; }
.envelope-top { transform-origin: top center; transition: transform .45s ease, z-index .45s; }
.envelope-paper { transition: transform .45s ease; }
.wax-seal { transition: opacity .25s, transform .35s; }
.envelope.is-opening .envelope-top { transform: rotateX(170deg); z-index: 0; }
.envelope.is-opening .envelope-paper { transform: translateY(-28px) rotate(2deg); }
.envelope.is-opening .wax-seal { opacity: 0; transform: scale(1.15); }
.letter-dialog[open], .photo-dialog[open] { animation: letter-arrives .45s cubic-bezier(.2,.7,.2,1); }
.letter-postscript { margin: 24px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font: 12px/1.85 var(--sans); color: #79665c; }
.present-icon { transition: transform .4s; }
.present-lid, .bow { transition: translate .45s ease-in, rotate .45s ease-in, opacity .45s; }
.gift-box.is-opening .present-icon { transform: rotate(4deg) scale(1.05); }
.gift-box.is-opening .present-lid, .gift-box.is-opening .bow { translate: 0 -45px; rotate: -12deg; opacity: 0; }
.in-view .hero-spark, .in-view .hero-heart, .in-view .gift-spark { animation: small-float 4.5s ease-in-out infinite alternate; }
.in-view .hero-heart { animation-delay: -.8s; }
.in-view .spark-right { animation-delay: -2s; }
.in-view .present-icon { animation: present-wiggle 5s ease-in-out infinite; }
.in-view .is-opening .present-icon { animation: none; }
@keyframes small-float { from { translate: 0 0; } to { translate: 0 -8px; } }
@keyframes present-wiggle { 0%, 75%, 100% { rotate: 0deg; } 82% { rotate: -5deg; } 90% { rotate: 5deg; } 95% { rotate: -2deg; } }
@keyframes letter-arrives { from { opacity: 0; translate: 0 22px; scale: .97; } to { opacity: 1; translate: 0 0; scale: 1; } }
@keyframes page-detail { from { opacity: .2; translate: 15px 9px; } to { opacity: 1; translate: 0 0; } }
@keyframes swipe-nudge { 0%, 65%, 100% { translate: 0 0; } 80% { translate: 4px 0; } }

@media (max-width: 700px) {
  /* Without JS the original vertical site remains fully readable. */
  .story-mode { --story-header: calc(62px + env(safe-area-inset-top, 0px)); --story-footer: calc(99px + env(safe-area-inset-bottom, 0px)); height: 100dvh; overflow: hidden; overscroll-behavior: none; }
  .story-mode .mobile-only { display: block; }
  .story-mode .header { position: fixed; inset: 0 20px auto; width: auto; height: var(--story-header); padding-top: env(safe-area-inset-top, 0px); z-index: 12; background: var(--paper); }
  .story-mode .header .brand { font-size: 25px; }
  .story-mode .header .brand span { margin-left: 5px; }
  .story-mode .header nav { gap: 13px; }
  .story-mode .header nav > a { min-height: 40px; display: inline-flex; align-items: center; }
  .story-mode .header .nav-gift { min-height: 34px; padding: 8px 10px; }
  .story-mode #story { position: fixed; inset: var(--story-header) 0 var(--story-footer); display: flex; width: 100%; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scroll-behavior: smooth; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .story-mode #story::-webkit-scrollbar, .story-mode [data-story-page]::-webkit-scrollbar { display: none; }
  .story-mode #home, .story-mode #moments, .story-mode #memory-grid { display: contents; }
  .story-mode .hero-bottom, .story-mode .section-heading, .story-mode .moments-note, .story-mode .footer { display: none; }
  .story-mode [data-story-page] { position: relative; flex: 0 0 100%; width: 100%; max-width: none; min-width: 0; height: 100%; margin: 0; padding: 28px 26px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 0; scroll-snap-align: start; scroll-snap-stop: always; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain; scrollbar-width: none; text-align: center; }
  .story-mode [data-story-page] > * { flex-shrink: 0; }
  .story-mode [data-story-page] > :first-child { margin-top: auto; }
  .story-mode [data-story-page] > :last-child { margin-bottom: auto; }
  .story-mode [data-story-page]:focus { outline: none; }
  .story-mode .hero-copy { background: radial-gradient(ellipse at 80% 10%, #e8d4cc44, transparent 55%); }
  .story-mode .opening-mark { position: relative; width: 114px; height: 103px; margin-bottom: 24px; color: #a28a73; }
  .opening-mark::before { content: ''; position: absolute; inset: 0 9px; border: 1px solid #d5bdab; border-radius: 50% 50% 45% 45%; rotate: -10deg; }
  .opening-mark svg { width: 45px; height: 53px; margin-top: 8px; }
  .opening-mark span { display: block; font-size: 7px; letter-spacing: 1.4px; line-height: 1.5; text-transform: uppercase; }
  .story-mode .hero-copy .eyebrow { margin-bottom: 19px; font-size: 8px; }
  .story-mode .hero h1 { font-size: clamp(62px, 17vw, 82px); line-height: .96; margin-bottom: 20px; }
  .story-mode .hero-description { margin: 0 0 24px; line-height: 1.85; font-size: 11px; max-width: 330px; }
  .story-mode .hero-copy .button { min-width: 170px; min-height: 48px; }
  .story-mode .hero-footnote { margin-top: 20px; font-size: 18px; }
  .story-mode .hero-art { padding: 30px 21px; }
  .story-mode .portrait-intro { margin-bottom: 28px; }
  .story-mode .portrait-intro .eyebrow { font-size: 8px; margin-bottom: 12px; }
  .story-mode .portrait-intro h2 { font-size: 38px; }
  .story-mode .portrait-scene { display: block; position: relative; width: min(100%, 330px); padding: 14px 24px 18px; }
  .story-mode .hero-polaroid { width: 100%; max-width: 275px; padding: 11px 11px 0; box-shadow: 4px 14px 28px #49352618; }
  .story-mode .hero-photo { aspect-ratio: 4 / 4.7; }
  .story-mode .polaroid-caption { font-size: 21px; margin-top: 14px; padding-bottom: 15px; }
  .story-mode .orbit-note, .story-mode .scribble-arrow { display: none; }
  .story-mode .round-stamp { width: 83px; height: 83px; left: 0; bottom: -62px; font-size: 5.5px; padding-top: 12px; }
  .story-mode .round-stamp svg { width: 23px; height: 23px; }
  .story-mode .hero-heart { right: 1px; bottom: 0; width: 32px; height: 32px; }
  .story-mode .hero-spark { right: 0; top: 40%; width: 26px; height: 26px; }
  .story-mode .portrait-note { width: min(210px, calc(100% - 112px)); margin-top: 23px; font-size: 21px; color: #907369; transform: translateX(68px); }
  .story-mode .memory-page { background: #f4eee4; padding: 30px 28px; }
  .story-mode .memory-page:nth-child(2) { background: #eef0e6; }
  .story-mode .memory-page:nth-child(3) { background: #f2e9e3; }
  .story-mode .memory-page-heading { margin-bottom: 34px; }
  .story-mode .memory-page-heading .eyebrow { font-size: 8px; margin-bottom: 13px; }
  .story-mode .memory-page-heading h2 { font-size: 36px; max-width: 285px; }
  .story-mode .memory-card { width: min(100%, 290px); padding: 11px 11px 21px; box-shadow: 4px 14px 28px #49352614; }
  .story-mode .memory-page:nth-child(2) .memory-card { top: 0; }
  .story-mode .memory-card .photo-placeholder { aspect-ratio: 1 / 1.04; }
  .story-mode .memory-card .polaroid-caption { font-size: 25px; margin: 17px 0 4px; padding: 0; }
  .story-mode .memory-note { font-size: 9px; }
  .story-mode .memory-page-footer { margin-top: 35px; font-size: 20px; color: #90776b; }
  .story-mode .wish-strip { border: 0; background: #eee9de; }
  .story-mode .wish-content { width: 100%; }
  .story-mode .wish-content .eyebrow { font-size: 8px; line-height: 1.7; max-width: 250px; margin: 0 auto 25px; }
  .story-mode .wish-content h2 { font-size: 45px; margin-bottom: 35px; }
  .story-mode .wish-choices { gap: 14px; margin-bottom: 26px; }
  .story-mode .wish-choice { flex-direction: column; gap: 10px; padding: 18px 10px 15px; width: 82px; min-height: 98px; border-radius: 45px 45px 8px 8px; }
  .story-mode .wish-choice svg { width: 31px; height: 36px; }
  .story-mode .wish-choice span { font-size: 10px; }
  .story-mode .wish-message { font-size: 28px; min-height: 155px; max-width: 340px; }
  .story-mode .wish-invitation { font-size: 20px; margin-top: 19px; }
  .story-mode .letter-section { padding: 34px 25px; background: radial-gradient(ellipse at 20% 80%, #e6d8c655, transparent 65%); }
  .story-mode .letter-intro h2 { font-size: 43px; }
  .story-mode .letter-intro .eyebrow { font-size: 8px; margin-bottom: 20px; }
  .story-mode .letter-intro > p:not(.eyebrow) { margin-bottom: 0; }
  .story-mode .envelope-area { margin-top: 42px; padding: 20px 5px 0; max-width: 340px; }
  .story-mode .envelope { height: 205px; }
  .story-mode .wax-seal { top: 83px; }
  .story-mode .envelope-note { margin: 25px 0 0; font-size: 20px; }
  .story-mode .gift-section { padding: 32px 22px; border: 0; }
  .story-mode .gift-inner { width: 100%; padding: 0; }
  .story-mode .gift-inner > .eyebrow { font-size: 8px; margin-bottom: 22px; }
  .story-mode .gift-inner h2 { font-size: 39px; }
  .story-mode .gift-description { margin: 20px 0 26px; font-size: 11px; }
  .story-mode .gift-spark { pointer-events: none; }
  .story-mode .spark-left { left: 0; top: 215px; }
  .story-mode .spark-right { right: 0; top: 280px; }
  .story-mode .gift-bottom { margin-top: 28px; font-size: 19px; }
  .story-mode .gift-reveal { padding: 23px 16px; }
  .story-mode .story-controls { display: block; position: fixed; inset: auto 0 0; height: var(--story-footer); padding: 11px 24px calc(9px + env(safe-area-inset-bottom, 0px)); background: var(--paper); z-index: 12; border-top: 1px solid var(--line); }
  .story-progress { display: flex; align-items: center; gap: 12px; height: 18px; margin-bottom: 8px; font-size: 9px; color: #92786d; }
  #story-counter { font-variant-numeric: tabular-nums; letter-spacing: 1px; color: var(--wine); }
  #story-chapter { letter-spacing: .25px; }
  .story-hint { margin-left: auto; color: #a18e7c; font: italic 16px var(--serif); }
  .story-hint span { display: inline-block; margin-left: 3px; animation: swipe-nudge 3s ease-in-out 4; }
  .story-navigation { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .story-arrow { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border: 1px solid #c8afb0; border-radius: 50%; background: transparent; font-size: 20px; color: var(--wine); transition: opacity .2s, background .2s; }
  #story-next { background: var(--wine); color: #fff7ee; border-color: var(--wine); }
  .story-arrow:disabled { opacity: .26; }
  .story-dots { display: flex; flex: 1; justify-content: center; min-width: 0; }
  .story-dot { width: 24px; height: 44px; border: 0; background: transparent; padding: 0; display: grid; place-items: center; flex-shrink: 1; }
  .story-dot::after { content: ''; display: block; width: 5px; height: 5px; border-radius: 8px; background: #d0bcb4; transition: width .3s, background .3s; }
  .story-dot[aria-current="step"]::after { width: 16px; background: var(--wine); }
  .story-mode .is-current .memory-page-heading, .story-mode .is-current .portrait-intro, .story-mode .is-current .letter-intro, .story-mode .is-current .wish-content, .story-mode .is-current .gift-inner { animation: page-detail .65s cubic-bezier(.2,.7,.2,1); }
  .story-mode.modal-open #story { overflow: hidden; }
}

@media (max-width: 360px) {
  .story-mode .header nav { gap: 9px; }
  .story-mode .header nav > a:first-child { display: none; }
  .story-mode [data-story-page] { padding-inline: 22px; }
  .story-mode .hero h1 { font-size: 62px; }
  .story-mode .gift-inner h2 { font-size: 34px; }
  .story-mode .portrait-intro h2 { font-size: 34px; }
  .story-mode .story-controls { padding-inline: 18px; }
  .story-dot { width: 21px; }
  .story-mode .memory-page-heading h2 { font-size: 33px; }
}

@media (max-width: 700px) and (max-height: 720px) {
  .story-mode [data-story-page] { padding-top: 22px; padding-bottom: 24px; }
  .story-mode .opening-mark { height: 62px; width: 78px; margin-bottom: 12px; }
  .opening-mark svg { height: 29px; width: 30px; margin-top: 1px; }
  .opening-mark span { font-size: 6px; }
  .story-mode .hero h1 { font-size: 57px; margin-bottom: 17px; }
  .story-mode .hero-copy .eyebrow { margin-bottom: 15px; }
  .story-mode .hero-description { font-size: 10px; margin-bottom: 18px; }
  .story-mode .hero-footnote { margin-top: 12px; font-size: 17px; }
  .story-mode .portrait-intro { margin-bottom: 15px; }
  .story-mode .portrait-intro h2 { font-size: 33px; }
  .story-mode .portrait-scene { max-width: 270px; padding-top: 10px; padding-bottom: 10px; }
  .story-mode .portrait-note { margin-top: 17px; font-size: 19px; }
  .story-mode .memory-page-heading { margin-bottom: 20px; }
  .story-mode .memory-page-heading h2 { font-size: 31px; }
  .story-mode .memory-card { max-width: 220px; }
  .story-mode .memory-page-footer { margin-top: 22px; font-size: 18px; }
  .story-mode .wish-content h2 { margin-bottom: 25px; }
  .story-mode .wish-message { min-height: 125px; font-size: 26px; }
  .story-mode .letter-intro h2 { font-size: 35px; }
  .story-mode .envelope-area { max-width: 280px; margin-top: 30px; }
  .story-mode .envelope { height: 170px; }
  .story-mode .wax-seal { top: 63px; }
  .story-mode .gift-inner h2 { font-size: 34px; }
  .story-mode .gift-description { font-size: 10px; margin-block: 16px 20px; }
  .story-mode .gift-bottom { margin-top: 22px; font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .story-mode #story { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* The certificate keeps the album palette, with the original PDF a tap away. */
.gift-open .gift-inner > h2, .gift-open .gift-description, .gift-open .gift-spark, .gift-open .gift-bottom { display: none; }
.gift-open .gift-inner > .eyebrow { margin-bottom: 20px; }
.gift-open .gift-reveal { width: 100%; max-width: 420px; padding: 22px; border-color: #d7c1bd; border-radius: 8px; box-shadow: 0 12px 36px #65363d0c; }
.certificate-card { position: relative; min-height: 170px; overflow: hidden; padding: 20px 22px 17px; background: radial-gradient(ellipse at 100% 100%, #ac7179, transparent 75%), #773e4b; color: #fff7ed; border-radius: 7px; text-align: left; box-shadow: 0 7px 17px #67373f22; }
.certificate-card::before, .certificate-card::after { content: ''; position: absolute; width: 190px; height: 190px; border: 1px solid #f3d9c52e; border-radius: 50%; right: -69px; top: 32px; pointer-events: none; }
.certificate-card::after { right: -93px; top: 11px; width: 220px; height: 220px; }
.certificate-top { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.certificate-top .ozon-wordmark { color: #fff7ed; font-size: 23px; letter-spacing: 2px; }
.certificate-top > span:last-child { font-size: 8px; letter-spacing: 1.7px; }
.certificate-top > span:last-child > span { font-size: 15px; margin-left: 3px; }
.certificate-amount { display: block; position: relative; margin-top: 18px; font: 500 53px/.95 var(--serif); letter-spacing: -1px; }
.certificate-label { display: block; margin-top: 7px; font-size: 9px; letter-spacing: .7px; color: #eed3ce; }
.certificate-dedication { display: block; position: relative; margin-top: 15px; font-size: 18px; color: #f1d7cd; }
.certificate-spark { position: absolute; width: 43px; height: 43px; top: 69px; right: 35px; color: #e4bfb2; rotate: 12deg; }
.gift-open #gift-details { margin: 18px 0 20px; font: italic 22px/1.25 var(--serif); color: #80665e; }
.certificate-code { text-align: left; }
.certificate-code label { font-size: 8px; color: #957c72; letter-spacing: 1.3px; }
.certificate-code .code-row { flex-direction: row; gap: 8px; margin-top: 8px; padding: 7px; min-height: 50px; background: #f6eee7; border-color: #d2b7b0; border-radius: 3px; }
.certificate-code input { min-width: 0; width: 100%; padding: 4px 2px; border: 0; background: transparent; font: 15px ui-monospace, monospace; letter-spacing: .5px; color: var(--wine); }
.certificate-code input:focus-visible { outline: 2px solid #b87e8c; outline-offset: 3px; }
.certificate-code .code-row button { width: auto; flex-shrink: 0; min-height: 40px; font-size: 9px; padding-inline: 10px; }
.gift-open .gift-status { font-size: 10px; margin: 8px 0 0; line-height: 1.5; }
.gift-status:empty { display: none; }
.activate-certificate { display: flex; width: 100%; min-height: 46px; justify-content: center; gap: 20px; margin-top: 14px; padding: 13px; font-size: 11px; }
.download-certificate { display: flex; align-items: center; justify-content: center; gap: 16px; min-height: 44px; margin-top: 5px; font-size: 11px; color: var(--wine); text-decoration: underline; text-underline-offset: 4px; }
.download-certificate span { font-size: 9px; text-decoration: none; letter-spacing: .7px; color: #987e76; }
.download-certificate:hover { color: #a96472; }
.gift-open .certificate-expiry { font-size: 9px; line-height: 1.6; margin: 5px 0 15px; color: #947e74; }
.certificate-instructions { border-top: 1px solid #e4d7cb; text-align: left; }
.certificate-instructions summary { display: flex; align-items: center; justify-content: space-between; min-height: 43px; cursor: pointer; list-style: none; font-size: 11px; color: #80685d; }
.certificate-instructions summary::-webkit-details-marker { display: none; }
.certificate-instructions summary:focus-visible { outline: 2px solid #b87e8c; outline-offset: 3px; }
.certificate-instructions summary span { font-size: 18px; transition: rotate .2s; }
.certificate-instructions[open] summary span { rotate: 45deg; }
.certificate-instructions ol { padding-left: 18px; margin: 2px 0 0; font-size: 11px; color: #806c60; line-height: 1.7; }
.certificate-instructions li { padding-left: 4px; margin-bottom: 9px; }
.certificate-instructions li::marker { color: var(--wine); }

@media (max-width: 700px) {
  .story-mode .gift-open { padding: 24px 20px; }
  .story-mode .gift-open .gift-reveal { padding: 17px; max-width: 380px; }
  .story-mode .gift-open .gift-inner > .eyebrow { margin-bottom: 16px; }
  .certificate-card { min-height: 155px; padding: 17px 19px; }
  .certificate-amount { font-size: 49px; margin-top: 13px; }
  .certificate-dedication { margin-top: 12px; font-size: 17px; }
  .gift-open #gift-details { font-size: 21px; margin: 16px 0; }
}
@media (max-width: 360px) {
  .story-mode .gift-open { padding-inline: 15px; }
  .story-mode .gift-open .gift-reveal { padding: 14px; }
  .certificate-card { padding-inline: 15px; }
  .certificate-top > span:last-child { letter-spacing: 1px; font-size: 7px; }
  .certificate-code input { font-size: 13px; letter-spacing: 0; }
  .certificate-code .code-row button { padding-inline: 8px; font-size: 8px; }
}
