:root {
  --wine: #7b2232;
  --wine-dark: #361116;
  --rose: #c75e70;
  --blush: #e8b0b7;
  --paper: #fffaf0;
  --paper-shadow: rgba(29, 9, 13, 0.32);
  --ink: #251e1e;
  --muted: #766968;
  --green: #324638;
  --safe-top: max(18px, env(safe-area-inset-top));
  --safe-bottom: max(20px, env(safe-area-inset-bottom));
}

* {
  box-sizing: border-box;
}

html {
  background: #27191a;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  letter-spacing: 0;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

.cover {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  grid-template-rows: minmax(160px, 0.8fr) auto minmax(80px, 0.55fr);
  align-items: center;
  justify-items: center;
  min-height: 100svh;
  overflow: hidden;
  padding: var(--safe-top) 24px var(--safe-bottom);
  color: #fff;
  background: #241012 url("assets/flowers.jpg") center 42% / cover no-repeat;
  transition: opacity 0.75s ease, visibility 0.75s ease;
  animation: coverReveal 0.85s ease-out both;
}

.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(17, 7, 9, 0.36), rgba(44, 12, 19, 0.62) 58%, rgba(18, 8, 10, 0.82));
}

.cover-shade {
  position: absolute;
  inset: 0;
  background: rgba(79, 22, 33, 0.12);
  backdrop-filter: saturate(0.76) contrast(1.04);
}

.cover > *:not(.cover-shade):not(.valentine-type) {
  position: relative;
  z-index: 2;
}

.cover-copy {
  align-self: end;
  justify-self: center;
  width: min(100%, 560px);
  margin: 0 auto 34px;
  text-align: center;
  animation: copyEntrance 0.9s cubic-bezier(0.2, 0.72, 0.28, 1) 0.18s both;
}

.eyebrow {
  margin: 0 0 14px;
  color: rgba(255, 238, 235, 0.78);
  font-family: Arial, sans-serif;
  font-size: 10px;
  letter-spacing: 0;
}

.cover h1 {
  margin: 0;
  font-size: 52px;
  font-weight: 400;
  line-height: 1.18;
  text-shadow: 0 2px 20px rgba(33, 8, 12, 0.5);
}

.cover-deck {
  margin: 17px 0 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 14px;
}

.valentine-type {
  position: absolute;
  z-index: 1;
  top: 21%;
  left: 50%;
  width: 100%;
  color: rgba(255, 242, 239, 0.045);
  font-family: Georgia, "Times New Roman", serif;
  text-align: center;
  transform: translate(-50%, -50%);
  -webkit-text-stroke: 1px rgba(255, 242, 239, 0.26);
  pointer-events: none;
  animation: monogramEntrance 1.25s ease-out 0.08s both;
}

.valentine-type span,
.valentine-type strong {
  display: block;
  font-weight: 400;
  line-height: 0.82;
}

.valentine-type span {
  font-size: 56px;
}

.valentine-type strong {
  font-size: 116px;
}

.envelope-button {
  position: relative;
  width: min(82vw, 350px);
  height: 235px;
  margin: 0 auto;
  justify-self: center;
  padding: 0;
  border: 0;
  color: #fff;
  cursor: pointer;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  will-change: transform, opacity;
  animation:
    envelopeEntrance 1.05s cubic-bezier(0.16, 0.76, 0.24, 1) 0.42s both,
    envelopeFloat 4.8s ease-in-out 1.55s infinite;
}

.envelope {
  position: absolute;
  top: 30px;
  left: 50%;
  width: 100%;
  aspect-ratio: 1.48;
  transform: translateX(-50%);
  filter: drop-shadow(0 24px 18px rgba(25, 8, 10, 0.35));
  perspective: 800px;
  transition: filter 0.35s ease;
}

.envelope::after {
  content: "";
  position: absolute;
  z-index: 7;
  inset: 0;
  border-radius: 2px;
  opacity: 0;
  background: linear-gradient(108deg, transparent 31%, rgba(255, 255, 255, 0.42) 48%, transparent 65%);
  mix-blend-mode: soft-light;
  pointer-events: none;
  transform: translateX(-145%);
  animation: envelopeGlint 4.6s ease-in-out 1.75s infinite;
}

.envelope-button:hover .envelope {
  filter: drop-shadow(0 27px 22px rgba(25, 8, 10, 0.44));
}

.envelope-back,
.envelope-front,
.envelope-flap,
.envelope-paper {
  position: absolute;
  inset: 0;
}

.envelope-back {
  border-radius: 2px;
  background: #e7d8c4;
}

