/*
 * Morph Card (Talkinggod Labs). Two states on one frame:
 *   card    - the cover, title, artist, a play glyph.
 *   player  - the cover sinks into a blurred backdrop, the media stage rises
 *             out of it, the glass control panel slides in.
 * .is-hero grows the frame to full size over the page (morphed by the View
 * Transitions API where the browser has it, else a FLIP animation).
 */
.mc {
	--mc-hue: 174; /* teal (#2ec4b6); was purple 280 - owner: no purple */
	--mc-radius: 18px;
	--mc-ease: cubic-bezier(.2, .8, .2, 1);
	--mc-glass: rgb(16 16 22 / .55);
	position: relative;
	width: 100%;
	aspect-ratio: 4 / 5;
	container-type: inline-size;
	font-family: inherit;
	color: #fff;
}
.mc--wide   { aspect-ratio: 16 / 9; }
.mc--story  { aspect-ratio: 9 / 16; }
.mc--square { aspect-ratio: 1 / 1; }
.mc--hero   { aspect-ratio: 21 / 9; max-height: 82vh; }
@media (max-width: 700px) { .mc--hero { aspect-ratio: 4 / 5; } }
/* Fill: the box the theme gives it decides the size. */
.mc--fill   { aspect-ratio: auto; height: 100%; min-height: 240px; }

.mc { perspective: 1100px; }

.mc__frame {
	position: absolute;
	inset: 0;
	border-radius: var(--mc-radius);
	transform-style: preserve-3d;
	transform: rotateX(var(--mc-rx, 0deg)) rotateY(var(--mc-ry, 0deg));
	transition: transform .18s linear;
}

/* --- the cover: its own clipped plane (3D lives between the planes) ------- */
.mc__artclip {
	position: absolute;
	inset: 0;
	border-radius: var(--mc-radius);
	overflow: hidden;
	background: #0b0b12;
	box-shadow: 0 10px 30px -12px rgb(0 0 0 / .6);
	transition: transform .8s var(--mc-ease);
}
.mc__art {
	position: absolute;
	inset: 0;
	/* Framed toward the top: on a card wider than its photo the crop keeps
	   heads and faces, not the middle. .mc__cut uses the same position. */
	background: #15151d 50% 28% / cover no-repeat;
	transition: filter .7s var(--mc-ease), transform .8s var(--mc-ease);
}
.mc__art::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgb(0 0 0 / 0) 45%, rgb(0 0 0 / .75) 100%);
	transition: opacity .5s;
}

/* An optional cut-out of the artist standing in front of the cover. */
.mc__cut {
	/*
	 * The cut-out is cut from the card's own art (same canvas), so it takes
	 * the art's exact geometry - the same box, cover fit and centring as
	 * .mc__art - and lines up with it pixel for pixel. Depth then adds the
	 * pop: translateZ(40px) under the card's 1100px perspective enlarges it
	 * by 1100/1060 (+3.8%); scale(.99) leaves a deliberate ~2.7% lift, so
	 * the figure stands just proud of its own photo instead of drifting off it.
	 * (Owner, 2026-10-08: the cut-out used to be fitted with "contain" while
	 * the art used "cover" - on a wide card the figure came out ~60% the
	 * size of the face behind it.)
	 */
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 28%;
	border-radius: var(--mc-radius);
	transform: translateZ(40px) scale(.99);
	transform-origin: 50% 50%;
	filter: drop-shadow(0 0 18px rgb(0 0 0 / .5));
	transition: transform .8s var(--mc-ease), opacity .45s;
	pointer-events: none;
}

/* --- card state ----------------------------------------------------------- */
/* In 3D the browser stacks by depth: the title and play button sit nearer
   the viewer than the cut-out (40px), or the cut-out covers them. */
