/* ---------- Colours & fonts ---------- */
:root {
  --bg: #fdf8f4;        /* cream */
  --text: #4a3b3b;      /* soft dark brown */
  --muted: #9c8a8a;
  --accent: #e8a0a8;    /* soft pink */
  --accent-light: #f8e1e4;
  --pink-end: #f9d6de;  /* light pink at the bottom of the page */
  --card: #fff;         /* white cards (map frame, play button) */

  --font-title: "Cormorant Garamond", Georgia, serif;
  --font-body: "Quicksand", system-ui, sans-serif;
  --font-hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
}

/* ---------- Base ---------- */
html {
  scroll-behavior: smooth;   /* menu links glide down instead of jumping */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh; /* phones: ignores the browser address bar */
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.7;
  overflow-x: hidden;
}

/* Cream on the first screen, then slowly more and more pink while scrolling down */
body {
  background: linear-gradient(
    to bottom,
    var(--bg) 0,
    var(--bg) 100vh,
    var(--pink-end) 100%
  );
}

a {
  color: inherit;
  text-decoration: none;
}

/* Anything with the "hidden" attribute stays invisible */
[hidden] {
  display: none !important;
}

/* ---------- Start screen ---------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  background: var(--bg);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.7s ease, visibility 0.7s;
}

.intro.hide {
  opacity: 0;
  visibility: hidden;
}

/* First screen ("Für dich"), fades out after the tap */
.intro-start {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.intro.playing .intro-start {
  opacity: 0;
  transform: scale(0.96);
}

/* The message that slides in after the tap.
   Hidden until her tap, so it never flashes while the page is loading. */
.intro-message {
  visibility: hidden;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

.intro-words {
  max-width: 900px;
  font-family: var(--font-title);
  font-weight: 500;
  font-size: clamp(2.2rem, 7vw, 3.6rem);
  line-height: 1.25;
  color: var(--text);
}

.intro-words span,
.intro-sign {
  display: inline-block;
  opacity: 0;
  transform: translateX(80px);
  filter: blur(6px);
}

.intro.playing .intro-message {
  visibility: visible;
}

/* Words come in one after another, from right to left */
.intro.playing .intro-words span {
  animation: slideIn 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  animation-delay: calc(0.6s + var(--i) * 0.18s);
}

.intro-sign {
  margin-top: 18px;
  font-family: var(--font-title);
  font-style: italic;
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  color: var(--accent);
}

.intro.playing .intro-sign {
  animation: slideIn 1s cubic-bezier(0.2, 0.8, 0.2, 1) 2.6s forwards;
}

@keyframes slideIn {
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

.intro-creature {
  width: 90px;
  animation: float 2.4s ease-in-out infinite;
}

.intro-start h1 {
  margin: 20px 0 8px;
  font-family: var(--font-title);
  font-weight: 500;
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  line-height: 1.2;
}

.intro-start p {
  color: var(--muted);
  animation: blink 2s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-8px) rotate(3deg); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* While the start screen is up, the photos wait, so she sees them fade in,
   and the page behind it can't be scrolled */
body.waiting {
  overflow: hidden;
}

body.waiting .floater,
body.waiting .visitor {
  animation-play-state: paused;
}

/* While the video page is open, the page behind it can't be scrolled */
body.locked {
  overflow: hidden;
}

/* ---------- Hearts on tap ---------- */
.tap-heart {
  position: fixed;
  z-index: 30;
  line-height: 1;
  pointer-events: none;
  translate: -50% -50%;
  opacity: 0;
  animation: heartUp 1.1s ease-out forwards;
}

@keyframes heartUp {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.4) rotate(0deg); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(var(--rot)); }
}

/* ---------- Big Polaroid (tap a floating photo) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(74, 59, 59, 0.35);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  cursor: zoom-out;
  transition: opacity 0.35s ease;
}

.lightbox.show {
  opacity: 1;
}

.lightbox-polaroid {
  width: min(78vw, 360px, calc((88vh - 80px) / 1.25));
  padding: 14px 14px 0;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  transform: scale(0.85) rotate(-6deg);
  transition: transform 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.lightbox.show .lightbox-polaroid {
  transform: rotate(-2deg);
}

.lightbox-polaroid img,
.lightbox-polaroid video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 2px;
  background: #000;
}

.lightbox-caption {
  padding: 10px 0 14px;
  font-family: var(--font-hand);
  font-size: 1.8rem;
  line-height: 1.2;
  text-align: center;
  color: var(--accent);
}

/* ---------- Envelope + letter (after the intro words) ---------- */
.intro-envelope,
.letter {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 24px 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s ease, visibility 0.7s;
}

.intro.envelope-stage,
.intro.reading {
  cursor: default;
}

.intro.envelope-stage .intro-message {
  opacity: 0;
  transition: opacity 0.6s ease;
}

.intro.envelope-stage .intro-envelope {
  opacity: 1;
  visibility: visible;
  transition-delay: 0.4s;
}

.intro.reading .intro-envelope {
  opacity: 0;
  visibility: hidden;
  transition-delay: 0s;
}

.intro.reading .letter {
  opacity: 1;
  visibility: visible;
}

/* The envelope itself */
.envelope {
  position: relative;
  width: min(300px, 78vw);
  aspect-ratio: 3 / 2;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  perspective: 900px;
  -webkit-tap-highlight-color: transparent;
  animation: envFloat 3s ease-in-out infinite;
}

.envelope.open {
  animation: none;
  cursor: default;
}

.env-back,
.env-front,
.env-flap,
.env-paper {
  position: absolute;
}

.env-back {
  inset: 0;
  background: #e99aa6;
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(232, 160, 168, 0.45);
}

/* the letter inside, slides up when opened */
.env-paper {
  left: 7%;
  right: 7%;
  top: 8%;
  height: 84%;
  z-index: 1;
  background:
    repeating-linear-gradient(transparent 0 13px, rgba(232, 160, 168, 0.3) 13px 14px)
    #fffaf6;
  border-radius: 6px;
  transition: transform 0.9s cubic-bezier(0.3, 0.8, 0.3, 1) 0.55s;
}

/* front pocket with a V cut at the top */
.env-front {
  inset: 0;
  z-index: 2;
  background: #f4b4be;
  border-radius: 10px;
  clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%);
}