.envelope-paper {
  inset: 12px 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(94, 55, 41, 0.12);
  color: #4c3432;
  background: #fffefa;
  box-shadow: 0 2px 7px rgba(75, 39, 28, 0.12);
  transition: transform 0.9s cubic-bezier(0.19, 0.8, 0.22, 1) 0.25s;
}

.envelope-paper span {
  margin-bottom: 8px;
  font-size: 12px;
  font-family: Arial, sans-serif;
}

.envelope-paper strong {
  font-size: 23px;
  font-weight: 500;
}

.envelope-front {
  z-index: 3;
  overflow: hidden;
  border-radius: 0 0 2px 2px;
}

.envelope-front::before,
.envelope-front::after {
  content: "";
  position: absolute;
  bottom: -28%;
  width: 74%;
  height: 112%;
  background: #ddcbb3;
}

.envelope-front::before {
  left: -22%;
  transform: rotate(38deg);
}

.envelope-front::after {
  right: -22%;
  transform: rotate(-38deg);
}

.envelope-flap {
  z-index: 4;
  height: 58%;
  transform-origin: top;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: #f1e3cf;
  transition: transform 0.75s cubic-bezier(0.55, 0.05, 0.68, 0.53);
}

.wax-seal {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(255, 220, 214, 0.46);
  border-radius: 50%;
  color: #f6d9cf;
  background: radial-gradient(circle at 38% 30%, #b64e60, #7b2232 64%, #401018);
  box-shadow: 0 8px 18px rgba(46, 9, 15, 0.45), inset 0 0 0 4px rgba(255, 227, 220, 0.08);
  transform: translate(-50%, -50%);
  transition: opacity 0.25s ease, transform 0.25s ease;
  animation: sealBreathe 2.8s ease-in-out 1.5s infinite;
}

.wax-seal::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 1px solid rgba(246, 217, 207, 0.48);
  border-radius: 50%;
  opacity: 0;
  animation: sealRing 2.8s ease-out 1.5s infinite;
}

.open-hint {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 100%;
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  letter-spacing: 0;
  transform: translateX(-50%);
  animation: breathe 2s ease-in-out infinite;
}

.cover-footnote {
  align-self: end;
  justify-self: center;
  margin: 0;
  color: rgba(255, 255, 255, 0.5);
  font: 10px/1.4 Arial, sans-serif;
  text-align: center;
  animation: footnoteEntrance 0.9s ease-out 0.9s both;
}

.cover.opening .envelope-flap {
  z-index: 1;
  transform: rotateX(180deg);
}

.cover.opening .wax-seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5);
}

.cover.opening .wax-seal::after,
.cover.opening .envelope::after {
  animation: none;
  opacity: 0;
}

.cover.opening .envelope-button {
  animation: envelopeCommit 0.34s ease-out both;
}

.cover.opening .cover-copy {
  animation: copyExit 0.5s ease-in both;
}

.cover.opening .valentine-type {
  animation: monogramExit 0.75s ease-in both;
}

.cover.opening .cover-footnote {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.cover.opening .envelope-paper {
  z-index: 2;
  transform: translateY(-92px);
}

.cover.opening .open-hint {
  opacity: 0;
}

.cover.is-hidden {
  animation: none;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.letter-scene {
  position: relative;
  min-height: 100vh;
  padding: 92px 18px 84px;
  overflow: hidden;
  background: #2c1418;
}

.letter-scene::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(145deg, rgba(70, 18, 28, 0.68), rgba(35, 45, 37, 0.48));
  pointer-events: none;
}

.botanical-photo {
  position: fixed;
  inset: -24px;
  background: url("assets/flowers.jpg") center / cover no-repeat;
  opacity: 0.72;
  background-position: center 34%;
  filter: blur(5px) saturate(0.62) contrast(1.06);
  transform: scale(1.05);
}

.scene-type {
  position: fixed;
  z-index: 0;
  top: 50%;
  left: 50%;
  width: 100%;
  color: rgba(255, 255, 255, 0.05);
  font-family: Georgia, "Times New Roman", serif;
  text-align: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.scene-type span,
.scene-type strong {
  display: block;
  font-weight: 400;
  line-height: 0.8;
}

.scene-type span {
  font-size: 64px;
}

.scene-type strong {
  font-size: 124px;
}

.letter-switcher {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(100%, 780px);
  margin: 0 auto 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.34);
  border-bottom: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(24, 11, 13, 0.3);
  backdrop-filter: blur(14px);
}

.letter-tab {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  min-height: 62px;
  padding: 8px 14px;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.56);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: color 0.2s ease, background 0.2s ease;
}

