:root {
	--bg-color: #ffffff;
	--text-color: #333333;
	--primary-color: #fdd647; /* Color taken from the old site style */
	--secondary-color: #ef6e4d;
	--nav-bg: #ffffff;
	--card-bg: #f9f9f9;
	--border-color: #e0e0e0;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg-color: #121212;
		--text-color: #e0e0e0;
		--primary-color: #fdd647;
		--secondary-color: #1e1e1e;
		--nav-bg: #1e1e1e;
		--card-bg: #2d2d2d;
		--border-color: #444444;
	}
}

body {
	font-family:
		"Source Sans 3", "Source Han Sans CN", "Noto Sans SC",
		"Microsoft YaHei", sans-serif;
	background-color: var(--bg-color);
	color: var(--text-color);
	margin: 0;
	padding: 0;
	transition:
		background-color 0.3s,
		color 0.3s;
	line-height: 1.6;
	overflow-x: hidden;
}

header {
	background-color: var(--nav-bg);
	padding: 0 5%;
	min-height: 80px; /* Use min-height to allow growth on mobile or wrap */
	display: flex;
	justify-content: space-between;
	align-items: center;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
	position: sticky;
	top: 0;
	z-index: 10000;
}

.logo {
	font-size: 1.5rem;
	font-weight: bold;
	color: var(--primary-color);
	display: flex;
	align-items: center;
	height: 100%;
}

nav ul {
	list-style: none;
	display: flex;
	gap: 0; /* Remove gap */
	height: 100%;
	margin: 0;
	padding: 0;
}

nav li {
	height: 100%;
	display: flex;
	align-items: center;
}

nav a {
	text-decoration: none;
	color: var(--text-color);
	font-weight: 500;
	transition: color 0.3s;
	height: 100%;
	display: flex;
	align-items: center;
	padding: 0 15px; /* Move spacing to padding */
}

nav a:hover,
nav a.active {
	color: var(--primary-color);
}

.hero {
	text-align: center;
	/* Remove padding that was used for sizing, use height instead for slider */
	height: 80vh;
	min-height: 500px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	background-color: var(--secondary-color);
	overflow: hidden; /* Contain the slider */
	position: relative;
	color: #fff;
}

/* Slider Layer */
.hero-slider-layer {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 0;
	display: flex;
	justify-content: center;
	align-items: center;
	pointer-events: none; /* Let clicks pass through */
}

.slide {
	position: absolute;
	top: 0;
	height: 100%;
	transition: all 0.5s ease-in-out;
}

.slide.current {
	z-index: 10;
	width: 100%;
	left: 0;
	background-size: contain; /* Fit height, show gaps */
	background-position: center;
	background-repeat: no-repeat;
}

/* Background layers for prev/next to fill gaps */
.slide.prev,
.slide.next {
	z-index: 5;
	width: 50%; /* Adjust to half screen roughly */
	background-size: cover;
	background-position: center;
	filter: brightness(0.4) blur(4px);
	height: 80%;
	top: 10%;
	position: absolute;
}

.slide.prev {
	left: 0;
	/* Gradient mask to fade out towards center */
	mask-image: linear-gradient(to right, black 60%, transparent 100%);
	-webkit-mask-image: linear-gradient(to right, black 60%, transparent 100%);
}

.slide.next {
	right: 0;
	/* Gradient mask to fade out towards center */
	mask-image: linear-gradient(to left, black 60%, transparent 100%);
	-webkit-mask-image: linear-gradient(to left, black 60%, transparent 100%);
}

.hero::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(
		0,
		0,
		0,
		0.3
	); /* Lighter overlay since we have dimmed side images */
	z-index: 15; /* Above slides, below content */
}

.hero > .hero-content {
	position: relative;
	z-index: 20;
	padding: 0 20px;
	max-width: 800px;
}

.hero p {
	white-space: pre-line; /* Allow newlines in text */
	line-height: 1.8;
}

/* Hide overlay and content when specified (e.g. for images without annotations) */
.hero.no-overlay::before {
	display: none;
}
.hero.no-overlay > * {
	display: none;
}

