/* Fixed header: logo, page navigation, tools (language / account / search) and CONTACT */

.site-header {
	position: fixed; top: 0; left: 0; right: 0; z-index: 800;
	height: var(--header-h);
	color: var(--c-white);
	background: transparent;
	transition: background-color .3s, transform .3s var(--ease-header);
}
.site-header.is-scrolled { background: var(--c-black); }
.site-header.is-hidden { transform: translateY(-100%); }
.site-header.is-open { background: var(--c-black); transform: none; }

.site-header__inner {
	position: relative;
	display: flex; align-items: center;
	height: 100%;
	padding: 0 calc(74 * var(--u)) 0 var(--header-logo-x);
}

.site-header__logo { display: block; flex: 0 0 auto; margin-right: auto; margin-left: calc(18 * var(--u)); }
.site-header__logo img { width: calc(139 * var(--u)); height: auto; }

.site-header__panel {
	display: flex; align-items: center;
	gap: 24px;
	height: 100%;
}

/* ---- Page navigation ---- */
/* Wix: every dropdown hangs from the right edge of the whole menu, 328px wide, text right-aligned */
.site-nav__list { position: relative; display: flex; align-items: center; gap: calc(24 * var(--u)); }

.site-nav__item { position: static; }

.site-nav__link, .site-tools__link {
	display: inline-flex; align-items: center; gap: 6px;
	height: var(--header-h);
	font-family: var(--f-roman), var(--f-cjk);
	font-size: 17px;   /* fixed in the Wix menu style */
	color: var(--c-white);
	transition: color .2s;
}
.site-nav__link:hover, .site-tools__link:hover,
.has-menu.is-open > .site-nav__link, .has-menu.is-open > .site-tools__link { color: var(--c-text-light); }
.site-nav__item.is-active > .site-nav__link { color: var(--c-white); }

.site-nav__chevron { width: 10px; height: 10px; transition: transform .2s; }
.has-menu.is-open .site-nav__chevron { transform: rotate(180deg); }

/* Dropdown panel: black, rounded bottom corners, 10px padding, items 36px tall */
.site-nav__menu {
	position: absolute; left: -54px; top: 100%;
	min-width: 328px;
	padding: 10px 24px;
	background: var(--c-black);
	border-radius: 16px;
	opacity: 0; visibility: hidden; transform: translateY(-4px);
	transition: opacity .2s, transform .2s, visibility 0s linear .2s;
}
/* 從文字下方約 12px 處展開（選單項目本身佔滿 header 高度，滑鼠移入面板不會中斷 hover） */
.site-nav .site-nav__menu { left: auto; right: 0; top: calc(50% + 22px); width: 328px; min-width: 0; text-align: right; }
.site-tools__item { position: relative; }
/* 語言、帳號選單：與主選單相同的展開位置，寬度依內容、不換行 */
.site-nav__menu--right { left: auto; right: -10px; top: calc(50% + 22px); width: max-content; min-width: 200px; text-align: right; white-space: nowrap; }
.has-menu:hover > .site-nav__menu,
.has-menu.is-open > .site-nav__menu,
.has-menu:focus-within > .site-nav__menu {
	opacity: 1; visibility: visible; transform: none;
	transition: opacity .2s, transform .2s, visibility 0s;
}
.site-nav__menu a {
	display: block;
	padding: 8px 0;
	min-height: 36px;
	font-family: var(--f-roman), var(--f-cjk);
	font-size: 17px; line-height: 20px;
	color: var(--c-white);
	transition: color .2s;
}
.site-nav__menu a:hover, .site-nav__menu .is-active > a { color: var(--c-text-light); }

/* ---- Tools ---- */
.site-tools { display: flex; align-items: center; gap: 20px; margin-left: 16px; }
.site-tools__item { position: relative; }
.site-tools__link { font-family: var(--f-grotesk), var(--f-cjk); font-size: 15px; letter-spacing: .8px; text-transform: uppercase; }
.site-tools { gap: calc(20 * var(--u)); margin-left: calc(16 * var(--u)); }
.site-tools__link .icon { width: 20px; height: 20px; }
.site-tools__link .site-nav__chevron { width: 10px; height: 10px; }

.site-search { display: flex; align-items: center; }
.site-search__form {
	display: flex; align-items: center;
	width: 0; overflow: hidden;
	transition: width .3s var(--ease-out-cubic);
}
.site-search.is-open .site-search__form { width: 220px; }
.site-search__form input {
	width: 100%; height: 36px;
	padding: 0 8px 0 12px;
	background: transparent; border: 0; border-bottom: 1px solid var(--c-text-light);
	color: var(--c-white); outline: none;
	font-family: var(--f-roman), var(--f-cjk); font-size: 15px;
}
.site-search__form input::placeholder { color: var(--c-text-light); }
.site-search__form button { display: flex; padding: 6px; color: var(--c-white); }
.site-search__form button .icon { width: 18px; height: 18px; }