/* the flap, flips open */
.env-flap {
  left: 0;
  right: 0;
  top: 0;
  height: 58%;
  z-index: 3;
  background: #ec8f9c;
  border-radius: 10px 10px 0 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
  transition: transform 0.6s ease, z-index 0s 0.3s;
}

.env-seal {
  position: absolute;
  left: 50%;
  top: 58%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  translate: -50% -50%;
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  font-size: 16px;
  box-shadow: 0 3px 8px rgba(232, 160, 168, 0.5);
  transition: opacity 0.3s ease;
}

.envelope.open .env-seal {
  opacity: 0;
}

.envelope.open .env-flap {
  transform: rotateX(180deg);
  z-index: 0;
}

.envelope.open .env-paper {
  transform: translateY(-55%);
}

.envelope-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--font-title);
  font-size: 1.8rem;
  line-height: 1.2;
  text-align: center;
  transition: opacity 0.4s ease;
}

.envelope-hint small {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--muted);
  animation: blink 2s ease-in-out infinite;
}

.envelope.open + .envelope-hint {
  opacity: 0;
}

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

/* The opened letter */
.letter-paper {
  width: min(560px, 92vw);
  max-height: 76vh;
  max-height: 76dvh;
  overflow-y: auto;
  padding: 32px 30px 28px;
  text-align: left;
  font-family: var(--font-hand);
  font-size: 1.5rem;
  line-height: 35px;
  color: var(--text);
  background:
    repeating-linear-gradient(transparent 0 34px, rgba(232, 160, 168, 0.28) 34px 35px)
    #fffaf6;
  background-position: 0 32px;   /* lines sit under the text (same as padding-top) */
  background-attachment: local;
  border-radius: 6px;
  box-shadow:
    0 2px 6px rgba(74, 59, 59, 0.08),
    0 18px 36px rgba(232, 160, 168, 0.35);
  transform: translateY(40px) rotate(-1deg) scale(0.94);
  transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.intro.reading .letter-paper {
  transform: rotate(-1deg);
}

/* more text below: the bottom of the paper fades out (removed at the end) */
.letter-paper.more {
  -webkit-mask-image: linear-gradient(#000 calc(100% - 70px), transparent);
  mask-image: linear-gradient(#000 calc(100% - 70px), transparent);
}

.letter-greeting {
  font-size: 1.9rem;
}

.letter-text p + p {
  margin-top: 35px;
}

.letter-signature {
  margin-top: 20px;
  text-align: right;
  font-size: 1.8rem;
  color: var(--accent);
}

.letter-continue {
  padding: 12px 30px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-size: 1rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 8px 18px rgba(232, 160, 168, 0.45);
}

/* laptops with a short screen: lines a little closer together */
@media (min-width: 481px) and (max-height: 860px) {
  .letter-paper {
    padding-top: 26px;
    font-size: 1.4rem;
    line-height: 31px;
    background:
      repeating-linear-gradient(transparent 0 30px, rgba(232, 160, 168, 0.28) 30px 31px)
      #fffaf6;
    background-position: 0 26px;
    background-attachment: local;
  }
  .letter-text p + p { margin-top: 31px; }
  .letter-signature { margin-top: 12px; }
}

@media (max-width: 480px) {
  .letter { gap: 18px; }
  .letter-paper {
    max-height: 80vh;
    max-height: 80dvh;
    padding: 20px 18px 16px;
    font-size: 1.28rem;
    line-height: 30px;
    background:
      repeating-linear-gradient(transparent 0 29px, rgba(232, 160, 168, 0.28) 29px 30px)
      #fffaf6;
    background-position: 0 20px;
    background-attachment: local;
  }
  .letter-greeting { font-size: 1.6rem; }
  .letter-text p + p { margin-top: 30px; }
  .letter-signature { margin-top: 10px; font-size: 1.6rem; }
}

/* ---------- Header ---------- */
/* Stays at the top while scrolling, slightly see-through */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  width: 100%;
  height: 72px;
  padding: 0 max(32px, calc((100vw - 1200px) / 2 + 32px));
  background: rgba(255, 255, 255, 0.35);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  font-size: 1.5rem;
  color: var(--accent);
}

/* ♪ music on/off button */
.music-toggle {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 1rem;
  line-height: 30px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s;
  animation: bop 1.2s ease-in-out infinite;
}

.music-toggle.off {
  opacity: 0.5;
  animation: none;
}

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

@media (max-width: 480px) {
  .site-header { padding: 0 16px; }
}

/* ---------- Main ---------- */
#app {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

/* The three parts of the page */
.page {
  scroll-margin-top: 72px;   /* so the menu doesn't cover the top of a part */
}

.page-countdown {
  display: flex;
  flex-direction: column;
  padding: 8px 0 120px;   /* last part: some room at the bottom of the page */
}

/* Same space between the photos -> video button -> line -> "Überraschung" */
.page-surprise {
  padding: 8px 0;
}

/* ---------- Line with a ♡ between the parts ---------- */
.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(360px, 70%);
  margin: 46px auto;
  color: var(--accent);
}

.divider i {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--accent));
}

