/* =========================================================
   设计走廊 v2 · 可拖拽全作品墙（仿 apollostudio.design/work）
   多行卡片横向错位 / 拖拽平移 + 惯性 / 边缘压暗聚焦中心
   ========================================================= */

html.corridor-html,
body.corridor-page {
	height: 100%;
	overflow: hidden;
	background: #0b0b0c;
}

.corridor-page #spiral {
	display: none; /* 本页无纵向滚动 */
}

/* ---- 画布 ---- */
/* 背景不再是死黑：中心一抹极淡的冷灰提亮中景，四周沉下去，营造纵深 */
.cw {
	position: fixed;
	inset: 0;
	overflow: hidden;
	cursor: grab;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	background:
		radial-gradient(90% 70% at 50% 42%, #161618 0%, #101012 46%, #0b0b0c 78%);
}

.cw.is-dragging {
	cursor: grabbing;
}

.cw-inner {
	position: absolute;
	/* 内容改为等高后变矮，垂直居中即可自然避开导航与控制条，不再额外下移 */
	top: 50%;
	left: 50%;
	/* 居中位移交给 CSS（JS 只驱动每行横向相位，不再整体平移） */
	transform: translate(-50%, -50%);
	will-change: transform;
}

/* 桌面端：五行收敛到一屏后，整体中心下移半个导航高，
   让第一行顶缘落在导航底缘（红线）附近，而不是钻到导航底下 */
@media (min-width: 768px) {
	.cw-inner {
		top: calc(50% + 38px);
	}
}

/* ---- 行：横向循环滚动（内容是两份以上，位移 -50% 无缝） ----
   关键：width:max-content + margin auto —— 每行在 inner 内各自居中。
   inner 的宽度由最宽的行决定，若行只左对齐，窄行会被甩出屏幕（v5 分行后各行
   宽度差 3 倍，此问题必现）。随机起点改用负 animation-delay（见行内样式）。 */
.cw-row {
	display: flex;
	align-items: center;
	width: max-content;
	margin-left: auto;
	margin-right: auto;
	gap: 0;
	margin-bottom: clamp(12px, 1.5vh, 24px);
	white-space: nowrap;
	animation: cw-scroll var(--sd, 90s) linear infinite;
	will-change: transform;
}

.cw-row.is-rev {
	animation-direction: reverse;
}

@keyframes cw-scroll {
	from { transform: translateX(0); }
	to { transform: translateX(calc(var(--dist, 5600px) * -1)); }
}

/* 鼠标经过不停滚动：保留行 Cayat-hover-el lift，但不打断自动播放 */

/* 每行一个统一高度（vh 标度 + px 兜底），合计约 85.5vh —— 五行一屏放全：
   垂直居中后顶部留白 ≈ 7vh（1080 屏约 78px，正好在导航底缘），
   底部行（SPA 系列等）不再被裁；纵向不再有多余行程，横向拖拽浏览不变 */
.cw-row--1 { --rh: clamp(110px, 13.5vh, 220px); }
.cw-row--2 { --rh: clamp(130px, 16vh, 260px); }
.cw-row--3 { --rh: clamp(130px, 16vh, 260px); }
.cw-row--4 { --rh: clamp(190px, 24vh, 380px); }
.cw-row--5 { --rh: clamp(130px, 16vh, 260px); }

/* ---- 卡片：尺寸随图片真实比例，高度/角度/垂直位置随机 ----
   质感三件套：hairline 描边 + 双层投影（近处贴影 + 远处氛围影）+ 默认微暗（悬停点亮） */
/* 卡片：高度由所在行的 --rh 统一决定（调用行的 competency:见下方行高表），
   宽度 = --ar（图片真实比例）× --rh —— 同一行顶线、底线严格齐平，宽度随内容自然变化 */
.cw-card {
	position: relative;
	flex: 0 0 auto;
	margin-right: var(--gap, 26px); /* 每张卡自带间距，保证两份内容无缝循环 */
	width: calc(var(--ar, 1) * var(--rh, 124px));
	height: var(--rh, 124px);
	border-radius: 10px;
	/* 传送带拖拽：禁止原生拖拽 <a>/<img>，否则浏览器拖影会劫持指针事件 */
	-webkit-user-drag: none;
	user-drag: none;
	overflow: hidden;
	background: #131315;
	outline: 1px solid rgba(255, 255, 255, .07);
	outline-offset: -1px;
	box-shadow:
		0 2px 6px rgba(0, 0, 0, .40),
		0 14px 34px rgba(0, 0, 0, .34);
	display: block;
	transform: rotate(var(--rot, 0deg));
	transition: transform .5s cubic-bezier(.22, .61, .36, 1), box-shadow .5s ease, outline-color .5s ease;
}

.cw-card img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: var(--obj, center center);
	display: block;
	pointer-events: none;
	filter: brightness(.94) saturate(.97);
	transition: filter .5s ease;
}