.site-header__contact { margin-left: 16px; }

/* ---- Mobile toggle ---- */
.site-header__toggle { display: none; position: relative; width: 44px; height: 44px; margin-left: 12px; }
.site-header__toggle-bar {
	position: absolute; left: 11px; width: 22px; height: 2px; background: currentColor;
	transition: transform .3s, opacity .2s;
}
.site-header__toggle-bar:nth-child(1) { top: 14px; }
.site-header__toggle-bar:nth-child(2) { top: 21px; }
.site-header__toggle-bar:nth-child(3) { top: 28px; }
.site-header.is-open .site-header__toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.is-open .site-header__toggle-bar:nth-child(2) { opacity: 0; }
.site-header.is-open .site-header__toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/*
Mobile: a provisional stacked menu until the designer delivers the mobile layout.
Only the CSS below is expected to change then; the markup stays.
*/
@media (max-width: 1100px) {
	:root { --header-h: 72px; --header-logo-x: 20px; }
	.site-nav__link, .site-tools__link { font-size: 17px; }

	.site-header__inner { padding-right: 12px; }
	.site-header__logo { margin-left: 0; }
	.site-header__logo img { width: 120px; }
	.site-header__toggle { display: block; }

	.site-header__panel {
		position: fixed; left: 0; right: 0; top: var(--header-h); bottom: 0;
		display: flex; flex-direction: column; align-items: stretch; gap: 0;
		padding: 8px 20px 40px;
		background: var(--c-black);
		overflow-y: auto;
		opacity: 0; visibility: hidden; transform: translateY(-8px);
		transition: opacity .25s, transform .25s, visibility 0s linear .25s;
	}
	.site-header.is-open .site-header__panel { opacity: 1; visibility: visible; transform: none; transition: opacity .25s, transform .25s, visibility 0s; }

	.site-nav__list { display: block; }
	.site-nav__link, .site-tools__link { height: auto; padding: 14px 0; font-size: 20px; width: 100%; justify-content: space-between; }
	.site-nav__item, .site-tools__item { border-bottom: 1px solid #2a2a2a; }

	.site-nav__menu, .site-nav__menu--right {
		position: static; min-width: 0; padding: 0 0 8px 16px;
		border-radius: 0; display: none; opacity: 1; visibility: visible; transform: none; transition: none;
	}
	.has-menu.is-open > .site-nav__menu { display: block; }
	.site-nav__menu a { font-size: 17px; }
	.site-nav .site-nav__menu { top: auto; width: auto; padding: 0 0 8px 16px; border-radius: 0; text-align: left; }
	.site-nav__menu--right { top: auto; width: auto; padding: 0 0 8px 16px; border-radius: 0; text-align: left; white-space: normal; }

	/* Order of the open menu: search at the top, under the close button; the pages; language
	   and account; CONTACT as a full-width button closing the list. The tool items join the
	   panel's own column (display: contents) so they can be placed around the page links. */
	.site-tools { display: contents; }
	.site-tools__item { order: 1; }
	.site-tools__link { text-transform: none; letter-spacing: 0; font-family: var(--f-roman), var(--f-cjk); }
	.site-search { order: -1; display: block; padding: 4px 0 12px; border-bottom: 0; }
	.site-search__button { display: none; }
	.site-search__form, .site-search.is-open .site-search__form { width: 100%; padding: 0 6px 0 4px; border-radius: 22px; background: #1a1a1a; }
	.site-search__form input { height: 44px; border-bottom: 0; padding-left: 14px; font-size: 16px; }   /* 16px: iOS does not zoom into the field */
	.site-search__form button { padding: 10px; }

	.site-header__contact { order: 2; flex: 0 0 auto; width: 100%; height: 48px; margin: 32px 0 0; }
}

/* Header bar of the Wix tablet (80px, logo 78px) and mobile (40px, logo 40px) layouts.
   The menu stays the stacked one above until the designer delivers the mobile menu. */
@media (max-width: 1000px) {
	:root { --header-h: 80px; --header-logo-x: 28px; }
	.site-header__logo img { width: 78px; }
}
@media (max-width: 750px) {
	:root { --header-h: 40px; --header-logo-x: 18px; }
	.site-header__logo img { width: 40px; }
}
