@font-face {
  font-family: CMUSS;
  src: url("https://cdn.jsdelivr.net/npm/latex.js@0.13.1/dist/fonts/Sans/cmunss.woff") format("woff");
  font-display: swap;
}

@font-face {
  font-family: HitchHikerSignature;
  src: url("https://graceli.ca/fonts/hitch-hike.regular.otf") format("opentype");
  font-display: swap;
}

.about-dialog {
  width: min(820px, calc(100vw - 32px));
  max-width: none;
  max-height: 92vh;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: #282e4a;
  overflow: auto;
  overscroll-behavior: contain;
  filter: drop-shadow(1px 4px 8px rgba(0, 0, 0, 0.3));
}

.about-dialog::backdrop {
  background: rgba(40, 46, 74, 0.2);
  backdrop-filter: blur(4px);
}

.about-letter {
  position: relative;
  padding: 104px clamp(80px, 12%, 110px) 60px;
  background: url("gallery/paper.webp") center / 100% 100% no-repeat;
}

.about-dialog.is-delivering {
  width: 100vw;
  height: 100dvh;
  max-height: none;
  overflow: hidden;
  filter: none;
}

.about-dialog.is-delivering .about-letter {
  position: absolute;
  top: 50%;
  left: 50%;
  box-sizing: border-box;
  width: min(820px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  visibility: hidden;
}

.about-dialog.is-zooming .about-letter {
  visibility: visible;
  animation: about-letter-zoom 900ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.about-dialog.is-delivering .about-main,
.about-dialog.is-delivering .about-photos,
.about-dialog.is-delivering .about-close {
  visibility: hidden;
}

.about-dialog.is-revealing .about-close {
  animation: about-content-appear 450ms ease both;
}

body.about-delivery-active > .hummingbird {
  visibility: hidden;
}

.about-delivery {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  animation: about-delivery-ready 4.8s linear both;
}

.about-delivery[hidden] {
  display: none;
}

.about-delivery-package {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 200px;
  height: 130px;
  margin: -65px 0 0 -100px;
  animation: about-delivery-flight 4.8s ease-in-out both;
}

.about-delivery-bird.hummingbird {
  position: absolute;
  top: -61px;
  left: 65px;
  width: 76px;
  height: 76px;
  opacity: 1;
  animation: about-delivery-bird 4.8s ease-in-out both;
}

.about-envelope {
  position: absolute;
  inset: 0;
  filter: drop-shadow(1px 5px 6px rgba(40, 46, 74, 0.25));
  perspective: 600px;
}

.about-envelope-back,
.about-envelope-front,
.about-envelope-flap,
.about-envelope-letter {
  position: absolute;
}

.about-envelope-back {
  inset: 0;
  background: #d8c9a9;
  border-radius: 2px;
}

.about-envelope-flap {
  z-index: 4;
  inset: 0 0 auto;
  height: 75px;
  background: #e3d7bd;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  animation: about-envelope-open 4.8s ease-in-out both;
}

.about-envelope-letter {
  z-index: 2;
  left: 9%;
  bottom: 8%;
  width: 82%;
  height: 90%;
  background: url("gallery/paper.webp") center / 100% 100% no-repeat;
  animation: about-letter-emerge 4.8s ease-in-out both;
}

.about-envelope-front {
  z-index: 3;
  inset: 0;
  background: #e9dfca;
  clip-path: polygon(0 0, 50% 58%, 100% 0, 100% 100%, 0 100%);
  border-radius: 2px;
}

.about-dialog.is-zooming .about-envelope-letter {
  visibility: hidden;
}

.about-dialog.is-zooming .about-envelope {
  animation: about-envelope-disappear 300ms ease both;
}

@keyframes about-delivery-flight {
  0% { transform: translate(calc(-50vw - 150px), 22vh) rotate(-5deg); }
  48%, 100% { transform: translate(0, 0) rotate(0); }
}

@keyframes about-delivery-bird {
  0%, 49% { opacity: 1; transform: translate(0, 0); }
  68%, 100% { opacity: 0; transform: translate(24vw, -24vh); }
}

@keyframes about-envelope-open {
  0%, 49% { transform: rotateX(0); }
  0%, 54% { z-index: 4; }
  55%, 100% { z-index: 1; }
  61%, 100% { transform: rotateX(180deg); }
}

@keyframes about-letter-emerge {
  0%, 59% { transform: translateY(0); }
  84%, 100% { transform: translateY(-125px); }
}

@keyframes about-delivery-ready {
  from, to { opacity: 1; }
}

@keyframes about-envelope-disappear {
  to { opacity: 0; }
}

@keyframes about-letter-zoom {
  from { transform: translate(-50%, -50%) translate(var(--zoom-x), var(--zoom-y)) scale(var(--zoom-scale-x), var(--zoom-scale-y)); }
  to { transform: translate(-50%, -50%) scale(1); }
}

@keyframes about-content-appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .about-dialog.is-revealing .about-main,
  .about-dialog.is-revealing .about-photos,
  .about-dialog.is-revealing .about-main .about-signature,
  .about-dialog.is-revealing .about-close {
    animation: none;
  }
}

.about-close {
  position: absolute;
  top: 35px;
  right: 48px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #282e4a;
  font: 30px/1 CMUSS, sans-serif;
  cursor: pointer;
}

.about-close:focus-visible {
  outline: 2px solid #282e4a;
  outline-offset: 2px;
}

.about-title {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.about-copy {
  font: 15px/1.4 CMUSS, sans-serif;
  user-select: text;
  -webkit-user-select: text;
}

.about-copy p {
  margin: 0 0 0.7em;
}

.about-dialog.is-revealing .about-copy p {
  animation: about-content-appear 2s ease both;
}

.about-dialog.is-revealing .about-copy p:nth-child(2) { animation-delay: 1.5s; }
.about-dialog.is-revealing .about-copy p:nth-child(3) { animation-delay: 3s; }
.about-dialog.is-revealing .about-copy p:nth-child(4) { animation-delay: 4.5s; }
.about-dialog.is-revealing .about-copy p:nth-child(5) { animation-delay: 6s; }
.about-dialog.is-revealing .about-copy p:nth-child(6) { animation-delay: 7.5s; }

.about-copy a {
  font-weight: 600;
  position: relative;
  color: #806100;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease-in-out, text-shadow 0.2s ease-in-out;
  padding-bottom: 0.35em;
  padding-top: 0.35em;
}

.about-copy a:hover,
.about-copy a:focus-visible {
  background: linear-gradient(104deg, rgba(239, 222, 151, 0) 0.9%, rgba(239, 222, 151, 0.85) 2.4%, rgba(239, 222, 151, 0.5) 5.8%, rgba(239, 222, 151, 0.1) 93%, rgba(239, 222, 151, 0.7) 96%, rgba(239, 222, 151, 0) 98%), linear-gradient(183deg, rgba(239, 222, 151, 0) 0%, rgba(239, 222, 151, 0.3) 7.9%, rgba(239, 222, 151, 0) 15%);
  background-size: 100% 75%;
  background-position: center;
  background-repeat: no-repeat;
  text-shadow: -0.15em 0.15em 0.42em rgba(239, 222, 151, 0.7), 0.15em -0.15em 0.31em #fff, -0.15em -0.15em 1.3em #fff;
  color: #000;
  text-decoration: none;
}

.about-copy a:focus-visible {
  outline: 2px solid #282e4a;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .about-copy a {
    transition: none;
  }
}

.about-letter-content {
  display: flex;
  align-items: stretch;
  gap: 20px;
  column-gap: 44px;
}

.about-main {
  flex: 1 1 0;
  min-width: 0;
}

.about-signature {
  display: inline-block;
  font: 21px/1 HitchHikerSignature, cursive;
}

.about-dialog.is-revealing .about-signature {
  animation: about-signature-write 1.5s ease-out 9.7s both;
}

@keyframes about-signature-write {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

.about-photos {
  display: flex;
  flex: 0 0 112px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  min-width: 0;
}

.about-polaroid {
  position: relative;
  box-sizing: border-box;
  flex: none;
  width: 112px;
  margin: 0;
  padding: 16px 9px 10px;
  background: #f7f7f1 url("gallery/polaroid-paper.png") top / 100% auto repeat-y;
  color: #282e4a;
  text-align: center;
  filter: drop-shadow(1px 4px 4px rgba(0, 0, 0, 0.5));
  transform: rotate(var(--photo-rotation));
}

.about-polaroid img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.about-polaroid-adult {
  --photo-rotation: 3deg;
}

.about-polaroid-adult img {
  object-position: center 46%;
}

.about-polaroid-child {
  --photo-rotation: -3deg;
}

.about-polaroid figcaption {
  min-height: 30px;
  padding-top: 8px;
  font: 14px/1.05 'Caveat', cursive;
}

.about-polaroid::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: -7px;
  left: calc(50% - 21px);
  width: 42px;
  height: 17px;
  background: rgba(239, 222, 151, 0.85);
  clip-path: polygon(2% 0, 98% 4%, 100% 90%, 3% 100%, 0 45%);
  mask-image: linear-gradient(#000, #000);
  mask-repeat: no-repeat;
  mask-size: 100% 100%;
  transform: rotate(-3deg);
}

.about-photo-image {
  position: relative;
}

.about-face-circle {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: #171717;
  stroke-width: 1.7;
  stroke-linecap: round;
  pointer-events: none;
}

.about-marker {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  background: url("gallery/marker.png") center / contain no-repeat;
  opacity: 0;
  offset-anchor: 7px 27px;
  offset-rotate: 0deg;
  pointer-events: none;
}

.about-polaroid-child .about-marker {
  offset-path: ellipse(10% 12% at 32% 22%);
}

.about-polaroid-adult .about-marker {
  offset-path: ellipse(8% 10% at 54% 22%);
}

@supports (offset-path: shape(from 0% 0%, line to 100% 100%)) {
  .about-polaroid-child .about-marker {
    offset-path: shape(from 42% 22%, curve to 32% 34% with 42% 29% / 38% 35%, curve to 22% 22% with 26% 34% / 21% 29%, curve to 32% 10% with 22% 16% / 26% 10%, curve to 41% 21% with 38% 10% / 42% 15%);
  }

  .about-polaroid-adult .about-marker {
    offset-path: shape(from 62% 22%, curve to 54% 32% with 62% 28% / 59% 33%, curve to 46% 22% with 49% 32% / 45% 28%, curve to 54% 12% with 46% 17% / 49% 12%, curve to 61% 21% with 59% 12% / 62% 16%);
  }
}

.about-dialog.is-revealing .about-polaroid-child .about-marker {
  animation: about-marker-move 2s linear 13.45s both;
}

.about-dialog.is-revealing .about-polaroid-adult .about-marker {
  animation: about-marker-move 2s linear 18.1s both;
}

.about-dialog.is-revealing .about-polaroid-child {
  animation: about-photo-drop 600ms cubic-bezier(0.2, 0.8, 0.3, 1) 11.35s both;
}

.about-dialog.is-revealing .about-polaroid-adult {
  animation: about-photo-drop 600ms cubic-bezier(0.2, 0.8, 0.3, 1) 16s both;
}

.about-dialog.is-revealing .about-polaroid-child::before {
  animation: about-tape-place 350ms ease-out 12.55s both;
}

.about-dialog.is-revealing .about-polaroid-adult::before {
  animation: about-tape-place 350ms ease-out 17.2s both;
}

.about-dialog.is-revealing .about-face-circle path {
  stroke-dasharray: 100;
}

.about-dialog.is-revealing .about-polaroid-child .about-face-circle path {
  animation: about-marker-circle 1s linear 14.05s both;
}

.about-dialog.is-revealing .about-polaroid-adult .about-face-circle path {
  animation: about-marker-circle 1s linear 18.7s both;
}

@keyframes about-photo-drop {
  0% {
    opacity: 0;
    transform: translateY(-110px) rotate(calc(var(--photo-rotation) - 12deg)) scale(1.15);
    filter: drop-shadow(5px 16px 10px rgba(0, 0, 0, 0.25));
    animation-timing-function: cubic-bezier(0.55, 0.05, 0.9, 0.55);
  }
  10% { opacity: 1; }
  62% {
    transform: translateY(0) rotate(var(--photo-rotation)) scale(1);
    filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.5));
    animation-timing-function: ease-out;
  }
  73% { transform: translateY(-9px) rotate(calc(var(--photo-rotation) + 2deg)); animation-timing-function: ease-in; }
  84% { transform: translateY(0) rotate(calc(var(--photo-rotation) - 1deg)); animation-timing-function: ease-out; }
  92% { transform: translateY(-2px) rotate(calc(var(--photo-rotation) + 0.5deg)); }
  100% { opacity: 1; transform: translateY(0) rotate(var(--photo-rotation)) scale(1); filter: drop-shadow(1px 4px 4px rgba(0, 0, 0, 0.5)); }
}