/* 消失点骨架态（is-empty 由 corridor.js 按距离挂载）：
   远景卡片只留一块有质感的暗面板 + 一丝斜向微光，被渐隐罩盖住后
   呈现「向暗处退散」的纵深，而不是一排空框 */
.cw-card.is-empty {
	background: linear-gradient(150deg, #17171a 0%, #101013 58%, #141417 100%);
}

.cw-card.is-empty::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(118deg, transparent 32%, rgba(255, 255, 255, .03) 50%, transparent 68%);
}

/* 悬停：点亮 + 轻抬 + 投影上浮（仅精确指针设备），保留随机角度 */
@media (hover: hover) and (pointer: fine) {
	.cw-card:hover {
		transform: translateY(-6px) scale(1.025) rotate(var(--rot, 0deg));
		box-shadow:
			0 4px 10px rgba(0, 0, 0, .42),
			0 26px 60px rgba(0, 0, 0, .58);
		outline-color: rgba(255, 255, 255, .16);
		z-index: 2;
	}

	.cw-card:hover img {
		filter: brightness(1.02) saturate(1.03);
	}
}

/* 捕获说明条：悬停浮现 */
.cw-cap {
	position: absolute;
	left: 10px;
	right: 10px;
	bottom: 10px;
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 10px;
	padding: 8px 12px;
	border-radius: 8px;
	background: rgba(10, 10, 12, .62);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .35s ease, transform .35s ease;
	pointer-events: none;
}

.cw-card:hover .cw-cap,
.cw-card:focus-visible .cw-cap {
	opacity: 1;
	transform: none;
}

.cw-cap b {
	font-size: 13px;
	font-weight: 600;
	color: rgba(255, 255, 255, .95);
	letter-spacing: .02em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cw-cap i {
	font-style: normal;
	font-size: 10.5px;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, .5);
	white-space: nowrap;
}

/* ---- 边缘压暗（聚焦中心） ---- */
.cw-vignette {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background:
		radial-gradient(120% 90% at 50% 50%, rgba(11, 11, 12, 0) 42%, rgba(11, 11, 12, .55) 78%, rgba(11, 11, 12, .92) 100%);
}

.cw-vignette::before,
.cw-vignette::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	height: 16%;
	pointer-events: none;
}

.cw-vignette::before {
	top: 0;
	height: 13%;
	/* 顶部压实但让出第一行：保证导航区（约 0-60px）内作品淡出，不再下压整个首行 */
	background: linear-gradient(to bottom,
		rgba(11, 11, 12, 1) 0%,
		rgba(11, 11, 12, .96) 30%,
		rgba(11, 11, 12, .6) 62%,
		rgba(11, 11, 12, .16) 88%,
		rgba(11, 11, 12, 0) 100%);
}

.cw-vignette::after {
	bottom: 0;
	height: 16%;
	background: linear-gradient(to top,
		rgba(11, 11, 12, 1) 0%,
		rgba(11, 11, 12, .85) 34%,
		rgba(11, 11, 12, 0) 100%);
}

/* ---- 底部控制条 ----
   默认藏在屏幕下方，只有纵向视角滚到最底部才弹出（is-visible 由 corridor.js 控制） */
