/* Candy Heart Wall — palette + heart styles */

:root {
  /* Curated candy heart palette — pastel, slightly desaturated, NOT rainbow.
     Each prompt = one color. Rollstack sky-blue is the BLUE candy color. */
  --candy-blue:   #8FCDEC;  /* Best memory — Rollstack sky, pastelled */
  --candy-blue-ink:#1A5A7C;
  --candy-mint:   #B6E2BB;  /* Where you flew in from */
  --candy-mint-ink:#2C6B47;
  --candy-coral:  #F89A8E;  /* Hottest take */
  --candy-coral-ink:#9C2F2A;
  --candy-pink:   #F7BAD0;  /* Shoutout */
  --candy-pink-ink:#9B3266;
  --candy-butter: #F6DC83;  /* Data Night Out — distinct from other 4 */
  --candy-butter-ink:#7A5410;
  --candy-purple: #C9B6E8;  /* TC overheard — soft lilac */
  --candy-purple-ink:#5B3D8C;

  /* Cream paper page background — the candy heart sits on butcher paper */
  --paper-cream: #FBF6EE;
  --paper-cream-2: #F7EFE2;
  --paper-ink: #2A2018;     /* warm dark for body text */
  --paper-ink-soft: #6A5A4A;

  --rs-navy: #003D57;
  --rs-sky: #0098D9;
}

html, body {
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  background: var(--paper-cream);
  color: var(--paper-ink);
  margin: 0;
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* Subtle paper grain via SVG noise — tiny, pastel-warm */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.6  0 0 0 0 0.5  0 0 0 0 0.35  0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}

/* ────────────── CANDY HEART STAMP TYPE ──────────────
   Characteristics of real candy heart text:
   - All caps, condensed, slight vertical stretch
   - Stamped (slightly uneven, faded edges)
   - Dark ink on light pastel — pigment matches the candy color family
   - Tightly tracked, 2 lines max
*/
.heart-text {
  font-family: "DM Sans", sans-serif;
  font-weight: 900;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  line-height: 0.95;
  text-align: center;
  text-wrap: balance;
  /* Candy stamp aesthetic — slightly compressed vertically, stamped fade */
  font-stretch: 75%;
  /* The stamped look — slight blur + offset = imperfect press */
  text-shadow:
    0 0 0.5px currentColor,
    0.5px 0.4px 0 rgba(0,0,0,0.06);
  /* squish the letters horizontally so it looks like the embossed candy lettering */
  font-feature-settings: "ss01";
}

/* ────────────── HEART SHAPE ──────────────
   Classic candy heart — pure CSS, two circles + rotated square.
   Slightly more squat than a Valentine heart.
*/
.heart {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transform-origin: center;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(2px 3px 0 rgba(0,0,0,0.04));
}

.heart-shape {
  position: absolute;
  inset: 0;
  background: var(--c, var(--candy-pink));
  /* SVG candy heart silhouette as mask — squat heart with chamfered top */
  -webkit-mask: var(--heart-mask) center / 100% 100% no-repeat;
          mask: var(--heart-mask) center / 100% 100% no-repeat;
}

.heart-shape::after {
  /* Subtle inner shading — gives candy 3D feel */
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 30%, rgba(255,255,255,0.55), transparent 70%),
    radial-gradient(ellipse 80% 40% at 50% 95%, rgba(0,0,0,0.07), transparent 60%);
  pointer-events: none;
}

.heart-content {
  position: relative;
  z-index: 1;
  padding: 0 14% 4%;  /* leave space for heart's pointy bottom */
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Color variants — each writes its color + ink color */
.heart[data-c="blue"]   { --c: var(--candy-blue);   --ink: var(--candy-blue-ink); }
.heart[data-c="mint"]   { --c: var(--candy-mint);   --ink: var(--candy-mint-ink); }
.heart[data-c="coral"]  { --c: var(--candy-coral);  --ink: var(--candy-coral-ink); }
.heart[data-c="pink"]   { --c: var(--candy-pink);   --ink: var(--candy-pink-ink); }
.heart[data-c="butter"] { --c: var(--candy-butter); --ink: var(--candy-butter-ink); }
.heart[data-c="purple"] { --c: var(--candy-purple); --ink: var(--candy-purple-ink); }

/* Loved state — subtle pulse + sparkle ring */
.heart.loved {
  animation: heart-pulse 600ms cubic-bezier(0.16, 1, 0.3, 1);
}
/* ──────────────  Press-and-hold delight  ──────────────
   Layered effects driven by --p (0–100%):
   • heart-glow      — radial halo that intensifies as --p grows
   • heart-shine     — bright surface highlight that breathes
   • love-flow       — six small hearts orbiting INTO the center
   • .heart.loving   — gently scales up on the wrapper itself        */

/* The heart wrapper itself breathes during loving — subtle scale tied to --p */
.heart.loving {
  animation: heart-breathe 700ms ease-in-out infinite;
  /* slight global lift so the heart feels like it's about to pop */
  transform: scale(calc(1 + var(--p, 0) / 1500));
  z-index: 5;
}
@keyframes heart-breathe {
  0%, 100% { filter: drop-shadow(2px 3px 0 rgba(0,0,0,0.04)); }
  50%      { filter: drop-shadow(0 0 18px var(--c, var(--candy-pink)))
                     drop-shadow(2px 3px 0 rgba(0,0,0,0.06)); }
}

/* Radial glow halo behind the heart, intensifies with --p */
.heart-glow {
  position: absolute;
  inset: -25%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    circle at 50% 50%,
    var(--c, var(--candy-pink)) 0%,
    rgba(255,255,255,0) 55%
  );
  opacity: calc(var(--p, 0) / 140);   /* up to ~0.7 at p=100 */
  filter: blur(8px);
  animation: heart-glow-pulse 700ms ease-in-out infinite;
}
@keyframes heart-glow-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

