/**
 * sm1 header（青蓝橙红）
 */

.sm1-header {
	--sm1-header-h: 64px;
	--sm1-header-bg: rgba(255, 255, 255, 0.92);
	--sm1-header-border: var(--sm1-line);
	--sm1-header-text: var(--sm1-ink);
	--sm1-header-muted: var(--sm1-muted);
	--sm1-header-accent: var(--sm1-accent);
	backdrop-filter: blur(12px);
	position: sticky;
	top: 0;
	z-index: 1000;
	background: var(--sm1-header-bg);
	border-bottom: 1px solid var(--sm1-header-border);
	box-shadow: 0 1px 0 rgba(21, 32, 51, 0.04);
}

.sm1-header__bar {
	display: flex;
	align-items: center;
	gap: 24px;
	min-height: var(--sm1-header-h);
}

.sm1-header__brand-wrap {
	flex-shrink: 0;
}

.sm1-header__brand,
.sm1-header__brand-wrap .custom-logo-link {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--sm1-header-text);
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
}

.sm1-header__brand-icon {
	width: 32px;
	height: 32px;
	border-radius: 8px;
	object-fit: contain;
	flex-shrink: 0;
}

.sm1-header__brand-text {
	max-width: 180px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sm1-header__brand-wrap img.custom-logo {
	max-height: 36px;
	width: auto;
}

.sm1-header__nav {
	flex: 1;
	min-width: 0;
}

.sm1-header__menu {
	display: flex;
	align-items: center;
	gap: 6px;
	list-style: none;
	margin: 0;
	padding: 0;
	flex-wrap: wrap;
}

.sm1-header__menu a {
	display: inline-flex;
	align-items: center;
	padding: 8px 14px;
	border-radius: 8px;
	color: var(--sm1-header-muted);
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	transition: color 0.2s ease, background 0.2s ease;
}

.sm1-header__menu a:hover,
.sm1-header__menu a:focus-visible {
	color: var(--sm1-header-text);
	background: var(--sm1-bg-soft);
}

.sm1-header__menu .current-menu-item > a,
.sm1-header__menu .current_page_item > a,
.sm1-header__menu a.current-menu-item,
.sm1-header__menu a.current_page_item {
	color: var(--sm1-header-text);
	background: var(--sm1-bg-soft);
	font-weight: 600;
}

.sm1-header__tools {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-left: auto;
	flex-shrink: 0;
}

.sm1-header__search {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--sm1-bg-soft);
	border: 1px solid transparent;
	border-radius: 999px;
	padding: 6px 6px 6px 16px;
	transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
	min-width: 240px;
	max-width: 320px;
}

.sm1-header__search:focus-within {
	background: var(--sm1-surface, var(--sm1-surface));
	border-color: var(--sm1-line, var(--sm1-line));
	box-shadow: 0 2px 12px rgba(21, 32, 51, 0.06);
}

.sm1-header__search-input {
	flex: 1;
	min-width: 0;
	border: none;
	background: transparent;
	padding: 4px 0;
	font-size: 14px;
	color: var(--sm1-header-text);
	outline: none;
}

.sm1-header__search-input::placeholder {
	color: var(--sm1-faint);
}

.sm1-header__search-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border: none;
	border-radius: 50%;
	background: var(--sm1-header-accent);
	color: var(--sm1-surface);
	cursor: pointer;
	flex-shrink: 0;
	transition: background 0.2s ease, transform 0.2s ease;
}

.sm1-header__search-btn:hover {
	background: var(--sm1-accent-hover, #0b7f8a);
}

.sm1-header__user {
	position: relative;
}

.sm1-header__avatar-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 2px solid var(--sm1-line, var(--sm1-line));
	border-radius: 50%;
	background: var(--sm1-surface, var(--sm1-surface));
	cursor: pointer;
	overflow: hidden;
	transition: border-color 0.2s ease, transform 0.2s ease;
}