.divider i:last-child {
  background: linear-gradient(to left, transparent, var(--accent));
}

.divider span {
  font-size: 14px;
  line-height: 1;
}

/* ---------- Home ---------- */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding-bottom: 0;
}

.hero h1 {
  font-family: var(--font-title);
  font-weight: 500;
  font-size: clamp(1.7rem, min(7vw, 6.5vh), 3.4rem);
  line-height: 1.2;
  margin: 0 0 16px;
  white-space: pre-line; /* makes \n in titles a new line */
  text-shadow: 0 0 24px var(--bg), 0 0 12px var(--bg);
}

.hero p {
  color: var(--muted);
  text-shadow: 0 0 12px var(--bg);
}

/* ---------- Start page: tap the text for a new one ---------- */
.hero-text {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  /* slow fade back in */
  transition: opacity 1.2s ease, filter 1.2s ease, transform 1.2s ease;
}

/* quick fade out before the new text comes */
.hero-text.swap-out {
  opacity: 0;
  filter: blur(6px);
  transform: translateY(8px);
  transition-duration: 0.45s;
}

/* ---------- Start page: first screen + scroll hint ---------- */
.home-hero {
  position: relative;
  min-height: calc(100vh - 72px);
  /* svh = screen height with the phone's address bar shown. It doesn't change
     while scrolling, so the text and photos don't jump around */
  min-height: calc(100svh - 72px);
  padding-bottom: 44px;
}

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 6px;
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.8rem;
  line-height: 1.2;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.scroll-arrow {
  font-size: 1rem;
  color: var(--accent);
  animation: nudge 1.6s ease-in-out infinite;
}

@keyframes nudge {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(5px); }
}

