/* =====================================================================
   Gallery / portfolio — premium 3D layer (js/gallery3d.js)
   Scoped under html.gallery-3d (added only when motion is allowed).
   ===================================================================== */

/* ---- "Coming Soon" stage ---- */
.gallery-3d .showcase-wrap {
	position: relative;
	max-width: 1140px;
	margin: 60px auto 40px;
	padding: 70px 0;
}

.gallery-3d .showcase-stage {
	position: absolute;
	inset: 0;
	perspective: 1400px;
	perspective-origin: 50% 40%;
	pointer-events: none;
	z-index: 0;
}

.gallery-3d .showcase-card {
	position: relative;
	z-index: 1;
	overflow: hidden;
}

/* Mouse tilt once the reveal animation has finished. */
.gallery-3d .showcase-card.revealed {
	transform: perspective(1100px) rotateX(var(--card-rx, 0deg)) rotateY(var(--card-ry, 0deg));
	transition: transform 0.12s linear, box-shadow 0.4s ease;
	box-shadow: 0 40px 90px rgba(11, 18, 36, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.gallery-3d .showcase-card > :not(.showcase-edge):not(.showcase-glare) {
	position: relative;
	z-index: 2;
}

/* Moving gradient edge. */
@property --showcase-angle {
	syntax: "<angle>";
	initial-value: 0deg;
	inherits: false;
}

.showcase-edge {
	position: absolute;
	inset: 0;
	padding: 1.5px;
	border-radius: inherit;
	background: conic-gradient(from var(--showcase-angle), #2563eb, #06b6d4, #9b51e0, #ff9f43, #2563eb);
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	animation: showcase-edge-spin 6s linear infinite;
	pointer-events: none;
	z-index: 1;
}

@keyframes showcase-edge-spin {
	to { --showcase-angle: 360deg; }
}

/* Light that follows the cursor across the card. */
.showcase-glare {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 1;
	background: radial-gradient(420px circle at var(--glare-x, 50%) var(--glare-y, 30%), rgba(255, 255, 255, 0.12), transparent 60%);
}

/* Badge gets a sweeping shine. */
.gallery-3d .showcase-card .badge-premium {
	position: relative;
	overflow: hidden;
}

.gallery-3d .showcase-card .badge-premium::after {
	content: "";
	position: absolute;
	top: 0;
	left: -60%;
	width: 40%;
	height: 100%;
	background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
	animation: showcase-badge-shine 3.2s ease-in-out infinite;
}

@keyframes showcase-badge-shine {
	0%, 55% { left: -60%; }
	100% { left: 130%; }
}

/* ---- Placeholder frames ---- */
.showcase-frame {
	position: absolute;
	top: 50%;
	left: 50%;
	transform-style: preserve-3d;
	opacity: 0;
	will-change: transform, opacity;
}

.showcase-frame-inner {
	width: 100%;
	height: 100%;
	border-radius: 14px;
	overflow: hidden;
	position: relative;
	background: linear-gradient(160deg, #ffffff, #eef4ff);
	border: 1px solid rgba(37, 99, 235, 0.14);
	box-shadow: 0 30px 60px rgba(17, 24, 39, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.9);
	animation: showcase-float 6s ease-in-out infinite;
}

@keyframes showcase-float {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-12px); }
}

/* Loading shimmer sweeping across every frame. */
.showcase-frame-inner::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.7) 50%, transparent 70%);
	transform: translateX(-100%);
	animation: showcase-shimmer 2.6s ease-in-out infinite;
}

@keyframes showcase-shimmer {
	60%, 100% { transform: translateX(100%); }
}

.frame-browser { width: 280px; height: 190px; }
.frame-phone { width: 118px; height: 230px; }
.frame-phone .showcase-frame-inner { border-radius: 22px; }
.frame-dashboard { width: 230px; height: 150px; }

/* Skeleton pieces */
.showcase-frame :is(.sk-hero, .sk-line, .sk-cols span, .sk-btn, .sk-side span, .sk-url) {
	display: block;
	border-radius: 6px;
	background: rgba(37, 99, 235, 0.12);
}

.sk-bar {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 9px 10px;
	border-bottom: 1px solid rgba(37, 99, 235, 0.1);
}

.sk-bar i {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #f87171;
}

.sk-bar i:nth-child(2) { background: #fbbf24; }
.sk-bar i:nth-child(3) { background: #34d399; }
.sk-url { flex: 1; height: 10px; margin-left: 8px; }

.sk-body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px;
}

.sk-hero {
	height: 46px;
	background: linear-gradient(120deg, rgba(37, 99, 235, 0.35), rgba(6, 182, 212, 0.3), rgba(155, 81, 224, 0.3)) !important;
}

.sk-hero.tall { height: 70px; }
.sk-line { height: 8px; }
.w60 { width: 60%; }
.w70 { width: 70%; }
.w80 { width: 80%; }
.w90 { width: 90%; }

.sk-cols {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
	margin-top: 4px;
}

.sk-cols span { height: 34px; }

.sk-notch {
	display: block;
	width: 40%;
	height: 10px;
	margin: 8px auto 2px;
	border-radius: 0 0 8px 8px;
	background: rgba(17, 24, 39, 0.75);
}

.sk-btn {
	height: 20px;
	margin-top: 6px;
	border-radius: 10px !important;
	background: linear-gradient(135deg, #2563eb, #06b6d4) !important;
}

.frame-dashboard .showcase-frame-inner {
	display: grid;
	grid-template-columns: 22% 1fr;
}

.sk-side {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px 8px;
	background: rgba(37, 99, 235, 0.06);
}

.sk-side span { height: 8px; }

.sk-main {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 12px;
}

.sk-chart {
	height: 78px;
	display: flex;
	align-items: flex-end;
	gap: 6px;
}

.sk-chart i {
	flex: 1;
	height: var(--h);
	border-radius: 4px 4px 0 0;
	background: linear-gradient(180deg, #60a5fa, #2563eb);
	transform-origin: bottom;
	animation: showcase-bars 3s ease-in-out infinite;
}

.sk-chart i:nth-child(2n) {
	background: linear-gradient(180deg, #67e8f9, #06b6d4);
	animation-delay: -1.2s;
}

@keyframes showcase-bars {
	0%, 100% { transform: scaleY(1); }
	50% { transform: scaleY(0.7); }
}

/* Dark theme frames */
html[data-theme="dark"] .showcase-frame-inner {
	background: linear-gradient(160deg, #16213b, #0f1930);
	border-color: rgba(148, 163, 184, 0.18);
	box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .showcase-frame-inner::after {
	background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.08) 50%, transparent 70%);
}

html[data-theme="dark"] .showcase-frame :is(.sk-line, .sk-cols span, .sk-side span, .sk-url) {
	background: rgba(148, 163, 184, 0.18);
}

/* Frames need room beside the card; on narrower screens keep only the
   card's own 3D (tilt, edge, glare). */
@media (max-width: 1100px) {
	.gallery-3d .showcase-stage {
		display: none;
	}

	.gallery-3d .showcase-wrap {
		padding: 0;
		margin: 30px auto;
	}
}

/* ---- Project grid (once projects are published) ---- */
.gallery-3d .portfolio-card.flip-in {
	animation: portfolio-flip-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
	animation-delay: var(--flip-delay, 0ms);
}

@keyframes portfolio-flip-in {
	from {
		opacity: 0;
		transform: perspective(1000px) rotateY(-70deg) translateZ(-120px);
	}
}

.gallery-3d .portfolio-featured-media {
	transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
	transform-style: preserve-3d;
}
