.private-app {
  min-height: 100vh;
  padding-bottom: 6.5rem;
  overflow: hidden;
  background: var(--paper-soft);
}

.private-mode {
  background: var(--paper-soft);
}

.private-nav {
  position: absolute;
  z-index: 20;
  top: max(0.55rem, env(safe-area-inset-top));
  right: 0.7rem;
  left: 0.7rem;
  min-height: 2.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.3rem 0.4rem 0.3rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: #fff;
  background: rgba(35, 27, 29, 0.48);
  box-shadow: 0 10px 30px rgba(20, 15, 17, 0.12);
  backdrop-filter: blur(16px);
}

.private-brand {
  width: 2rem;
  height: 2rem;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  color: inherit;
  font-family: var(--serif);
  text-decoration: none;
}

.private-links {
  display: none;
  gap: 1.25rem;
}

.private-links a {
  color: inherit;
  font-size: 0.77rem;
  text-decoration: none;
}

.private-logout {
  padding: 0.48rem 0.65rem;
  border: 0;
  color: rgba(255, 255, 255, 0.76);
  background: transparent;
  cursor: pointer;
  font-size: 0.72rem;
}

.private-logout:hover {
  color: #fff;
}

.birthday-hero {
  position: relative;
  aspect-ratio: 3 / 4;
  display: grid;
  align-items: end;
  isolation: isolate;
  overflow: hidden;
  color: #fffaf6;
  background: #1d2028;
}

.birthday-hero-media {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: #1d2028;
}

.birthday-hero-media::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(to top, rgba(24, 15, 18, 0.78), rgba(24, 15, 18, 0.12) 58%, transparent 78%),
    linear-gradient(to right, rgba(24, 15, 18, 0.18), transparent 70%);
}

.birthday-hero-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 53% center;
  animation: hero-arrive 1.4s ease both;
}

.birthday-hero-copy {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 4rem 1.35rem 2.6rem;
  text-shadow: 0 2px 24px rgba(20, 12, 15, 0.5);
  animation: hero-copy-arrive 900ms 180ms ease both;
}

.hero-eyebrow,
.section-index {
  margin: 0 0 1rem;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.hero-eyebrow {
  color: rgba(255, 255, 255, 0.76);
}

.birthday-hero h1 {
  max-width: 11ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3rem, 14vw, 4.5rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.9;
}

.hero-date {
  margin: 1.4rem 0 0;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.16em;
}

.hero-scroll {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.73rem;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.hero-scroll::after {
  content: "↓";
}

.section-pad {
  padding: clamp(5.5rem, 16vw, 10rem) 1.25rem;
}

.section-heading {
  width: min(100%, 68rem);
  margin-inline: auto;
}

.section-index {
  color: var(--wine);
}

.section-heading h2,
.final-copy h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.6rem, 10vw, 5.7rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
}

.centered-heading {
  max-width: 48rem;
  text-align: center;
}

.section-intro {
  max-width: 34rem;
  margin: 1.25rem auto 0;
  color: var(--ink-soft);
  line-height: 1.7;
}

.letter-section {
  position: relative;
  display: grid;
  gap: 2.5rem;
  background:
    linear-gradient(rgba(135, 70, 88, 0.04) 1px, transparent 1px),
    var(--paper-soft);
  background-size: 100% 2.1rem;
}

.letter-heading,
.letter-copy {
  width: min(100%, 43rem);
}

.letter-heading {
  margin-inline: auto;
  text-align: center;
}

.letter-copy {
  margin-inline: auto;
}

.letter-copy p {
  margin: 0 0 1.4rem;
  color: #4c4143;
  font-family: var(--serif);
  font-size: clamp(1.2rem, 5vw, 1.55rem);
  line-height: 1.8;
  white-space: pre-line;
}

.letter-copy p:first-child::first-letter {
  float: left;
  margin: 0.08em 0.12em 0 0;
  color: var(--wine);
  font-size: 3.6em;
  line-height: 0.8;
}

.memories-section {
  background: var(--paper);
}

.memory-list {
  width: min(100%, 72rem);
  display: grid;
  gap: 5rem;
  margin: clamp(4rem, 12vw, 7rem) auto 0;
}

.memory-card {
  display: grid;
  gap: 1.75rem;
}

.memory-media {
  overflow: hidden;
  border-radius: 0.3rem 2rem 0.3rem 2rem;
  box-shadow: 0 25px 60px rgba(57, 40, 44, 0.14);
}

.memory-card-reverse .memory-media {
  border-radius: 2rem 0.3rem 2rem 0.3rem;
}

.memory-image {
  width: 100%;
  aspect-ratio: 4 / 5;
  display: block;
  object-fit: cover;
  transition: transform 700ms ease;
}

.memory-image-focus-right {
  object-position: 58% center;
}

.memory-image-focus-left {
  object-position: 43% center;
}

.memory-card:hover .memory-image {
  transform: scale(1.015);
}

.memory-copy {
  align-self: center;
  padding: 0 0.6rem;
}

.memory-number {
  display: inline-block;
  margin-bottom: 1.1rem;
  color: var(--wine);
  font-family: var(--serif);
  font-size: 0.9rem;
  font-style: italic;
}

.memory-copy h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 500;
  line-height: 1.05;
}