.mc__meta { transform: translateZ(70px); }
.mc__open { transform: translateZ(80px); }
.mc__open {
	position: absolute;
	inset: 0;
	z-index: 3;
	border: 0;
	padding: 0;
	background: transparent;
	cursor: pointer;
	display: grid;
	place-items: center;
}
.mc__playbtn {
	width: clamp(46px, 16cqw, 76px);
	aspect-ratio: 1;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: rgb(255 255 255 / .16);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	box-shadow: 0 0 0 1px rgb(255 255 255 / .25), 0 0 30px hsl(var(--mc-hue) 90% 60% / .45);
	transition: transform .35s var(--mc-ease), opacity .3s;
}
.mc__open:hover .mc__playbtn,
.mc__open:focus-visible .mc__playbtn { transform: scale(1.08); }
.mc__playbtn svg { width: 42%; height: 42%; fill: #fff; margin-left: 6%; }

.mc__meta {
	position: absolute;
	left: 6%;
	right: 6%;
	bottom: 6%;
	z-index: 2;
	display: flex;
	flex-direction: column;
	gap: .2em;
	text-shadow: 0 1px 12px rgb(0 0 0 / .6);
	transition: transform .55s var(--mc-ease), font-size .55s var(--mc-ease);
	pointer-events: none;
}
.mc__title { font-weight: 700; font-size: clamp(15px, 6cqw, 30px); line-height: 1.1; }
.mc__artist { opacity: .8; font-size: clamp(12px, 3.6cqw, 18px); }

/* --- player state --------------------------------------------------------- */
.mc__stage {
	position: absolute;
	z-index: 1;
	left: 5%;
	right: 5%;
	top: 5%;
	aspect-ratio: 16 / 9;
	border-radius: calc(var(--mc-radius) * .6);
	overflow: hidden;
	background: #000 center / cover no-repeat;
	box-shadow: 0 18px 40px -16px rgb(0 0 0 / .8), 0 0 0 1px rgb(255 255 255 / .08);
	opacity: 0;
	/* Lying flat, deep inside the card. */
	transform: translateZ(-160px) rotateX(62deg) scale(.82);
	transform-origin: 50% 100%;
	transition: opacity .45s .08s, transform .9s .05s var(--mc-ease);
}
.mc__media, .mc__media iframe, .mc__media video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }

.mc__panel {
	position: absolute;
	z-index: 4;
	left: 4%;
	right: 4%;
	bottom: 4%;
	padding: 3.5cqw 4cqw 3cqw;
	border-radius: calc(var(--mc-radius) * .8);
	background: var(--mc-glass);
	-webkit-backdrop-filter: blur(16px) saturate(1.3);
	backdrop-filter: blur(16px) saturate(1.3);
	box-shadow: inset 0 0 0 1px rgb(255 255 255 / .1), 0 0 24px hsl(var(--mc-hue) 80% 50% / .25);
	opacity: 0;
	/* Folded down on its bottom hinge. */
	transform: rotateX(-96deg);
	transform-origin: 50% 100%;
	transition: opacity .3s, transform .75s var(--mc-ease);
	pointer-events: none;
}
.mc__seek { display: flex; align-items: center; gap: .6em; font-size: clamp(11px, 3cqw, 13px); font-variant-numeric: tabular-nums; opacity: .85; }
.mc__seek input { flex: 1; accent-color: hsl(var(--mc-hue) 90% 65%); height: 4px; }
.mc__buttons { display: flex; justify-content: center; align-items: center; gap: 4cqw; margin-top: 2cqw; }
.mc__btn {
	width: clamp(30px, 10cqw, 44px);
	aspect-ratio: 1;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	display: grid;
	place-items: center;
	cursor: pointer;
	padding: 0;
}
.mc__btn svg { width: 60%; height: 60%; fill: currentColor; }
.mc__btn.is-big { width: clamp(42px, 14cqw, 60px); background: rgb(255 255 255 / .14); box-shadow: 0 0 22px hsl(var(--mc-hue) 90% 60% / .5); }
.mc__btn:hover { background: rgb(255 255 255 / .12); }
.mc__i-pause, .mc.is-playing .mc__i-play { display: none; }
.mc.is-playing .mc__i-pause { display: contents; }
.mc.is-muted .mc__mute { opacity: .45; }
.mc.is-single .mc__prev, .mc.is-single .mc__next { visibility: hidden; }

.mc__close {
	position: absolute;
	z-index: 5;
	top: 2.5%;
	right: 2.5%;
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 50%;
	background: rgb(0 0 0 / .45);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transition: opacity .3s;
}

/* The 3D morph: the cover falls back, the video plane rises from deep inside,
   the controls swing up on their hinge, the title floats forward - while the
   whole card tilts through it. */
