:root {
  /* palette from giraffe photo — caramel coat, sage leaves, warm cream */
  --accent: #b8784a;
  --accent-soft: #d4a876;
  --accent-deep: #6f4528;
  --green: #4e7a44;
  --green-soft: #8faf72;
  --cream: #f2ebe0;
  --sand: #e5d9c8;
  --text: #2c241c;
  --text-muted: #5a5046;
  --shadow: rgba(44, 36, 28, 0.16);
  --shadow-accent: rgba(111, 69, 40, 0.32);

  /* legacy names used throughout the stylesheet */
  --pink: var(--accent);
  --pink-soft: var(--accent-soft);
  --pink-deep: var(--accent-deep);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Poppins", Arial, sans-serif;
  background: var(--cream);
  color: var(--text);
}

.hidden {
  display: none !important;
}

/* ---------------------------------- */
/* LANDING / UNLOCK SCREEN            */
/* ---------------------------------- */
#unlock-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  text-align: center;
  overflow: hidden;
  /* warm sand base before the photo fades in */
  background: #ddd8d4;
}

.unlock-photo-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #ddd8d4;
}
.unlock-photo-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(232, 223, 210, 0.2) 0%,
    rgba(44, 36, 28, 0.08) 100%
  );
  pointer-events: none;
}

/* the background photo — real <img> renders more reliably on iOS than CSS backgrounds */
.unlock-photo {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 45%;
  opacity: 0;
  transition: opacity 0.9s ease;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}
.unlock-photo.loaded {
  opacity: 1;
}

/* soft floating hearts in the background — desktop only */
#unlock-screen::before,
#unlock-screen::after {
  content: "❤";
  position: absolute;
  z-index: 1;
  color: rgba(184, 120, 74, 0.1);
  font-size: 160px;
  pointer-events: none;
  animation: drift 9s ease-in-out infinite;
}
#unlock-screen::before { top: -30px; left: -20px; }
#unlock-screen::after  { bottom: -40px; right: -30px; animation-delay: 2s; }

@keyframes drift {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50%      { transform: translateY(18px) rotate(6deg); }
}

.lock-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 560px;
  padding: 48px 32px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(10px);
  box-shadow: 0 24px 60px var(--shadow);
  animation: cardIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.lock-eyebrow {
  margin: 0 0 16px;
  letter-spacing: 0.02em;
  text-transform: none;
  font-size: clamp(14px, 2.8vw, 16px);
  font-weight: 400;
  line-height: 1.55;
  color: var(--pink-deep);
  opacity: 0.9;
}

.lock-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: clamp(40px, 9vw, 72px);
  line-height: 1;
  color: var(--text);
}

.lock-title .plus {
  color: var(--accent);
  font-size: 0.7em;
}

#password-input {
  width: clamp(160px, 40vw, 240px);
  padding: 4px 8px 8px;
  border: none;
  border-bottom: 3px solid var(--pink-soft);
  background: transparent;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-weight: 500;
  font-size: 1em;
  color: var(--pink-deep);
  text-align: center;
  outline: none;
  transition: border-color 0.25s ease;
}
#password-input::placeholder {
  color: rgba(111, 69, 40, 0.38);
}
#password-input:focus {
  border-color: var(--pink);
}

.lock-sub {
  margin: 22px 0 28px;
  font-size: clamp(14px, 2.5vw, 15px);
  font-weight: 300;
  line-height: 1.6;
  color: var(--text-muted);
}

#unlock-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 34px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-deep) 100%);
  color: white;
  font-family: "Poppins", sans-serif;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 12px 24px var(--shadow-accent);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#unlock-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(111, 69, 40, 0.42);
}
#unlock-btn:active {
  transform: translateY(0);
}
.btn-heart {
  display: inline-block;
  animation: beat 1.2s ease-in-out infinite;
}
@keyframes beat {
  0%, 100% { transform: scale(1); }
  15%      { transform: scale(1.25); }
  30%      { transform: scale(1); }
}

#error-message {
  min-height: 22px;
  margin: 18px 0 0;
  font-size: 15px;
  color: var(--pink-deep);
  font-weight: 500;
}

/* shake the card on wrong answer */
#unlock-screen.wrong .lock-card {
  animation: shake 0.45s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}

/* ---------------------------------- */
/* HEART TRANSITION OVERLAY           */
/* ---------------------------------- */
#heart-transition {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  pointer-events: none;
}
#heart-transition.show {
  display: block;
}

