/* Project favorites — heart toggle.
   Design language borrowed from the catalog share button (.gs-project-card-share):
   a rounded white 3D "puck" that lifts and tilts on hover. The heart adds a celebratory
   beat + sparkle burst when a project is saved. Kid-friendly, but calm when idle so it
   doesn't overwhelm a card that may also show a share button.

   BEM: gs-fav-btn (+ __icon, __burst, __spark). State: .is-favorited / .is-bursting. */

:root {
  --gs-fav-pink: #ff4d8d;
  --gs-fav-pink-deep: #c9145a;
  --gs-fav-idle: var(--gs-purple, #6a0dad);
}

.gs-fav-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: var(--gs-fav-idle);
  cursor: pointer;
  box-shadow: 0 0.3rem 0 rgba(8, 2, 15, 0.16), 0 0.4rem 0.85rem rgba(8, 2, 15, 0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease, color 0.18s ease,
    background-color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.gs-fav-btn--sm { width: 2rem; height: 2rem; font-size: 0.85rem; }
.gs-fav-btn--md { width: 2.35rem; height: 2.35rem; font-size: 1rem; }
.gs-fav-btn--lg { width: 2.9rem; height: 2.9rem; font-size: 1.25rem; }

/* Labeled pill variant for roomy surfaces (featured carousel). Heart + text together. */
.gs-fav-btn--pill {
  width: auto;
  height: auto;
  min-height: 2.9rem;
  padding: 0.5rem 1.15rem;
  border-radius: 999px;
  gap: 0.5rem;
  font-family: var(--bs-header-font-family, 'Jua'), sans-serif;
  font-size: 1.05rem;
}

.gs-fav-btn__label {
  position: relative;
  z-index: 2;
  font-weight: 700;
  line-height: 1;
}

.gs-fav-btn__icon {
  position: relative;
  z-index: 2;
  line-height: 1;
  transition: transform 0.2s ease, color 0.18s ease;
}

/* Hover/focus: lift + playful tilt, heart blushes toward pink (mirrors the share "fly"). */
.gs-fav-btn:hover,
.gs-fav-btn:focus-visible {
  color: var(--gs-fav-pink);
  transform: translateY(-2px) rotate(-3deg);
  box-shadow: 0 0.5rem 0 rgba(8, 2, 15, 0.18), 0 0.6rem 1rem rgba(201, 20, 90, 0.28);
  outline: none;
}

.gs-fav-btn:hover .gs-fav-btn__icon,
.gs-fav-btn:focus-visible .gs-fav-btn__icon {
  transform: scale(1.12);
}

.gs-fav-btn:focus-visible {
  box-shadow: 0 0.5rem 0 rgba(8, 2, 15, 0.18), 0 0 0 0.22rem rgba(255, 77, 141, 0.45);
}

.gs-fav-btn:active {
  transform: translateY(0) rotate(0);
  box-shadow: 0 0.12rem 0 rgba(8, 2, 15, 0.16);
}

/* Saved state: solid pink heart on a soft blush puck. */
.gs-fav-btn.is-favorited {
  color: var(--gs-fav-pink);
  background: #fff0f6;
}

.gs-fav-btn.is-favorited:hover,
.gs-fav-btn.is-favorited:focus-visible {
  color: var(--gs-fav-pink-deep);
}

/* On-dark variant: outline-light idle (matches the share button on the purple featured
   card), solid pink when saved. Defined after the base rules so it wins on shared props. */
.gs-fav-btn--on-dark {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.65);
  box-shadow: none;
}

.gs-fav-btn--on-dark:hover,
.gs-fav-btn--on-dark:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: #fff;
  box-shadow: 0 0.4rem 0.85rem rgba(8, 2, 15, 0.28);
}

.gs-fav-btn--on-dark.is-favorited {
  background: var(--gs-fav-pink);
  border-color: var(--gs-fav-pink);
  color: #fff;
}

.gs-fav-btn--on-dark.is-favorited:hover,
.gs-fav-btn--on-dark.is-favorited:focus-visible {
  background: var(--gs-fav-pink-deep);
  border-color: var(--gs-fav-pink-deep);
  color: #fff;
}