/* ---------- Gallery ---------- */
.gallery-section {
  position: relative;
  left: 50%;
  translate: -50% 0;
  width: min(1000px, calc(100vw - 32px));
  padding: 64px 0 96px;
  text-align: center;
}

.gallery-section h2 {
  font-family: var(--font-title);
  font-weight: 500;
  font-size: clamp(2rem, 6vw, 2.8rem);
  line-height: 1.2;
}

.gallery-section > p {
  margin-bottom: 32px;
  color: var(--accent);
}

/* Masonry-style columns: 3 on computers, 2 on phones */
.gallery {
  columns: 3;
  column-gap: 20px;
}

.gallery-item {
  break-inside: avoid;
  margin: 0 0 20px;
  padding: 8px;
  background: #fff;
  border-radius: 16px;
  box-shadow:
    0 2px 4px rgba(74, 59, 59, 0.08),
    0 10px 20px rgba(232, 160, 168, 0.22);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.gallery-item.visible {
  opacity: 1;
  transform: none;
}

.gallery-item img,
.gallery-item video {
  display: block;
  width: 100%;
  border-radius: 10px;
}

.gallery-item figcaption {
  padding: 8px 4px 2px;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 600px) {
  .gallery { columns: 2; column-gap: 12px; }
  .gallery-item { margin-bottom: 12px; padding: 6px; border-radius: 12px; }
  .gallery-item img, .gallery-item video { border-radius: 8px; }
  .gallery-section { padding: 48px 0 72px; }
}

/* ---------- Video: small play button above "Überraschung" ---------- */
.page-edit {
  padding: 56px 0 8px;
}

.edit-teaser {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.edit-teaser p {
  color: var(--muted);
}

.play-small,
.play-big {
  position: relative;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.play-small {
  width: 76px;
  height: 76px;
  background: var(--card);
  color: var(--accent);
  box-shadow:
    0 2px 4px rgba(74, 59, 59, 0.08),
    0 10px 20px rgba(232, 160, 168, 0.35);
}

.play-small svg { width: 34px; height: 34px; fill: currentColor; }

/* Soft pulsing ring around the play buttons */
.play-small::before,
.play-big::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: ring 2s ease-out infinite;
}

@keyframes ring {
  from { transform: scale(1);   opacity: 0.7; }
  to   { transform: scale(1.5); opacity: 0; }
}

/* ---------- Video page ---------- */
.video-page {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 16px 32px;
  background: linear-gradient(to bottom, var(--bg), var(--pink-end));
  opacity: 0;
  visibility: hidden;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s;
}

.video-page.open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.video-back {
  position: absolute;
  top: 22px;
  left: 20px;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.video-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
}

.video-stage h2 {
  font-family: var(--font-title);
  font-weight: 500;
  font-size: clamp(2.2rem, 7vw, 3.2rem);
  line-height: 1.2;
}

.play-big {
  width: 120px;
  height: 120px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 28px rgba(232, 160, 168, 0.5);
}

.play-big svg { width: 54px; height: 54px; fill: currentColor; margin-left: 4px; }

#edit-video {
  max-width: min(90vw, 420px);
  max-height: 70vh;
  max-height: 70dvh;
  border: 6px solid #fff;
  border-radius: 18px;
  background: #000;
  box-shadow: 0 10px 24px rgba(74, 59, 59, 0.2);
}

.video-soon {
  font-family: var(--font-title);
  font-size: 1.6rem;
  color: var(--accent);
}

/* ---------- Surprise gifts ---------- */
/* Computers: next to each other. Phones: one under the other. */
.gifts {
  --gift-size: 180px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  margin-top: 40px;
}

/* Each gift: small while closed, grows to the picture's size when opened */
.gift-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--gift-size);
  height: 150px;
  transition: height 0.8s ease 0.3s;
}

.gift-wrap.open {
  height: var(--gift-size);
}

.gift {
  position: relative;
  width: 100px;
  height: 100px;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: wobble 3s ease-in-out infinite;
  transition: opacity 0.5s ease 0.35s, scale 0.5s ease 0.35s;
}

.gift-wrap:nth-child(2) .gift { animation-delay: 0.4s; }
.gift-wrap:nth-child(3) .gift { animation-delay: 0.8s; }

@media (hover: hover) {
  .gift:hover {
    animation-duration: 0.8s;
  }
}