.letter-tab:last-child {
  border-right: 0;
}

.letter-tab .tab-index {
  color: rgba(255, 255, 255, 0.46);
  font: 11px/1 Arial, sans-serif;
}

.tab-copy {
  display: block;
  min-width: 0;
}

.tab-copy strong,
.tab-copy small {
  display: block;
}

.tab-copy strong {
  font-size: 15px;
  font-weight: 500;
}

.tab-copy small {
  margin-top: 4px;
  overflow: hidden;
  font: 8px/1 Arial, sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.letter-tab.is-active {
  color: #fff;
  background: rgba(123, 34, 50, 0.78);
}

.letter-tab.is-active .tab-index {
  color: #f5c4ca;
}

.letter {
  position: relative;
  z-index: 1;
  width: min(100%, 780px);
  margin: 0 auto;
  padding: 82px 92px 38px;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(86, 66, 50, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 9% 4%, rgba(160, 105, 62, 0.1), transparent 16%),
    radial-gradient(circle at 91% 88%, rgba(123, 34, 50, 0.055), transparent 20%);
  background-size: 100% 31px, auto, auto;
  box-shadow: 0 28px 80px var(--paper-shadow);
  transform-origin: center top;
}

.letter::before,
.letter::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.letter::before {
  inset: 0;
  z-index: 0;
  opacity: 0.22;
  background-image:
    radial-gradient(circle at 18% 23%, rgba(95, 65, 42, 0.13) 0 0.7px, transparent 0.9px),
    radial-gradient(circle at 72% 64%, rgba(95, 65, 42, 0.1) 0 0.6px, transparent 0.8px);
  background-size: 19px 23px, 27px 31px;
}

.letter::after {
  display: none;
}

.letter-header,
.letter-body,
.letter-signoff,
.letter-actions,
.credit {
  position: relative;
  z-index: 3;
}

.ornament-frame {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  color: rgba(123, 34, 50, 0.68);
  pointer-events: none;
}

.ornament-frame::before,
.ornament-frame::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.ornament-frame::before {
  inset: 18px;
  border: 1px solid rgba(118, 79, 45, 0.42);
}

.ornament-frame::after {
  inset: 25px;
  border: 1px solid rgba(123, 34, 50, 0.16);
}

.ornament-defs {
  position: absolute;
}

.ornament-corner {
  position: absolute;
  width: 82px;
  height: 82px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.82;
}

.ornament-tl {
  top: 20px;
  left: 20px;
}

.ornament-tr {
  top: 20px;
  right: 20px;
  transform: rotate(90deg);
}

.ornament-br {
  right: 20px;
  bottom: 20px;
  transform: rotate(180deg);
}

.ornament-bl {
  bottom: 20px;
  left: 20px;
  transform: rotate(270deg);
}

.ornament-stroke {
  stroke-dasharray: none;
  stroke-dashoffset: 0;
}

.ornament-fine {
  stroke-width: 1;
}

.clover-leaf {
  fill: rgba(74, 105, 68, 0.09);
  stroke: rgba(55, 87, 56, 0.76);
  stroke-width: 1.25;
}

.ornament-dot {
  fill: rgba(123, 34, 50, 0.7);
  stroke: none;
}

.frame-emblem {
  position: absolute;
  left: 50%;
  display: grid;
  width: 28px;
  height: 18px;
  place-items: center;
  color: rgba(123, 34, 50, 0.48);
  background: var(--paper);
  font-size: 7px;
  transform: translateX(-50%) rotate(45deg);
}

.frame-emblem-top {
  top: 10px;
}

.frame-emblem-bottom {
  bottom: 10px;
}

.paper-glint {
  position: absolute;
  top: -20%;
  left: -45%;
  width: 34%;
  height: 140%;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 245, 211, 0.3), transparent);
  transform: skewX(-16deg);
}

.letter-folio {
  z-index: 3;
}

.letter-enter {
  animation: paperArrival 0.62s cubic-bezier(0.2, 0.72, 0.28, 1) both;
}

.letter-enter .ornament-frame {
  animation: ornamentFrameDown 1.9s cubic-bezier(0.18, 0.68, 0.25, 1) both;
}

.letter-enter .paper-glint {
  animation: paperGlint 1.15s ease-out 1.35s both;
}

.letter-body.text-mask-reveal {
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 42px), transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 42px), transparent 100%);
  -webkit-mask-position: top;
  mask-position: top;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  animation: textMaskPull var(--text-reveal-duration, 4.8s) cubic-bezier(0.2, 0.62, 0.28, 1) 0.3s both;
}