/* Bright shine layer on the heart silhouette — uses the same SVG mask
   so the shine is clipped to the heart shape. Sweeps brighter with --p. */
.heart-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  -webkit-mask: var(--heart-mask, none) center / 100% 100% no-repeat;
          mask: var(--heart-mask, none) center / 100% 100% no-repeat;
  background:
    radial-gradient(ellipse 60% 35% at 50% 28%,
      rgba(255,255,255, calc(0.55 + var(--p, 0) / 220)),
      transparent 70%),
    linear-gradient(180deg,
      rgba(255,255,255, calc(var(--p, 0) / 350)),
      transparent 60%);
}
.heart .heart-shine {
  --heart-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 90'><path d='M50 86 C 18 60, 2 42, 2 25 C 2 10, 14 2, 26 2 C 36 2, 44 8, 50 18 C 56 8, 64 2, 74 2 C 86 2, 98 10, 98 25 C 98 42, 82 60, 50 86 Z' fill='black'/></svg>");
}

/* Inflowing love hearts — six small hearts placed around the perimeter
   spiraling toward the center while fading in & out. */
.love-flow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  pointer-events: none;
  z-index: 4;
  color: var(--c, var(--candy-pink));
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.95));
  animation: love-flow-in 900ms cubic-bezier(0.55, 0.05, 0.4, 1) var(--delay, 0ms) infinite;
}
.love-flow svg { width: 100%; height: 100%; display: block; }
@keyframes love-flow-in {
  0% {
    transform:
      rotate(var(--angle, 0deg))
      translateX(75%)
      rotate(calc(var(--angle, 0deg) * -1))
      scale(0.4);
    opacity: 0;
  }
  20% { opacity: 1; }
  70% {
    transform:
      rotate(var(--angle, 0deg))
      translateX(20%)
      rotate(calc(var(--angle, 0deg) * -1))
      scale(0.85);
    opacity: 1;
  }
  100% {
    transform:
      rotate(var(--angle, 0deg))
      translateX(0)
      rotate(calc(var(--angle, 0deg) * -1))
      scale(1.1);
    opacity: 0;
  }
}

.heart.loving::before {
  /* Press-and-hold ring fill — same as before but a touch thicker */
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: conic-gradient(rgba(255,255,255,0.85) var(--p, 0%), transparent var(--p, 0%));
  -webkit-mask: radial-gradient(circle, transparent 49%, black 50%, black 62%, transparent 63%);
          mask: radial-gradient(circle, transparent 49%, black 50%, black 62%, transparent 63%);
  pointer-events: none;
  z-index: 3;
  filter: drop-shadow(0 0 6px var(--c, var(--candy-pink)));
}

@keyframes heart-pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* Sparkle that pops out when loved */
.spark {
  position: absolute;
  width: 12px;
  height: 12px;
  pointer-events: none;
  color: #fff;
  filter: drop-shadow(0 0 4px rgba(255,255,255,0.9));
  animation: spark-fly 700ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes spark-fly {
  0%   { transform: translate(0,0) scale(0.4); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0; }
}

/* Floating "+1" indicator that rises from the heart on every love.
   Makes short-tap feedback unambiguous: you can SEE the love land. */
.love-floater {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translate(-50%, 0);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  pointer-events: none;
  white-space: nowrap;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.18));
  animation: love-float 800ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  z-index: 5;
}
@keyframes love-float {
  0%   { opacity: 0; transform: translate(calc(-50% + var(--fx, 0px)), 4px) scale(0.7); }
  18%  { opacity: 1; transform: translate(calc(-50% + var(--fx, 0px)), -4px) scale(1.15); }
  60%  { opacity: 1; transform: translate(calc(-50% + var(--fx, 0px)), -22px) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--fx, 0px)), -38px) scale(0.95); }
}

/* Love counter chip — tiny pill on bottom-right of heart */
.love-count {
  position: absolute;
  bottom: -6px;
  right: -4px;
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px 2px 5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  z-index: 3;
}