/* Box */
.gift-body {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 0;
  height: 62px;
  background: #f4b4be;
  border-radius: 8px;
  box-shadow: 0 6px 14px rgba(232, 160, 168, 0.35);
}

/* Lid */
.gift-lid {
  position: absolute;
  left: 0;
  right: 0;
  top: 22px;
  height: 20px;
  background: #ec9aa6;
  border-radius: 6px;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s;
  z-index: 1;
}

/* Ribbon going down the middle */
.gift-body::before,
.gift-lid::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 14px;
  translate: -50% 0;
  background: #fff;
  opacity: 0.85;
}

/* Bow on top */
.gift-bow {
  position: absolute;
  left: 50%;
  bottom: 100%;
  translate: -50% 3px;
  width: 46px;
  height: 20px;
  /* knot in the middle */
  background: radial-gradient(circle at 50% 75%, #fff 0 5px, transparent 5.5px);
  z-index: 1;
}

.gift-bow::before,
.gift-bow::after {
  content: "";
  position: absolute;
  bottom: 2px;
  width: 20px;
  height: 14px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: #f8d3d9;
  box-sizing: border-box;
  z-index: -1;
}

.gift-bow::before { left: 1px;  rotate: -25deg; }
.gift-bow::after  { right: 1px; rotate: 25deg; }

/* The picture inside, hidden until the gift is opened */
.gift-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 6px solid #fff;
  border-radius: 18px;
  box-shadow:
    0 2px 4px rgba(74, 59, 59, 0.08),
    0 10px 20px rgba(232, 160, 168, 0.3);
  opacity: 0;
  transform: scale(0.6) rotate(-4deg);
  transition:
    opacity 1.2s ease 0.6s,
    transform 1.2s cubic-bezier(0.34, 1.3, 0.64, 1) 0.6s;
  pointer-events: none;
}

/* Opened: lid flies off, box fades away, picture slowly appears */
.gift-wrap.open .gift {
  animation: none;
  cursor: default;
  opacity: 0;
  scale: 0.7;
}

.gift-wrap.open .gift-lid {
  transform: translate(18px, -46px) rotate(24deg);
  opacity: 0;
}

.gift-wrap.open .gift-image {
  opacity: 1;
  transform: none;
}

@keyframes wobble {
  0%, 80%, 100% { transform: rotate(0deg); }
  85%           { transform: rotate(-5deg); }
  90%           { transform: rotate(5deg); }
  95%           { transform: rotate(-3deg); }
}

@media (max-width: 760px) {
  .gifts {
    --gift-size: min(58vw, 230px);
    flex-direction: column;
    gap: 8px;
    margin-top: 28px;
  }

  .gift-wrap { height: 140px; }
  .gift-wrap.open { height: var(--gift-size); }
  .gift-image { border-width: 5px; border-radius: 16px; }
}

/* ---------- Map: "Unsere Orte" ---------- */
.page-map {
  padding: 8px 0;
}

.map-section {
  position: relative;
  left: 50%;
  translate: -50% 0;
  width: min(960px, calc(100vw - 32px));
  text-align: center;
}

.map-section h2 {
  font-family: var(--font-title);
  font-weight: 500;
  font-size: clamp(2.2rem, 7vw, 3.2rem);
  line-height: 1.2;
}

.map-section > p {
  color: var(--muted);
}

.love-map-frame {
  margin-top: 28px;
  padding: 8px;
  background: var(--card);
  border-radius: 22px;
  box-shadow:
    0 2px 4px rgba(74, 59, 59, 0.08),
    0 14px 30px rgba(232, 160, 168, 0.3);
}

.love-map {
  position: relative;
  z-index: 0;
  isolation: isolate;   /* keeps the map's layers below the menu and pop-ups */
  height: min(62vh, 520px);
  border-radius: 16px;
  overflow: hidden;
  background: #f6ece8;
  font-family: var(--font-body);
}

/* soft pink tint on the map (OpenStreetMap is very colourful by default) */
.love-map .leaflet-tile-pane {
  filter: grayscale(0.85) sepia(0.35) hue-rotate(-50deg) saturate(1.6) brightness(1.06) contrast(0.92);
}

.love-map .leaflet-control-attribution {
  font-size: 9px;
  background: rgba(255, 255, 255, 0.7);
}

.love-map .leaflet-bar a {
  color: var(--accent);
}

