/* The Bakance card: the lagoon seen from above, seven bands of blue. */
.card-stage {
	perspective: 1100px;
	width: min(92vw, 392px);
	margin: 0 auto;
	touch-action: pan-y;
}
.card3d {
	--rx: 0deg; --ry: 0deg; --gx: 50%; --gy: 30%; --hx: 0; --hy: 0; --flip: 0deg; --lift: 0px;
	position: relative;
	aspect-ratio: 1.586;
	transform-style: preserve-3d;
	transform: translateY(var(--lift)) rotateX(var(--rx)) rotateY(calc(var(--ry) + var(--flip)));
	transition: --flip .7s;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	will-change: transform;
}
.card3d.flipping { transition: transform .75s cubic-bezier(.3, .9, .25, 1); }
.card-face {
	position: absolute; inset: 0; border-radius: 22px; overflow: hidden;
	backface-visibility: hidden; -webkit-backface-visibility: hidden;
	box-shadow:
		0 1px 0 rgba(255, 255, 255, .5) inset,
		0 30px 60px -18px rgba(10, 42, 67, .55),
		0 14px 24px -12px rgba(10, 42, 67, .35);
}
.card-back { transform: rotateY(180deg); background: #fff; }

.lagoon { position: absolute; inset: 0; width: 100%; height: 100%; }
.lagoon .band { transition: fill 1.2s ease; }
.lagoon .drift-a { animation: driftA 14s ease-in-out infinite alternate; }
.lagoon .drift-b { animation: driftB 19s ease-in-out infinite alternate; }
@keyframes driftA { to { transform: translate(-10px, 4px); } }
@keyframes driftB { to { transform: translate(12px, -5px); } }

.caustics {
	position: absolute; inset: -20%;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.018 .034' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 -7 4.4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
	background-size: 240px 240px;
	mix-blend-mode: soft-light;
	opacity: .32;
	animation: caustic 22s linear infinite;
	transform: translate(calc(var(--hx) * -14px), calc(var(--hy) * -10px));
}
@keyframes caustic { to { background-position: 240px 120px; } }

.foil {
	position: absolute; inset: 0;
	background:
		repeating-linear-gradient(115deg,
			rgba(255, 0, 132, .0) 0%, rgba(255, 182, 39, .55) 8%, rgba(159, 230, 223, .6) 16%,
			rgba(31, 111, 178, .55) 24%, rgba(170, 120, 255, .5) 32%, rgba(255, 0, 132, .0) 40%);
	background-size: 260% 260%;
	background-position: calc(50% + var(--hx) * 60%) calc(50% + var(--hy) * 60%);
	mix-blend-mode: color-dodge;
	opacity: calc(.18 + (var(--hx) * var(--hx) + var(--hy) * var(--hy)) * .5);
	-webkit-mask-image: linear-gradient(135deg, transparent 10%, #000 45%, #000 60%, transparent 92%);
	mask-image: linear-gradient(135deg, transparent 10%, #000 45%, #000 60%, transparent 92%);
}
.glare {
	position: absolute; inset: 0;
	background: radial-gradient(circle at var(--gx) var(--gy), rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 45%);
	mix-blend-mode: overlay;
}

.card-content {
	position: absolute; inset: 0; padding: 18px 20px 16px;
	display: grid; grid-template-rows: auto 1fr auto; color: #fff;
	transform: translateZ(30px);
}
.card3d[data-level="clara"] .card-content { color: var(--deep); }

.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.brand { font-family: var(--display); font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; text-shadow: 0 1px 10px rgba(10, 42, 67, .2); }
.brand img { height: 30px; width: auto; border-radius: 8px; }
.brand .wave { width: 22px; height: 22px; }
.level-pill {
	font-size: .76rem; font-weight: 700; padding: 5px 10px; border-radius: 999px;
	background: rgba(10, 42, 67, .55); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
	white-space: nowrap;
}
.card3d[data-level="clara"] .level-pill { background: rgba(255, 255, 255, .7); color: var(--deep); }

.card-mid { align-self: end; padding-bottom: 8px; }
.holder {
	font-family: var(--display); font-weight: 700; font-size: clamp(1.25rem, 6vw, 1.6rem); line-height: 1.05;
	text-shadow: 0 2px 14px rgba(10, 42, 67, .25);
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-code { font-family: var(--body); font-weight: 700; font-size: .95rem; letter-spacing: .16em; opacity: .9; margin-top: 4px; font-variant-numeric: tabular-nums; }

.card-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stamps { display: flex; gap: 7px; }
.stamp {
	width: 26px; height: 26px; border-radius: 50%;
	box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6);
	background: rgba(255, 255, 255, .12);
	position: relative;
}
.card3d[data-level="clara"] .stamp { box-shadow: inset 0 0 0 2px rgba(10, 42, 67, .35); background: rgba(255, 255, 255, .4); }
.card3d .stamp.on, .card3d[data-level] .stamp.on {
	background: radial-gradient(circle at 35% 30%, #fff 0 12%, var(--mango) 13% 60%, #E08A00 100%);
	box-shadow: 0 0 0 2px rgba(255, 255, 255, .85), 0 0 16px rgba(255, 182, 39, .8);
}
.stamp.drop { animation: stampDrop .9s cubic-bezier(.3, 1.6, .5, 1) both; }
.stamp.drop::after {
	content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #fff;
	animation: ripple 1.1s .35s ease-out both;
}
@keyframes stampDrop { 0% { transform: translateY(-90px) scale(.4); opacity: 0; } 60% { transform: translateY(4px) scale(1.15); opacity: 1; } 100% { transform: none; } }
@keyframes ripple { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(2.8); opacity: 0; } }
.since { font-size: .72rem; font-weight: 700; text-align: right; padding: 3px 8px; border-radius: 999px; background: rgba(10, 42, 67, .45); color: #fff; }
.card3d[data-level="clara"] .since { background: rgba(255, 255, 255, .6); color: var(--deep); }

/* back */
.back-inner { position: absolute; inset: 0; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; padding: 16px 18px; color: var(--deep); }
.qr-box { position: relative; width: clamp(128px, 40vw, 168px); aspect-ratio: 1; background: #fff; border-radius: 14px; padding: 8px; box-shadow: inset 0 0 0 2px #E3F4F1; }
.qr-box svg, .qr-box canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.qr-ring { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); pointer-events: none; overflow: visible; }
.qr-ring rect { fill: none; stroke: var(--turq); stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; transition: stroke-dashoffset 1s linear; }
.back-text h3 { font-size: 1rem; }
.back-text .card-code { color: var(--deep); opacity: 1; font-size: 1.05rem; margin: 6px 0; }
.back-text p { font-size: .8rem; color: var(--ink-soft); line-height: 1.35; }
.back-edge { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: linear-gradient(90deg, #E9FBF7, #9FE6DF, #22B8C4, #1F8FC4, #1F6FB2, #16508A, #0A2A43); }

.card-shadow { height: 26px; margin: -6px auto 0; width: 78%; background: radial-gradient(ellipse at center, rgba(10, 42, 67, .28), transparent 70%); filter: blur(4px); transform: translateX(calc(var(--shx, 0) * 1px)); }

.card3d.levelup .lagoon { animation: levelPulse 1.4s ease; }
@keyframes levelPulse { 30% { filter: brightness(1.5) saturate(1.4); } }
.card3d.born { animation: born 1.3s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes born { 0% { transform: translateY(40px) rotateX(70deg) scale(.7); opacity: 0; filter: blur(8px); } 60% { opacity: 1; filter: blur(0); } }

@media (prefers-reduced-motion: reduce) {
	.caustics, .lagoon .drift-a, .lagoon .drift-b { animation: none; }
}