.sm1-header__avatar-btn:hover,
.sm1-header__avatar-btn[aria-expanded="true"] {
	border-color: var(--sm1-ink);
}

.sm1-header__avatar-img,
.sm1-header__avatar-btn img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	display: block;
}

.sm1-header__dropdown {
	position: absolute;
	top: 100%;
	right: 0;
	width: 200px;
	padding-top: 8px;
	background: transparent;
	border: 0;
	z-index: 1001;
}

.sm1-header__dropdown-panel {
	background: var(--sm1-surface, var(--sm1-surface));
	border: 1px solid var(--sm1-line);
	border-radius: 12px;
	box-shadow: 0 12px 40px rgba(21, 32, 51, 0.12);
	overflow: hidden;
}

.sm1-header__dropdown-head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px;
	border-bottom: 1px solid var(--sm1-bg-soft);
}

.sm1-header__dropdown-head img {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	flex-shrink: 0;
}

.sm1-header__dropdown-meta {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.sm1-header__dropdown-meta strong {
	font-size: 14px;
	color: var(--sm1-ink);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sm1-header__dropdown-meta span {
	font-size: 12px;
	color: var(--sm1-faint);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sm1-header__dropdown-body {
	padding: 8px;
}

.sm1-header__dropdown-link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 8px;
	color: var(--sm1-body);
	font-size: 14px;
	text-decoration: none;
	transition: background 0.2s ease, color 0.2s ease;
}

.sm1-header__dropdown-icon {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	color: var(--sm1-muted);
	transition: color 0.2s ease;
}

.sm1-header__dropdown-link:hover .sm1-header__dropdown-icon,
.sm1-header__dropdown-link:focus-visible .sm1-header__dropdown-icon {
	color: var(--sm1-ink);
}

.sm1-header__dropdown-link--danger .sm1-header__dropdown-icon {
	color: inherit;
}

.sm1-header__dropdown-link:hover,
.sm1-header__dropdown-link:focus-visible {
	background: var(--sm1-bg-soft);
	color: var(--sm1-ink);
}

.sm1-header__dropdown-link--danger {
	color: #b91c1c;
}

.sm1-header__dropdown-link--danger:hover {
	background: #fef2f2;
	color: #b91c1c;
}

.sm1-header__dropdown-link--danger:hover .sm1-header__dropdown-icon {
	color: inherit;
}

.sm1-header__login-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	background: var(--sm1-header-accent);
	color: var(--sm1-surface);
	border-radius: 999px;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	transition: background 0.2s ease, transform 0.2s ease;
}

.sm1-header__login-btn:hover {
	background: var(--sm1-accent-hover, #0b7f8a);
	color: var(--sm1-surface);
}

.sm1-header__login-btn--block {
	width: 100%;
	justify-content: center;
}

.sm1-header__register-btn {
	display: block;
	margin-top: 10px;
	padding: 10px;
	text-align: center;
	color: var(--sm1-muted);
	font-size: 14px;
	text-decoration: none;
}

.sm1-header__register-btn:hover {
	color: var(--sm1-ink);
}

.sm1-header__mobile-tools {
	display: none;
	align-items: center;
	gap: 4px;
}

.sm1-header__icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: none;
	border-radius: 10px;
	background: transparent;
	color: var(--sm1-body);
	cursor: pointer;
	text-decoration: none;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	transition: background 0.2s ease, color 0.2s ease;
}

.sm1-header__icon-btn:hover,
.sm1-header__icon-btn:focus-visible {
	background: var(--sm1-bg-soft);
	color: var(--sm1-ink);
}

.sm1-header__mobile-avatar {
	padding: 0;
	overflow: hidden;
	border-radius: 50%;
}

.sm1-header__menu-toggle {
	flex-direction: column;
	gap: 5px;
}

.sm1-header__menu-bar {
	display: block;
	width: 18px;
	height: 2px;
	background: currentColor;
	border-radius: 2px;
	transition: transform 0.25s ease, opacity 0.25s ease;
}

.sm1-header.is-mobile-menu-open .sm1-header__menu-bar:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.sm1-header.is-mobile-menu-open .sm1-header__menu-bar:nth-child(2) {
	opacity: 0;
}

.sm1-header.is-mobile-menu-open .sm1-header__menu-bar:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

.sm1-header__search-panel {
	border-bottom: 1px solid var(--sm1-header-border);
	background: var(--sm1-surface, var(--sm1-surface));
	padding: 10px 0 12px;
	animation: sm1-search-panel-in 0.2s ease;
}

.sm1-header__search-panel[hidden] {
	display: none !important;
}

.sm1-header__search-panel-inner {
	display: flex;
	align-items: center;
	gap: 8px;
}

.sm1-header__search-panel .sm1-header__search {
	min-width: 0;
	flex: 1;
	width: auto;
	background: var(--sm1-bg-soft);
	border-color: var(--sm1-line, var(--sm1-line));
	padding: 6px 6px 6px 14px;
}

.sm1-header__search-panel .sm1-header__search:focus-within {
	background: var(--sm1-surface, var(--sm1-surface));
	border-color: var(--sm1-line);
	box-shadow: 0 2px 10px rgba(21, 32, 51, 0.06);
}

.sm1-header__search-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	border: none;
	border-radius: 10px;
	background: var(--sm1-bg-soft);
	color: var(--sm1-body);
	cursor: pointer;
}

