/*!
 * ISSeL Santa Peek 5.0 – Frontend styles
 * Santa and speech bubble are purely decorative and never intercept clicks.
 */

@font-face {
	font-family: "ISSeL Santa Hand";
	src: url("../fonts/caveat-bold.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-017F, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}

.isp-root {
	--isp-bubble-bg: #ffffff;
	--isp-bubble-border: #d2ab48;
	--isp-text: #15152d;
	--isp-accent: #d2ab48;
	--isp-z: 99990;
	--isp-font: "ISSeL Santa Hand", "Segoe Print", "Bradley Hand", "Hiragino Maru Gothic ProN", "Yu Gothic UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK JP", system-ui, sans-serif;

	position: fixed;
	inset: 0;
	z-index: var(--isp-z);
	overflow: hidden;
	pointer-events: none;
	contain: strict;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

.isp-root.isp-font-inherit {
	--isp-font: inherit;
}

.isp-root *,
.isp-root *::before,
.isp-root *::after {
	box-sizing: border-box;
	pointer-events: none;
}

/* ---------------------------------------------------------------- Santa */

.isp-santa {
	position: absolute;
	top: 0;
	left: 0;
	visibility: hidden;
	will-change: transform, opacity;
}

.isp-santa.is-active {
	visibility: visible;
}

.isp-santa__sway {
	position: absolute;
	inset: 0;
	transform-origin: var(--isp-origin, 50% 100%);
}

.isp-santa.is-idle .isp-santa__sway {
	animation: isp-sway 3.2s ease-in-out infinite;
}

.isp-santa.is-hanging.is-idle .isp-santa__sway {
	animation-name: isp-swing;
	animation-duration: 2.8s;
}

.isp-santa__img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	object-fit: contain;
	filter: drop-shadow(0 10px 18px rgba(10, 10, 30, 0.28));
	-webkit-user-drag: none;
}

.isp-santa__img.is-flip-x { transform: scaleX(-1); }
.isp-santa__img.is-flip-y { transform: scaleY(-1); }
.isp-santa__img.is-rot-180 { transform: rotate(180deg); }

.isp-santa__logo {
	position: absolute;
	display: block;
	max-width: none;
	height: auto;
	margin: 0;
	border: 0;
	transform: translate(-50%, -50%) rotate(var(--isp-logo-rot, 0deg));
}

@keyframes isp-sway {
	0%, 100% { transform: rotate(0deg); }
	30% { transform: rotate(var(--isp-sway, 1.6deg)); }
	65% { transform: rotate(calc(var(--isp-sway, 1.6deg) * -0.55)); }
}

@keyframes isp-swing {
	0%, 100% { transform: rotate(0deg); }
	25% { transform: rotate(var(--isp-sway, 2.4deg)); }
	75% { transform: rotate(calc(var(--isp-sway, 2.4deg) * -1)); }
}

/* --------------------------------------------------------- Speech bubble */

.isp-bubble {
	position: absolute;
	top: 0;
	left: 0;
	visibility: hidden;
	color: var(--isp-text);
	font-family: var(--isp-font);
	font-weight: 700;
	font-style: normal;
	line-height: 1.02;
	letter-spacing: 0;
	text-align: center;
	text-transform: none;
	white-space: normal;
	will-change: transform, opacity;
}

.isp-bubble__inner {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: max-content;
	min-height: 2.6em;
	padding: 0.66em 1em 0.72em;
}

.isp-bubble.is-active {
	visibility: visible;
}

.isp-bubble__shape {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: calc(100% * 140 / 110);
	overflow: visible;
	filter: drop-shadow(0 6px 10px rgba(21, 21, 45, 0.22));
}

.isp-bubble--tail-br .isp-bubble__shape { transform: scaleX(-1); }

.isp-bubble--tail-tl .isp-bubble__shape,
.isp-bubble--tail-tr .isp-bubble__shape {
	top: auto;
	bottom: 0;
	filter: drop-shadow(0 -2px 10px rgba(21, 21, 45, 0.2));
}

.isp-bubble--tail-tl .isp-bubble__shape { transform: scaleY(-1); }
.isp-bubble--tail-tr .isp-bubble__shape { transform: scale(-1, -1); }

.isp-bubble__path {
	fill: var(--isp-bubble-bg);
	stroke: var(--isp-bubble-border);
	stroke-width: var(--isp-stroke, 3.5px);
	stroke-linejoin: round;
	vector-effect: non-scaling-stroke;
}

.isp-bubble__text {
	position: relative;
	display: block;
	max-width: 100%;
	overflow-wrap: anywhere;
	word-break: normal;
	transform: rotate(-3deg);
}

.isp-bubble__text.is-cjk {
	font-family: "Hiragino Maru Gothic ProN", "Yu Gothic UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK JP", system-ui, sans-serif;
	font-size: 0.78em;
	line-height: 1.25;
	word-break: keep-all;
	white-space: nowrap;
}

.isp-bubble__text.is-fallback-script {
	font-size: 0.82em;
	line-height: 1.15;
}

/* Little accent strokes ("ta-da" lines) next to the bubble. */
.isp-bubble__accent {
	position: absolute;
	width: 2.1em;
	height: 2.1em;
	overflow: visible;
}

.isp-bubble__accent line {
	stroke: var(--isp-accent);
	stroke-width: var(--isp-accent-stroke, 3.5px);
	stroke-linecap: round;
	vector-effect: non-scaling-stroke;
}

.isp-bubble--tail-bl .isp-bubble__accent { right: -0.9em; top: -1.15em; transform: scaleX(-1); }
.isp-bubble--tail-br .isp-bubble__accent { left: -0.9em; top: -1.15em; }
.isp-bubble--tail-tl .isp-bubble__accent { right: -0.9em; bottom: -1.15em; transform: scale(-1, -1); }
.isp-bubble--tail-tr .isp-bubble__accent { left: -0.9em; bottom: -1.15em; transform: scaleY(-1); }

/* Small twinkle sparkles */
.isp-sparkle {
	position: absolute;
	width: 0.7em;
	height: 0.7em;
	opacity: 0;
	fill: var(--isp-accent);
}

.isp-bubble.is-idle .isp-sparkle {
	animation: isp-twinkle 1.6s ease-in-out infinite;
}

.isp-bubble.is-idle .isp-sparkle:nth-of-type(2) {
	animation-delay: 0.55s;
}

@keyframes isp-twinkle {
	0%, 100% { opacity: 0; transform: scale(0.4) rotate(0deg); }
	50% { opacity: 1; transform: scale(1) rotate(45deg); }
}

.isp-bubble.is-idle .isp-bubble__inner {
	animation: isp-float 2.4s ease-in-out infinite;
}

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

/* ------------------------------------------------------- Reduced motion */

@media (prefers-reduced-motion: reduce) {
	.isp-santa.is-idle .isp-santa__sway,
	.isp-bubble.is-idle .isp-sparkle,
	.isp-bubble.is-idle .isp-bubble__inner {
		animation: none !important;
	}
}

@media print {
	.isp-root {
		display: none !important;
	}
}
