:root {
  font-family:Georgia,'Times New Roman',serif;
  color:#583c49;
  background:#faf8f5;
  font-synthesis:none;
  color-scheme:light;
  --muted:#956e80;
  --accent:#a75e7b;
}

* {
  box-sizing:border-box;
}

html,body {
  width:100%;
  height:100%;
  margin:0;
  overflow:hidden;
}

button,input {
  font:inherit;
  color:inherit;
}

button {
  cursor:pointer;
}

button:focus-visible {
  outline:2px solid #a66b86;
  outline-offset:5px;
}

[hidden] {
  display:none!important;
}

body {
  background:linear-gradient(to bottom,#faf8f5 0%,#faf8f5 74%,#f6f1ee 89%,#f1ede9 100%);
}

#space {
  position:fixed;
  inset:0;
  overflow:hidden;
  perspective-origin:50% 50%;
  touch-action:none;
  cursor:grab;
  user-select:none;
}

#space.dragging {
  cursor:grabbing;
}

#world {
  position:absolute;
  left:50%;
  top:49%;
  width:0;
  height:0;
  transform-style:preserve-3d;
  will-change:transform;
}

.image-card {
  position:absolute;
  left:0;
  top:0;
  padding:0;
  border:0;
  background:transparent;
  transform-style:preserve-3d;
  backface-visibility:hidden;
  cursor:pointer;
  outline:none;
}

.image-card img {
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  background:#fff;
  pointer-events:none;
  -webkit-user-drag:none;
  box-shadow:0 3px 10px #743c591a;
  outline:1px solid #95677b24;
  outline-offset:-1px;
}

.image-card:focus-visible {
  outline:2px solid #a15d7d;
  outline-offset:7px;
}

.image-card .caption {
  position:absolute;
  left:50%;
  top:100%;
  margin-top:7px;
  white-space:nowrap;
  font-family:-apple-system,BlinkMacSystemFont,sans-serif;
  font-size:13px;
  line-height:1.4;
  transform:translateX(-50%);
  pointer-events:none;
  opacity:0;
  transition:opacity .2s;
}

.image-card:hover .caption {
  opacity:1;
}

.image-card.is-selected .caption {
  opacity:0;
}

.year-heart {
  position:absolute;
  pointer-events:none;
  backface-visibility:hidden;
  transition:opacity .25s;
}

.year-heart svg {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  overflow:visible;
}

.year-heart path {
  fill:#f5d3e408;
  stroke:#ad708938;
  stroke-width:.48;
  vector-effect:non-scaling-stroke;
}

.horizon {
  position:fixed;
  inset:auto 0 0;
  height:17vh;
  pointer-events:none;
  background:linear-gradient(transparent,#d8cfca12);
  z-index:2;
}

.focus-frame {
  position:fixed;
  z-index:4;
  left:50%;
  top:43%;
  width:min(72vw,900px);
  height:min(50vh,520px);
  transform:translate(-50%,-50%);
  pointer-events:none;
  display:flex;
  align-items:center;
  justify-content:center;
  opacity:1;
  transition:opacity .35s ease;
}

.focus-frame img {
  display:block;
  max-width:100%;
  max-height:100%;
  width:auto;
  height:auto;
  object-fit:contain;
  background:#fff;
  box-shadow:0 18px 60px #80476420,0 2px 12px #80476418;
  outline:1px solid #95677b24;
  outline-offset:-1px;
}

.flying .focus-frame {
  opacity:.18;
}

.selection {
  position:fixed;
  left:50%;
  bottom:75px;
  transform:translateX(-50%);
  z-index:5;
  text-align:center;
  max-width:92vw;
}

#selection-meta {
  font-family:-apple-system,BlinkMacSystemFont,sans-serif;
  font-size:12px;
  color:#956b80;
  letter-spacing:1px;
  margin:0 0 7px;
}

#selection-title {
  font-size:20px;
  font-weight:400;
  letter-spacing:2px;
  margin:0 0 9px;
}

.photo-controls {
  display:flex;
  gap:16px;
  align-items:center;
  justify-content:center;
}

.photo-controls button {
  border:0;
  background:#faf8f5cc;
  border-radius:20px;
  padding:7px 11px;
  font-size:17px;
  color:#86566f;
}

#back {
  font-size:13px;
  background:transparent;
}

kbd {
  font:10px Arial,sans-serif;
  border:1px solid #b3859d80;
  border-radius:3px;
  padding:2px 4px;
  margin-left:7px;
}

.footer {
  position:fixed;
  bottom:16px;
  left:0;
  right:0;
  z-index:8;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:13px;
  pointer-events:none;
}

.instructions {
  margin:0;
  text-align:center;
  color:#956b80;
  font-size:12px;
  letter-spacing:.5px;
  pointer-events:none;
}