.cw-dock {
	position: fixed;
	left: 50%;
	bottom: clamp(18px, 3.4vh, 34px);
	transform: translateX(-50%) translateY(calc(100% + 60px));
	opacity: 0;
	pointer-events: none;
	z-index: 60;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px 8px 18px;
	border-radius: 999px;
	background: rgba(14, 14, 16, .72);
	border: 1px solid rgba(255, 255, 255, .1);
	-webkit-backdrop-filter: blur(18px);
	backdrop-filter: blur(18px);
	box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
	white-space: nowrap;
	transition: transform .55s cubic-bezier(.22, .61, .36, 1), opacity .55s ease;
}

.cw-dock.is-visible {
	transform: translateX(-50%) translateY(0);
	opacity: 1;
	pointer-events: auto;
}

.cw-count {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .04em;
	color: rgba(255, 255, 255, .92);
	margin-right: 4px;
}

.cw-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 8px 14px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, .14);
	background: rgba(255, 255, 255, .05);
	color: rgba(255, 255, 255, .88);
	font-size: 12.5px;
	font-weight: 500;
	letter-spacing: .03em;
	cursor: pointer;
	transition: background .25s ease, border-color .25s ease, color .25s ease;
}

.cw-btn:hover {
	background: rgba(255, 255, 255, .12);
	border-color: rgba(255, 255, 255, .26);
	color: #fff;
}

.cw-btn svg {
	width: 15px;
	height: 15px;
}

