/* =========================================================
   2-2 页：Top 5 Countries — Life Expectancy Rankings
   header / intro 复用 page21.css 中的 .page-21-header / .page-21-intro
   ========================================================= */

.page-22 {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	align-items: flex-start;
	/* 底部留空给后续页脚信息 */
	padding: clamp(1.4rem, 3vw, 2.4rem) clamp(1.4rem, 3vw, 2.4rem) clamp(3.6rem, 7vh, 5.4rem);
	gap: 1rem;
}

/* 柱状图卡片容器：占据剩余高度，内部纵向排列图区 + 控制条 */
.page-22-chart {
	flex: 1;
	width: 100%;
	min-height: 0;
	display: flex;
	flex-direction: column;
	gap: 0.9rem;
	margin-top: 0.4rem;
	padding: clamp(1rem, 2vw, 1.4rem);
	border-radius: 1.4rem;
	background:
		linear-gradient(160deg, rgba(255, 255, 255, 0.82), rgba(230, 240, 245, 0.64)),
		radial-gradient(circle at top left, rgba(44, 109, 142, 0.12), transparent 48%);
	border: 1px solid rgba(23, 72, 106, 0.12);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68), 0 24px 56px rgba(31, 31, 31, 0.08);
}

/* 柱状图占位区：弹性占满卡片剩余高度 */
.page-22-bars {
	flex: 1;
	min-height: 0;
	border-radius: 1rem;
	border: 1.5px dashed rgba(23, 72, 106, 0.28);
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(215, 229, 236, 0.28)),
		repeating-linear-gradient(
			180deg,
			rgba(23, 72, 106, 0.05) 0,
			rgba(23, 72, 106, 0.05) 1px,
			transparent 1px,
			transparent 32px
		);
	display: grid;
	place-items: center;
	padding: 1.5rem;
}

.page-22-bars p {
	margin: 0;
	text-align: center;
	font-size: clamp(1rem, 1.6vw, 1.15rem);
	line-height: 1.7;
	opacity: 0.78;
}

/* 时间轴控制条：播放键 + 滑块 + 年份标签 */
.page-22-controls {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 0.9rem;
	padding: 0.62rem 0.9rem;
	border-radius: 0.9rem;
	background: rgba(255, 255, 255, 0.6);
	border: 1px solid rgba(23, 72, 106, 0.1);
	box-shadow: 0 4px 14px rgba(23, 72, 106, 0.07);
	backdrop-filter: blur(6px);
}

/* 播放按钮 */
.page-22-play-btn {
	flex-shrink: 0;
	width: 2.2rem;
	height: 2.2rem;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, #17486a, #2c6d8e);
	color: #f7f4ea;
	font-size: 0.82rem;
	cursor: pointer;
	display: grid;
	place-items: center;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	box-shadow: 0 6px 16px rgba(23, 72, 106, 0.28);
}

.page-22-play-btn:hover,
.page-22-play-btn:focus-visible {
	transform: scale(1.1);
	box-shadow: 0 10px 22px rgba(23, 72, 106, 0.34);
	outline: none;
}

/* 时间轴滑块 */
.page-22-timeline {
	flex: 1;
	-webkit-appearance: none;
	appearance: none;
	height: 4px;
	border-radius: 2px;
	background: linear-gradient(
		to right,
		#2c6d8e 0%,
		#2c6d8e calc((var(--pct, 0) * 1%)),
		rgba(23, 72, 106, 0.2) calc((var(--pct, 0) * 1%))
	);
	cursor: pointer;
	outline: none;
}

.page-22-timeline::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 1.05rem;
	height: 1.05rem;
	border-radius: 50%;
	background: #17486a;
	box-shadow: 0 2px 8px rgba(23, 72, 106, 0.38);
	transition: transform 0.18s ease;
	cursor: grab;
}

.page-22-timeline::-webkit-slider-thumb:hover {
	transform: scale(1.22);
}

.page-22-timeline::-moz-range-thumb {
	width: 1.05rem;
	height: 1.05rem;
	border: 0;
	border-radius: 50%;
	background: #17486a;
	box-shadow: 0 2px 8px rgba(23, 72, 106, 0.38);
	transition: transform 0.18s ease;
	cursor: grab;
}

.page-22-timeline::-moz-range-progress {
	background: #2c6d8e;
	border-radius: 2px;
}

/* 年份标签 */
.page-22-year-label {
	flex-shrink: 0;
	min-width: 2.8rem;
	text-align: right;
	font-size: 0.9rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	color: #17486a;
}

/* 用 JS 驱动滑块填充进度（可动态写入 CSS 变量） */
#rankingTimeline {
	--pct: 0;
}

@media (max-width: 768px) {
	.page-22 {
		padding-bottom: clamp(4.2rem, 10vh, 6rem);
	}
}