.instructions span {
  padding:0 8px;
  opacity:.55;
}

.focused .instructions {
  opacity:.45;
}

.flying #space {
  cursor:progress;
}

.sr-only {
  position:absolute;
  width:1px;
  height:1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
}

.no-script {
  position:fixed;
  inset:45% 0;
  text-align:center;
}

@media(max-width:700px) {
  #world {
    top:47%;
  }
  .focus-frame {
    top:46%;
    width:88vw;
    height:min(42vh,430px);
  }
  .selection {
    bottom:75px;
  }
  #selection-title {
    font-size:18px;
  }
  .footer {
    bottom:19px;
  }
  .instructions {
    font-size:11px;
    letter-spacing:0;
  }
  .instructions span {
    padding:0 4px;
  }
  .photo-controls {
    gap:24px;
  }
}

@media(max-height:600px) and (min-width:701px) {
  .selection {
    bottom:65px;
  }
}

@media(prefers-reduced-motion:reduce) {
  * {
    transition:none!important;
  }
}

#space {
  mask-image:linear-gradient(transparent,black 12%,black 85%,transparent 99%);
}

body.focused #space {
  mask-image:none;
}

.footer {
  background:linear-gradient(transparent,#f1ede966);
  padding-top:10px;
}

.focused .image-card {
  visibility:hidden;
}

@media(min-width:701px) {
  #world {
    top:50%;
  }
}

@media(max-width:700px) and (max-height:560px) {
  .selection {
    bottom:55px;
  }
  .footer {
    bottom:7px;
  }
  .instructions {
    display:none;
  }
}

.selection {
  width:min(440px,92vw);
}

#back {
  white-space:nowrap;
}

body {
  background:radial-gradient(ellipse at 50% 42%,#fdfaf8 0%,#f9f3f0 55%,#f3e9e6 100%);
}

#hearts {
  position:fixed;
  inset:0;
  width:100%;
  height:100%;
  pointer-events:none;
  z-index:0;
}

#space {
  z-index:1;
}

/* Opening: one photo appears on its own, then shrinks away as the camera pulls back through the heart. */
.intro-photo {
  position:fixed;
  left:50%;
  top:50%;
  z-index:3;
  width:min(230px,56vw);
  padding:min(8px,1.8vw);
  background:#fff;
  border-radius:2px;
  box-shadow:0 10px 26px #7a3d5226;
  pointer-events:none;
  transform:translate(-50%,-50%);
  animation:photo-in .9s cubic-bezier(.25,.1,.25,1) both,photo-recede 1.6s cubic-bezier(.5,0,.7,1) 1.7s forwards;
}

.intro-photo img {
  display:block;
  width:100%;
  aspect-ratio:3/2;
  object-fit:cover;
  background:#f3ece8;
}

@keyframes photo-in {
  from {
    opacity:0;
    transform:translate(-50%,-50%) scale(.96);
  }
}

@keyframes photo-recede {
  from {
    opacity:1;
    transform:translate(-50%,-50%);
  }
  to {
    opacity:0;
    transform:translate(-50%,-50%) scale(.2);
  }
}

@media(max-width:700px) {
  .intro-photo {
    top:47%;
  }
}

/* The button that sets off the fireworks: fades in once the heart has built. */
.burst-button {
  pointer-events:auto;
  border:1px solid #c99aae66;
  background:#fffaf8d9;
  color:#86566f;
  border-radius:999px;
  padding:9px 22px;
  font-size:13px;
  letter-spacing:2px;
  box-shadow:0 6px 18px #a0566f1a;
  opacity:0;
  transform:translateY(6px);
  transition:opacity .8s ease,transform .8s ease;
}

.burst-button.shown {
  opacity:1;
  transform:none;
}

.burst-button:hover {
  background:#fff;
}

.burst-button:not(.shown),.focused .burst-button {
  opacity:0;
  pointer-events:none;
}

/* A deep blue dusk falls for the fireworks and lifts again after. */
body::before {
  content:"";
  position:fixed;
  inset:0;
  z-index:0;
  pointer-events:none;
  opacity:0;
  transition:opacity 1.4s ease;
  background:radial-gradient(ellipse 110% 85% at 50% 30%,#2f5687 0%,#213f6b 48%,#162d50 100%);
}

body.night::before {
  opacity:1;
}

body.fireworks .year-heart {
  visibility:hidden;
}

.instructions {
  transition:color 1.4s ease;
}

body.night .instructions {
  color:#c9d6e8;
}

.footer {
  transition:background 1.4s ease;
}

body.fireworks .footer {
  background:none;
}

.horizon {
  transition:opacity 1.4s ease;
}

body.fireworks .horizon {
  opacity:0;
}

body.birthday-mode #album,
body.birthday-mode #hearts,
body.birthday-mode .album-entry {
  visibility:hidden;
}
