/* PHOMI Header — mobile drawer + shared desktop nav scaling.
   Page CSS still owns layout; header.css caps nav type below 1920. */

/* 汉堡按钮默认按深色背景(透明 header 压在 hero 图上)取白色;
   白底 header 的页面用 --phomi-nav-toggle-color 改成深色。 */
.phomi-header {
	--phomi-nav-toggle-color: #fff;
}

button.phomi-nav-toggle,
.phomi-nav-toggle {
	-webkit-appearance: none;
	appearance: none;
	align-items: center;
	background: transparent !important;
	background-color: transparent !important;
	background-image: none !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	color: transparent !important;
	cursor: pointer;
	display: none;
	flex: 0 0 auto;
	gap: 8px;
	height: 44px !important;
	justify-content: flex-end;
	margin: 0;
	min-height: 44px !important;
	min-width: 44px !important;
	outline: none !important;
	padding: 0 !important;
	position: relative;
	width: auto !important;
	z-index: 60;
}

.phomi-nav-toggle::-moz-focus-inner {
	border: 0;
	padding: 0;
}

.phomi-nav-toggle__bars,
.phomi-nav-toggle__bars::before,
.phomi-nav-toggle__bars::after {
	background: var(--phomi-nav-toggle-color, #fff);
	border-radius: 1px;
	display: block;
	height: 1.5px;
	transition: transform 0.22s ease, opacity 0.22s ease, top 0.22s ease, background-color 0.22s ease;
	width: 20px;
}

.phomi-nav-toggle__bars {
	flex: 0 0 auto;
	position: relative;
}

.phomi-nav-toggle__bars::before,
.phomi-nav-toggle__bars::after {
	content: "";
	left: 0;
	position: absolute;
}

.phomi-nav-toggle__bars::before {
	top: -6px;
}

.phomi-nav-toggle__bars::after {
	top: 6px;
}

.phomi-nav-toggle__label {
	color: var(--phomi-nav-toggle-color, #fff);
	display: none;
	flex: 0 0 auto;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0;
	line-height: 20px;
	transition: color 0.22s ease;
	white-space: nowrap;
}

/* Partner Hub 外链按钮:桌面贴 header 右侧,移动端收在汉堡按钮左边。 */
.phomi-header__cta {
	align-items: center;
	background: var(--phomi-blue, #70c7d1);
	border-radius: 8px;
	box-sizing: border-box;
	color: #fff;
	display: inline-flex;
	font-size: 14px;
	font-weight: 400;
	justify-content: center;
	line-height: 20px;
	padding: 9px 18px;
	text-decoration: none;
	transition: background-color 0.24s ease;
	white-space: nowrap;
}

.phomi-header__cta:hover,
.phomi-header__cta:focus,
.phomi-header__cta:focus-visible {
	background: #5cb6c1;
	color: #fff;
	text-decoration: none;
}

/* 抽屉里的 Partner Hub 跟其它菜单行一样是纯文字,只在汉堡菜单下出现。 */
.phomi-nav__partner-hub {
	display: none;
}

/* 白底 header(案例/新闻详情、只有 header 的浅色 hero)未滚动时也要深色汉堡。 */
.phomi-header--case-detail,
.phomi-header--news-detail,
.phomi-header--on-light,
.phomi-header.is-scrolled,
.phomi-header.is-nav-active,
.phomi-header.is-mega-active,
.phomi-header.is-nav-hover,
.phomi-header.is-nav-open {
	--phomi-nav-toggle-color: #111;
}

/* 没有 banner 图、只剩白底 header 的 hero(phomi-hero--header-only)同理。 */
.phomi-hero--header-only .phomi-header {
	--phomi-nav-toggle-color: #111;
}

.phomi-header.is-nav-open .phomi-nav-toggle__bars {
	background: transparent;
}

.phomi-header.is-nav-open .phomi-nav-toggle__bars::before {
	top: 0;
	transform: rotate(45deg);
}

.phomi-header.is-nav-open .phomi-nav-toggle__bars::after {
	top: 0;
	transform: rotate(-45deg);
}

body.phomi-nav-open {
	overflow: hidden;
}

/* iPad + phone: hamburger drawer with accordion submenus. */
@media (max-width: 1180px) {
	header.phomi-header {
		background: transparent;
		height: 64px !important;
	}

	header.phomi-header.is-scrolled,
	header.phomi-header.is-nav-open,
	header.phomi-header.is-nav-active,
	header.phomi-header.is-mega-active,
	header.phomi-header.is-nav-hover {
		background: #fff;
	}

	header.phomi-header .phomi-header__inner {
		align-items: center !important;
		display: flex !important;
		height: 64px !important;
		justify-content: space-between !important;
		max-width: none !important;
		padding: 0 16px 0 20px !important;
	}

	header.phomi-header .phomi-logo {
		left: auto !important;
		position: relative !important;
		top: auto !important;
		transform: none !important;
		width: 120px !important;
		z-index: 61;
	}

	header.phomi-header.is-nav-open .phomi-logo__default {
		opacity: 0;
	}

	header.phomi-header.is-nav-open .phomi-logo__active {
		opacity: 1;
	}

	html body header.phomi-header button.phomi-nav-toggle,
	header.phomi-header .phomi-nav-toggle {
		-webkit-appearance: none;
		appearance: none;
		background: transparent !important;
		background-color: transparent !important;
		background-image: none !important;
		border: 0 !important;
		border-radius: 0 !important;
		box-shadow: none !important;
		color: transparent !important;
		display: flex;
		filter: none !important;
		height: 44px !important;
		min-height: 44px !important;
		min-width: 44px !important;
		outline: none !important;
		padding: 0 !important;
		transform: none !important;
		width: auto !important;
		z-index: 70;
	}

	header.phomi-header .phomi-nav-toggle__label {
		display: block;
	}

	header.phomi-header .phomi-header__cta {
		display: none;
	}

	header.phomi-header .phomi-nav__partner-hub {
		display: block;
	}

	html body header.phomi-header button.phomi-nav-toggle:hover,
	html body header.phomi-header button.phomi-nav-toggle:focus,
	html body header.phomi-header button.phomi-nav-toggle:focus-visible,
	html body header.phomi-header button.phomi-nav-toggle:active,
	header.phomi-header .phomi-nav-toggle:hover,
	header.phomi-header .phomi-nav-toggle:focus,
	header.phomi-header .phomi-nav-toggle:focus-visible,
	header.phomi-header .phomi-nav-toggle:active,
	header.phomi-header.is-nav-open .phomi-nav-toggle {
		background: transparent !important;
		background-color: transparent !important;
		box-shadow: none !important;
		filter: none !important;
		outline: none !important;
		transform: none !important;
	}

	header.phomi-header .phomi-nav {
		background: #fff;
		bottom: 0;
		display: block !important;
		height: auto !important;
		left: 0 !important;
		overflow: auto;
		padding: 88px 24px 40px !important;
		pointer-events: none;
		position: fixed !important;
		right: 0;
		top: 0 !important;
		transform: translateY(-12px);
		transition: opacity 0.22s ease, visibility 0.22s ease, transform 0.22s ease;
		visibility: hidden;
		white-space: normal !important;
		width: 100% !important;
		z-index: 50;
		opacity: 0;
	}

	header.phomi-header.is-nav-open .phomi-nav {
		display: block !important;
		opacity: 1;
		pointer-events: auto;
		transform: none;
		visibility: visible;
	}

	header.phomi-header .phomi-nav > ul {
		align-items: stretch !important;
		display: flex !important;
		flex-direction: column !important;
		flex-wrap: nowrap !important;
		gap: 0 !important;
		justify-content: flex-start !important;
	}

	header.phomi-header .phomi-nav > ul > li {
		width: 100%;
	}

	header.phomi-header .phomi-nav > ul > li > a,
	header.phomi-header .phomi-nav > ul > li:hover > a,
	header.phomi-header .phomi-nav > ul > li:focus-within > a,
	header.phomi-header .phomi-nav > ul > li > a:hover,
	header.phomi-header .phomi-nav > ul > li > a:focus,
	header.phomi-header .phomi-nav > ul > li > a:focus-visible,
	header.phomi-header .phomi-nav > ul > li > a:active {
		background: transparent !important;
		border-bottom: 1px solid #eee;
		box-shadow: none !important;
		color: #111 !important;
		display: flex !important;
		filter: none !important;
		font-size: 16px !important;
		justify-content: space-between;
		letter-spacing: 0 !important;
		line-height: 24px !important;
		min-height: 52px;
		opacity: 1 !important;
		outline: none !important;
		padding: 14px 0 !important;
		/* text-transform: uppercase; */
		transform: none !important;
		transition: color 0.2s ease !important;
		width: 100%;
	}

	header.phomi-header .phomi-nav > ul > li > a:active {
		color: var(--phomi-blue, #70c7d1) !important;
	}

	header.phomi-header .phomi-nav .has-menu > a::after {
		border-bottom: 1.5px solid #111 !important;
		border-right: 1.5px solid #111 !important;
		content: "";
		display: block !important;
		flex: 0 0 auto;
		height: 8px !important;
		margin-left: 12px !important;
		transform: rotate(45deg) !important;
		transition: transform 0.2s ease;
		width: 8px !important;
	}

	header.phomi-header .phomi-nav .has-menu.is-mega-open > a::after {
		transform: rotate(225deg) !important;
	}

	.phomi-menu-scrim {
		display: none !important;
	}

	header.phomi-header .phomi-mega-menu,
	header.phomi-header .has-mega-menu--about .phomi-mega-menu,
	header.phomi-header .has-mega-menu--case .phomi-mega-menu,
	header.phomi-header .has-mega-menu--product .phomi-mega-menu {
		background: transparent !important;
		display: none !important;
		height: auto !important;
		left: auto !important;
		min-height: 0 !important;
		opacity: 1 !important;
		overflow: visible !important;
		pointer-events: auto !important;
		position: static !important;
		top: auto !important;
		transform: none !important;
		visibility: visible !important;
		width: 100% !important;
	}

	header.phomi-header.is-nav-open .has-mega-menu.is-mega-open > .phomi-mega-menu,
	header.phomi-header .has-mega-menu.is-mega-open > .phomi-mega-menu {
		display: block !important;
	}

	header.phomi-header .phomi-mega-menu__panel,
	header.phomi-header .has-mega-menu--about .phomi-mega-menu__panel,
	header.phomi-header .has-mega-menu--case .phomi-mega-menu__panel,
	header.phomi-header .has-mega-menu--product .phomi-mega-menu__panel {
		align-items: stretch !important;
		background: #f7f7f7 !important;
		display: flex !important;
		flex-direction: column !important;
		flex-wrap: nowrap !important;
		gap: 0 !important;
		grid-template-columns: none !important;
		height: auto !important;
		justify-content: flex-start !important;
		min-height: 0 !important;
		padding: 4px 0 8px 16px !important;
		position: relative !important;
		width: 100% !important;
	}

	header.phomi-header .phomi-mega-card,
	header.phomi-header .phomi-mega-card:nth-child(n),
	header.phomi-header .has-mega-menu--about .phomi-mega-card:nth-child(n),
	header.phomi-header .has-mega-menu--case .phomi-mega-card:nth-child(n),
	header.phomi-header .has-mega-menu--product .phomi-mega-card:nth-child(n),
	header.phomi-header .has-mega-menu--application .phomi-mega-card:nth-child(n),
	header.phomi-header .has-mega-menu--partner .phomi-mega-card:nth-child(n) {
		border-bottom: 1px solid #ececec;
		box-sizing: border-box !important;
		color: #333 !important;
		display: block !important;
		filter: none !important;
		flex: 0 0 auto !important;
		font-size: 14px !important;
		grid-column: auto !important;
		grid-row: auto !important;
		height: auto !important;
		left: auto !important;
		line-height: 20px !important;
		margin: 0 !important;
		min-height: 44px;
		opacity: 1 !important;
		padding: 12px 8px 12px 0 !important;
		pointer-events: auto !important;
		position: relative !important;
		top: auto !important;
		transform: none !important;
		visibility: visible !important;
		width: 100% !important;
	}

	header.phomi-header .phomi-mega-card img {
		display: none !important;
	}

	header.phomi-header .phomi-mega-card span {
		color: inherit;
		display: block !important;
		font-size: 14px !important;
		line-height: 20px !important;
		position: static !important;
		white-space: normal !important;
	}

	header.phomi-header .phomi-mega-card:hover,
	header.phomi-header .phomi-mega-card:focus-visible {
		filter: none !important;
		transform: none !important;
		color: var(--phomi-blue, #70c7d1) !important;
	}

	header.phomi-header .phomi-mega-card__toggle {
		display: none !important;
	}

	header.phomi-header .has-mega-menu--product .phomi-mega-card-group.has-children .phomi-mega-card__toggle {
		align-items: center !important;
		background: transparent !important;
		border: 0 !important;
		bottom: auto !important;
		color: #333 !important;
		cursor: pointer;
		display: flex !important;
		height: 44px !important;
		justify-content: center !important;
		left: auto !important;
		margin: 0 !important;
		padding: 0 !important;
		position: absolute !important;
		right: 0 !important;
		top: 0 !important;
		transform: none !important;
		width: 44px !important;
		z-index: 2 !important;
	}

	header.phomi-header .has-mega-menu--product .phomi-mega-card-group.has-children .phomi-mega-card-wrap {
		position: relative !important;
	}

	header.phomi-header .has-mega-menu--product .phomi-mega-card-group.has-children .phomi-mega-card__chevron {
		border-bottom: 1.5px solid #333 !important;
		border-right: 1.5px solid #333 !important;
		display: block !important;
		height: 8px !important;
		transform: rotate(45deg) !important;
		transition: transform 0.2s ease;
		width: 8px !important;
	}

	header.phomi-header .has-mega-menu--product .phomi-mega-card-group.has-children.is-submenu-open .phomi-mega-card__chevron {
		transform: rotate(225deg) !important;
	}

	header.phomi-header .phomi-mega-submenu {
		border-top: 1px solid #ececec;
		display: none !important;
		flex-direction: column !important;
		gap: 8px !important;
		margin-top: 4px !important;
		padding: 8px 0 4px !important;
		width: 100% !important;
	}

	/* Desktop shows it as the submenu's left-hand column title; flattened into the
	   drawer it is just a stray grey line, so drop it (禅道 #3542). */
	header.phomi-header .phomi-mega-submenu__label {
		display: none !important;
	}

	header.phomi-header .phomi-mega-submenu__list {
		/* .phomi-nav ul (desktop) sets align-items: flex-start — rows would shrink to text width. */
		align-items: stretch !important;
		display: flex !important;
		flex-direction: column !important;
		gap: 0 !important;
		list-style: none !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	header.phomi-header .phomi-mega-submenu__list li {
		border-bottom: 1px solid #ececec;
		margin: 0 !important;
	}

	header.phomi-header .phomi-mega-submenu__list a {
		color: #333 !important;
		display: block !important;
		font-size: 14px !important;
		line-height: 20px !important;
		padding: 12px 8px 12px 0 !important;
		text-decoration: none !important;
	}

	header.phomi-header .phomi-mega-submenu__list a:hover,
	header.phomi-header .phomi-mega-submenu__list a:focus-visible {
		color: var(--phomi-blue, #70c7d1) !important;
	}

	header.phomi-header .phomi-mega-submenu__media {
		display: none !important;
	}

	header.phomi-header .has-mega-menu--product .phomi-mega-card-group.is-submenu-open .phomi-mega-submenu {
		display: flex !important;
		opacity: 1 !important;
		pointer-events: auto !important;
		position: static !important;
		visibility: visible !important;
	}
}

@media (max-width: 767px) {
	header.phomi-header {
		height: 60px !important;
	}

	header.phomi-header .phomi-header__inner {
		height: 60px !important;
	}

	header.phomi-header .phomi-logo {
		width: 108px !important;
	}

	header.phomi-header .phomi-nav {
		padding-top: 80px !important;
	}
}

@media (min-width: 1181px) {
	.phomi-nav-toggle {
		display: none !important;
	}

	header.phomi-header .phomi-header__cta {
		border-radius: clamp(6px, 0.416667vw, 8px);
		font-size: clamp(13px, 0.729167vw, 14px);
		line-height: clamp(19px, 1.041667vw, 20px);
		padding: clamp(7px, 0.520833vw, 10px) clamp(14px, 1.145833vw, 22px);
		position: absolute;
		right: clamp(16px, 2vw, 40px);
		top: 50%;
		transform: translateY(-50%);
	}

	/* 1920 design = 14px; pure vw drops to ~10px at 1400 — floor at 13px */
	header.phomi-header .phomi-nav > ul > li > a {
		font-size: clamp(13px, 0.729167vw, 14px);
		line-height: clamp(19px, 1.041667vw, 20px);
	}

	header.phomi-header .phomi-nav ul {
		gap: clamp(14px, 2.1875vw, 42px);
	}

	header.phomi-header .phomi-nav .has-menu > a::after {
		height: clamp(4px, 0.260417vw, 5px);
		margin-left: clamp(6px, 0.416667vw, 8px);
		width: clamp(4px, 0.260417vw, 5px);
	}

	/* Mega menu card flow — overrides page CSS absolute positioning (product.css etc.). */
	.phomi-nav .has-mega-menu--about .phomi-mega-menu__panel,
	.phomi-nav .has-mega-menu--case .phomi-mega-menu__panel,
	.phomi-nav .has-mega-menu--product .phomi-mega-menu__panel,
	.phomi-nav .has-mega-menu--technology .phomi-mega-menu__panel,
	.phomi-nav .has-mega-menu--application .phomi-mega-menu__panel,
	.phomi-nav .has-mega-menu--partner .phomi-mega-menu__panel {
		display: flex !important;
		flex-wrap: wrap !important;
		justify-content: center !important;
	}

	.phomi-nav .has-mega-menu .phomi-mega-card,
	.phomi-nav .has-mega-menu .phomi-mega-card:nth-child(n) {
		flex: 0 0 var(--phomi-mega-card-width, clamp(240px, 16.145833vw, 310px)) !important;
		left: auto !important;
		position: relative !important;
		top: auto !important;
		width: var(--phomi-mega-card-width, clamp(240px, 16.145833vw, 310px)) !important;
	}

	.phomi-nav .has-mega-menu--product .phomi-mega-card-group {
		flex: 0 0 var(--phomi-mega-card-width, clamp(240px, 16.145833vw, 310px)) !important;
		left: auto !important;
		position: static !important;
		top: auto !important;
		width: var(--phomi-mega-card-width, clamp(240px, 16.145833vw, 310px)) !important;
	}

	.phomi-nav .has-mega-menu--product .phomi-mega-card-wrap,
	.phomi-nav .has-mega-menu--product .phomi-mega-card-group:not(.has-children) .phomi-mega-card {
		position: relative !important;
		width: 100% !important;
	}
}

/* Laptop: center logo + nav as one block; vw left offset overflows on the right. */
@media (min-width: 1181px) and (max-width: 1600px) {
	header.phomi-header .phomi-header__inner {
		align-items: center;
		box-sizing: border-box;
		column-gap: clamp(6px, 0.8vw, 14px);
		display: flex;
		justify-content: center;
		padding-inline: clamp(16px, 2vw, 32px);
	}

	header.phomi-header .phomi-logo {
		flex: 0 0 auto;
		left: auto;
		margin-top: 0;
		position: relative;
		top: auto;
		width: clamp(96px, 8.333333vw, 160px);
	}

	header.phomi-header .phomi-nav {
		display: flex;
		flex: 0 0 auto;
		justify-content: flex-start;
		left: auto;
		margin-top: 0;
		min-width: 0;
		position: relative;
		top: auto;
		transform: none;
		width: auto;
	}

	header.phomi-header .phomi-nav > ul {
		flex-wrap: nowrap;
		justify-content: flex-start;
	}
}

/* Wide desktop: keep Figma top offset; avoid transform (breaks fixed mega menu width). */
@media (min-width: 1601px) {
	header.phomi-header .phomi-header__inner {
		align-items: center;
		display: flex;
		height: 100%;
	}

	header.phomi-header .phomi-nav {
		align-self: center;
		margin-top: 0;
		top: auto;
		transform: none;
	}
}

@media (min-width: 1181px) and (max-width: 1400px) {
	header.phomi-header .phomi-nav > ul {
		gap: 0;
	}

	header.phomi-header .phomi-nav > ul > li {
		margin: 0 12px;
	}
}