.panel {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50.2%; /* slight overlap so there is no center seam */
  overflow: hidden;
  background:
    radial-gradient(600px 600px at center, #e5d9c8 0%, transparent 70%),
    linear-gradient(160deg, #d4a876 0%, #b8784a 55%, #6f4528 100%);
  transition: transform 1s cubic-bezier(0.7, 0, 0.3, 1);
}
.panel.left  { left: 0;  transform: translateX(-100%); }
.panel.right { right: 0; transform: translateX(100%); }

/* hearts meet in the center */
#heart-transition.together .panel.left,
#heart-transition.together .panel.right {
  transform: translateX(0);
}

/* heart opens up to reveal the site */
#heart-transition.open .panel.left  { transform: translateX(-100%); }
#heart-transition.open .panel.right { transform: translateX(100%); }

/* each panel carries one half of a single full-screen photo.
   both <img> elements are sized to the full viewport and anchored to
   opposite edges, so the panel's overflow:hidden clips each to its half.
   when the panels meet they line up into one seamless photo. */
.photo {
  position: absolute;
  top: 0;
  width: 100vw;
  height: 100%;
  object-fit: cover;
  object-position: center;
  user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
}
.panel.left  .photo { left: 0; }
.panel.right .photo { right: 0; }

/* a soft glowing line where the two halves meet, to sell "as one" */
.seam {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  opacity: 0;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 24px 6px rgba(255, 255, 255, 0.7);
  transition: opacity 0.4s ease;
}
.panel.left  .seam { right: 0; }
.panel.right .seam { left: 0; }

#heart-transition.together .seam {
  opacity: 1;
}
#heart-transition.open .seam {
  opacity: 0;
}

/* ---------------------------------- */
/* BIRTHDAY SITE — horizontal journey */
/* ---------------------------------- */
#birthday-site {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--cream);
  animation: fadeUp 1s ease 0.4s both;
}
@keyframes fadeUp {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.hero-heart {
  color: var(--pink);
  display: inline-block;
  animation: beat 1.2s ease-in-out infinite;
}

/* fixed header: timeline rail across the top */
.journey-header {
  flex: 0 0 auto;
  padding: 18px 20px 10px;
  background: linear-gradient(180deg, var(--cream) 70%, transparent);
  z-index: 10;
}
.journey-hint {
  margin: 10px 0 0;
  text-align: center;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: #8a7d6e;
  opacity: 0.85;
}

/* full-width progress rail */
.journey-rail {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 4px 0;
}
.journey-rail::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 34px;
  height: 3px;
  background: var(--sand);
  border-radius: 3px;
  z-index: 0;
}
.journey-rail-fill {
  position: absolute;
  left: 10px;
  top: 34px;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--pink), var(--pink-deep));
  border-radius: 3px;
  transition: width 0.65s cubic-bezier(0.7, 0, 0.2, 1);
  z-index: 1;
}
.journey-node {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  padding: 0 2px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}
.journey-node-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--sand);
  transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}
.journey-node-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #8a7d6e;
  text-align: center;
  line-height: 1.2;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.3s ease;
}
.journey-node:hover .journey-node-dot {
  transform: scale(1.2);
  background: var(--pink-soft);
}
.journey-node.done .journey-node-dot {
  background: var(--pink);
}
.journey-node.active .journey-node-dot {
  background: var(--pink-deep);
  transform: scale(1.5);
  box-shadow: 0 0 0 5px rgba(184, 120, 74, 0.22);
}
.journey-node.active .journey-node-label {
  color: var(--pink-deep);
  font-weight: 600;
}

/* main horizontal viewport */
.journey-viewport {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.journey-track {
  display: flex;
  height: 100%;
  will-change: transform;
  transition: transform 0.75s cubic-bezier(0.7, 0, 0.2, 1);
}
.journey-panel {
  flex: 0 0 100%;
  min-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px 24px;
}

/* welcome + letter panels */
.journey-welcome,
.journey-letter {
  text-align: center;
  background:
    radial-gradient(600px 400px at 50% 40%, rgba(143, 175, 114, 0.2) 0%, transparent 70%);
}
.journey-welcome .panel-inner,
.journey-letter .panel-inner {
  max-width: 560px;
}
.panel-eyebrow {
  margin: 0 0 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--pink-deep);
  opacity: 0.75;
}
.journey-welcome h1 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: clamp(40px, 8vw, 68px);
  margin: 0 0 16px;
  color: var(--text);
}
.panel-lead {
  margin: 0;
  font-weight: 300;
  font-size: clamp(16px, 2.5vw, 20px);
  line-height: 1.6;
  color: var(--text-muted);
}
.journey-letter h2 {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(32px, 6vw, 48px);
  color: var(--pink-deep);
  margin: 0 0 20px;
}
.journey-letter p {
  font-size: clamp(17px, 2.5vw, 21px);
  font-weight: 300;
  line-height: 1.75;
  color: var(--text-muted);
  margin: 0 0 1.1em;
}
.journey-letter p:last-of-type:not(.letter-signoff) {
  margin-bottom: 1.1em;
}
.letter-signoff {
  margin: 1.5em 0 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(20px, 3.5vw, 26px);
  font-style: italic;
  font-weight: 500;
  color: var(--accent-deep);
  text-align: right;
}

