/* ========== AIGC content only — aligned with site chrome ========== */
/* All selectors scoped under .ag so sidebar / header stay untouched */

.ag {
	--ink: #1f2937;
	--mute: #6b7280;
	--line: #e5e7eb;
	--soft: #f9fafb;
	--accent: #3b82f6;
	--accent-soft: #eff6ff;
	--coral: #f97316;
	--mint: #14b8a6;
	color: var(--ink);
	margin: 0 0 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

@media (min-width: 640px) {
	.ag {
		margin-top: 1.5rem; /* 与首页 hero 对齐，距顶栏留白 */
	}
}

@media (min-width: 1024px) {
	.ag {
		gap: 1.1rem;
		margin-bottom: 2rem;
	}
}

.ag * { box-sizing: border-box; }

.ag-sheet {
	position: relative;
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 1rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
	overflow: hidden;
}

/* ===== Controls ===== */
.ag-controls {
	position: sticky;
	top: 0.5rem;
	z-index: 20;
	padding: 0.85rem;
	background: #fff;
	overflow: visible; /* 勿 hidden，否则横向轨易吞掉纵向滚轮 */
}

@media (min-width: 640px) {
	.ag-controls { padding: 1rem; }
}

.ag-search {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	margin-bottom: 0.75rem;
	padding: 0.2rem 0.2rem 0.2rem 0.95rem;
	border-radius: 0.85rem;
	background: var(--soft);
	border: 1px solid var(--line);
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ag-search:focus-within {
	background: #fff;
	border-color: #93c5fd;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.ag-search > i {
	color: var(--accent);
	font-size: 0.9rem;
}

.ag-search input {
	flex: 1;
	min-width: 0;
	border: 0;
	outline: none;
	background: transparent;
	color: var(--ink);
	font-size: 0.94rem;
	padding: 0.72rem 0.55rem 0.72rem 0;
}

.ag-search input::placeholder { color: #9ca3af; }

.ag-rail {
	display: flex;
	flex-wrap: nowrap;
	gap: 0.45rem;
	overflow-x: auto;
	overflow-y: visible;
	overscroll-behavior-x: contain;
	touch-action: pan-x pan-y;
	-webkit-overflow-scrolling: touch;
	scroll-snap-type: x proximity;
	scrollbar-width: none; /* Firefox */
	mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 1.5rem), transparent);
	-webkit-mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 1.5rem), transparent);
	padding-bottom: 2px; /* 避免 shadow 被裁切 */
}

.ag-rail::-webkit-scrollbar {
	display: none; /* Chrome / Safari */
}

.ag-rail a {
	display: inline-flex;
	align-items: center;
	gap: 0.38rem;
	flex-shrink: 0;
	padding: 0.5rem 0.85rem;
	border-radius: 999px;
	text-decoration: none;
	color: #4b5563;
	font-size: 0.8rem;
	font-weight: 700;
	background: var(--soft);
	border: 1px solid transparent;
	white-space: nowrap;
	scroll-snap-align: start;
	transition: 0.16s ease;
}

.ag-rail a i {
	font-size: 0.7rem;
	color: var(--accent);
}

.ag-rail a em {
	font-style: normal;
	min-width: 1.1rem;
	padding: 0.05rem 0.32rem;
	border-radius: 999px;
	font-size: 0.65rem;
	background: #fff;
	color: #9ca3af;
	border: 1px solid var(--line);
}

.ag-rail a:hover {
	color: var(--ink);
	border-color: #d1d5db;
	background: #fff;
}

.ag-rail a.is-active {
	color: #fff;
	background: var(--accent);
	border-color: transparent;
	box-shadow: 0 6px 16px rgba(59, 130, 246, 0.28);
}

.ag-rail a.is-active i,
.ag-rail a.is-active em {
	color: #fff;
	background: rgba(255, 255, 255, 0.2);
	border-color: transparent;
}

/* ===== Sections ===== */
.ag-sec {
	padding: 1.1rem;
	scroll-margin-top: 7.5rem;
}

@media (min-width: 640px) {
	.ag-sec { padding: 1.25rem; }
}

.ag-sec-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 0.95rem;
}

.ag-sec-title {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	margin: 0;
	font-size: 1.05rem;
	font-weight: 800;
	letter-spacing: -0.02em;
}

.ag-sec-title a {
	color: inherit;
	text-decoration: none;
}

.ag-sec-title a:hover { color: var(--accent); }

.ag-sec-ico {
	width: 2rem;
	height: 2rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 0.65rem;
	background: var(--accent-soft);
	color: var(--accent);
	font-size: 0.75rem;
}

.ag-sec-meta {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	font-size: 0.74rem;
	color: var(--mute);
}

.ag-sec-more {
	color: var(--accent);
	text-decoration: none;
	font-weight: 700;
}

