/* ==========================================================================
   WP Contact Us — Front-end styles
   Pure CSS, no preprocessor. Modern-browser compatible.
   All selectors are namespaced with `.wpku-` to avoid collisions with theme
   styles and to prevent this plugin from overriding theme rules.
   ========================================================================== */

/* ---------- Contact section container (reading-friendly) ---------- */
.wpku-contact {
	/* Follow the article column width — never overflow / break the reading
	   column. max-width: 100% keeps it inside the content wrapper. */
	margin: 2em 0;
	padding: 1.6em 1.2em 1.4em;
	max-width: 100%;
	box-sizing: border-box;
	background: #fafafa;
	border: 1px solid #ececed;
	/* Thin top divider for clear visual separation without breaking flow. */
	border-top: 2px solid #d8d8dc;
	border-radius: 0 0 12px 12px;
	text-align: center;
	color: #1d1d1f;
}

.wpku-contact__title {
	/* Close to the 16px reading baseline, slightly emphasised, not stealing show. */
	margin: 0 0 0.9em;
	font-size: 1.15rem;
	font-weight: 600;
	line-height: 1.4;
	color: #1d1d1f;
}

.wpku-contact__buttons {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75rem;
}

/* ---------- Buttons (touch-friendly, reading-sized) ---------- */
.wpku-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	/* >= 44px minimum touch target on all devices. */
	min-height: 44px;
	padding: 0.55rem 1.15rem;
	box-sizing: border-box;
	border: none;
	border-radius: 999px;
	color: #fff;
	/* ~16px reading baseline so buttons don't overpower the body text. */
	font-size: 1rem;
	font-weight: 500;
	line-height: 1.2;
	cursor: pointer;
	text-decoration: none;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	/* Entrance animation. The button is visible by default (opacity: 1); the
	   keyframe provides the fade-in-up effect below. This guarantees the button
	   is never left permanently invisible if animations are disabled. */
	opacity: 1;
	transform: translateY(0);
	animation: wpku-fade-in-up 0.5s ease both;
}

.wpku-btn:hover,
.wpku-btn:focus {
	transform: translateY(-3px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
	text-decoration: none;
	color: #fff;
}

.wpku-btn:focus-visible {
	outline: 3px solid rgba(0, 122, 255, 0.5);
	outline-offset: 2px;
}

/* Accessibility fallback: if the user (or the OS / a browser extension) has
   disabled animations, the entrance animation must not leave buttons invisible. */
@media (prefers-reduced-motion: reduce) {
	.wpku-btn {
		opacity: 1;
		transform: none;
		animation: none;
	}
}

.wpku-btn__icon {
	font-size: 1.15rem;
	line-height: 1;
}

/* Color scheme per channel */
.wpku-btn--imessage { background: #34c759; }
.wpku-btn--wechat   { background: #07c160; }
.wpku-btn--official { background: #06ad56; }
.wpku-btn--email    { background: #007aff; }

/* Entrance stagger */
.wpku-contact__buttons .wpku-btn:nth-child(1) { animation-delay: 0.05s; }
.wpku-contact__buttons .wpku-btn:nth-child(2) { animation-delay: 0.12s; }
.wpku-contact__buttons .wpku-btn:nth-child(3) { animation-delay: 0.19s; }
.wpku-contact__buttons .wpku-btn:nth-child(4) { animation-delay: 0.26s; }

@keyframes wpku-fade-in-up {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ---------- Modal ---------- */
.wpku-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.wpku-modal[hidden] {
	display: none;
}

.wpku-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.wpku-modal.is-open .wpku-modal__overlay {
	opacity: 1;
}

.wpku-modal__dialog {
	position: relative;
	background: #fff;
	border-radius: 16px;
	padding: 1.5rem;
	max-width: 90vw;
	max-height: 90vh;
	text-align: center;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	transform: scale(0.92);
	opacity: 0;
	transition: transform 0.25s ease, opacity 0.25s ease;
}

.wpku-modal.is-open .wpku-modal__dialog {
	transform: scale(1);
	opacity: 1;
}

.wpku-modal__close {
	position: absolute;
	top: 0.5rem;
	right: 0.75rem;
	background: transparent;
	border: none;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	color: #888;
	padding: 0.25rem;
	transition: color 0.2s ease;
}

.wpku-modal__close:hover,
.wpku-modal__close:focus {
	color: #333;
	outline: none;
}

.wpku-modal__img {
	max-width: 280px;
	width: 100%;
	height: auto;
	border-radius: 8px;
	display: block;
	margin: 0 auto;
}

.wpku-modal__caption {
	margin: 0.75rem 0 0;
	font-weight: 600;
	color: #1d1d1f;
}

/* ---------- Responsive (mobile / touch) ---------- */
@media (max-width: 640px) {
	.wpku-contact {
		padding: 1.3em 0.9em 1.1em;
		border-radius: 0 0 10px 10px;
	}
	.wpku-contact__buttons {
		gap: 0.6rem;
	}
	.wpku-btn {
		/* Keep >= 44px touch target, natural wrapping, never overflow viewport. */
		font-size: 1rem;
		padding: 0.6rem 1rem;
		min-height: 44px;
		max-width: 100%;
	}
	.wpku-modal__img {
		max-width: 220px;
	}
}

/* ---------- Dark mode ---------- */
@media (prefers-color-scheme: dark) {
	.wpku-contact {
		background: #1c1c1e;
		border-color: #2c2c2e;
		border-top-color: #3a3a3c;
		color: #f5f5f7;
	}
	.wpku-contact__title {
		color: #f5f5f7;
	}
	.wpku-btn:hover,
	.wpku-btn:focus {
		color: #fff;
	}
	.wpku-modal__dialog {
		background: #1c1c1e;
		box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
	}
	.wpku-modal__caption {
		color: #f5f5f7;
	}
	.wpku-modal__close {
		color: #aaa;
	}
	.wpku-modal__close:hover,
	.wpku-modal__close:focus {
		color: #fff;
	}
}