.map-hint {
  margin-top: 14px;
  font-size: 0.85rem;
}

.map-replay {
  margin-top: 6px;
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Little Polaroid pins on the map */
.map-pin-wrap {
  background: none;
  border: none;
}

.map-pin {
  position: relative;
  width: 50px;
  padding: 4px 4px 10px;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 4px 10px rgba(74, 59, 59, 0.3);
  rotate: var(--tilt);
  transform-origin: 50% 100%;
  cursor: pointer;
  animation: pinDrop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) var(--d) both;
}

.map-pin img {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 2px;
}

/* little point at the bottom */
.map-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  translate: -50% 0;
  border: 7px solid transparent;
  border-top-color: #fff;
  border-bottom: 0;
}

.map-count {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: 600 11px/20px var(--font-body);
  text-align: center;
}

@keyframes pinDrop {
  from { opacity: 0; transform: translateY(-50px) scale(0.6); }
  to   { opacity: 1; transform: none; }
}

/* Big Polaroid with several photos: tap for the next one */
.lightbox-polaroid.several {
  cursor: pointer;
}

.lightbox-polaroid.flip {
  animation: polaroidFlip 0.4s ease;
}

@keyframes polaroidFlip {
  0%   { transform: rotate(-2deg) scale(1); }
  50%  { transform: rotate(1deg) scale(0.96); }
  100% { transform: rotate(-2deg) scale(1); }
}

/* ---------- Countdown ---------- */
.countdown {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 40px;
}

.countdown[hidden],
.countdown-done[hidden] {
  display: none;
}

.countdown-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 76px;
  padding: 16px 8px 12px;
  background: var(--accent-light);
  border-radius: 14px;
  box-shadow:
    0 2px 4px rgba(232, 160, 168, 0.18),
    0 8px 16px rgba(232, 160, 168, 0.25);
}

.countdown-box span {
  font-family: var(--font-title);
  font-size: clamp(2rem, 8vw, 2.8rem);
  line-height: 1;
  color: var(--text);
}

.countdown-box small {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--muted);
}

.countdown-done {
  margin-top: 32px;
  font-family: var(--font-title);
  font-size: 2rem;
  color: var(--accent) !important;
}

@media (max-width: 400px) {
  .countdown { gap: 8px; }
  .countdown-box { min-width: 0; flex: 1; padding: 12px 4px 10px; }
}

/* ---------- Floating photos and videos ---------- */
.floaters {
  position: absolute;   /* belongs to the first screen, scrolls away with it */
  top: 72px;            /* starts below the menu */
  left: 0;
  right: 0;
  height: calc(100vh - 72px - 44px);
  height: calc(100svh - 72px - 44px);  /* stable on phones; leaves room for "Mehr von uns" */
  z-index: 2;   /* above the text area, so every photo can be tapped */
  overflow: hidden;
  pointer-events: none;
}

/* Polaroid style: thin white border, thicker at the bottom */
.floater {
  position: absolute;
  display: flex;
  width: min(13vw, 19vh);
  width: min(13vw, 19svh);
  aspect-ratio: 3 / 4;
  translate: -50% -50%;
  padding: 6px 6px 22px;
  background: #fff;
  border-radius: 4px;
  pointer-events: auto;
  cursor: zoom-in;
  -webkit-touch-callout: none;   /* no "save image" menu on long-press */
  -webkit-user-select: none;
  user-select: none;
  box-shadow:
    0 2px 4px rgba(74, 59, 59, 0.12),
    0 8px 16px rgba(74, 59, 59, 0.22);
  opacity: 0;
  animation:
    appear 1s ease var(--delay) forwards,
    drift var(--speed) ease-in-out var(--delay) infinite alternate;
}

/* iPhones: never show the big ▶ play button on the small videos */
.floater video::-webkit-media-controls,
.floater video::-webkit-media-controls-start-playback-button,
.lightbox-polaroid video::-webkit-media-controls-start-playback-button {
  display: none !important;
  -webkit-appearance: none;
}

.floater img:not(.visitor),
.floater video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
}

@keyframes appear {
  to { opacity: 1; }
}

@keyframes drift {
  from { transform: translate(0, 0) rotate(var(--r1)); }
  to   { transform: translate(var(--dx), var(--dy)) rotate(var(--r2)); }
}