@keyframes about-tape-place {
  from { mask-size: 0% 100%; }
  to { mask-size: 100% 100%; }
}

@keyframes about-marker-circle {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: 0; }
}

@keyframes about-marker-move {
  0% { opacity: 0; offset-distance: 0%; transform: translate(-80px, -45px); }
  10% { opacity: 1; }
  30% { opacity: 1; offset-distance: 0%; transform: translate(0, 0); }
  80% { opacity: 1; offset-distance: 100%; transform: translate(0, 0); }
  100% { opacity: 0; offset-distance: 100%; transform: translate(15px, -20px); }
}

@media (prefers-reduced-motion: reduce) {
  .about-dialog.is-revealing .about-copy p,
  .about-dialog.is-revealing .about-polaroid,
  .about-dialog.is-revealing .about-polaroid::before,
  .about-dialog.is-revealing .about-polaroid-child .about-marker,
  .about-dialog.is-revealing .about-polaroid-adult .about-marker,
  .about-dialog.is-revealing .about-polaroid-child .about-face-circle path,
  .about-dialog.is-revealing .about-polaroid-adult .about-face-circle path {
    animation: none;
  }
}

@media (max-height: 760px) {
  .about-letter {
    padding-top: 92px;
    padding-bottom: 40px;
  }

  .about-copy {
    font-size: 13px;
  }
}

@media (max-width: 600px) {
  .about-letter-content {
    flex-direction: column;
  }

  .about-photos {
    flex: none;
    align-self: center;
  }

  .about-letter {
    padding-right: clamp(48px, 12vw, 76px);
    padding-left: clamp(48px, 12vw, 76px);
  }

  .about-close {
    top: 30px;
    right: 30px;
  }
}
