/* ---------------------------------------------------------------
   Tokens
--------------------------------------------------------------- */
:root {
  --ink:      #241b2f;
  --paper:    #fbf7f2;
  --blue:     #4e7fff;
  --pink:     #FF4D6D;
  --purple:   #9b6bff;
  --gold:     #f2a93b;
  --line:     rgba(36, 27, 47, 0.1);
  --shadow:   0 18px 40px rgba(36, 27, 47, 0.16);
  --font-display: 'Caveat', cursive;
  --font-ui: 'Quicksand', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  /* background: var(--paper); */
}

img { max-width: 100%; display: block; }

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------------------------------------------------------------
   Top bar
--------------------------------------------------------------- */
.top-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 5vw 18px;
  border-bottom: 1px solid var(--line);
}

.top-bar__mark {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.top-bar--slim { align-items: center; }

/* ---------------------------------------------------------------
   Gallery grid
--------------------------------------------------------------- */
.gallery-wrap {
  padding: 32px 5vw 64px;
  /* background-color: yellow; */
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.status {
  font-size: 15px;
  color: rgba(36, 27, 47, 0.6);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  width: 1200px;
  /* background-color: #FFEDF1; */
}

@media (max-width: 1100px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------
   Card
--------------------------------------------------------------- */
.card-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  
}
.card__art:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 30px 60px rgba(43, 33, 64, 0.25);
}

.card {
  background: #fff;
  border-radius: 22px;
  /* box-shadow: var(--shadow); */
  overflow: hidden;
  border: 1px solid var(--line);

  --accent: var(--gold);
  --name-color: #fff;
  --msg-color: #fff;
}

.card__art {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #eee;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card__bg {
  display: block;
  width: 100%;
  height: auto;
}

/* Everything — photo, sticker, name, divider, message — lives in one
   centered column. The ORDER in which they stack is set per card via
   inline `style.order`, driven by the shuffled `element_order` array
   returned from api/get_templates.php (and api/get_template.php). */
.card__stack {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 82%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  text-align: center;
  padding: 16px 18px;
  border-radius: 16px;
}

.card__profile {
  width: 150px;
  height: 150px;
  object-fit: cover;
  transform-origin: center;
}

.card__sticker {
  width: 150px;
  height: 150px;
  object-fit: contain;
  /* filter: drop-shadow(0 6px 10px rgba(0,0,0,0.25)); */
  transform-origin: center;
}

.card__name {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1.1;
  color: var(--name-color, #fff);
  text-shadow: 0 2px 10px rgba(0,0,0,0.45);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform-origin: center;
}

.card__divider {
  width: 30px;
  height: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.card__message {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.3;
  color: var(--msg-color, #fff);
  text-shadow: 0 1px 6px rgba(0,0,0,0.4);
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__btn {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 999px;
  /* background: var(--ink); */
  background-color: #FFEDF1;
  /* color: #fff; */
  color: #FF4D6D;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14px;
  /* box-shadow: var(--shadow); */
  transition: transform 0.15s ease, background 0.15s ease;
}

.card__btn:hover { 
  background: var(--pink); 
  color: #FFFFFF;
  transform: translateY(-1px); 
}

/* ---------------------------------------------------------------
   Entrance animation — one orchestrated reveal per card, triggered
   when it scrolls into view.
--------------------------------------------------------------- */
@keyframes cardIn      { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes badgePop    { from { opacity: 0; transform: scale(0.4) rotate(-14deg); } to { opacity: 1; transform: scale(1) rotate(0deg); } }
@keyframes tagSlide    { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }

@keyframes profileFloat {
  0%, 100% { transform: translateY(0)    scale(1);    }
  50%      { transform: translateY(-8px) scale(1.04); }
}
@keyframes stickerWiggle {
  0%, 100% { transform: translateY(0)    rotate(-6deg); }
  50%      { transform: translateY(-6px) rotate( 6deg); }
}
@keyframes nameBob {
  0%, 100% { transform: translateY(0);   }
  50%      { transform: translateY(-6px); }
}

.card { opacity: 0; }
.card.in-view {
  opacity: 1;
  animation: cardIn 0.5s ease forwards;
}

.card.in-view .card__profile {
  animation:
    badgePop     0.5s  0.15s cubic-bezier(.34,1.56,.64,1) both,
    profileFloat 3.2s  0.65s ease-in-out infinite;
}
.card.in-view .card__sticker {
  animation:
    badgePop      0.5s 0.28s cubic-bezier(.34,1.56,.64,1) both,
    stickerWiggle 3.6s 0.78s ease-in-out infinite;
}
.card.in-view .card__name {
  animation:
    tagSlide 0.45s 0.4s  ease both,
    nameBob  3s    0.85s ease-in-out infinite;
}
.card.in-view .card__message {
  animation: tagSlide 0.45s 0.52s ease both;
}

@media (prefers-reduced-motion: reduce) {
  .card, .card__profile, .card__sticker, .card__name, .card__message {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ---------------------------------------------------------------
   Falling confetti overlay
--------------------------------------------------------------- */
.card__confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 14%, #000 100%);
          mask-image: linear-gradient(to bottom, transparent 0%, #000 14%, #000 100%);
}

@media (prefers-reduced-motion: reduce) {
  .card__confetti { display: none; }
}



.empty-state
{
  /* background-color: yellow; */
  text-align: center;
}
.empty-state .btn{
margin-top: 30px;
}