/* ══════════════════════════════════════════════════════════
   Until I Hold You Again — modern bento edition 💕
   Fonts: Fraunces (editorial serif) + Outfit (geometric sans)
   ══════════════════════════════════════════════════════════ */

:root {
  --bg:        #FFF9F7;
  --tile:      #FFFFFF;
  --ink:       #3D2B2F;
  --muted:     #9A7E84;
  --rose:      #E4657F;
  --rose-deep: #C94564;
  --blush:     #FDECEE;
  --line:      #F4DDE2;
  --radius:    22px;
  --shadow:    0 10px 34px rgba(201, 69, 100, 0.10);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', 'Segoe UI', sans-serif;
  background:
    radial-gradient(ellipse 55% 40% at 85% -5%, #FFE4E9 0%, transparent 60%),
    radial-gradient(ellipse 45% 35% at 0% 100%, #FFEFE7 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.5;
  overflow-x: hidden;
}

.shell {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px 28px;
}

/* ─────────────── Hero ─────────────── */

.hero {
  position: relative;
  text-align: center;
  padding: clamp(3.2rem, 7vh, 5rem) 0 clamp(2rem, 4vh, 3rem);
}

.hero-photos { position: absolute; inset: 0; pointer-events: none; }

.hero-photos img {
  position: absolute;
  width: clamp(120px, 16vw, 210px);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(61, 43, 47, 0.18);
  opacity: 0.85;
}

.hero-photos img:nth-child(1) { left: -1%;  top: 12%;  transform: rotate(-9deg); }
.hero-photos img:nth-child(2) { right: -1%; top: 8%;   transform: rotate(7deg); }
.hero-photos img:nth-child(3) { right: 14%; top: 58%;  transform: rotate(-4deg); width: clamp(90px, 10vw, 140px); opacity: 0.7; }

/* soft fade so text always wins */
.hero-photos::after {
  content: "";
  position: absolute;
  inset: -10%;
  background: radial-gradient(ellipse 62% 88% at 50% 45%, rgba(255, 249, 247, 0.94) 35%, rgba(255, 249, 247, 0.25) 75%, transparent 100%);
}

.hearts-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.floating-heart {
  position: absolute;
  bottom: -6vh;
  animation: floatUp linear infinite;
  opacity: 0;
  user-select: none;
}

@keyframes floatUp {
  0%   { transform: translateY(0) rotate(-6deg); opacity: 0; }
  10%  { opacity: var(--h-opacity, 0.3); }
  90%  { opacity: var(--h-opacity, 0.3); }
  100% { transform: translateY(-52vh) rotate(8deg); opacity: 0; }
}

.hero-title {
  position: relative;
  font-family: 'Fraunces', serif;
  font-optical-sizing: auto;
  font-weight: 480;
  font-size: clamp(2.4rem, 6.5vw, 4.6rem);
  line-height: 1.06;
  letter-spacing: -0.015em;
  margin-top: 0.9rem;
}

.hero-title em {
  font-style: italic;
  font-weight: 420;
  color: var(--rose-deep);
}

.hero-sub {
  position: relative;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: clamp(1rem, 2.2vw, 1.3rem);
  color: var(--muted);
  margin-top: 0.55rem;
}

/* ─────────────── Countdown (big, typographic) ─────────────── */

.countdown {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(1.1rem, 4.5vw, 3.4rem);
  margin-top: clamp(1.6rem, 4vh, 2.8rem);
}

.count-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: clamp(3.8rem, 13vw, 9.5rem);
}

.count-unit + .count-unit { position: relative; }

.count-unit + .count-unit::before {
  content: ":";
  position: absolute;
  left: calc(clamp(1.1rem, 4.5vw, 3.4rem) / -2);
  top: 8%;
  transform: translateX(-50%);
  font-family: 'Fraunces', serif;
  font-size: clamp(1.6rem, 5vw, 3.4rem);
  color: var(--line);
}

.count-num {
  font-size: clamp(3.6rem, 13vw, 8.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  background: linear-gradient(160deg, #F48CA0 0%, #E4657F 42%, #C22B52 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 10px rgba(201, 69, 100, 0.22));
  transition: transform 0.15s ease;
}

.count-num.tick { transform: scale(1.07); }

.count-label {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: clamp(0.9rem, 2.1vw, 1.15rem);
  color: var(--muted);
  margin-top: 0.4rem;
}

.countdown-done {
  position: relative;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: clamp(2.2rem, 7vw, 4.4rem);
  color: var(--rose-deep);
  margin-top: 2rem;
  animation: pop 0.6s cubic-bezier(0.18, 1.4, 0.4, 1);
}

@keyframes pop {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.dateline {
  position: relative;
  margin-top: clamp(1rem, 2.5vh, 1.6rem);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* ─────────────── Bento grid ─────────────── */

.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  /* 3 rows + 2 gaps = 352px = Spotify's exact embed height */
  grid-auto-rows: 108px;
  gap: 14px;
  margin-top: clamp(0.8rem, 2vh, 1.6rem);
}

.tile {
  position: relative;
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tile-map      { grid-column: 1 / 4; grid-row: 1 / 5; }
.tile-pl-1     { grid-column: 4 / 7; grid-row: 1 / 4; }
.tile-pl-2     { grid-column: 4 / 7; grid-row: 4 / 7; }
.tile-photo    { grid-column: 1 / 3; grid-row: 5 / 7; }
.tile-progress { grid-column: 3 / 4; grid-row: 5 / 7; }

/* playlist tiles hug Spotify's real card height */
.tile-pl-1, .tile-pl-2 { height: 352px; }

/* map fills its tile */
#loveMap { position: absolute; inset: 0; z-index: 1; }

.leaflet-container { font-family: 'Outfit', sans-serif; background: #F6EFF0; }

.heart-pin { background: none; border: none; }

.map-heart {
  display: block;
  font-size: 1.25rem;
  line-height: 1;
  text-align: center;
  filter: drop-shadow(0 3px 4px rgba(201, 69, 100, 0.4));
  transform-origin: 50% 80%;
}

.map-heart.beating { animation: heartbeat 1.4s ease-in-out infinite; }

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  12%      { transform: scale(1.3); }
  24%      { transform: scale(1); }
  36%      { transform: scale(1.18); }
}

.pin-label {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 99px;
  box-shadow: 0 3px 8px rgba(201, 69, 100, 0.14);
  color: var(--rose-deep);
  font-weight: 600;
  font-size: 0.64rem;
  letter-spacing: 0.02em;
  padding: 0.14rem 0.5rem;
}

.pin-label::before { display: none; }

.love-path {
  stroke-dasharray: 6 9;
  animation: dashFlow 1.1s linear infinite;
}

@keyframes dashFlow { to { stroke-dashoffset: -15; } }

/* playlists: Spotify's card IS the tile */
.tile-playlist {
  background: transparent;
  border: none;
  box-shadow: var(--shadow);
}

.tile-playlist iframe {
  display: block;
  width: 100%;
  height: 352px;
  border: 0;
}

/* photo tile */
.tile-photo {
  padding: 0;
  cursor: zoom-in;
}

.tile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.tile-photo:hover img, .tile-photo:focus-visible img { transform: scale(1.06); }

/* progress tile (photo peeking through) */
.tile-progress-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.16;
}

.tile-progress-body {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 1rem;
  text-align: center;
}

.progress-pct {
  font-size: clamp(1.9rem, 3.2vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--rose-deep);
}

.progress-cap {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.25;
}

.progress-track {
  width: 100%;
  height: 8px;
  margin-top: 0.4rem;
  background: var(--blush);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #F3AEB9, var(--rose));
  transition: width 1.2s ease;
}

/* ─────────────── Filmstrip ─────────────── */

.stripwrap { margin-top: 14px; }

.strip {
  overflow: hidden;
  border-radius: var(--radius);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}

.strip-track {
  display: flex;
  width: max-content;
  animation: stripSlide 90s linear infinite;
  will-change: transform;
  transform: translateZ(0);
}

.strip:hover .strip-track { animation-play-state: paused; }

.strip-track img {
  height: clamp(140px, 22vw, 200px);
  width: auto;
  border-radius: 14px;
  margin-right: 12px;
  cursor: zoom-in;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.strip-track img:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(201, 69, 100, 0.22);
}

@keyframes stripSlide { to { transform: translateX(-50%); } }

/* ─────────────── Footer ─────────────── */

.footer {
  text-align: center;
  padding: 2.2rem 0 0.6rem;
}

.footer-days {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 1.25rem;
  color: var(--rose-deep);
  margin-bottom: 0.3rem;
}

.footer-note {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.beat {
  color: var(--rose);
  display: inline-block;
  animation: heartbeat 1.6s ease-in-out infinite;
}

/* ─────────────── Lightbox ─────────────── */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(43, 26, 30, 0.93);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.lightbox[hidden] { display: none; }

.lb-figure {
  max-width: min(88vw, 900px);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lb-figure img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  background: var(--tile);
}

.lb-figure figcaption {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 1.15rem;
  color: #F6CBD4;
  margin-top: 0.8rem;
  text-align: center;
}

.lb-btn {
  position: absolute;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 0;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  z-index: 1;
}

.lb-btn:hover { background: rgba(255, 255, 255, 0.28); }
.lb-close { top: 1.2rem; right: 1.2rem; }
.lb-prev  { left: 1rem; top: 50%; transform: translateY(-50%); font-size: 1.9rem; }
.lb-next  { right: 1rem; top: 50%; transform: translateY(-50%); font-size: 1.9rem; }

/* ─────────────── Flying memories ─────────────── */

.memory-chip {
  position: fixed;
  top: 103vh;
  z-index: 60;
  max-width: min(70vw, 380px);
  padding: 0.4rem 1rem;
  font-family: 'Fraunces', serif;
  font-style: italic;
  text-align: center;
  color: var(--rose-deep);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  border: 1px solid var(--line);
  border-radius: 99px;
  box-shadow: 0 6px 20px rgba(201, 69, 100, 0.14);
  pointer-events: none;
  user-select: none;
  opacity: 0;
  animation: memFloat linear forwards;
}

@keyframes memFloat {
  0%   { transform: translate(0, 0) rotate(var(--m-rot, 0deg)); opacity: 0; }
  8%   { opacity: var(--m-op, 0.65); }
  50%  { transform: translate(var(--m-sway, 30px), -58vh) rotate(calc(var(--m-rot, 0deg) * -1)); }
  92%  { opacity: var(--m-op, 0.65); }
  100% { transform: translate(0, -118vh) rotate(var(--m-rot, 0deg)); opacity: 0; }
}

/* ─────────────── Confetti hearts ─────────────── */

.confetti-heart {
  position: fixed;
  top: -6vh;
  z-index: 1100;
  animation: confettiFall linear forwards;
  pointer-events: none;
  user-select: none;
}

@keyframes confettiFall {
  to { transform: translateY(115vh) rotate(360deg); }
}

/* ─────────────── Responsive ─────────────── */

@media (max-width: 900px) {
  .hero-photos img:nth-child(3) { display: none; }

  /* smaller photos = shorter track, so speed the reel up to compensate */
  .strip-track { animation-duration: 52s; }

  .bento { grid-template-columns: 1fr 1fr; grid-auto-rows: auto; }
  .tile-map      { grid-column: 1 / 3; grid-row: auto; height: 320px; }
  .tile-pl-1,
  .tile-pl-2     { grid-column: 1 / 3; grid-row: auto; height: 352px; }
  .tile-photo    { grid-column: 1 / 2; grid-row: auto; height: 230px; }
  .tile-progress { grid-column: 2 / 3; grid-row: auto; height: 230px; }
}

@media (max-width: 560px) {
  .hero-photos img { opacity: 0.45; }
  .hero-photos img:nth-child(2) { display: none; }
  .strip-track { animation-duration: 36s; }
  .tile-photo, .tile-progress { grid-column: 1 / 3; }
  .lb-prev { left: 0.3rem; }
  .lb-next { right: 0.3rem; }
}

/* ─────────────── Reduced motion ─────────────── */

@media (prefers-reduced-motion: reduce) {
  .floating-heart, .beat, .confetti-heart,
  .map-heart.beating, .love-path, .strip-track { animation: none !important; }
  .memory-chip { display: none; }
  html { scroll-behavior: auto; }
}