/* Beat + sparkle replay when the project becomes favorited. */
.gs-fav-btn.is-bursting .gs-fav-btn__icon {
  animation: gs-fav-pop 0.45s ease;
}

@keyframes gs-fav-pop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.45); }
  55%  { transform: scale(0.85); }
  75%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* ── Sparkle burst ───────────────────────────────────────────────────────── */
.gs-fav-btn__burst {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.gs-fav-btn__spark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.32rem;
  height: 0.32rem;
  margin: -0.16rem 0 0 -0.16rem;
  border-radius: 50%;
  background: var(--gs-fav-pink);
  opacity: 0;
}

.gs-fav-btn__spark:nth-child(1) { --gs-spark-angle: 0deg;   background: var(--gs-fav-pink); }
.gs-fav-btn__spark:nth-child(2) { --gs-spark-angle: 60deg;  background: var(--gs-yellow, #fdb515); }
.gs-fav-btn__spark:nth-child(3) { --gs-spark-angle: 120deg; background: var(--gs-fav-pink); }
.gs-fav-btn__spark:nth-child(4) { --gs-spark-angle: 180deg; background: var(--gs-teal, #008080); }
.gs-fav-btn__spark:nth-child(5) { --gs-spark-angle: 240deg; background: var(--gs-fav-pink); }
.gs-fav-btn__spark:nth-child(6) { --gs-spark-angle: 300deg; background: var(--gs-yellow, #fdb515); }

.gs-fav-btn.is-bursting .gs-fav-btn__spark {
  animation: gs-fav-spark 0.55s ease-out;
}

@keyframes gs-fav-spark {
  0% {
    opacity: 1;
    transform: rotate(var(--gs-spark-angle)) translateY(0) scale(0.6);
  }
  70% { opacity: 1; }
  100% {
    opacity: 0;
    transform: rotate(var(--gs-spark-angle)) translateY(-1.35rem) scale(1);
  }
}

/* Error rollback nudge. */
.gs-fav-btn.is-fav-error {
  animation: gs-fav-shake 0.4s ease;
}

@keyframes gs-fav-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

/* In-flight: keep it tappable but hint a pending request. */
.gs-fav-btn.is-fav-pending {
  cursor: progress;
}

/* Card action cluster: heart + share live together in the upper-right corner.
   Higher specificity than catalog_share_modal.css so the share button drops its own
   absolute positioning and sits in the flex row beside the heart. */
.gs-card-actions {
  z-index: 3;
}

.gs-card-actions .gs-project-card-share {
  position: static;
  top: auto;
  right: auto;
  margin: 0;
}

/* Gallery completion card: heart sits where the old star placeholder lived. */
.gs-gallery-card__favorite {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 4;
}

/* Project detail / featured image hero. */
.gs-hero-favorite {
  z-index: 4;
}

/* ── Profile favorites tab ───────────────────────────────────────────────── */
.gs-profile-tabs__nav .nav-link {
  font-family: var(--bs-header-font-family, 'Jua'), sans-serif;
  color: var(--gs-purple, #6a0dad);
}

.gs-profile-tabs__nav .nav-link.active {
  color: var(--gs-dark-purple, #3c0777);
  font-weight: 700;
}

.gs-fav-sort .btn.active {
  background: var(--gs-light-yellow, #f9e3ab);
  border-color: var(--gs-yellow, #fdb515);
  color: var(--gs-dark-purple, #3c0777);
}

.gs-fav-empty {
  color: var(--gs-purple, #6a0dad);
}

.gs-fav-empty__icon {
  font-size: 2.75rem;
  color: var(--gs-fav-pink);
}

@media (prefers-reduced-motion: reduce) {
  .gs-fav-btn,
  .gs-fav-btn__icon { transition: color 0.12s ease, background-color 0.12s ease; }
  .gs-fav-btn:hover,
  .gs-fav-btn:focus-visible { transform: none; }
  .gs-fav-btn.is-bursting .gs-fav-btn__icon { animation: none; }
  .gs-fav-btn.is-bursting .gs-fav-btn__spark { animation: none; opacity: 0; }
  .gs-fav-btn.is-fav-error { animation: none; }
}