/* ────────────── BUTTONS ────────────── */
.btn-pill {
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 150ms, background 150ms, box-shadow 150ms;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
.btn-pill:active { transform: scale(0.96); }

.btn-primary {
  background: var(--rs-blue-500, #0098D9);
  color: #fff;
  padding: 14px 24px;
  font-size: 16px;
  box-shadow: 0 4px 0 0 rgba(0,0,0,0.12), 0 6px 16px rgba(0,0,0,0.08);
}
.btn-primary:hover { background: var(--rs-blue-600, #0084BD); }

.btn-ghost {
  background: rgba(255,255,255,0.7);
  border: 1.5px solid rgba(0,0,0,0.1);
  color: var(--paper-ink);
  padding: 10px 18px;
  font-size: 14px;
  backdrop-filter: blur(8px);
}

/* Pre-themed input — colored to match selected prompt */
.candy-input {
  width: 100%;
  background: var(--c-tint, rgba(0,0,0,0.04));
  border: 2px solid var(--c, transparent);
  border-radius: 16px;
  padding: 16px 18px;
  font-family: inherit;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink, var(--paper-ink));
  text-transform: uppercase;
  letter-spacing: 0.01em;
  text-align: center;
  resize: none;
  outline: none;
  box-sizing: border-box;
}
.candy-input::placeholder {
  color: var(--ink, var(--paper-ink));
  opacity: 0.4;
  text-transform: uppercase;
  font-weight: 700;
}

/* Stat ticker — JS swaps which child has .on, CSS handles the slide+fade.
   Absolute positioning means only one line ever paints at a time, so the
   old keyframe overlap (where two lines briefly rendered together during
   the transition window) can't happen. */
.ticker {
  display: inline-block;
  position: relative;
  height: 1.4em;
  line-height: 1.4em;
  vertical-align: bottom;
  overflow: hidden;
  /* Reserve a sensible width so the surrounding header doesn't reflow as
     lines change length. Adjust freely; this is a soft hint. */
  min-width: 220px;
}
.ticker > span {
  position: absolute;
  inset: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  opacity: 0;
  transform: translateY(60%);
  transition:
    opacity 380ms ease,
    transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.ticker > span.on {
  opacity: 1;
  transform: translateY(0);
}

/* Gentle bob animation for hearts when "settled" */
@keyframes bob {
  0%, 100% { transform: translate(var(--dx, 0), 0) rotate(var(--rot, 0deg)); }
  50%      { transform: translate(var(--dx, 0), -4px) rotate(calc(var(--rot, 0deg) + 0.5deg)); }
}

/* Highlight for the just-submitted heart — a glow halo plus a brief
   scale pulse on first appearance so the user can spot their heart
   joining the flow without the old scripted hover-in-center routine. */
.heart.highlight {
  animation: heart-highlight-pulse 900ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.heart.highlight::after {
  content: "";
  position: absolute;
  inset: -14px;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--c, var(--candy-pink)) 55%, white) 0%,
    transparent 65%
  );
  pointer-events: none;
  z-index: -1;
  animation: highlight-halo 1.6s ease-in-out infinite;
}
@keyframes highlight-halo {
  0%, 100% { opacity: 0.45; transform: scale(1); }
  50%      { opacity: 0.9;  transform: scale(1.18); }
}
@keyframes heart-highlight-pulse {
  0%   { transform: scale(0.85); }
  45%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* Modal/sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(42, 32, 24, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 200ms ease-out;
}
.sheet { position: relative; z-index: 1001; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  background: var(--paper-cream);
  width: 100%;
  max-width: 480px;
  border-radius: 28px 28px 0 0;
  padding: 8px 22px 28px;
  animation: slide-up 320ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.15);
  max-height: 92dvh;
  overflow-y: auto;
}
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle {
  width: 44px;
  height: 5px;
  background: rgba(0,0,0,0.15);
  border-radius: 999px;
  margin: 8px auto 16px;
}

/* Banner stripe at top — homage to the plane flyover */
.banner-stripe {
  background:
    repeating-linear-gradient(135deg,
      var(--candy-pink) 0 24px,
      var(--candy-butter) 24px 48px,
      var(--candy-mint) 48px 72px,
      var(--candy-blue) 72px 96px,
      var(--candy-coral) 96px 120px);
  height: 6px;
}

/* Scribble underline */
.scribble {
  position: relative;
  display: inline-block;
}
.scribble::after {
  content: "";
  position: absolute;
  left: -4px; right: -4px; bottom: -4px;
  height: 8px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 8' preserveAspectRatio='none'><path d='M2 5 Q 30 1 60 4 T 118 5' fill='none' stroke='%23F89A8E' stroke-width='2.5' stroke-linecap='round'/></svg>") center/100% 100% no-repeat;
}

/* SR-only */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