.hero h1 {
	font-size: 3.5rem;
	margin-bottom: 20px;
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero p {
	font-size: 1.4rem;
	max-width: 700px;
	margin: 0 auto 40px;
	opacity: 1;
	text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.btn {
	display: inline-block;
	padding: 12px 30px;
	background-color: var(--primary-color);
	color: #fff;
	text-decoration: none;
	border-radius: 9999px; /* Capsule */
	font-weight: bold;
	transition: opacity 0.3s;
}

.btn:hover {
	opacity: 0.9;
}

section {
	padding: 80px 10%;
}

h2 {
	text-align: center;
	margin-bottom: 40px;
	position: relative;
}

h2::after {
	content: "";
	display: block;
	width: 50px;
	height: 3px;
	background-color: var(--primary-color);
	margin: 10px auto 0;
}

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 30px;
	/* Center content if they don't fill the row */
	justify-content: center;
}

.card {
	background-color: transparent;
	border: none;
	border-radius: 0; /* Rectangular */
	overflow: visible;
	transition: z-index 0s;
	position: relative;
	display: flex;
	flex-direction: column;
	z-index: 1;
}

.card:hover {
	z-index: 100; /* Float above everything */
}

.card-img {
	height: var(--card-height, 300px);
	width: var(--card-base-width, 100%);
	background-color: var(--secondary-color);
	position: relative;
	z-index: 1;
	border-radius: 0; /* Rectangular */

	transition:
		width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
		margin 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
		transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
		box-shadow 0.3s ease,
		border-radius 0.3s ease;
}

.card:hover .card-img {
	width: var(--card-hover-width, 100%);
	/* Use JS-calculated margin if available to prevent overflow, else center */
	margin-left: var(
		--card-hover-margin-left,
		calc(
			(var(--card-hover-width, 100%) - var(--card-base-width, 100%)) / -2
		)
	);
	transform: none;
	box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
	border-radius: 0;
}

/* Background Layer: Dimmed fill for gaps */
.card-img::before {
	content: "";
	position: absolute;
	inset: 0;
	background-image: inherit;
	background-repeat: no-repeat;
	background-size: cover;
	background-position: center;
	filter: brightness(0.5) blur(8px);
	z-index: 1;
}

/* Main Image Layer */
.card-img::after {
	content: "";
	position: absolute;
	inset: 0;
	background-image: inherit;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	z-index: 2;
	transition: background-size 0.4s ease-in-out;
}

.card:hover .card-img::after {
	background-size: auto 100%;
}

.card-content {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	padding: 20px;
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.9) 0%,
		rgba(0, 0, 0, 0.5) 70%,
		transparent 100%
	);
	transform: translateY(100%);
	opacity: 0;
	pointer-events: none;
	transition:
		transform 0.3s ease-in-out,
		opacity 0.3s ease-in-out,
		width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
		left 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
		border-radius 0.3s ease;
	color: #fff;
	z-index: 10;
}

.card:hover .card-content {
	transform: translateY(0);
	opacity: 1;
	pointer-events: auto;
	width: var(--card-hover-width, 100%);
	left: calc(
		(var(--card-hover-width, 100%) - var(--card-base-width, 100%)) / -2
	);
	border-radius: 0;
}

.card-content h3 {
	margin-top: 0;
	color: #fff;
}

.card-content p {
	color: #eee;
}

footer {
	background-color: var(--secondary-color);
	text-align: center;
	padding: 40px;
	margin-top: 40px;
	font-size: 0.9rem;
}

.controls {
	display: flex;
	gap: 0;
	align-items: center;
	height: 100%; /* Ensure container takes full height if possible */
}

/* Custom Language Selector */
.lang-dropdown {
	position: relative;
	height: 100%;
	display: flex;
	align-items: center;
}

#lang-btn {
	background: transparent;
	border: none;
	color: var(--text-color);
	font-size: 1rem;
	font-weight: 500;
	cursor: pointer;
	padding: 0 20px;
	height: 100%;
	display: flex;
	align-items: center;
	border-radius: 0; /* Squared edges */
	font-family: inherit;
	transition: color 0.3s; /* Only transition color */
}

#lang-btn:hover {
	color: var(--primary-color);
	background-color: transparent;
}

#lang-btn svg {
	width: 20px;
	height: 20px;
	stroke-width: 1.5;
}

.lang-menu {
	position: absolute;
	top: 100%; /* Position below the button */
	right: 0; /* Right aligned */
	background-color: var(--nav-bg);
	list-style: none;
	padding: 0;
	margin: 0;
	/* No border */
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
	min-width: 150px;
	z-index: 10001;
	display: none; /* Hidden by default */
}

.lang-menu.show {
	display: block;
}

.lang-menu li {
	padding: 12px 20px;
	cursor: pointer;
	white-space: nowrap;
	color: var(--text-color);
	transition: all 0.2s;
	font-size: 0.9rem;
	text-align: left;
}

.lang-menu li:hover {
	background-color: var(--secondary-color);
	color: var(--primary-color);
}

#scroll-indicator {
	position: fixed;
	top: 50%;
	right: 20px;
	transform: translateY(-50%);
	display: flex;
	flex-direction: column;
	gap: 0; /* Remove gap to allow merged backgrounds */
	z-index: 9999;
}

.indicator-item {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	height: 34px; /* Fixed height to control spacing */
	position: relative;
	cursor: pointer;
}