.letter-body.text-mask-reveal .reveal {
  opacity: 1;
  transform: none;
  transition: none;
}

.letter-folio {
  position: absolute;
  top: 48px;
  right: 104px;
  color: rgba(123, 34, 50, 0.22);
  font: 56px/1 Georgia, "Times New Roman", serif;
}

.letter-number {
  margin: 0 0 26px;
  color: var(--wine);
  font: 600 9px/1.4 Arial, sans-serif;
  letter-spacing: 0;
}

.letter h2 {
  margin: 0;
  color: var(--wine-dark);
  max-width: 80%;
  font-size: 46px;
  font-weight: 400;
  line-height: 1.35;
}

.ink-line {
  width: 68px;
  height: 1px;
  margin: 30px 0 50px;
  background: var(--wine);
}

.letter-body {
  font-size: 18px;
  line-height: 2.22;
}

.letter-body p {
  margin: 0 0 31px;
  text-align: justify;
}

.letter-body .salutation {
  margin-bottom: 32px;
  color: var(--wine-dark);
  font-size: 17px;
  font-weight: 500;
}

blockquote {
  position: relative;
  margin: 42px -7px;
  padding: 23px 18px 23px 24px;
  border-left: 3px solid var(--rose);
  color: var(--wine-dark);
  font-size: 1.04em;
  line-height: 2;
  background: rgba(217, 135, 143, 0.08);
}

.letter-signoff {
  margin-top: 62px;
  padding-top: 38px;
  border-top: 1px solid rgba(69, 47, 45, 0.18);
}

.letter-signoff > p {
  margin: 0 0 36px;
  color: var(--muted);
  font-size: 14px;
}

.signature {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 12px;
}

.signature span {
  color: var(--muted);
  font-size: 11px;
}

.signature strong {
  color: var(--wine);
  font-family: "KaiTi", "STKaiti", cursive;
  font-size: 38px;
  font-weight: 400;
}

.letter-signoff time {
  display: block;
  margin-top: 8px;
  color: #8e817f;
  font: 10px/1.4 Arial, sans-serif;
  text-align: right;
}

.letter-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 66px;
}