/* hidden last beat after the letter */
.journey-finale {
  text-align: center;
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, rgba(184, 120, 74, 0.12) 0%, transparent 70%);
}
.journey-finale .panel-inner {
  max-width: 480px;
}
.finale-eyebrow {
  margin: 0 0 20px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--accent-deep);
  opacity: 0.75;
}
.finale-line {
  margin: 0 0 12px;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(26px, 5vw, 38px);
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
}
.finale-emphasis {
  margin-bottom: 32px;
  color: var(--accent-deep);
}
.finale-replay {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 10px 24px var(--shadow-accent);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.finale-replay:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(111, 69, 40, 0.42);
}

/* memory panels: photo + story side by side */
.journey-memory {
  padding: 0;
}
.memory-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(20px, 4vw, 48px);
  width: 100%;
  max-width: 1100px;
  height: 100%;
  max-height: calc(100vh - 160px);
  align-items: center;
}
.journey-memory.flip .memory-layout {
  direction: rtl;
}
.journey-memory.flip .memory-layout > * {
  direction: ltr;
}
.memory-photo-wrap {
  position: relative;
  height: 100%;
  min-height: 240px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 50px var(--shadow);
}
.memory-photo-wrap:not(.memory-has-video)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(78, 122, 68, 0.1));
  pointer-events: none;
  z-index: 1;
}
.memory-photo,
.memory-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  background: linear-gradient(160deg, #ebe3d6, #ded0bc);
}
/* tall screenshots (e.g. iMessage) — show full image, don't crop to keyboard */
.memory-fit-contain {
  background: #141414;
}
.memory-fit-contain .memory-photo,
.memory-fit-contain .memory-video {
  object-fit: contain;
  object-position: top center;
}
.memory-video {
  background: #2c241c;
}

/* video play overlay */
.memory-video-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}
.memory-video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.35s ease;
}
.memory-video-play {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.35s ease;
}
.memory-video-play-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  box-shadow: 0 8px 28px var(--shadow-accent);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.memory-video-play-icon::before {
  content: "";
  margin-left: 4px;
  border-style: solid;
  border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent #fff;
}
.memory-video-play-label {
  font-family: "Poppins", sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}
.memory-video-play:hover .memory-video-play-icon {
  transform: scale(1.06);
  box-shadow: 0 12px 32px rgba(111, 69, 40, 0.45);
}
.memory-video-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(20, 20, 20, 0.45);
  pointer-events: none;
}
.memory-video-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: videoSpin 0.75s linear infinite;
}
@keyframes videoSpin {
  to { transform: rotate(360deg); }
}
.memory-video-wrap.is-playing .memory-video-overlay {
  opacity: 0;
  pointer-events: none;
}
.memory-video-wrap.is-playing .memory-video-play {
  pointer-events: none;
}
.memory-video-wrap.is-loading .memory-video-loading {
  display: flex;
}
.memory-video-wrap.is-loading .memory-video-play {
  opacity: 0;
  pointer-events: none;
}
.memory-has-video::after {
  content: "▶ Video";
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  padding: 5px 10px;
  border-radius: 999px;
  font-family: "Poppins", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(44, 36, 28, 0.72);
  backdrop-filter: blur(4px);
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.memory-has-video:has(.memory-video-wrap.is-playing)::after {
  opacity: 0;
}

/* 2×2 photo gallery slide */
.memory-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  height: 100%;
  min-height: 240px;
}
.memory-gallery-photo {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  display: block;
  border-radius: 10px;
  background: linear-gradient(160deg, #ebe3d6, #ded0bc);
}
.journey-memory-gallery .memory-photo-wrap::after {
  display: none;
}
.journey-memory-gallery .memory-photo-wrap {
  box-shadow: none;
  background: transparent;
}
.memory-story {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 8px;
}
.memory-story > * {
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.journey-panel.active .memory-story > * {
  opacity: 1;
  transform: none;
}
.journey-panel.active .memory-title { transition-delay: 0.08s; }
.journey-panel.active .memory-caption { transition-delay: 0.16s; }

.memory-title {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(28px, 4.5vw, 42px);
  margin: 0 0 14px;
  color: var(--text);
  line-height: 1.15;
}
.memory-caption {
  margin: 0;
  font-weight: 300;
  font-size: clamp(15px, 2.2vw, 19px);
  line-height: 1.65;
  color: var(--text-muted);
}

/* welcome / letter / finale text reveal */
.journey-welcome .panel-inner > *,
.journey-letter .panel-inner > *,
.journey-finale .panel-inner > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.journey-panel.active .panel-inner > * {
  opacity: 1;
  transform: none;
}
.journey-panel.active .panel-eyebrow,
.journey-panel.active .finale-eyebrow { transition-delay: 0.05s; }
.journey-panel.active h1,
.journey-panel.active h2 { transition-delay: 0.12s; }
.journey-panel.active .panel-lead,
.journey-panel.active .journey-letter p { transition-delay: 0.2s; }
.journey-panel.active .letter-signoff { transition-delay: 0.35s; }
.journey-panel.active .finale-line { transition-delay: 0.15s; }
.journey-panel.active .finale-line.finale-emphasis { transition-delay: 0.25s; }
.journey-panel.active .finale-replay { transition-delay: 0.4s; }

/* footer controls */
.journey-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px 24px 28px;
  background: linear-gradient(0deg, var(--cream) 60%, transparent);
  z-index: 10;
}
.journey-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-deep) 100%);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 24px var(--shadow-accent);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.journey-arrow:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 14px 28px rgba(111, 69, 40, 0.42);
}
.journey-arrow:disabled {
  opacity: 0.3;
  cursor: default;
  transform: none;
  box-shadow: none;
}
.journey-counter {
  min-width: 80px;
  text-align: center;
  font-family: "Cormorant Garamond", serif;
  font-size: 22px;
  color: var(--pink-deep);
}

