/* DSH Notify Bell — sound showcase styles.
 * Semantic tokens only (no hard-coded black/white). Theme follows the system
 * by default; explicit light/dark overrides via html[data-theme]. */

/* ---------- Semantic tokens ---------- */
:root {
	--bg: #f6f7f9;
	--surface: #ffffff;
	--surface-2: #eef0f4;
	--fg: #1b1f2a;
	--fg-secondary: #5b6472;
	--fg-tertiary: #8b93a7;
	--border: #d9dde5;
	--accent: #4d6bfe;
	--accent-contrast: #ffffff;
	--accent-soft: #e7ebff;
	--danger: #d64545;
	--success: #2e9e5b;
	--focus-ring: #4d6bfe;
	--shadow: 0 2px 10px rgba(20, 24, 40, 0.08);
	--radius: 14px;
	--radius-sm: 10px;
	--font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
	--mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
	--bg: #131722;
	--surface: #1b1f2a;
	--surface-2: #232838;
	--fg: #e7e9f0;
	--fg-secondary: #a4acbd;
	--fg-tertiary: #7b8398;
	--border: #323a4e;
	--accent: #86a0ff;
	--accent-contrast: #131722;
	--accent-soft: #252c44;
	--danger: #ff7a7a;
	--success: #6fd39a;
	--focus-ring: #86a0ff;
	--shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #131722;
		--surface: #1b1f2a;
		--surface-2: #232838;
		--fg: #e7e9f0;
		--fg-secondary: #a4acbd;
		--fg-tertiary: #7b8398;
		--border: #323a4e;
		--accent: #86a0ff;
		--accent-contrast: #131722;
		--accent-soft: #252c44;
		--danger: #ff7a7a;
		--success: #6fd39a;
		--focus-ring: #86a0ff;
		--shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
	}
}

/* ---------- Base ---------- */
* {
	box-sizing: border-box;
}

html {
	color-scheme: light;
}

html[data-theme="dark"] {
	color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
	html:not([data-theme="light"]) {
		color-scheme: dark;
	}
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--font);
	line-height: 1.5;
	transition: background-color 0.2s ease, color 0.2s ease;
}

a {
	color: var(--accent);
}

code {
	font-family: var(--mono);
	font-size: 0.9em;
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 0 5px;
}

:focus-visible {
	outline: 2px solid var(--focus-ring);
	outline-offset: 2px;
	border-radius: 6px;
}

/* ---------- Header ---------- */
.site-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	padding: 20px 28px;
	border-bottom: 1px solid var(--border);
	background: var(--surface);
}

.brand {
	display: flex;
	align-items: center;
	gap: 14px;
}

.brand-logo {
	width: 72px;
	height: 72px;
	flex: none;
	/* Brand icon: fixed #4176e6 in both themes (PNG carries the color). */
	filter: none;
}

.brand h1 {
	margin: 0;
	font-size: 22px;
	font-weight: 650;
	letter-spacing: -0.01em;
}

.subtitle {
	margin: 2px 0 0;
	color: var(--fg-secondary);
	font-size: 13.5px;
}

.badge {
	display: inline-block;
	margin: 6px 0 0;
	padding: 2px 8px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--surface-2);
	color: var(--fg-tertiary);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.header-links {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.link-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 14px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--surface);
	color: var(--fg);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
	text-decoration: none;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.link-btn:hover {
	background: var(--surface-2);
	border-color: var(--fg-tertiary);
}

/* ---------- Main / demo ---------- */
main {
	max-width: 1080px;
	margin: 0 auto;
	padding: 28px 20px 40px;
}

.demo {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 20px 22px 18px;
	margin-bottom: 28px;
}

.demo h2,
.cards h2,
.notes h2 {
	margin: 0 0 6px;
	font-size: 17px;
	font-weight: 650;
}

.demo-hint {
	margin: 0 0 14px;
	color: var(--fg-secondary);
	font-size: 13px;
}

.demo-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.demo-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 9px 16px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--accent-soft);
	color: var(--fg);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.1s ease;
}

.demo-btn:hover {
	background: var(--surface-2);
	border-color: var(--accent);
}

.demo-btn:active {
	transform: scale(0.97);
}

.demo-btn .demo-btn-icon {
	color: var(--accent);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	line-height: 0;
}

.demo-btn .demo-btn-icon svg {
	display: block;
}

.demo-status {
	margin: 14px 0 0;
	padding: 9px 14px;
	border-radius: var(--radius-sm);
	background: var(--surface-2);
	border-left: 3px solid var(--accent);
	color: var(--fg-secondary);
	font-size: 13.5px;
	font-weight: 500;
	min-height: 1.5em;
}