.mc.is-player .mc__artclip { transform: translateZ(-90px) scale(1.085); }
.mc.is-player .mc__art { filter: blur(22px) brightness(.42) saturate(1.35); transform: scale(1.18); }
.mc.is-player .mc__art::after { opacity: 0; }
.mc.is-player .mc__cut { transform: translateZ(-60px) scale(.9); opacity: 0; }
.mc.is-player .mc__open { opacity: 0; pointer-events: none; }
.mc.is-player .mc__stage { opacity: 1; transform: translateZ(46px); }
.mc.is-player .mc__panel { opacity: 1; transform: translateZ(30px); pointer-events: auto; transition-delay: .12s; }
.mc.is-player .mc__close { opacity: 1; pointer-events: auto; transform: translateZ(70px); }
.mc.is-player .mc__meta { transform: translateZ(60px); }
.mc.is-player .mc__frame { animation: mc-morph .95s var(--mc-ease); }
.mc.is-closing .mc__frame { animation: mc-unmorph .9s var(--mc-ease); }
@keyframes mc-morph {
	0%   { transform: none; }
	38%  { transform: translateZ(-50px) rotateX(16deg) rotateY(-16deg); }
	100% { transform: none; }
}
@keyframes mc-unmorph {
	0%   { transform: none; }
	40%  { transform: translateZ(-50px) rotateX(-14deg) rotateY(14deg); }
	100% { transform: none; }
}
.mc.is-player .mc__meta { bottom: auto; top: calc(5% + 90cqw * 9 / 16 + 3%); font-size: .8em; }

/* Shapes in player state. */
.mc--wide .mc__stage { left: 17.5%; right: auto; width: 65%; }
.mc--hero .mc__stage { left: 25.25%; right: auto; width: 49.5%; }
.mc--square .mc__stage { left: 5%; right: 5%; }
.mc--wide.is-player .mc__meta,
.mc--hero.is-player .mc__meta { top: 5%; left: 4%; right: auto; max-width: 22%; }
.mc--wide .mc__panel, .mc--hero .mc__panel { padding: 1.6cqw 2cqw 1.4cqw; }
.mc--wide .mc__buttons, .mc--hero .mc__buttons { gap: 2cqw; margin-top: .8cqw; }
.mc--wide .mc__btn, .mc--hero .mc__btn { width: clamp(30px, 5cqw, 44px); }
.mc--wide .mc__btn.is-big, .mc--hero .mc__btn.is-big { width: clamp(40px, 7cqw, 58px); }
.mc--story.is-player .mc__stage { top: 14%; }
.mc--story.is-player .mc__meta { top: calc(14% + 90cqw * 9 / 16 + 4%); }

/* Full size over the page. */
.mc.is-hero .mc__frame {
	position: fixed;
	z-index: 2147483100;
	inset: 4vh 4vw;
	border-radius: 22px;
}
.mc.is-hero .mc__artclip { border-radius: 22px; box-shadow: 0 30px 80px -20px rgb(0 0 0 / .9); }
.mc.is-hero .mc__stage { top: 6%; left: 50%; right: auto; width: min(84vw, 113vh); margin-left: calc(min(84vw, 113vh) / -2); }
.mc.is-hero .mc__meta { top: 3%; left: 3%; max-width: 30%; font-size: 1em; }
.mc.is-hero .mc__panel { left: 50%; right: auto; width: min(720px, 92%); margin-left: calc(min(720px, 92%) / -2); padding: 14px 18px 12px; }
.mc.is-hero .mc__buttons { gap: 18px; margin-top: 6px; }
.mc.is-hero .mc__btn { width: 42px; }
.mc.is-hero .mc__btn.is-big { width: 58px; }
.mc-backdrop {
	position: fixed;
	inset: 0;
	z-index: 2147483099;
	background: rgb(0 0 0 / .6);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

@media (prefers-reduced-motion: reduce) {
	.mc *, .mc *::after { transition-duration: .01s !important; animation: none !important; }
}

/* A narrow hero (phone) plays like a card. */
@media (max-width: 700px) {
	.mc--hero .mc__stage { top: 5%; bottom: auto; left: 5%; right: 5%; width: auto; }
	.mc--hero.is-player .mc__meta { top: calc(5% + 90cqw * 9 / 16 + 3%); left: 6%; max-width: none; }
	.mc--hero .mc__panel { padding: 3.5cqw 4cqw 3cqw; }
	.mc--hero .mc__buttons { gap: 4cqw; margin-top: 2cqw; }
	.mc--hero .mc__btn { width: clamp(30px, 10cqw, 44px); }
	.mc--hero .mc__btn.is-big { width: clamp(42px, 14cqw, 60px); }
}