.memory-copy p {
  max-width: 30rem;
  margin: 1rem 0 0;
  color: var(--ink-soft);
  line-height: 1.75;
}

.gallery-section {
  background: var(--paper-soft);
}

.gallery-grid {
  width: min(100%, 78rem);
  columns: 2;
  column-gap: 0.7rem;
  margin: 3.5rem auto 0;
}

.gallery-card {
  position: relative;
  width: 100%;
  display: block;
  break-inside: avoid;
  margin: 0 0 0.7rem;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0.75rem;
  background: var(--paper-deep);
  cursor: zoom-in;
}

.gallery-card:focus-visible {
  outline: 3px solid var(--wine);
  outline-offset: 3px;
}

.gallery-image {
  width: 100%;
  height: auto;
  display: block;
  transition: filter 350ms ease, transform 600ms ease;
}

.gallery-card-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 2.4rem 0.8rem 0.75rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(25, 18, 20, 0.74));
  font-family: var(--serif);
  font-size: 0.78rem;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 250ms ease, transform 250ms ease;
}

.gallery-card:hover .gallery-image,
.gallery-card:focus-visible .gallery-image {
  filter: saturate(0.92) brightness(0.88);
  transform: scale(1.025);
}

.private-button {
  min-height: 3.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 650;
  text-decoration: none;
}

.final-section {
  min-height: 78svh;
  display: grid;
  place-items: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 35%, rgba(201, 155, 165, 0.18), transparent 22rem),
    var(--paper-soft);
}

.final-copy {
  width: min(100%, 45rem);
}

.final-copy > p:not(.section-index) {
  max-width: 34rem;
  margin: 1.3rem auto 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.7;
}

.final-crossword {
  width: min(100%, 34rem);
  margin: 3.25rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid rgba(104, 54, 67, 0.16);
}

.final-crossword p {
  margin: 0 auto 1.35rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.65;
}

.final-download {
  border-color: var(--wine);
  color: var(--wine);
  background: transparent;
}

.final-download:hover {
  color: #fff;
  background: var(--wine);
}

.final-flourish {
  display: block;
  margin-top: 2.5rem;
  color: var(--wine);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.18em;
}

.modal-open {
  overflow: hidden;
}

.lightbox {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
}

.lightbox::backdrop {
  background: rgba(22, 16, 18, 0.82);
  backdrop-filter: blur(8px);
}

.lightbox {
  overflow: hidden;
  color: white;
  background: rgba(25, 19, 21, 0.96);
}

.modal-close {
  position: relative;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  color: white;
  background: rgba(25, 19, 21, 0.42);
  cursor: pointer;
}

.modal-close::before,
.modal-close::after {
  position: absolute;
  width: 1rem;
  height: 1px;
  content: "";
  background: currentColor;
}

.modal-close::before {
  transform: rotate(45deg);
}

.modal-close::after {
  transform: rotate(-45deg);
}

.lightbox > .modal-close {
  position: absolute;
  z-index: 2;
  top: max(1rem, env(safe-area-inset-top));
  right: 1rem;
}

.lightbox-figure {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  gap: 0.75rem;
  margin: 0;
  padding: 4.5rem 1rem max(1rem, env(safe-area-inset-bottom));
}

.lightbox-image {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: calc(100vh - 8rem);
  object-fit: contain;
}

.lightbox-caption {
  color: rgba(255, 255, 255, 0.76);
  font-family: var(--serif);
  text-align: center;
}

.lightbox-arrow {
  position: absolute;
  z-index: 2;
  top: 50%;
  width: 2.75rem;
  height: 3.5rem;
  padding: 0;
  border: 0;
  color: white;
  background: rgba(25, 19, 21, 0.35);
  cursor: pointer;
  font-size: 2.4rem;
  transform: translateY(-50%);
}

.lightbox-previous { left: 0; }
.lightbox-next { right: 0; }

.music-player {
  position: fixed;
  z-index: 18;
  right: 0.75rem;
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  left: 0.75rem;
  padding: 0.6rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 1.1rem;
  color: var(--ink);
  background: rgba(250, 246, 241, 0.9);
  box-shadow: 0 15px 45px rgba(46, 31, 35, 0.18);
  backdrop-filter: blur(18px);
}

.music-player-row {
  min-height: 3rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.5rem;
}

.music-note {
  width: 2.55rem;
  height: 2.55rem;
  display: grid;
  place-items: center;
  border-radius: 0.8rem;
  color: white;
  background: var(--wine);
  font-family: var(--serif);
  font-size: 1.2rem;
}

.is-playing .music-note {
  animation: music-pulse 2.2s ease-in-out infinite;
}

.music-details {
  min-width: 0;
}