.indicator-dot {
	width: 12px;
	height: 12px;
	background-color: transparent;
	border: 2px solid var(--text-color);
	border-radius: 50%;
	transition: all 0.3s ease;
	box-sizing: border-box;
	margin-left: 15px; /* Spacing between label and dot */
	flex-shrink: 0;
}

.indicator-item:hover .indicator-dot,
.indicator-item.active .indicator-dot {
	background-color: var(--primary-color);
	border-color: var(--primary-color);
}
.indicator-item.active .indicator-dot {
	transform: scale(1.3);
}

.indicator-label {
	background-color: var(--card-bg);
	color: var(--text-color);
	padding: 0 12px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 5em;
	font-size: 0.8rem;
	white-space: nowrap;
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
}
/* Visibility Rules */
/* Only show active label when scrolling (triggered by JS class) */
#scroll-indicator.show-labels .indicator-item.active .indicator-label,
/* Always show on hover */
.indicator-item:hover .indicator-label {
	opacity: 1;
}

/* Border Radius Logic for Merged Background */
.radius-both {
	border-radius: 17px; /* Matches height/2 (34px/2) */
	margin-right: 0;
}
.radius-top {
	border-radius: 17px 17px 0 0;
}
.radius-bottom {
	border-radius: 0 0 17px 17px;
}
.radius-none {
	border-radius: 0;
}

/* Contact Copy Button Styles */
.copy-group-container {
	display: inline-flex;
	justify-content: center;
	align-items: center;
}

.email-copy-btn {
	background-color: var(--card-bg);
	border: 1px solid var(--border-color);
	border-radius: 50px;
	padding: 4px;
	font-family: inherit;
	color: var(--text-color);
	cursor: pointer;
	display: flex;
	align-items: center;
	transition: all 0.2s ease;
	font-size: 1rem;
}

.email-copy-btn:hover {
	border-color: var(--primary-color);
	background-color: var(--bg-color);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.qq-copy-btn {
	background-color: rgba(253, 213, 72, 0.1);
	color: var(--primary-color);
	padding: 8px 20px;
	border-radius: 40px;
	font-weight: 600;
	transition: background-color 0.2s;
}

.qq-copy-btn:hover {
	background-color: var(--primary-color);
	color: #fff;
}

.email-suffix {
	padding: 0 20px 0 10px;
	color: var(--text-color);
}

@media (max-width: 768px) {
	header {
		height: auto;
		flex-direction: column;
		padding: 15px 5%;
		gap: 15px;
		align-items: center;
		text-align: center;
	}

	.logo {
		height: auto;
		font-size: 1.1rem;
		flex-direction: column;
		gap: 10px;
	}

	.logo img {
		margin-right: 0 !important;
	}

	.controls {
		flex-direction: column;
		width: 100%;
		gap: 15px;
		height: auto;
	}

	nav {
		width: 100%;
		height: auto;
	}

	nav ul {
		flex-wrap: wrap;
		justify-content: center;
		width: 100%;
		height: auto;
		gap: 5px;
	}

	nav li {
		height: auto;
	}

	nav a {
		padding: 8px 12px;
		font-size: 0.95rem;
		height: auto;
		display: inline-flex;
	}

	.lang-dropdown {
		width: 100%;
		justify-content: center;
		height: auto;
	}

	#lang-btn {
		padding: 10px;
		height: auto;
		width: auto;
		min-width: 120px;
		justify-content: center;
		border: 1px solid var(--border-color);
		border-radius: 4px;
	}

	.lang-menu {
		width: 200px;
		left: 50%;
		transform: translateX(-50%);
		right: auto;
		text-align: center;
		box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
	}

	.lang-menu li {
		text-align: center;
		padding: 15px;
	}

	.hero {
		height: 60vh;
		min-height: 400px;
	}

	.slide.prev,
	.slide.next {
		display: none;
	}

	.slide.current {
		background-size: cover;
	}

	.hero h1 {
		font-size: 2rem;
	}

	.hero p {
		font-size: 1rem;
		padding: 0 10px;
	}

	section {
		padding: 40px 5%;
	}

	.grid {
		gap: 15px;
	}

	.card-img {
		--card-height: 250px;
	}

	.copy-group-container {
		width: 100%;
		max-width: 320px;
		margin: 0 auto;
	}

	.email-copy-btn {
		width: 100%;
		justify-content: center;
		flex-direction: column;
		border-radius: 20px;
		padding: 10px;
	}

	.qq-copy-btn {
		width: 100%;
		box-sizing: border-box;
		margin-bottom: 5px;
		text-align: center;
	}

	.email-suffix {
		padding: 10px 0;
		width: 100%;
		text-align: center;
	}

	#scroll-indicator {
		display: none !important;
	}
}
