/* Birthday splash right after the name is typed (.cb-) */
body[data-view="celebrate"] { background: #14081f; color-scheme: dark; }

.cb-page {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(8px, 2.4dvh, 22px);
  padding: calc(20px + env(safe-area-inset-top)) var(--gutter) calc(24px + env(safe-area-inset-bottom));
  color: #fff; text-align: center;
}
.cb-sky {
  position: absolute; inset: -20%; z-index: -1;
  background:
    radial-gradient(40% 30% at 20% 20%, rgba(255, 77, 109, 0.35), transparent 70%),
    radial-gradient(40% 30% at 80% 25%, rgba(123, 108, 255, 0.35), transparent 70%),
    radial-gradient(50% 40% at 50% 85%, rgba(62, 193, 255, 0.25), transparent 70%),
    #14081f;
  animation: cb-sky 14s ease-in-out infinite alternate;
}
@keyframes cb-sky { to { transform: rotate(8deg) scale(1.1); } }

.cb-kicker {
  margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  animation: fade-up 600ms var(--ease-out) both;
}

/* ---------- rainbow title ---------- */
.cb-title {
  margin: 0; display: flex; flex-direction: column; align-items: center;
  font-family: var(--font-hand); font-weight: 700; line-height: 1.02;
}
.cb-line { display: block; white-space: nowrap; }
.cb-line--a { font-size: clamp(36px, 11vw, 76px); }
.cb-line--b { font-size: clamp(46px, 15vw, 104px); margin-top: 2px; }
.cb-l {
  display: inline-block; color: var(--c);
  text-shadow: 0 0 18px color-mix(in srgb, var(--c) 60%, transparent), 0 3px 0 rgba(0, 0, 0, 0.25);
  animation:
    cb-drop 700ms var(--ease-spring) calc(300ms + var(--i) * 70ms) both,
    cb-wave 2.4s ease-in-out calc(1600ms + var(--i) * 90ms) infinite,
    cb-hue 6s linear calc(var(--i) * -300ms) infinite;
}
.cb-sp { display: inline-block; width: 0.3em; }
@keyframes cb-drop { from { opacity: 0; transform: translateY(-60px) rotate(-20deg) scale(0.4); } to { opacity: 1; transform: none; } }
@keyframes cb-wave { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes cb-hue { to { filter: hue-rotate(360deg); } }

/* ---------- photo heart ---------- */
.cb-heart {
  position: relative; flex: none;
  /* as big as the screen allows: nearly edge to edge on a phone (it may use the side gutters) */
  width: min(calc(100vw - 6px), max(50dvh, calc(100dvh - 400px)), 620px); aspect-ratio: 1;
}
.cb-outline { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: 2; pointer-events: none; }
.cb-outline path { fill: none; stroke-linejoin: round; }
/* beat 2: the glow draws itself, then the marching line fades in on top */
.cb-outline-glow { stroke-width: 4.5; opacity: 0.6; filter: blur(2.5px); stroke-dasharray: 100; stroke-dashoffset: 100; }
.cb-page.is-heart .cb-outline-glow { animation: cb-draw 1.3s var(--ease-out) forwards; }
@keyframes cb-draw { to { stroke-dashoffset: 0; } }
.cb-outline-line {
  stroke-width: 1.4; stroke-dasharray: 3 2.2; opacity: 0;
  transition: opacity 600ms 900ms;
  animation: cb-march 2s linear infinite;
}
.cb-page.is-heart .cb-outline-line { opacity: 1; }
@keyframes cb-march { to { stroke-dashoffset: -10.4; } }

/* the mosaic sits exactly in the heart's box and is clipped to the heart shape */
.cb-mosaic {
  position: absolute; left: 3%; top: 4%; width: 94%; height: 92%; z-index: 1;
  clip-path: url(#cb-heart-clip);
  background: radial-gradient(60% 50% at 50% 45%, rgba(255, 94, 196, 0.35), rgba(20, 8, 31, 0.9));
  opacity: 0; transition: opacity 900ms 500ms;
}
.cb-page.is-heart .cb-mosaic { opacity: 1; }
.cb-tile {
  position: absolute; left: var(--l); top: var(--t); width: var(--w); height: var(--h);
  padding: 1.5px; /* thin dark seams between photos */
  --glide: 620ms cubic-bezier(0.65, 0, 0.35, 1); /* smooth in-out, no overshoot, so the heart never shows holes */
  transition: left var(--glide), top var(--glide), width var(--glide), height var(--glide);
}
.cb-tile-in {
  width: 100%; height: 100%; overflow: hidden; border-radius: 3px; background: #2a1a3a;
  opacity: 0; transform: scale(0.3);
  transition: opacity 400ms, transform 650ms var(--ease-spring);
}
/* beat 3: photos fill the heart one by one */
.cb-page.is-photos .cb-tile.is-loaded .cb-tile-in,
.cb-page.is-photos .cb-tile.is-failed .cb-tile-in { opacity: 1; transform: none; transition-delay: calc(var(--k) * 240ms); }
.cb-img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }
.cb-sheen {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.35) 50%, transparent 65%);
  background-size: 250% 100%; background-position: 150% 0;
}
/* beat 4: alive — a heartbeat, a sheen now and then */
.cb-page.is-alive .cb-heart { animation: cb-beat 1.1s ease-in-out; }
.cb-page.is-alive .cb-sheen { opacity: 1; animation: cb-sheen 4.5s ease-in-out 600ms infinite; }
@keyframes cb-sheen { 0% { background-position: 150% 0; } 40%, 100% { background-position: -50% 0; } }
@keyframes cb-beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.07); } 30% { transform: scale(0.98); } 45% { transform: scale(1.04); } }

.cb-msg {
  margin: 0; max-width: 30ch; font-size: 16px; line-height: 1.5; color: rgba(255, 255, 255, 0.85);
  opacity: 0; transform: translateY(10px);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
}
.cb-page.is-msg .cb-msg { opacity: 1; transform: none; }

.cb-actions { min-height: 56px; display: grid; place-items: center; }
.cb-go {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 26px; border: 0; border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #ff4d6d, #ff9f1c, #ffd60a, #52d273, #3ec1ff, #7b6cff, #ff5ec4);
  background-size: 200% 100%;
  color: #1b0d26; font-weight: 800; font-size: 16px;
  box-shadow: 0 10px 30px rgba(255, 94, 196, 0.35);
  opacity: 0; transform: translateY(10px) scale(0.95); pointer-events: none;
  transition: opacity 500ms, transform 500ms var(--ease-spring);
  animation: cb-slide 4s linear infinite;
}
.cb-go.is-in { opacity: 1; transform: none; pointer-events: auto; }
.cb-go:active { transform: scale(0.96); }
.cb-go-arrow { transition: transform 200ms; }
.cb-go:hover .cb-go-arrow { transform: translateX(4px); }
@keyframes cb-slide { to { background-position: 200% 0; } }

/* shorter phones: give the height to the heart, not the headline */
@media (max-height: 800px) {
  .cb-page { gap: clamp(6px, 1.6dvh, 14px); }
  .cb-kicker { display: none; }
  .cb-line--a { font-size: clamp(32px, 9.5vw, 60px); }
  .cb-line--b { font-size: clamp(40px, 12.5vw, 84px); }
}
@media (max-height: 620px) {
  .cb-heart { width: min(calc(100vw - 6px), 54dvh); }
  .cb-kicker { display: none; }
}
