/* "Bump to Make Friends" — self-contained styles for js/friends.js.
   Delete this file (and the marked blocks in index.html) to remove the feature. */

.bond {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* lets the memories row scroll instead of widening the card */
  gap: 24px;
  padding: 32px;
  background: linear-gradient(135deg, #fff0f5, #f1eaff);
}

/* ---------- Stage ---------- */
.bond__stage {
  position: relative;
  height: clamp(260px, 30vw, 330px);
  border-radius: var(--radius-md);
  background:
    radial-gradient(ellipse 60% 18% at 50% 92%, rgba(139, 92, 246, 0.12), transparent),
    linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.2));
}

.bond__sound {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow);
  font-size: 1.1rem;
}

.bond__buddy {
  position: absolute;
  bottom: 18px;
  z-index: 1;
  width: min(30%, 210px);
}
.bond__buddy--left { left: 6%; }
.bond__buddy--right { right: 6%; }
.bond__art svg { width: 100%; overflow: visible; }

.bond-gaze { transition: transform 0.3s ease; }

/* Speech bubble above each buddy */
.bond__bubble {
  position: absolute;
  bottom: calc(100% - 6px);
  left: 50%;
  width: max-content;
  max-width: 210px;
  padding: 8px 14px;
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 8px) scale(0.8);
  transition: opacity 0.25s, transform 0.3s cubic-bezier(0.3, 1.5, 0.5, 1);
  pointer-events: none;
}
.bond__bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  border: 7px solid transparent;
  border-top-color: var(--white);
  translate: -50% 0;
}
.bond__bubble.is-visible { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* Data link between the two screens while memories sync */
.bond__link {
  position: absolute;
  top: 60%;
  left: 30%;
  right: 30%;
  height: 4px;
  border-radius: 4px;
  background: repeating-linear-gradient(90deg, #c4a6ff 0 8px, transparent 8px 14px);
  opacity: 0;
  transition: opacity 0.3s, background 0.3s, box-shadow 0.3s;
}
.bond__link span {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  border-radius: 50%;
  background: #8b5cf6;
  box-shadow: 0 0 10px #8b5cf6;
  animation: bond-travel 0.9s linear infinite;
}
.bond__link span:nth-child(2) { animation-delay: 0.3s; animation-direction: reverse; background: #ff6b9a; box-shadow: 0 0 10px #ff6b9a; }
.bond__link span:nth-child(3) { animation-delay: 0.6s; }

[data-phase='sync'] .bond__link,
[data-phase='saved'] .bond__link { opacity: 1; }
[data-phase='saved'] .bond__link { background: #ff6b9a; box-shadow: 0 0 12px rgba(255, 107, 154, 0.7); }
[data-phase='saved'] .bond__link span { display: none; }

/* Screen progress bar drawn by friends.js */
.bond-progress {
  transform-box: fill-box;
  transform-origin: left center;
  animation: bond-progress 1.4s ease-in-out forwards;
}

/* Hearts + ring that burst from the bump point */
.bond__fx { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.bond-heart {
  position: absolute;
  left: 50%;
  top: 48%;
  color: #ff6b9a;
  font-size: var(--size);
  line-height: 1;
  opacity: 0;
  animation: bond-heart-rise 1.9s ease-out var(--delay) forwards;
}
.bond-ring {
  position: absolute;
  left: 50%;
  top: 55%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid #ff6b9a;
  border-radius: 50%;
  animation: bond-ring-out 0.7s ease-out forwards;
}

/* ---------- Controls ---------- */
.bond__controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.bond__picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity 0.2s;
}
.bond__picker .icon-btn { background: var(--white); box-shadow: var(--shadow); }
.bond__picker [data-bond-name] { min-width: 96px; text-align: center; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; }
.bond__picker.is-locked { opacity: 0.45; pointer-events: none; }

/* ---------- Memories ---------- */
.bond__memories-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.bond__memories-head strong { display: inline-flex; align-items: center; gap: 6px; }
.bond__memories-head svg { width: 18px; height: 18px; color: #8b5cf6; }
.bond__reset {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: underline;
}

/* One row that scrolls sideways, so the section never grows taller. */
.bond__list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  /* room for the card shadows and the "new" outline, which would otherwise be clipped */
  padding: 4px 4px 12px;
  margin: -4px -4px -12px;
}
.bond__list li {
  flex: none;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 10px;
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}
.bond__list small { display: block; color: var(--muted); font-size: 0.78rem; }
.bond__list .is-new { animation: bond-pop 0.6s cubic-bezier(0.3, 1.5, 0.5, 1); outline: 2px solid #ff9fc0; }
.bond__list .bond__empty { color: var(--muted); box-shadow: none; background: rgba(255, 255, 255, 0.6); }
.bond__faces { display: flex; }
.bond__faces svg { width: 36px; }
.bond__faces svg + svg { margin-left: -10px; }
.bond__faces .buddy-eyes { animation: none; }

/* ---------- Animations ---------- */
@keyframes bond-travel {
  from { left: 0; }
  to { left: calc(100% - 10px); }
}
@keyframes bond-progress { from { transform: scaleX(0); } }
@keyframes bond-heart-rise {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.3); }
  15% { opacity: 1; transform: translate(-50%, -20px) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-1 * var(--rise))) scale(0.8) rotate(15deg); }
}
@keyframes bond-ring-out {
  from { opacity: 1; transform: scale(0.3); }
  to { opacity: 0; transform: scale(4.5); }
}
@keyframes bond-pop { from { transform: scale(0.6); opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .bond { padding: 20px 14px; }
  .bond__stage { height: 230px; }
  .bond__buddy { width: 36%; bottom: 12px; }
  .bond__buddy--left { left: 3%; }
  .bond__buddy--right { right: 3%; }
  .bond__bubble { max-width: 140px; font-size: 0.72rem; padding: 6px 10px; }
  .bond__controls { grid-template-columns: 1fr 1fr; }
  .bond__controls .btn { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .bond__picker { gap: 4px; }
  .bond__picker [data-bond-name] { min-width: 70px; font-size: 1rem; }
}
