/* The item card: one cosmetic as a small picture, its name, kind, rarity and price.
   Used by the home page, the store and the account page. Markup comes from js/item.js. */

.item {
	--rarity: var(--rarity-common);
	display: grid;
	grid-template-rows: auto 1fr auto;
	gap: var(--s-3);
	padding: var(--s-4);
	border-radius: var(--r-lg);
	background: var(--card);
	box-shadow: var(--shadow-1);
	color: var(--ink);
	text-align: start;
	cursor: pointer;
	border: 0;
	font: inherit;
	width: 100%;
}
.item[data-rarity="uncommon"] { --rarity: var(--rarity-uncommon); }
.item[data-rarity="rare"] { --rarity: var(--rarity-rare); }
.item[data-rarity="epic"] { --rarity: var(--rarity-epic); }
.item[data-rarity="legendary"] { --rarity: var(--rarity-legendary); }
.item:hover { box-shadow: var(--shadow-2); }
.item[aria-pressed="true"], .item.is-selected { box-shadow: 0 0 0 3px var(--violet), var(--shadow-2); }

.item__art {
	position: relative;
	aspect-ratio: 1;
	border-radius: var(--r-md);
	background:
		radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--rarity) 24%, var(--mist-2)), transparent 70%),
		linear-gradient(180deg, var(--mist-1), var(--mist-2));
	display: grid;
	place-items: center;
	isolation: isolate;
}
/* The ground under the model: a soft pool of the rarity colour, so it stands on something. */
.item__art::before {
	content: "";
	position: absolute;
	inset: auto 14% 7%;
	height: 16%;
	border-radius: 50%;
	background: radial-gradient(closest-side, color-mix(in srgb, var(--rarity) 34%, transparent), transparent);
	pointer-events: none;
}
.item__art img { width: 72%; height: 72%; object-fit: contain; image-rendering: pixelated; transition: opacity 320ms var(--ease); }
/* The live 3D picture (js/studio.js) is a little taller and wider than the frame, so a model can come out of it. */
.item__3d {
	position: absolute;
	left: -8%;
	top: -12%;
	width: 116%;
	height: 112%;
	pointer-events: none;
	opacity: 0;
	transition: opacity 320ms var(--ease);
}
.item__art.is-live .item__3d { opacity: 1; }
.item__art.is-live > img, .item__art.is-live > .item__glyph { opacity: 0; }
.item__art .item__flag {
	position: absolute;
	inset-block-start: var(--s-2);
	inset-inline-start: var(--s-2);
}

.item__name { font-size: var(--t-base); font-weight: 700; line-height: 1.6; }
.item__tags { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-block-start: var(--s-1); }

.item__price { display: flex; align-items: baseline; gap: var(--s-2); font-weight: 700; color: var(--ink); }
.item__price .num { font-size: var(--t-md); }
.item__price small { font-size: var(--t-xs); color: var(--ink-3); font-weight: 500; }
.item__price s { font-size: var(--t-sm); color: var(--ink-3); font-weight: 500; }
.item__price--free { color: var(--ok); }
.item__owned { color: var(--violet); }

.item__glyph { display: grid; place-items: center; width: 100%; height: 100%; color: var(--rarity); transition: opacity 320ms var(--ease); }
.item__glyph svg { width: 44%; height: 44%; }
/* A sound has no body to show, so the speaker's waves ripple out while the pointer is on the card. */
.item:hover .item__glyph .wave { animation: item-wave 900ms var(--ease) infinite; }
.item:hover .item__glyph .wave--2 { animation-delay: 180ms; }
@keyframes item-wave { 0% { opacity: 0.15; } 40% { opacity: 1; } 100% { opacity: 0.15; } }
