/* Argentum — front end
   Sizes, corner and mobile behaviour are injected per install by the plugin. */

#argentum,
.argentum-preview-stage {
	z-index: 9990;
	font-family: Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	pointer-events: none;
}
#argentum * ,
.argentum-preview-stage * { box-sizing: border-box; }

.argentum-cat {
	position: relative;
	cursor: pointer;
	pointer-events: auto;
}
.argentum-fig {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	image-rendering: pixelated;
	-ms-interpolation-mode: nearest-neighbor;
}

/* --- phases ------------------------------------------------------------ */
.argentum-cat.ph-off,
.argentum-cat.ph-gone { opacity: 0; visibility: hidden; }
.argentum-cat.ph-in  .argentum-fig { animation: argentum-mat var(--argentum-in, 1.2s) steps(14, end) both; }
.argentum-cat.ph-out .argentum-fig { animation: argentum-demat var(--argentum-out, 1.1s) steps(13, end) both; }
.argentum-cat.ph-hold { animation: argentum-breathe 3.6s ease-in-out infinite; }

/* idle motion, only while the companion is fully present */
.argentum-cat.ph-hold [id$="-tail"]   { animation: argentum-tail 3.2s ease-in-out infinite; }
.argentum-cat.ph-hold [id$="-half"]   { animation: argentum-half 5.4s steps(1, end) infinite; }
.argentum-cat.ph-hold [id$="-closed"] { animation: argentum-shut 5.4s steps(1, end) infinite; }
[id$="-half"], [id$="-closed"] { opacity: 0; }

/* --- the beam, clipped to the sprite's own outline --------------------- */
.argentum-beam {
	position: absolute;
	left: -6%;
	top: -4%;
	width: 112%;
	height: 108%;
	opacity: 0;
	pointer-events: none;
	mix-blend-mode: screen;
	background-image:
		linear-gradient(180deg, rgba(150,240,255,0) 0%, rgba(150,240,255,.85) 38%, rgba(255,255,255,.95) 50%, rgba(150,240,255,.85) 62%, rgba(150,240,255,0) 100%),
		repeating-linear-gradient(0deg, rgba(200,250,255,.5) 0 2px, rgba(200,250,255,0) 2px 5px);
	background-size: 100% 55%, 100% 100%;
	background-repeat: no-repeat, repeat;
	-webkit-mask-size: 100% 100%;
	        mask-size: 100% 100%;
	-webkit-mask-position: center;
	        mask-position: center;
	-webkit-mask-repeat: no-repeat;
	        mask-repeat: no-repeat;
	filter: blur(.4px);
}
.argentum-cat.ph-in  .argentum-beam { animation: argentum-beam var(--argentum-in, 1.2s) linear both, argentum-flick .16s steps(2, end) infinite; }
.argentum-cat.ph-out .argentum-beam { animation: argentum-beam var(--argentum-out, 1.1s) linear both, argentum-flick .16s steps(2, end) infinite; }

@keyframes argentum-mat {
	0%   { opacity: 0;   clip-path: inset(0 0 100% 0); filter: brightness(2.6) saturate(0); }
	14%  { opacity: .4;  clip-path: inset(0 0 82% 0); }
	26%  { opacity: .15; clip-path: inset(0 0 70% 0); }
	40%  { opacity: .75; clip-path: inset(0 0 52% 0); filter: brightness(1.9) saturate(.3); }
	54%  { opacity: .35; clip-path: inset(0 0 38% 0); }
	70%  { opacity: .9;  clip-path: inset(0 0 20% 0); filter: brightness(1.4) saturate(.7); }
	84%  { opacity: .7;  clip-path: inset(0 0 6% 0); }
	100% { opacity: 1;   clip-path: inset(0 0 0 0);   filter: none; }
}
@keyframes argentum-demat {
	0%   { opacity: 1;   clip-path: inset(0 0 0 0);   filter: none; }
	18%  { opacity: .8;  filter: brightness(1.5) saturate(.6); }
	34%  { opacity: .95; clip-path: inset(14% 0 0 0); }
	50%  { opacity: .4;  clip-path: inset(34% 0 0 0); filter: brightness(2) saturate(.25); }
	66%  { opacity: .7;  clip-path: inset(52% 0 0 0); }
	82%  { opacity: .25; clip-path: inset(74% 0 0 0); }
	100% { opacity: 0;   clip-path: inset(100% 0 0 0); filter: brightness(2.8) saturate(0); }
}
@keyframes argentum-beam {
	0%   { opacity: 0; background-position: 0 -70%; }
	10%  { opacity: 1; }
	90%  { opacity: 1; }
	100% { opacity: 0; background-position: 0 170%; }
}
@keyframes argentum-flick { 0%, 100% { opacity: .85; } 50% { opacity: .35; } }
@keyframes argentum-half  { 0% { opacity: 0; } 90.5% { opacity: 1; } 92% { opacity: 0; } 95% { opacity: 1; } 96.5% { opacity: 0; } 100% { opacity: 0; } }
@keyframes argentum-shut  { 0% { opacity: 0; } 92% { opacity: 1; } 95% { opacity: 0; } 100% { opacity: 0; } }
@keyframes argentum-tail  { 0%, 100% { transform: rotate(-3.6deg); } 50% { transform: rotate(3.6deg); } }
@keyframes argentum-breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes argentum-pop { from { opacity: 0; transform: translateY(6px) scale(.96); } to { opacity: 1; transform: none; } }

/* --- speech bubble ----------------------------------------------------- */
[id$="-bubble"] {
	position: absolute;
	width: max-content;
	max-width: 200px;
	background: #fff;
	border: 2px solid #0D1B2E;
	border-radius: 9px;
	padding: 6px 17px 6px 9px;
	box-shadow: 0 4px 12px rgba(13, 27, 46, .14);
	pointer-events: auto;
	animation: argentum-pop .28s ease-out;
}
[id$="-bubble"].argentum-hidden { display: none; }
[id$="-text"] {
	font-size: 11px;
	line-height: 1.4;
	color: #0D1B2E;
	font-weight: 500;
}
[id$="-x"] {
	position: absolute;
	top: 0;
	right: 0;
	width: 30px;
	height: 30px;
	margin: -8px -8px 0 0;
	display: flex;
	align-items: flex-start;
	justify-content: flex-end;
	padding: 5px 5px 0 0;
	font-size: 12px;
	line-height: 1;
	color: #8A94A4;
	cursor: pointer;
}
[id$="-x"]:hover { color: #0D1B2E; }
.argentum-arrow {
	position: absolute;
	bottom: 12px;
	width: 0;
	height: 0;
	border-left: 8px solid #0D1B2E;
	border-top: 6px solid transparent;
	border-bottom: 6px solid transparent;
}
.argentum-arrow.in { border-left-color: #fff; }

@media only screen and (max-width: 690px) {
	[id$="-bubble"] { max-width: 150px; padding: 5px 15px 5px 8px; }
	[id$="-text"]   { font-size: 10px; line-height: 1.35; }
	.argentum-arrow { bottom: 10px; }
	[id$="-x"] { width: 44px; height: 44px; margin: -13px -13px 0 0; padding: 9px 9px 0 0; font-size: 12px; }
}