.sm1-header__search-close:hover,
.sm1-header__search-close:focus-visible {
	background: var(--sm1-bg-soft);
	color: var(--sm1-ink);
}

.sm1-header.is-search-open .sm1-header__search-toggle {
	background: var(--sm1-bg-soft);
	color: var(--sm1-ink);
}

.sm1-header__search-toggle .sm1-header__search-icon-close[hidden],
.sm1-header__search-toggle .sm1-header__search-icon[hidden] {
	display: none !important;
}

@keyframes sm1-search-panel-in {
	from {
		opacity: 0;
		transform: translateY(-6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

body.sm1-modal-open {
	overflow: hidden;
}

.sm1-header__mobile-menu {
	border-top: 1px solid var(--sm1-line-soft);
	border-bottom: 1px solid var(--sm1-header-border);
	background: var(--sm1-surface);
	max-height: calc(100dvh - var(--sm1-header-h, 56px));
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding-bottom: env(safe-area-inset-bottom, 0px);
	box-shadow: 0 12px 24px rgba(21, 32, 51, 0.06);
	animation: sm1-mobile-menu-in 0.2s ease;
}

.sm1-header__mobile-menu[hidden] {
	display: none !important;
}

.sm1-header__mobile-menu-inner {
	padding-top: 8px;
	padding-bottom: 16px;
}

.sm1-header__mobile-menu-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.sm1-header__mobile-menu-list li {
	margin: 0;
}

.sm1-header__mobile-menu-list a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px;
	min-height: 46px;
	border-radius: 10px;
	color: var(--sm1-body);
	font-size: 15px;
	font-weight: 500;
	text-decoration: none;
	-webkit-tap-highlight-color: transparent;
	transition: background 0.2s ease, color 0.2s ease;
}

.sm1-header__mobile-menu-list a::after {
	content: "";
	width: 6px;
	height: 6px;
	flex-shrink: 0;
	border-right: 2px solid var(--sm1-faint);
	border-bottom: 2px solid var(--sm1-faint);
	transform: rotate(-45deg);
	opacity: 0.7;
}

.sm1-header__mobile-menu-list a:hover,
.sm1-header__mobile-menu-list a:active,
.sm1-header__mobile-menu-list .current-menu-item > a,
.sm1-header__mobile-menu-list .current_page_item > a {
	color: var(--sm1-ink);
	background: var(--sm1-bg-soft);
}

.sm1-header__mobile-menu-list .current-menu-item > a,
.sm1-header__mobile-menu-list .current_page_item > a {
	font-weight: 600;
}

.sm1-header__mobile-menu-list .sub-menu {
	list-style: none;
	margin: 2px 0 0;
	padding: 0 0 0 14px;
}

.sm1-header__mobile-menu-list .sub-menu a {
	min-height: 42px;
	font-size: 14px;
}

.sm1-header__mobile-menu-list .current-menu-item > a::after,
.sm1-header__mobile-menu-list .current_page_item > a::after {
	border-color: var(--sm1-accent);
	opacity: 1;
}

.sm1-header__mobile-menu-actions {
	margin-top: 10px;
	padding-top: 12px;
	border-top: 1px solid var(--sm1-line-soft);
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	gap: 8px;
}

.sm1-header__mobile-menu-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	flex: 1 1 auto;
	padding: 9px 12px;
	min-height: 42px;
	border-radius: 999px;
	background: var(--sm1-bg-soft);
	color: var(--sm1-body);
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
	-webkit-tap-highlight-color: transparent;
	transition: background 0.2s ease, color 0.2s ease;
}

.sm1-header__mobile-menu-icon {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	color: var(--sm1-muted);
	transition: color 0.2s ease;
}

.sm1-header__mobile-menu-link:hover,
.sm1-header__mobile-menu-link:active {
	background: var(--sm1-line-soft);
	color: var(--sm1-ink);
}

.sm1-header__mobile-menu-link:hover .sm1-header__mobile-menu-icon,
.sm1-header__mobile-menu-link:active .sm1-header__mobile-menu-icon {
	color: var(--sm1-ink);
}

.sm1-header__mobile-menu-link--danger {
	background: #fef2f2;
	color: #b91c1c;
}

.sm1-header__mobile-menu-link--danger .sm1-header__mobile-menu-icon {
	color: inherit;
}

.sm1-header__mobile-menu-link--danger:hover,
.sm1-header__mobile-menu-link--danger:active {
	background: #fee2e2;
	color: #b91c1c;
}

.sm1-header__mobile-menu-actions .sm1-header__login-btn {
	flex: 1 1 0;
	width: auto;
	justify-content: center;
	min-height: 42px;
	padding: 9px 16px;
	border-radius: 999px;
}

.sm1-header__mobile-menu-actions .sm1-header__register-btn {
	flex: 1 1 0;
	margin-top: 0;
	padding: 9px 16px;
	min-height: 42px;
	border-radius: 999px;
	background: var(--sm1-bg-soft);
	text-align: center;
}

.sm1-header__mobile-menu-actions .sm1-header__register-btn:hover {
	background: var(--sm1-line-soft);
	color: var(--sm1-ink);
}

@keyframes sm1-mobile-menu-in {
	from {
		opacity: 0;
		transform: translateY(-6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (max-width: 991px) {
	.sm1-header {
		--sm1-header-h: 56px;
	}

	.sm1-header__bar {
		gap: 10px;
		padding-left: env(safe-area-inset-left, 0px);
		padding-right: env(safe-area-inset-right, 0px);
	}

	.sm1-header__brand,
	.sm1-header__brand-wrap .custom-logo-link {
		font-size: 17px;
	}

	.sm1-header__brand-text {
		max-width: 132px;
	}

	.sm1-header__brand-wrap img.custom-logo {
		max-height: 30px;
	}

	.sm1-header__nav,
	.sm1-header__search--desktop,
	.sm1-header__user {
		display: none;
	}

	.sm1-header__mobile-tools {
		display: flex;
		margin-left: auto;
		gap: 2px;
	}

	.sm1-header.is-mobile-menu-open .sm1-header__menu-toggle {
		background: var(--sm1-bg-soft);
		color: var(--sm1-ink);
	}
}

@media (min-width: 1200px) {
	.sm1-header__search--desktop {
		min-width: 280px;
	}
}

@media (min-width: 992px) {
	.sm1-header__search-panel,
	.sm1-header__mobile-menu {
		display: none !important;
	}
}

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}