.letter-actions button {
  min-height: 48px;
  padding: 0 15px;
  border: 1px solid var(--wine);
  border-radius: 0;
  cursor: pointer;
  font-size: 13px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.letter-actions button:active {
  transform: scale(0.97);
}

.letter-actions button:disabled {
  border-color: rgba(132, 113, 109, 0.32);
  color: rgba(132, 113, 109, 0.52);
  background: transparent;
  cursor: default;
  transform: none;
}

.text-button {
  color: var(--wine);
  background: transparent;
}

.primary-button {
  color: #fff;
  background: var(--wine);
}

.share-button {
  grid-column: 1 / -1;
  color: var(--wine);
  background: rgba(123, 34, 50, 0.04);
}

.credit {
  margin: 42px 0 0;
  color: #a89d9a;
  font: 8px/1.5 Arial, sans-serif;
  text-align: center;
}

.sound-button {
  position: fixed;
  z-index: 5;
  top: var(--safe-top);
  right: 18px;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 50%;
  color: #fff;
  background: rgba(42, 17, 20, 0.34);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.sound-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 18px;
  height: 18px;
}

.sound-icon i {
  display: block;
  width: 2px;
  height: 5px;
  background: currentColor;
  transition: height 0.2s ease;
}

.sound-button[aria-pressed="true"] .sound-icon i {
  animation: bars 0.8s ease-in-out infinite alternate;
}

.sound-button[aria-pressed="true"] .sound-icon i:nth-child(2) {
  animation-delay: -0.25s;
}

.sound-button[aria-pressed="true"] .sound-icon i:nth-child(3) {
  animation-delay: -0.5s;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 16px);
  max-width: calc(100vw - 40px);
  padding: 11px 18px;
  border-radius: 3px;
  color: #fff;
  background: rgba(40, 24, 24, 0.9);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes coverReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes copyEntrance {
  from {
    opacity: 0;
    transform: translateY(-13px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes monogramEntrance {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes envelopeEntrance {
  from {
    opacity: 0;
    transform: translateY(34px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes envelopeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes envelopeGlint {
  0%, 42% {
    opacity: 0;
    transform: translateX(-145%);
  }
  52% { opacity: 0.42; }
  64% {
    opacity: 0;
    transform: translateX(145%);
  }
  100% {
    opacity: 0;
    transform: translateX(145%);
  }
}

@keyframes sealBreathe {
  0%, 100% {
    box-shadow: 0 8px 18px rgba(46, 9, 15, 0.45), inset 0 0 0 4px rgba(255, 227, 220, 0.08);
  }
  50% {
    box-shadow: 0 10px 25px rgba(85, 17, 29, 0.58), 0 0 18px rgba(196, 82, 98, 0.22), inset 0 0 0 4px rgba(255, 227, 220, 0.12);
  }
}

@keyframes sealRing {
  0%, 34% {
    opacity: 0;
    transform: scale(0.86);
  }
  52% { opacity: 0.42; }
  75%, 100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

@keyframes footnoteEntrance {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes envelopeCommit {
  from { transform: translateY(-3px) scale(1); }
  to { transform: translateY(3px) scale(0.995); }
}

@keyframes copyExit {
  from {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
    filter: blur(4px);
  }
}

@keyframes monogramExit {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.04);
  }
}

@keyframes breathe {
  50% { opacity: 0.52; }
}

@keyframes bars {
  from { height: 4px; }
  to { height: 15px; }
}

@keyframes paperArrival {
  from {
    opacity: 0.72;
    transform: translateY(14px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ornamentFrameDown {
  from {
    opacity: 0.35;
    clip-path: inset(0 0 100% 0);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
  }
}

@keyframes textMaskPull {
  from {
    -webkit-mask-size: 100% 0;
    mask-size: 100% 0;
  }
  to {
    -webkit-mask-size: 100% calc(100% + 52px);
    mask-size: 100% calc(100% + 52px);
  }
}

@keyframes paperGlint {
  0% {
    left: -45%;
    opacity: 0;
  }
  22% { opacity: 0.42; }
  100% {
    left: 112%;
    opacity: 0;
  }
}

@media (min-width: 760px) {
  .letter-scene {
    padding-top: 110px;
    padding-bottom: 110px;
  }

  .letter {
    transform: none;
  }
}

@media (max-width: 640px) {
  .cover {
    grid-template-rows: minmax(150px, 0.8fr) auto minmax(72px, 0.5fr);
    padding-right: 18px;
    padding-left: 18px;
  }

  .cover-copy {
    margin-bottom: 24px;
  }

  .cover h1 {
    font-size: 40px;
  }

  .cover-deck {
    font-size: 12px;
  }

  .valentine-type {
    top: 20%;
  }

  .valentine-type span {
    font-size: 38px;
  }

  .valentine-type strong {
    font-size: 58px;
  }

  .envelope-button {
    width: min(88vw, 350px);
    height: 228px;
  }

  .letter-scene {
    padding-top: 72px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .letter-tab {
    grid-template-columns: 1fr;
    min-height: 58px;
    padding: 7px 5px;
    text-align: center;
  }

  .letter-tab .tab-index {
    display: none;
  }

  .tab-copy strong {
    font-size: 14px;
  }

  .tab-copy small {
    font-size: 7px;
  }

  .scene-type span {
    font-size: 40px;
  }

  .scene-type strong {
    font-size: 60px;
  }

  .letter {
    padding: 60px 28px 30px;
  }

  .ornament-frame::before {
    inset: 10px;
  }

  .ornament-frame::after {
    inset: 15px;
  }

  .ornament-corner {
    width: 54px;
    height: 54px;
    stroke-width: 1.15;
  }

  .ornament-tl {
    top: 12px;
    left: 12px;
  }

  .ornament-tr {
    top: 12px;
    right: 12px;
  }

  .ornament-br {
    right: 12px;
    bottom: 12px;
  }

  .ornament-bl {
    bottom: 12px;
    left: 12px;
  }

  .frame-emblem {
    width: 22px;
    background: var(--paper);
  }

  .frame-emblem-top {
    top: 2px;
  }

  .frame-emblem-bottom {
    bottom: 2px;
  }

  .letter-folio {
    top: 35px;
    right: 72px;
    font-size: 38px;
  }

  .letter::after {
    top: 27px;
    right: 24px;
    width: 56px;
  }

  .letter-number {
    max-width: 72%;
    margin-bottom: 23px;
    font-size: 8px;
  }

  .letter h2 {
    max-width: 100%;
    font-size: 34px;
    line-height: 1.45;
  }

  .ink-line {
    margin-top: 24px;
    margin-bottom: 38px;
  }

  .letter-body {
    font-size: 16px;
    line-height: 2.12;
  }

  .letter-body p {
    margin-bottom: 26px;
  }

  .letter-signoff {
    margin-top: 48px;
  }

  .signature strong {
    font-size: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
