/* Colecao de cartas do portfolio: carta colecionavel, distribuicao animada e momento de coleta. */

/* Gaveta: painel translucido sobre o ceu espacial. */
.collection-drawer .collection-drawer-panel {
  border-color: rgba(210, 232, 244, 0.12);
  background:
    radial-gradient(ellipse at 85% -10%, rgba(80, 140, 190, 0.2), transparent 50%),
    radial-gradient(ellipse at 0% 110%, rgba(120, 80, 190, 0.14), transparent 45%),
    rgba(3, 8, 14, 0.78) !important;
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.collection-drawer.is-opening .collection-drawer-backdrop {
  animation: vp-backdrop-in 600ms ease both;
}

.collection-drawer.is-opening .collection-drawer-panel {
  animation: vp-drawer-in 820ms cubic-bezier(0.16, 0.82, 0.18, 1) both !important;
}

.collection-drawer.is-opening .collection-drawer-panel header > *,
.collection-drawer.is-opening .collection-tabs,
.collection-drawer.is-opening .collection-category-tabs,
.collection-drawer.is-opening .collection-progress {
  animation: vp-rise-in 900ms cubic-bezier(0.16, 0.82, 0.18, 1) both;
}

.collection-drawer.is-opening .collection-drawer-panel header > :nth-child(2) { animation-delay: 80ms; }
.collection-drawer.is-opening .collection-tabs { animation-delay: 160ms; }
.collection-drawer.is-opening .collection-category-tabs { animation-delay: 220ms; }
.collection-drawer.is-opening .collection-progress { animation-delay: 280ms; }

.collection-drawer .collection-progress span {
  position: relative;
  overflow: hidden;
  transition: transform 1400ms cubic-bezier(0.16, 0.82, 0.18, 1);
}

.collection-drawer .collection-progress span::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  background-size: 40% 100%;
  background-repeat: no-repeat;
  content: "";
  animation: vp-progress-shine 2.8s ease-in-out infinite;
}

/* Grade */
.collection-drawer .collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(150px, 15vw, 200px), 1fr));
  gap: clamp(18px, 2.2vw, 30px);
  padding: 18px 14px 28px 4px;
  perspective: 1600px;
}

/* Carta */
.vp-card {
  position: relative;
  display: block;
  aspect-ratio: 5 / 7;
  color: #fff;
  text-decoration: none;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(0);
  transform-style: preserve-3d;
  transition: transform 700ms cubic-bezier(0.16, 0.82, 0.18, 1), filter 500ms ease;
  will-change: transform;
}

.vp-card.is-tilting {
  transition: transform 140ms ease-out;
}

.vp-card:focus-visible {
  outline: none;
}

.vp-card:focus-visible .vp-card-face {
  box-shadow: 0 0 0 2px rgba(140, 198, 216, 0.9), 0 30px 70px rgba(0, 0, 0, 0.6);
}

.vp-card-body {
  position: absolute;
  inset: 0;
  display: block;
  transform-style: preserve-3d;
}

.vp-card-face,
.vp-card-back {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  border-radius: 14px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.vp-card-face {
  background: #070c12;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: box-shadow 500ms ease;
}

.vp-card-face::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(3, 6, 10, 0.55) 0%, transparent 22%, transparent 48%, rgba(3, 6, 10, 0.92) 100%);
  content: "";
  pointer-events: none;
}

.vp-card-art,
.vp-card-art img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.vp-card-art img {
  object-fit: cover;
  transform: scale(1.04);
  transition: transform 900ms cubic-bezier(0.16, 0.82, 0.18, 1), filter 600ms ease;
}

.vp-card.is-collected .vp-card-art img {
  filter: saturate(1.05) contrast(1.04);
}

.vp-card.is-locked .vp-card-art img {
  filter: grayscale(1) brightness(0.42) contrast(1.1) blur(1.5px);
}

.vp-card:hover .vp-card-art img {
  transform: scale(1.1);
}

.vp-card.is-locked:hover .vp-card-art img {
  filter: grayscale(0.6) brightness(0.62) blur(0);
}

.vp-card-frame {
  position: absolute;
  inset: 8px;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  pointer-events: none;
}

.vp-card.is-collected .vp-card-frame {
  border-color: rgba(212, 175, 55, 0.5);
  box-shadow: inset 0 0 24px rgba(212, 175, 55, 0.08);
}

/* Brilho holografico que segue o ponteiro nas cartas coletadas. */
.vp-card-foil {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at var(--mx, 50%) var(--my, 30%), rgba(255, 255, 255, 0.16), transparent 38%),
    linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, 0.26) 45%, rgba(140, 198, 216, 0.22) 50%, rgba(212, 175, 55, 0.24) 55%, transparent 68%);
  background-size: 100% 100%, 260% 100%;
  background-position: 0 0, var(--mx, -120%) 0;
  mix-blend-mode: soft-light;
  opacity: 0;
  transition: opacity 500ms ease;
  pointer-events: none;
}

.vp-card.is-collected:hover .vp-card-foil,
.vp-card.is-collected.is-tilting .vp-card-foil,
.vp-card-flight .vp-card-foil {
  opacity: 1;
}

.vp-card.is-collected:hover .vp-card-face {
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(212, 175, 55, 0.16), 0 0 0 1px rgba(212, 175, 55, 0.3);
}