@media (max-width: 720px) {
  #unlock-screen {
    padding: 16px;
    min-height: 100dvh;
    background: #ddd8d4;
  }
  /* hide emoji hearts on phone — they render huge and overpower the photo */
  #unlock-screen::before,
  #unlock-screen::after {
    display: none;
  }
  .unlock-photo-wrap {
    background: #ddd8d4;
  }
  .unlock-photo {
    object-fit: contain;
    object-position: center center;
    transform: scale(1.04);
    transform-origin: center center;
  }
  .lock-card {
    padding: 32px 20px;
    max-height: 78dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .journey-header { padding: 12px 12px 6px; }
  .journey-hint { display: none; }
  .journey-node-label { font-size: 0; }
  .journey-node-dot { width: 12px; height: 12px; }
  .journey-rail { padding-top: 18px; }
  .journey-rail::before,
  .journey-rail-fill { top: 24px; }

  .memory-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    height: auto;
    max-height: none;
    gap: 16px;
    align-items: start;
  }
  .journey-memory.journey-panel {
    align-items: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .journey-memory.flip .memory-layout { direction: ltr; }
  .memory-photo-wrap {
    width: 100%;
    max-width: min(100%, 320px);
    margin: 0 auto;
    height: auto;
    min-height: 0;
    max-height: min(40dvh, 300px);
    aspect-ratio: 4 / 3;
  }
  /* tall screenshots (iMessage, etc.) need a portrait frame */
  .memory-photo-wrap.memory-fit-contain {
    max-height: min(52dvh, 480px);
    aspect-ratio: 9 / 16;
  }
  .memory-photo-wrap.memory-has-video {
    max-height: min(48dvh, 420px);
    aspect-ratio: 9 / 16;
  }
  .memory-photo,
  .memory-video {
    object-fit: cover;
    object-position: center;
    height: 100%;
    max-height: inherit;
  }
  .memory-fit-contain .memory-photo,
  .memory-fit-contain .memory-video {
    object-fit: contain;
    object-position: top center;
  }
  .memory-photo-wrap:not(.memory-fit-contain) {
    background: linear-gradient(160deg, #ebe3d6, #ded0bc);
  }
  .memory-gallery {
    max-height: min(50dvh, 480px);
    aspect-ratio: 1;
    gap: 6px;
  }
  .memory-gallery-photo {
    border-radius: 8px;
    object-fit: cover;
  }
  .memory-story {
    position: relative;
    z-index: 2;
    padding: 0 4px 8px;
    text-align: center;
  }
  .memory-story > * { transform: translateY(12px); }
  .journey-panel.active .memory-story > * { transform: none; }

  /* text-heavy panels (welcome, letter, finale): allow scrolling so long
     copy is never clipped on short phone screens */
  .journey-welcome.journey-panel,
  .journey-letter.journey-panel,
  .journey-finale.journey-panel {
    align-items: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: 20px;
    padding-bottom: 24px;
  }
  .journey-welcome .panel-inner,
  .journey-letter .panel-inner,
  .journey-finale .panel-inner {
    margin: auto 0;
  }
  .journey-letter p {
    font-size: clamp(15px, 4vw, 18px);
    line-height: 1.6;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}