.music-details span,
.music-details strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-context {
  margin-bottom: 0.18rem;
  color: var(--ink-soft);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.music-details strong {
  font-family: var(--serif);
  font-size: 0.86rem;
  font-weight: 600;
}

.music-details .music-artist {
  margin-top: 0.1rem;
  color: var(--ink-soft);
  font-size: 0.62rem;
  letter-spacing: 0;
  text-transform: none;
}

.music-controls {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.music-control {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 1.35rem;
}

.music-play {
  color: white;
  background: var(--ink);
  font-size: 0.65rem;
}

.music-expand {
  width: 2.15rem;
  height: 2.15rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(104, 54, 67, 0.16);
  border-radius: 50%;
  color: var(--wine);
  background: rgba(135, 70, 88, 0.07);
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.music-expand::before {
  width: 0.46rem;
  height: 0.46rem;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  content: "";
  transform: translateY(0.12rem) rotate(-135deg);
  transition: transform 180ms ease;
}

.music-player.is-expanded .music-expand::before {
  transform: translateY(-0.12rem) rotate(45deg);
}

.music-expand:hover {
  border-color: rgba(104, 54, 67, 0.3);
  background: rgba(135, 70, 88, 0.13);
}

.music-expand:active {
  transform: scale(0.94);
}

.music-progress {
  max-height: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  overflow: hidden;
  opacity: 0;
  transition: max-height 220ms ease, margin-top 220ms ease, opacity 160ms ease;
}

.music-player.is-expanded .music-progress {
  max-height: 2.5rem;
  margin-top: 0.45rem;
  opacity: 1;
}

.music-progress time {
  min-width: 2.25rem;
  color: var(--ink-soft);
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}

.music-progress time:last-child {
  text-align: right;
}

.music-progress input {
  width: 100%;
  height: 1.75rem;
  margin: 0;
  accent-color: var(--wine);
  cursor: pointer;
}

.music-progress input:disabled {
  cursor: default;
  opacity: 0.45;
}

.music-control:focus-visible,
.music-expand:focus-visible,
.music-progress input:focus-visible,
.modal-close:focus-visible,
.lightbox-arrow:focus-visible,
.gallery-card:focus-visible,
.private-button:focus-visible {
  outline: 3px solid var(--rose);
  outline-offset: 3px;
}

@keyframes hero-arrive {
  from { opacity: 0; transform: scale(1.025); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes hero-copy-arrive {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes music-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@media (min-width: 38rem) {
  .birthday-hero-copy,
  .section-pad {
    padding-inline: 2rem;
  }

  .gallery-grid {
    columns: 3;
    column-gap: 1rem;
  }

  .gallery-card {
    margin-bottom: 1rem;
  }

  .music-player {
    right: 1.25rem;
    left: auto;
    width: min(24rem, calc(100% - 2.5rem));
  }
}

@media (min-width: 48rem) {
  .private-nav {
    position: fixed;
    top: max(0.75rem, env(safe-area-inset-top));
    right: auto;
    left: 50%;
    width: min(calc(100% - 1.5rem), 72rem);
    min-height: 3.25rem;
    padding: 0.45rem 0.55rem 0.45rem 0.7rem;
    transform: translateX(-50%);
  }

  .private-brand {
    width: 2.25rem;
    height: 2.25rem;
  }

  .private-links {
    display: flex;
  }

  .private-logout {
    padding: 0.58rem 0.8rem;
  }
}

@media (hover: hover) {
  .gallery-card-caption {
    opacity: 0;
    transform: translateY(6px);
  }

  .gallery-card:hover .gallery-card-caption,
  .gallery-card:focus-visible .gallery-card-caption {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 52rem) {
  .birthday-hero {
    min-height: 100svh;
    aspect-ratio: auto;
  }

  .birthday-hero-media {
    height: auto;
  }

  .birthday-hero-image {
    height: 100%;
    max-height: none;
    object-position: center 48%;
  }

  .birthday-hero-copy {
    width: min(100%, 72rem);
    height: auto;
    margin-inline: auto;
    padding: 8rem 3rem max(4rem, env(safe-area-inset-bottom));
  }

  .birthday-hero h1 {
    width: auto;
    max-width: 10em;
    font-size: clamp(4.5rem, 6.5vw, 6.4rem);
  }

  .letter-section {
    grid-template-columns: 0.8fr 1.2fr;
    align-items: start;
    padding-inline: max(3rem, calc((100vw - 72rem) / 2));
  }

  .letter-heading,
  .letter-copy {
    width: 100%;
  }

  .letter-heading {
    margin-inline: 0;
    text-align: left;
  }

  .letter-copy {
    padding-top: 2rem;
  }

  .memory-card {
    grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.85fr);
    gap: clamp(3rem, 8vw, 7rem);
    align-items: center;
  }

  .memory-card-reverse {
    grid-template-columns: minmax(18rem, 0.85fr) minmax(0, 1.15fr);
  }

  .memory-card-reverse .memory-media {
    grid-column: 2;
  }

  .memory-card-reverse .memory-copy {
    grid-column: 1;
    grid-row: 1;
  }

  .memory-image {
    aspect-ratio: 5 / 6;
  }

  .gallery-grid {
    columns: 4;
  }

}

@media (prefers-reduced-motion: reduce) {
  .memory-card:hover .memory-image,
  .gallery-card:hover .gallery-image,
  .gallery-card:focus-visible .gallery-image {
    transform: none;
  }
}