/* ---------- Little visitor on the frames ---------- */
.visitor {
  position: absolute;
  bottom: calc(100% - 10px);   /* sits on the top edge of the frame */
  width: 40%;
  height: auto;
  z-index: 1;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 2px 2px rgba(74, 59, 59, 0.18));
  animation:
    pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both,
    wiggle 2.4s ease-in-out 0.5s infinite;
}

.visitor.flip {
  scale: -1 1;   /* looks the other way */
}

.visitor.leave {
  animation: hop 0.5s ease-in forwards;
}

@keyframes pop {
  from { transform: translateY(40%) scale(0.3); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-4deg); }
  75%      { transform: rotate(4deg); }
}

@keyframes hop {
  0%   { transform: none; opacity: 1; }
  40%  { transform: translateY(-30%); opacity: 1; }
  100% { transform: translateY(-10%) scale(0.3); opacity: 0; }
}

/* Computers: keep the text away from the photos on the left and right */
@media (min-aspect-ratio: 1/1) and (min-height: 501px) {
  .hero {
    width: 100%;
    max-width: calc(80vw - min(13vw, 19vh) - 80px);
    margin: 0 auto;
  }
}

/* Phones held sideways: text a bit narrower and smaller so the frames fit next to it */
@media (max-height: 500px) and (min-aspect-ratio: 1/1) {
  #app { max-width: 64vw; }
  .hero h1 { font-size: 2rem; }
}

/* Short phones: slightly smaller photos and title so everything fits */
@media (max-aspect-ratio: 1/1) and (max-height: 700px) {
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: 0.9rem; }
}

/* Phones: a bit bigger, since there are fewer of them */
@media (max-aspect-ratio: 1/1) {
  .floater {
    width: min(26vw, 14.5vh);
    width: min(26vw, 14.5svh);
    padding: 4px 4px 15px;
    border-radius: 3px;
  }
}

/* Short phones: slightly smaller photos (must come after the phone rule above) */
@media (max-aspect-ratio: 1/1) and (max-height: 700px) {
  .floater { width: min(24vw, 13vh); width: min(24vw, 13svh); }
}

/* ======================================================================
   Night mode (21:00 – 06:00): dark purple with pink
   The <html> element gets the class "night" (see index.html / app.js).
   ====================================================================== */
html.night {
  --bg: #26191f;           /* very dark rose / plum */
  --text: #f7e6ee;         /* soft pinkish white */
  --muted: #c8a8b6;
  --accent: #f29bb8;       /* pink */
  --accent-light: #432634;
  --pink-end: #46202f;     /* deep raspberry at the bottom */
  --card: #35222b;
  color-scheme: dark;
}

html.night .site-header {
  background: rgba(38, 25, 31, 0.5);
}

/* things that are white cards by day become dark purple cards */
html.night .play-small,
html.night .love-map-frame {
  background: var(--card);
}

/* the letter stays a light sheet of paper, so its writing stays dark */
html.night .letter-paper {
  color: #4a3b3b;
}

/* map in dark purple tones */
html.night .love-map .leaflet-tile-pane {
  filter: grayscale(1) invert(0.9) sepia(0.4) hue-rotate(290deg) saturate(1.3) brightness(0.85);
}

html.night .love-map {
  background: #2c1d24;
}

html.night .love-map .leaflet-control-attribution {
  background: rgba(38, 25, 31, 0.75);
  color: var(--muted);
}

html.night .love-map .leaflet-control-attribution a {
  color: var(--accent);
}

html.night .love-map .leaflet-bar a {
  background: var(--card);
  border-color: #4d2e3c;
}

/* the little animal gets a soft light outline, so it stands out on the dark background */
html.night .intro-creature,
html.night .visitor {
  filter:
    drop-shadow(0 0 1px #fff)
    drop-shadow(0 0 1px #fff)
    drop-shadow(0 0 6px rgba(242, 155, 184, 0.7));
}

/* a few softly twinkling stars in the background */
html.night body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 8% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 38%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 35% 8%, #ffd6e7 50%, transparent 51%),
    radial-gradient(1px 1px at 48% 26%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 63% 14%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 77% 33%, #ffd6e7 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 90% 9%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 14% 72%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 42% 64%, #ffd6e7 50%, transparent 51%),
    radial-gradient(1px 1px at 70% 80%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 86% 58%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 92%, #fff 50%, transparent 51%);
  opacity: 0.7;
  animation: twinkle 4s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.35; }
  to   { opacity: 0.85; }
}