.vp-card-top {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.vp-card-top b {
  color: #e7c76a;
  font-weight: 900;
}

.vp-card.is-locked .vp-card-top b {
  color: rgba(255, 255, 255, 0.55);
}

.vp-card-top i {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.7);
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vp-card-info {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 3;
  display: grid;
  gap: 6px;
}

.vp-card-info strong {
  display: -webkit-box;
  overflow: hidden;
  font-family: var(--serif, serif);
  font-size: clamp(1.05rem, 1.3vw, 1.3rem);
  font-weight: 400;
  line-height: 1.08;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.vp-card-info small {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.58);
  font-family: var(--font);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.vp-card-state {
  position: absolute;
  z-index: 3;
  font-family: var(--font);
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.vp-card.is-collected .vp-card-state {
  top: 40px;
  left: 18px;
  color: rgba(231, 199, 106, 0.85);
}

.vp-card.is-locked .vp-card-state {
  top: 50%;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.78);
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.vp-card.is-locked .vp-card-state::before {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 62%, rgba(255, 255, 255, 0.9) 0 3px, transparent 3.5px),
    linear-gradient(rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)) 50% 66% / 12px 9px no-repeat,
    radial-gradient(circle at 50% 42%, transparent 0 4px, rgba(255, 255, 255, 0.9) 4.5px 5.8px, transparent 6.3px);
  content: "";
  opacity: 0.9;
}

/* Verso: o que aparece antes de a carta girar. */
.vp-card-back {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.16), transparent 55%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 12px),
    linear-gradient(160deg, #0b1a28, #04080e 70%);
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.4), inset 0 0 0 9px #050a10, inset 0 0 0 10px rgba(212, 175, 55, 0.3), 0 22px 60px rgba(0, 0, 0, 0.55);
  transform: rotateY(180deg);
}

.vp-card-back img {
  width: 58%;
  height: auto;
  opacity: 0.88;
}

/* Distribuicao: as cartas chegam viradas e giram em sequencia. */
.collection-grid.is-dealing .vp-card {
  animation: vp-deal 900ms cubic-bezier(0.16, 0.82, 0.18, 1) both;
  animation-delay: calc(var(--deal, 0) * 50ms + 120ms);
}

.collection-grid.is-dealing .vp-card-body {
  animation: vp-flip 1000ms cubic-bezier(0.3, 1.25, 0.4, 1) both;
  animation-delay: calc(var(--deal, 0) * 50ms + 300ms);
}

/* Momento de coleta */
.vp-card-stage {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
}

.vp-card-flight {
  position: absolute;
  top: 0;
  left: 0;
  perspective: 1200px;
}

.vp-card-flight .vp-card {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
}

.vp-card-flight .vp-card-face {
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7), 0 0 80px rgba(212, 175, 55, 0.22), 0 0 0 1px rgba(212, 175, 55, 0.4);
}

.vp-card-flight .vp-card-info strong {
  font-size: 1.5rem;
}

.vp-card-burst {
  position: absolute;
  inset: -45%;
  z-index: -1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 236, 180, 0.55), rgba(212, 175, 55, 0.18) 30%, transparent 62%),
    repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.22) 0deg 2deg, transparent 2deg 14deg);
  -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 70%);
  mask-image: radial-gradient(circle, #000 20%, transparent 70%);
  opacity: 0;
}

.vp-card-flight-label {
  position: absolute;
  left: 50%;
  bottom: -46px;
  color: #e7c76a;
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 12px);
}

.collection-peek.is-receiving {
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.6), 0 0 40px rgba(212, 175, 55, 0.4);
}

@keyframes vp-deal {
  from {
    opacity: 0;
    transform: translate3d(0, 90px, 0) rotateZ(-7deg) scale(0.86);
  }
}

@keyframes vp-flip {
  from {
    transform: rotateY(180deg);
  }
}

@keyframes vp-drawer-in {
  from {
    opacity: 0;
    filter: blur(10px);
    transform: translate3d(0, 46px, 0) scale(0.98);
  }
}

@keyframes vp-backdrop-in {
  from {
    opacity: 0;
  }
}

@keyframes vp-rise-in {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
  }
}

@keyframes vp-progress-shine {
  0%, 30% { background-position: -60% 0; }
  70%, 100% { background-position: 160% 0; }
}

@media (max-width: 760px) {
  .collection-drawer .collection-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .vp-card-top,
  .vp-card-info {
    left: 14px;
    right: 14px;
  }

  .vp-card-top {
    top: 14px;
  }

  .vp-card-info {
    bottom: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .collection-grid.is-dealing .vp-card,
  .collection-grid.is-dealing .vp-card-body,
  .collection-drawer.is-opening .collection-drawer-panel,
  .collection-drawer.is-opening .collection-drawer-panel header > * {
    animation: none !important;
  }

  .vp-card {
    transform: none;
  }
}

/* Cabecalho compacto: titulo e resumo na mesma faixa, cartas logo abaixo. */
.collection-drawer .collection-drawer-panel header {
  min-height: 0 !important;
  padding-bottom: 6px !important;
}

.collection-drawer .collection-drawer-panel header > div {
  min-height: 0 !important;
  align-content: end;
  row-gap: 8px !important;
}

.collection-drawer .collection-drawer-panel h2 {
  font-size: clamp(2.2rem, 4.2vw, 3.8rem) !important;
  line-height: 0.95 !important;
}

.collection-drawer .collection-drawer-panel header strong {
  color: #fff;
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1.5vw, 1.35rem) !important;
}