.ag-sec-more:hover { color: #2563eb; }

/* ===== Cards：一行最多 4 个；minmax(0,1fr) 避免长标题撑破导致第 4 列被裁切 ===== */
.ag-cards {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 0.75rem;
	width: 100%;
	min-width: 0;
}

@media (min-width: 640px) {
	.ag-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
}

@media (min-width: 900px) {
	.ag-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 侧栏 lg:ml-64 后内容区变窄，1200 视口仍常只显示 3 列，故提前到 1024 */
@media (min-width: 1024px) {
	.ag-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.aigcs-panel,
.ag-sec {
	min-width: 0;
}

.ag-card {
	--tone: var(--accent);
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 100%;
	padding: 0.95rem;
	text-decoration: none;
	color: inherit;
	background: var(--soft);
	border: 1px solid var(--line);
	border-radius: 0.9rem;
	transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.ag-card:hover {
	transform: translateY(-3px);
	background: #fff;
	border-color: #bfdbfe;
	box-shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
}

.ag-t0 { --tone: #3b82f6; }
.ag-t1 { --tone: #14b8a6; }
.ag-t2 { --tone: #f97316; }
.ag-t3 { --tone: #eab308; }
.ag-t4 { --tone: #8b5cf6; }
.ag-t5 { --tone: #10b981; }
.ag-t6 { --tone: #ec4899; }
.ag-t7 { --tone: #06b6d4; }

.ag-card-top {
	display: flex;
	gap: 0.75rem;
	align-items: flex-start;
}

.ag-logo,
.ag-logo-fb {
	width: 2.85rem;
	height: 2.85rem;
	flex-shrink: 0;
	border-radius: 0.75rem;
	object-fit: cover;
	background: #fff;
	border: 1px solid var(--line);
}

.ag-logo-fb {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 1rem;
	font-weight: 800;
	color: #fff;
	background: var(--tone);
	border-color: transparent;
}

.ag-card-body { min-width: 0; flex: 1; }

.ag-card-title-row {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.4rem;
}

.ag-card h3 {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 800;
	letter-spacing: -0.02em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ag-badges {
	display: inline-flex;
	gap: 0.22rem;
	flex-shrink: 0;
}

.ag-badge {
	padding: 0.1rem 0.38rem;
	border-radius: 999px;
	font-size: 0.6rem;
	font-weight: 800;
	letter-spacing: 0.04em;
}

.ag-badge-hot {
	color: #fff;
	background: #f97316;
}

.ag-badge-new {
	color: #1d4ed8;
	background: var(--accent-soft);
}

.ag-card p {
	margin: 0.35rem 0 0;
	font-size: 0.78rem;
	line-height: 1.55;
	color: var(--mute);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.4rem;
}

.ag-card-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.45rem;
	margin-top: auto;
	padding-top: 0.75rem;
}

.ag-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	min-width: 0;
}

.ag-tag {
	padding: 0.1rem 0.42rem;
	border-radius: 999px;
	font-size: 0.64rem;
	color: #6b7280;
	background: #fff;
	border: 1px solid var(--line);
}

.ag-go {
	display: inline-flex;
	align-items: center;
	gap: 0.28rem;
	padding: 0.28rem 0.6rem;
	border-radius: 999px;
	font-size: 0.7rem;
	font-weight: 800;
	color: #fff;
	background: var(--accent);
	transition: transform 0.16s ease, background 0.16s ease;
}

.ag-card:hover .ag-go {
	transform: translateX(2px);
	background: #2563eb;
}

.ag-go i { font-size: 0.62rem; }

.ag-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 24rem;
	text-align: center;
	padding: 5rem 1.25rem;
	color: var(--mute);
	font-size: 0.95rem;
	background: #fff;
	border: 1px dashed #d1d5db;
	border-radius: 1rem;
}

/* display:flex 会压过 Tailwind .hidden，需显式隐藏 */
.ag-empty.hidden {
	display: none !important;
}

@media (min-width: 640px) {
	.ag-empty {
		min-height: 28rem;
		padding: 6rem 1.5rem;
	}
}

.ag-empty i {
	display: block;
	font-size: 1.75rem;
	margin-bottom: 0.75rem;
	color: var(--accent);
}

.aigcs-panel {
	position: relative;
	min-height: 4rem;
	transition: opacity 0.18s ease;
}

.aigcs-panel.is-loading {
	opacity: 0.45;
	pointer-events: none;
}

.aigcs-panel.is-loading::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 1.2rem;
	width: 1.4rem;
	height: 1.4rem;
	margin-left: -0.7rem;
	border: 2px solid #bfdbfe;
	border-top-color: #3b82f6;
	border-radius: 50%;
	animation: aigc-spin 0.7s linear infinite;
}

@keyframes aigc-spin {
	to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
	.ag-card { transition: none !important; }
	.aigcs-panel.is-loading::after { animation: none; }
}