/* ---- 响应式 ---- */
@media (max-width: 767.98px) {
	.cw-row {
		/* 不能用 gap： Berger *= 间距必须一致，否则循环位移算不准会接缝跳动 */
		gap: 0;
		margin-bottom: clamp(12px, 1.6vh, 20px);
	}
	/* 竖屏行高：总高约 88vh，留出余量让整体能下移避开导航 */
	.cw-row--1 { --rh: clamp(58px, 13.5vh, 100px); }
	.cw-row--2 { --rh: clamp(70px, 17vh, 122px); }
	.cw-row--3 { --rh: clamp(70px, 17vh, 122px); }
	.cw-row--4 { --rh: clamp(96px, 23vh, 172px); }
	.cw-row--5 { --rh: clamp(70px, 17vh, 122px); }
	/* 整体下移：首行落在导航底缘之下（默认居中会把顶行钻进导航底下） */
	.cw-inner {
		top: calc(50% + 40px);
	}
	.cw-card {
		margin-right: var(--gap, 18px);
		border-radius: 8px;
	}
	.cw-cap b {
		font-size: 11.5px;
	}
	.cw-cap i {
		font-size: 9px;
	}
	.cw-dock {
		padding: 6px 8px 6px 14px;
		gap: 7px;
	}
	.cw-btn {
		padding: 7px 11px;
		font-size: 11.5px;
	}
	/* 小屏顶部渐隐：导航区让位，但不压没首行 */
	.cw-vignette::before {
		height: 18%;
		background: linear-gradient(to bottom,
			rgba(11, 11, 12, 1) 0%,
			rgba(11, 11, 12, .97) 34%,
			rgba(11, 11, 12, .8) 56%,
			rgba(11, 11, 12, .3) 82%,
			rgba(11, 11, 12, 0) 100%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.cw-card,
	.cw-cap,
	.cw-dock {
		transition: none;
	}
}

/* ============================================================
   作品弹窗卡片（点卡片弹出，单独展示 + 转到详情 + 关闭）
   ============================================================ */
.cw-modal {
	position: fixed;
	inset: 0;
	z-index: 120;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	visibility: hidden;
	pointer-events: none;
}
.cw-modal.is-open {
	visibility: visible;
	pointer-events: auto;
}

/* 遮罩：黑化 + 轻模糊 */
.cw-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(8, 8, 9, .62);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	opacity: 0;
	transition: opacity .42s cubic-bezier(.22, 1, .36, 1);
}
.cw-modal.is-open .cw-modal-backdrop { opacity: 1; }

/* 卡片主体：圆角玻璃，弹出带回弹感 */
.cw-modal-card {
	position: relative;
	width: min(860px, 92vw);
	max-height: min(86vh, 780px);
	display: flex;
	flex-direction: column;
	background: linear-gradient(160deg, #1a1a1d 0%, #121214 100%);
	border: 1px solid rgba(255, 255, 255, .1);
	border-radius: 22px;
	box-shadow:
		0 30px 90px rgba(0, 0, 0, .65),
		0 6px 22px rgba(0, 0, 0, .45);
	overflow: hidden;
	opacity: 0;
	transform: scale(.86) translateY(26px);
	transition:
		opacity .34s ease,
		transform .5s cubic-bezier(.2, 1.25, .32, 1); /* 轻微过冲，弹出来 */
}
.cw-modal.is-open .cw-modal-card {
	opacity: 1;
	transform: scale(1) translateY(0);
}
/* 关闭时收得比弹出快、无过冲 */
.cw-modal:not(.is-open) .cw-modal-card {
	transition:
		opacity .26s ease,
		transform .3s cubic-bezier(.5, 0, .75, .4);
}

/* 展示区：任意比例作品图都居中完整呈现 */
.cw-modal-stage {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 26px 26px 14px;
	background:
		radial-gradient(ellipse at 50% 42%, rgba(255, 255, 255, .045) 0%, rgba(255, 255, 255, 0) 62%);
}
.cw-modal-stage img {
	max-width: 100%;
	max-height: min(58vh, 560px);
	width: auto;
	height: auto;
	border-radius: 10px;
	box-shadow: 0 10px 36px rgba(0, 0, 0, .5);
	background: #0b0b0c;
}

/* 底部信息条：标题/分类 + 操作按钮 */
.cw-modal-meta {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 22px 20px;
}
.cw-modal-titles { min-width: 0; }
.cw-modal-titles b {
	display: block;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: 1px;
	color: #fff;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.cw-modal-titles i {
	display: inline-block;
	margin-top: 6px;
	font-style: normal;
	font-size: 11px;
	letter-spacing: 2px;
	color: rgba(255, 255, 255, .55);
	border: 1px solid rgba(255, 255, 255, .18);
	border-radius: 999px;
	padding: 3px 12px;
}
.cw-modal-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.cw-modal-go {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 44px;
	padding: 0 22px;
	border-radius: 999px;
	background: #fff;
	color: #0d0d0e;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 1px;
	text-decoration: none;
	transition: transform .3s cubic-bezier(.22, 1, .36, 1), box-shadow .3s ease, opacity .3s ease;
}
.cw-modal-go em { font-style: normal; transition: transform .3s ease; }
.cw-modal-go:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 26px rgba(255, 255, 255, .16);
	color: #0d0d0e;
}
.cw-modal-go:hover em { transform: translateX(4px); }

/* 关闭按钮：右上角悬浮圆钮 */
.cw-modal-close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 2;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, .16);
	background: rgba(14, 14, 16, .72);
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	transition: transform .3s cubic-bezier(.22, 1, .36, 1), background .3s ease, border-color .3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}
.cw-modal-close:hover {
	background: rgba(255, 255, 255, .14);
	border-color: rgba(255, 255, 255, .4);
	transform: rotate(90deg);
}

/* 弹窗打开时暂停走廊流动，画面静止更聚焦 */
body.cw-modal-open .cw-row { animation-play-state: paused; }

@media (max-width: 767.98px) {
	.cw-modal { padding: 14px; }
	.cw-modal-card { width: 100%; border-radius: 18px; }
	.cw-modal-stage { padding: 20px 16px 10px; }
	.cw-modal-stage img { max-height: 46vh; }
	.cw-modal-meta { flex-direction: column; align-items: stretch; gap: 12px; padding: 10px 16px 16px; }
	.cw-modal-go { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
	.cw-modal-backdrop,
	.cw-modal-card,
	.cw-modal-go,
	.cw-modal-go em,
	.cw-modal-close { transition: none; }
}
