/**
 * Contact section component — self-contained, scoped to .tm-contact
 * Loaded last site-wide via inc/contact-section.php
 */

.tm-contact .section-container {
	max-width: 1400px;
	margin: 0 auto;
	padding: 0 var(--spacing-lg);
}

.tm-contact .section-header {
	text-align: center;
	margin-bottom: var(--spacing-xl);
}

.tm-contact .section-title {
	font-size: clamp(2rem, 5vw, 3.5rem);
	font-weight: 900;
	margin-bottom: var(--spacing-md);
	position: relative;
	display: inline-block;
	color: var(--primary-color);
}

.tm-contact .section-title::before,
.tm-contact .section-title::after {
	content: '';
	position: absolute;
	width: 50px;
	height: 4px;
	background: var(--primary-color);
	top: 50%;
	transform: translateY(-50%);
}

.tm-contact .section-title::before {
	left: -70px;
}

.tm-contact .section-title::after {
	right: -70px;
}

.tm-contact .section-subtitle {
	font-size: 1.2rem;
	color: var(--secondary-color);
	max-width: 600px;
	margin: 0 auto;
	line-height: 1.6;
}

.tm-contact {
	position: relative;
	padding: clamp(3.5rem, 8vw, 6rem) 0;
	background:
		radial-gradient(ellipse 80% 60% at 15% 0%, color-mix(in srgb, var(--primary-color) 18%, transparent) 0%, transparent 55%),
		radial-gradient(ellipse 70% 50% at 90% 100%, color-mix(in srgb, var(--primary-light) 12%, transparent) 0%, transparent 50%),
		linear-gradient(180deg, var(--bg-dark) 0%, #0a0a0f 100%);
	overflow: hidden;
}

.tm-contact__glow {
	position: absolute;
	border-radius: 50%;
	filter: blur(80px);
	pointer-events: none;
	opacity: 0.45;
}

.tm-contact__glow--a {
	width: min(420px, 55vw);
	height: min(420px, 55vw);
	top: -8%;
	left: -6%;
	background: color-mix(in srgb, var(--primary-color) 40%, transparent);
}

.tm-contact__glow--b {
	width: min(360px, 45vw);
	height: min(360px, 45vw);
	bottom: -10%;
	right: -4%;
	background: color-mix(in srgb, var(--primary-light) 30%, transparent);
}

.tm-contact__header {
	position: relative;
	z-index: 1;
}

.tm-contact__layout {
	position: relative;
	z-index: 1;
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
	gap: clamp(1.5rem, 4vw, 3rem);
	align-items: start;
	margin-top: clamp(2rem, 5vw, 3rem);
}

.tm-contact__info {
	display: flex;
	flex-direction: column;
	gap: var(--spacing-md);
}

.tm-contact__info-intro {
	padding: var(--spacing-lg);
	border-radius: var(--radius-md);
	background: color-mix(in srgb, var(--bg-card) 85%, transparent);
	border: 1px solid color-mix(in srgb, var(--primary-color) 35%, transparent);
	box-shadow: 0 12px 40px color-mix(in srgb, var(--text-primary) 25%, transparent);
}

.tm-contact__info-kicker {
	margin: 0 0 var(--spacing-sm);
	font-size: 0.78rem;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--primary-light);
}

.tm-contact__info-text {
	margin: 0;
	font-size: 1.05rem;
	line-height: 1.65;
	color: color-mix(in srgb, var(--text-light) 82%, transparent);
}

/* ===== Interactive pixel playground ===== */
.tm-pixel-playground {
	position: relative;
	flex: 1;
	min-height: 420px;
}