/* ---------- Sound cards ---------- */
.cards-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 16px;
}

.card {
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 18px;
}

.card-head {
	display: flex;
	align-items: center;
	gap: 12px;
}

.card-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	border-radius: 12px;
	background: var(--accent-soft);
	color: var(--accent);
	flex: none;
}

.card-event {
	margin: 0;
	font-size: 16px;
	font-weight: 650;
}

.card-sound {
	margin: 1px 0 0;
	color: var(--fg-secondary);
	font-size: 12.5px;
}

.card-meta {
	margin: 0;
	color: var(--fg-tertiary);
	font-size: 12.5px;
}

.card-meta .rs-name {
	color: var(--fg-secondary);
}

.card-controls {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 2px;
}

/* Icon glyph: own flex box, zero line-height so the SVG never inherits a
   text baseline — icon and label center on the same axis. */
.play-glyph {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	line-height: 0;
}

.play-glyph svg {
	display: block;
}

.play-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 108px;
	padding: 8px 16px;
	border: 1px solid var(--accent);
	border-radius: 999px;
	background: var(--accent);
	color: var(--accent-contrast);
	font: inherit;
	font-size: 13.5px;
	font-weight: 650;
	cursor: pointer;
	flex: none;
	transition: filter 0.15s ease;
}

.play-btn:hover {
	filter: brightness(1.08);
}

.play-btn.playing .play-glyph {
	content: "❚❚";
}

.progress {
	flex: 1;
	min-width: 60px;
	height: 6px;
	border-radius: 3px;
	background: var(--surface-2);
	border: 1px solid var(--border);
	overflow: hidden;
}

.progress-fill {
	height: 100%;
	width: 100%;
	transform: scaleX(0);
	transform-origin: left center;
	background: var(--accent);
	border-radius: 3px;
	/* RAF 每帧驱动 transform（合成层，避免 layout/reflow）；
	   不用 transition，避免引入视觉延迟。 */
}

.card-time {
	font-family: var(--mono);
	font-size: 11px;
	color: var(--fg-tertiary);
	flex: none;
}

.volume-row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.volume-label {
	font-size: 12px;
	color: var(--fg-tertiary);
	flex: none;
}

.volume {
	flex: 1;
	accent-color: var(--accent);
	cursor: pointer;
}

/* ---------- Notes ---------- */
.notes {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 20px 22px;
	margin-top: 28px;
}

.notes p {
	margin: 0 0 10px;
	color: var(--fg-secondary);
	font-size: 14px;
}

.notes-list {
	margin: 0 0 14px;
	padding: 0;
	list-style: none;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px 18px;
	color: var(--fg-secondary);
	font-size: 13.5px;
}

/* 5 个语义条目：桌面 3+2、平板 2+2+1、移动单列；code 列竖排对齐。 */
.notes-list li {
	display: flex;
	align-items: baseline;
	gap: 8px;
	min-width: 0;
}

.notes-list li code {
	flex: none;
}

.notes-src {
	font-size: 12.5px;
	color: var(--fg-tertiary);
}

/* ---------- Footer ---------- */
.site-footer {
	text-align: center;
	padding: 18px;
	border-top: 1px solid var(--border);
	color: var(--fg-tertiary);
	font-size: 12.5px;
}

.site-footer p {
	margin: 0;
}

.site-footer .footer-credits {
	margin-top: 4px;
	font-size: 11.5px;
}

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
	.site-header {
		padding: 16px 16px;
	}

	main {
		padding: 18px 12px 28px;
	}

	.cards-grid {
		grid-template-columns: 1fr; /* mobile: single column */
	}

	.demo-grid {
		flex-direction: column;
	}

	.demo-btn {
		justify-content: center;
	}

	.notes-list {
		grid-template-columns: 1fr; /* mobile: single column */
	}
}

@media (min-width: 701px) and (max-width: 1020px) {
	.cards-grid {
		grid-template-columns: repeat(2, 1fr); /* tablet: two columns */
	}

	.notes-list {
		grid-template-columns: repeat(2, 1fr); /* tablet: 2+2+1 */
	}
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition: none !important;
		animation: none !important;
	}
}

/* Play/pause glyphs: only one visible at a time; both same viewBox so button width never changes. */
.play-btn .pause-path {
	display: none;
}

.play-btn.playing .play-path {
	display: none;
}

.play-btn.playing .pause-path {
	display: block;
}