.tm-pixel-playground__cabinet {
	position: relative;
	height: 100%;
	min-height: inherit;
	padding: clamp(0.85rem, 2vw, 1.15rem);
	border-radius: 14px;
	background: linear-gradient(
		165deg,
		color-mix(in srgb, var(--bg-card) 95%, transparent) 0%,
		color-mix(in srgb, var(--bg-dark) 98%, transparent) 100%
	);
	border: 4px solid color-mix(in srgb, var(--primary-dark) 80%, var(--bg-dark));
	box-shadow:
		0 0 0 2px color-mix(in srgb, var(--primary-light) 35%, transparent),
		0 20px 50px color-mix(in srgb, var(--text-primary) 40%, transparent),
		inset 0 2px 0 color-mix(in srgb, var(--text-light) 8%, transparent);
	transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.tm-pixel-playground.is-active .tm-pixel-playground__cabinet,
.tm-pixel-playground.is-dragging .tm-pixel-playground__cabinet {
	box-shadow:
		0 0 0 2px color-mix(in srgb, var(--primary-light) 65%, transparent),
		0 0 40px color-mix(in srgb, var(--primary-color) 35%, transparent),
		0 24px 56px color-mix(in srgb, var(--text-primary) 45%, transparent);
}

.tm-pixel-playground__marquee {
	overflow: hidden;
	margin-bottom: 0.75rem;
	padding: 0.45rem 0;
	border-radius: 6px;
	background: color-mix(in srgb, var(--primary-dark) 70%, var(--bg-dark));
	border: 2px solid color-mix(in srgb, var(--primary-color) 50%, transparent);
}

.tm-pixel-playground__marquee-text {
	display: inline-block;
	padding-left: 100%;
	font-family: "Press Start 2P", cursive;
	font-size: clamp(0.45rem, 1.4vw, 0.58rem);
	line-height: 1.6;
	letter-spacing: 0.08em;
	color: var(--primary-light);
	white-space: nowrap;
	animation: tm-marquee-scroll 14s linear infinite;
}

@keyframes tm-marquee-scroll {
	0% { transform: translateX(0); }
	100% { transform: translateX(-100%); }
}

.tm-pixel-playground__screen {
	position: relative;
	min-height: clamp(280px, 42vw, 360px);
	border-radius: 8px;
	overflow: hidden;
	background:
		radial-gradient(circle at 50% 120%, color-mix(in srgb, var(--primary-color) 25%, transparent) 0%, transparent 55%),
		linear-gradient(180deg, #0d0a18 0%, #06050c 100%);
	border: 3px solid color-mix(in srgb, var(--text-primary) 70%, transparent);
	box-shadow: inset 0 0 60px color-mix(in srgb, var(--primary-color) 18%, transparent);
	transform-style: preserve-3d;
	transition: transform 0.35s ease;
	touch-action: none;
}

.tm-pixel-playground__scanlines {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: repeating-linear-gradient(
		0deg,
		transparent 0,
		transparent 2px,
		color-mix(in srgb, var(--text-light) 3%, transparent) 2px,
		color-mix(in srgb, var(--text-light) 3%, transparent) 4px
	);
	opacity: 0.35;
	z-index: 4;
}

.tm-pixel-playground__grid {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background-image:
		linear-gradient(color-mix(in srgb, var(--primary-color) 12%, transparent) 1px, transparent 1px),
		linear-gradient(90deg, color-mix(in srgb, var(--primary-color) 12%, transparent) 1px, transparent 1px);
	background-size: 16px 16px;
	opacity: 0.45;
	z-index: 1;
}

.tm-pixel-playground__stars {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
}

.tm-pixel-playground__star {
	position: absolute;
	width: 4px;
	height: 4px;
	background: var(--text-light);
	box-shadow: 0 0 6px color-mix(in srgb, var(--primary-light) 80%, transparent);
	animation: tm-star-twinkle 2.4s ease-in-out infinite;
}

.tm-pixel-playground__star--1 { top: 8%; left: 10%; animation-delay: 0s; }
.tm-pixel-playground__star--2 { top: 14%; left: 28%; animation-delay: 0.3s; }
.tm-pixel-playground__star--3 { top: 6%; left: 52%; animation-delay: 0.6s; }
.tm-pixel-playground__star--4 { top: 18%; left: 72%; animation-delay: 0.9s; }
.tm-pixel-playground__star--5 { top: 10%; left: 88%; animation-delay: 1.2s; }
.tm-pixel-playground__star--6 { top: 32%; left: 6%; animation-delay: 0.2s; }
.tm-pixel-playground__star--7 { top: 38%; left: 92%; animation-delay: 0.5s; }
.tm-pixel-playground__star--8 { top: 52%; left: 14%; animation-delay: 0.8s; }
.tm-pixel-playground__star--9 { top: 48%; left: 84%; animation-delay: 1.1s; }
.tm-pixel-playground__star--10 { top: 72%; left: 8%; animation-delay: 0.4s; }
.tm-pixel-playground__star--11 { top: 78%; left: 32%; animation-delay: 0.7s; }
.tm-pixel-playground__star--12 { top: 68%; left: 58%; animation-delay: 1s; }
.tm-pixel-playground__star--13 { top: 82%; left: 76%; animation-delay: 1.3s; }
.tm-pixel-playground__star--14 { top: 74%; left: 90%; animation-delay: 0.15s; }
.tm-pixel-playground__star--15 { top: 24%; left: 44%; animation-delay: 0.45s; width: 3px; height: 3px; }
.tm-pixel-playground__star--16 { top: 58%; left: 48%; animation-delay: 0.75s; width: 3px; height: 3px; }
.tm-pixel-playground__star--17 { top: 42%; left: 62%; animation-delay: 1.05s; width: 5px; height: 5px; }
.tm-pixel-playground__star--18 { top: 88%; left: 52%; animation-delay: 1.35s; width: 3px; height: 3px; }

@keyframes tm-star-twinkle {
	0%, 100% { opacity: 0.25; transform: scale(1); }
	50% { opacity: 1; transform: scale(1.35); }
}

.tm-pixel-playground__hero {
	position: absolute;
	left: 50%;
	top: 42%;
	transform: translate(-50%, -50%);
	z-index: 3;
	pointer-events: none;
	text-align: center;
	transition: transform 0.4s ease, filter 0.4s ease;
}

.tm-pixel-playground.is-active .tm-pixel-playground__hero {
	transform: translate(-50%, -52%) scale(1.04);
	filter: drop-shadow(0 0 16px color-mix(in srgb, var(--primary-light) 55%, transparent));
}

.tm-pixel-playground__hero-sprite {
	position: relative;
	width: 56px;
	height: 56px;
	margin: 0 auto 0.5rem;
}

.tm-pixel-playground__hero-sprite .px {
	position: absolute;
	width: 8px;
	height: 8px;
	background: var(--primary-light);
	box-shadow: 0 0 8px color-mix(in srgb, var(--primary-light) 60%, transparent);
}

.tm-pixel-playground__hero-sprite .px-h1 { top: 4px; left: 16px; }
.tm-pixel-playground__hero-sprite .px-h2 { top: 4px; left: 24px; background: var(--text-light); }
.tm-pixel-playground__hero-sprite .px-h3 { top: 4px; left: 32px; }
.tm-pixel-playground__hero-sprite .px-b1 { top: 16px; left: 12px; background: var(--primary-color); }
.tm-pixel-playground__hero-sprite .px-b2 { top: 16px; left: 20px; background: var(--text-light); width: 16px; }
.tm-pixel-playground__hero-sprite .px-b3 { top: 16px; left: 36px; background: var(--primary-color); }
.tm-pixel-playground__hero-sprite .px-e1 { top: 28px; left: 16px; background: color-mix(in srgb, var(--secondary-light) 80%, var(--primary-light)); }
.tm-pixel-playground__hero-sprite .px-e2 { top: 28px; left: 32px; background: color-mix(in srgb, var(--secondary-light) 80%, var(--primary-light)); }

.tm-pixel-playground__hero-tag {
	margin: 0;
	font-family: "Press Start 2P", cursive;
	font-size: 0.48rem;
	line-height: 1.6;
	letter-spacing: 0.06em;
	color: color-mix(in srgb, var(--text-light) 75%, transparent);
}

/* Draggable loot */
.tm-loot {
	position: absolute;
	z-index: 6;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.35rem;
	padding: 0;
	border: none;
	background: transparent;
	cursor: grab;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	transition: filter 0.25s ease, transform 0.2s ease;
}

.tm-loot:focus-visible {
	outline: 2px solid var(--primary-light);
	outline-offset: 4px;
	border-radius: 4px;
}

.tm-loot:hover {
	filter: drop-shadow(0 0 12px color-mix(in srgb, var(--primary-light) 70%, transparent));
	transform: translateY(-4px) scale(1.06);
}

.tm-loot.is-dragging {
	cursor: grabbing;
	z-index: 20;
	transform: scale(1.12);
	filter: drop-shadow(0 0 20px color-mix(in srgb, var(--primary-light) 90%, transparent));
}

.tm-loot.is-dropped {
	animation: tm-loot-drop 0.42s ease;
}

@keyframes tm-loot-drop {
	0% { transform: scale(1.15); }
	55% { transform: scale(0.92); }
	100% { transform: scale(1); }
}

.tm-loot__sprite {
	display: block;
	width: 44px;
	height: 44px;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
	border: 3px solid color-mix(in srgb, var(--text-light) 25%, transparent);
	box-shadow:
		4px 4px 0 color-mix(in srgb, var(--text-primary) 55%, transparent),
		inset 0 0 0 2px color-mix(in srgb, var(--text-light) 12%, transparent);
}

.tm-loot__sprite--svg {
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(165deg, var(--primary-color), var(--primary-dark));
	color: var(--text-light);
}

.tm-loot__sprite--svg svg {
	width: 22px;
	height: 22px;
}

.tm-loot--coin .tm-loot__sprite {
	background:
		linear-gradient(135deg, #ffd54a 0%, #ffb300 45%, #ff8f00 100%);
	border-color: #ffe082;
}

.tm-loot--heart .tm-loot__sprite {
	background:
		radial-gradient(circle at 35% 35%, #ff8a80 0%, #e53935 55%, #b71c1c 100%);
	border-color: #ffab91;
	clip-path: polygon(50% 18%, 62% 8%, 78% 8%, 88% 22%, 88% 38%, 50% 72%, 12% 38%, 12% 22%, 22% 8%, 38% 8%);
}

.tm-loot--gem .tm-loot__sprite {
	background: linear-gradient(160deg, #b388ff 0%, #7c4dff 50%, #651fff 100%);
	border-color: #d1c4e9;
	clip-path: polygon(50% 0%, 92% 38%, 72% 100%, 28% 100%, 8% 38%);
}

.tm-loot--potion .tm-loot__sprite {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end;
	background:
		linear-gradient(180deg, #69f0ae 0%, #00e676 40%, #1b5e20 100%);
	border-color: #b9f6ca;
	border-radius: 4px 4px 8px 8px;
}

.tm-loot--potion .tm-loot__sprite::before {
	content: "";
	display: block;
	width: 14px;
	height: 7px;
	margin-bottom: auto;
	margin-top: 4px;
	background: #8d6e63;
	border: 2px solid #5d4037;
}

.tm-loot__tag {
	font-family: "Press Start 2P", cursive;
	font-size: 0.42rem;
	line-height: 1.4;
	color: color-mix(in srgb, var(--text-light) 88%, transparent);
	text-shadow: 0 2px 0 color-mix(in srgb, var(--text-primary) 60%, transparent);
}

.tm-pixel-playground__hint {
	margin: 0.85rem 0 0;
	text-align: center;
	font-size: 0.82rem;
	font-weight: 600;
	color: color-mix(in srgb, var(--text-light) 62%, transparent);
	line-height: 1.5;
}

/* Form card */
.tm-contact__form-wrap {
	position: relative;
}

.tm-inquiry-form {
	position: relative;
	padding: clamp(1.35rem, 3.5vw, 2rem);
	border-radius: 16px;
	background: linear-gradient(
		165deg,
		color-mix(in srgb, var(--bg-card) 96%, transparent) 0%,
		color-mix(in srgb, var(--bg-dark) 98%, transparent) 100%
	);
	border: 1px solid color-mix(in srgb, var(--primary-color) 40%, transparent);
	box-shadow:
		0 24px 60px color-mix(in srgb, var(--text-primary) 35%, transparent),
		inset 0 1px 0 color-mix(in srgb, var(--text-light) 6%, transparent);
}

.tm-inquiry-form::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	padding: 1px;
	background: linear-gradient(
		135deg,
		color-mix(in srgb, var(--primary-light) 45%, transparent),
		transparent 40%,
		color-mix(in srgb, var(--primary-color) 35%, transparent)
	);
	mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	mask-composite: exclude;
	pointer-events: none;
}

.tm-inquiry-form__head {
	margin-bottom: var(--spacing-lg);
	padding-bottom: var(--spacing-md);
	border-bottom: 1px solid color-mix(in srgb, var(--primary-color) 25%, transparent);
}

.tm-inquiry-form__title {
	margin: 0 0 0.35rem;
	font-size: clamp(1.2rem, 2.5vw, 1.45rem);
	font-weight: 800;
	color: var(--text-light);
}

.tm-inquiry-form__hint {
	margin: 0;
	font-size: 0.85rem;
	color: color-mix(in srgb, var(--text-light) 60%, transparent);
}

.tm-inquiry-form__required {
	color: var(--primary-light);
	margin-left: 0.15em;
}

.tm-inquiry-form__alert {
	margin-bottom: var(--spacing-md);
	padding: 0.85rem 1rem;
	border-radius: var(--radius-sm);
	font-size: 0.92rem;
	font-weight: 600;
	line-height: 1.45;
}

.tm-inquiry-form__alert.is-success {
	background: color-mix(in srgb, #22c55e 18%, var(--bg-dark));
	border: 1px solid color-mix(in srgb, #22c55e 45%, transparent);
	color: #bbf7d0;
}

.tm-inquiry-form__alert.is-error {
	background: color-mix(in srgb, #ef4444 16%, var(--bg-dark));
	border: 1px solid color-mix(in srgb, #ef4444 42%, transparent);
	color: #fecaca;
}

.tm-inquiry-form__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--spacing-md);
}

.tm-inquiry-form__field--full {
	grid-column: 1 / -1;
}

.tm-inquiry-form__label {
	display: block;
	margin-bottom: 0.45rem;
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: color-mix(in srgb, var(--secondary-light) 90%, var(--text-light));
}

.tm-inquiry-form__control {
	position: relative;
	display: flex;
	align-items: stretch;
}

.tm-inquiry-form__control--textarea {
	align-items: flex-start;
}

.tm-inquiry-form__icon {
	position: absolute;
	left: 0.85rem;
	top: 50%;
	transform: translateY(-50%);
	width: 18px;
	height: 18px;
	color: color-mix(in srgb, var(--primary-light) 75%, transparent);
	pointer-events: none;
	z-index: 1;
}

.tm-inquiry-form__icon--textarea {
	top: 1rem;
	transform: none;
}

.tm-inquiry-form__icon svg {
	width: 100%;
	height: 100%;
	display: block;
}

.tm-inquiry-form__input,
.tm-inquiry-form__textarea {
	width: 100%;
	padding: 0.9rem 1rem 0.9rem 2.65rem;
	background: color-mix(in srgb, var(--bg-dark) 88%, transparent);
	border: 1.5px solid color-mix(in srgb, var(--text-light) 12%, transparent);
	border-radius: 10px;
	color: var(--text-light);
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.45;
	transition:
		border-color var(--transition-fast),
		box-shadow var(--transition-fast),
		background var(--transition-fast);
}

.tm-inquiry-form__textarea {
	min-height: 148px;
	resize: vertical;
	padding-top: 0.95rem;
}

.tm-inquiry-form__input::placeholder,
.tm-inquiry-form__textarea::placeholder {
	color: color-mix(in srgb, var(--text-light) 38%, transparent);
}

.tm-inquiry-form__input:hover,
.tm-inquiry-form__textarea:hover {
	border-color: color-mix(in srgb, var(--primary-color) 45%, transparent);
}

.tm-inquiry-form__input:focus,
.tm-inquiry-form__textarea:focus {
	outline: none;
	border-color: var(--primary-light);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 28%, transparent);
	background: color-mix(in srgb, var(--bg-dark) 95%, transparent);
}

.tm-inquiry-form__field.is-invalid .tm-inquiry-form__input,
.tm-inquiry-form__field.is-invalid .tm-inquiry-form__textarea {
	border-color: #f87171;
	box-shadow: 0 0 0 3px color-mix(in srgb, #ef4444 22%, transparent);
}

.tm-inquiry-form__error {
	margin: 0.4rem 0 0;
	font-size: 0.82rem;
	font-weight: 600;
	color: #fca5a5;
	line-height: 1.35;
}

.tm-inquiry-form__submit {
	width: 100%;
	margin-top: var(--spacing-lg);
}

.tm-inquiry-form__submit .tm-pixel-btn__inner {
	width: 100%;
	justify-content: center;
}

.tm-inquiry-form__submit:disabled {
	opacity: 0.72;
	cursor: not-allowed;
}

.service-detail-page .tm-contact,
.category-archive-page .tm-contact {
	border-top: 4px solid var(--primary-color);
	box-shadow: inset 0 48px 80px color-mix(in srgb, var(--primary-color) 6%, transparent);
}

@media (max-width: 1024px) {
	.tm-contact .section-title::before,
	.tm-contact .section-title::after {
		display: none;
	}
}

@media (max-width: 900px) {
	.tm-contact__layout {
		grid-template-columns: 1fr;
	}

	.tm-contact__info {
		order: 2;
	}

	.tm-contact__form-wrap {
		order: 1;
	}

	.tm-pixel-playground {
		min-height: 340px;
	}
}

@media (max-width: 640px) {
	.tm-inquiry-form__grid {
		grid-template-columns: 1fr;
	}

	.tm-inquiry-form__field--full {
		grid-column: auto;
	}

	.tm-pixel-playground {
		min-height: 300px;
	}

	.tm-loot__sprite {
		width: 52px;
		height: 52px;
	}

	.tm-loot__tag {
		font-size: 0.48rem;
	}

	.tm-pixel-playground__screen {
		min-height: 260px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tm-pixel-playground__marquee-text,
	.tm-pixel-playground__star,
	.tm-loot.is-dropped {
		animation: none !important;
	}

	.tm-pixel-playground__screen {
		transform: none !important;
	}

	.tm-loot:hover {
		transform: none;
	}
}
