﻿/*
Theme Name: Hello Elementor Xinye
Description: Child theme for the xinyetextiles.com clone. Replays the reference
  site's element classes and stylesheets so the mirrored Elementor content renders
  exactly like the source, while staying fully editable in Elementor.
Template: hello-elementor
Version: 1.0.0
*/

/* Styles are loaded from functions.php, after Elementor's own generated CSS. */

/*
 * Header stacking.
 *
 * The reference header is a <header> with static positioning: the hero section
 * (positioned, pulled up by -88px) paints over the header's green background while
 * the header's inner section keeps z-index:10, so the nav stays above the hero and
 * the hero image shows through the header. This build wraps the header markup in a
 * positioned, z-index:99 div, which lifts the green background above the hero and
 * turns the top of every page into a solid bar.
 */
header.ehf-header,
.ehf-header,
#masthead,
.elementor-225 {
	position: static !important;
	z-index: auto !important;
}

/*
 * Font metric note: shipping the real Poppins, and size-adjusting the local face
 * to its metrics (96%, 98%), both measured worse across the case-study pages 闂?the
 * reference's line breaks do not follow a single width scale. The system face is kept
 * as-is; the residual 闂?% on the case pages is per-block line wrapping.
 */

/*
 * The reference runs Elementor 4, which renders widget markup without the
 * `.elementor-widget-container` wrapper. On Elementor 3.x that wrapper adds a
 * line box around the inline-level <img>, so an image whose parent sets a tall
 * line-height measures roughly twice its real height. Block-level images restore
 * the reference geometry.
 */
.elementor-widget-image .elementor-widget-container > img,
.elementor-widget-image > img {
	display: block;
}

/*
 * Same line-box problem where the image sits inside a link: keep the image inline
 * (several widgets lay images out in a row and need inline flow) but collapse the
 * line box, which otherwise adds the font descender to every logo.
 */
.elementor-widget-image .elementor-widget-container {
	line-height: 0;
}

.elementor-widget-image .elementor-widget-container figcaption,
.elementor-widget-image .widget-image-caption {
	line-height: 1.4;
}

/*
 * Gallery parity layer.
 *
 * The replayed gallery markup carries Elementor 4's layout variables on the
 * container (--columns / --rows / --aspect-ratio / --hgap / --vgap) and places
 * each item with --column / --row, but the grid itself lives in a stylesheet this
 * Elementor build does not ship. Without it the container collapses to 1px.
 */
.elementor-gallery__container {
	display: grid;
	grid-template-columns: repeat(var(--columns, 3), minmax(0, 1fr));
	grid-auto-rows: auto;
	gap: var(--vgap, 10px) var(--hgap, 10px);
	min-height: 1px;
}

.elementor-gallery__container > .e-gallery-item {
	position: relative;
	grid-column: var(--column, auto);
	grid-row: var(--row, auto);
	overflow: hidden;
	display: block;
}

.elementor-gallery__container > .e-gallery-item > .e-gallery-image {
	display: block;
	width: 100%;
	height: 0;
	padding-top: var(--aspect-ratio, 66.6666%);
	background-size: cover;
	background-position: center center;
	background-repeat: no-repeat;
}

/*
 * Elementor 4 positions icon-box icons with logical values (inline-start /
 * inline-end); this build's widget CSS only knows left/right/top, so a replayed
 * `elementor-position-inline-start` box falls back to "icon above text" and doubles
 * its height. Map the logical values to the flex layout they describe.
 */
.elementor-position-inline-start .elementor-icon-box-wrapper,
.elementor-position-inline-end .elementor-icon-box-wrapper {
	display: flex;
	align-items: center;
}

.elementor-position-inline-end .elementor-icon-box-wrapper {
	flex-direction: row-reverse;
}

.elementor-position-inline-start .elementor-icon-box-wrapper > .elementor-icon-box-icon {
	margin-inline-end: 10px;
}

.elementor-position-inline-end .elementor-icon-box-wrapper > .elementor-icon-box-icon {
	margin-inline-start: 10px;
}

.elementor-position-inline-start .elementor-icon-box-wrapper > .elementor-icon-box-content,
.elementor-position-inline-end .elementor-icon-box-wrapper > .elementor-icon-box-content {
	min-width: 0;
	/* The reference's content column takes the remaining width; without this the
	   text column keeps its content width and wraps earlier than the reference. */
	flex: 1 1 auto;
}

/*
 * Contact page: the reference's icon-list d84c2d4 is an empty inline list that
 * renders 23x0 (invisible). This build loads the Material Design Icons stylesheet
 * that the reference only loads per-widget, so the "-" glyph becomes visible and
 * adds a 24px line. Hide it to match the reference.
 */
.elementor-element-d84c2d4 {
	display: none;
}

/*
 * The icon-box description is a <p>; the widget CSS of Elementor 4 removes its
 * margins while 3.x leaves the paragraph's own top/bottom margin, which adds 14px
 * per icon box.
 */
.elementor-icon-box-content > p.elementor-icon-box-description {
	margin: 0;
}

/*
 * Footer link lists.
 *
 * The reference's footer icon-lists carry an `mdi mdi-minus` glyph that renders 18px
 * wide but zero tall: the Material Design Icons font is not loaded there, so nothing is
 * drawn. This build loads that font globally, which turns every footer link into
 * "- Home". Keep the indent and drop the glyph, exactly as the reference renders it.
 */
.elementor-icon-list-icon i.mdi-minus {
	font-size: 0;
	line-height: 0;
}

/* The reference keeps the 18px indent the (invisible) glyph occupied. */
.elementor-icon-list-icon:has(> i.mdi-minus) {
	width: 18px;
}

/*
 * Bottom inquiry row (home).
 *
 * The reference splits the 1280px row into a 600px dark info panel and a 660px form.
 * Both children size themselves from their content, and this build's form widget has a
 * narrower intrinsic width, so the panel swells to 837px while the form shrinks to
 * 423px. The reference's own split is restored as percentages of the row.
 */
@media (min-width: 1025px) {
	.elementor-768 .elementor-element-50acfa0 { width: 46.875%; }
	.elementor-768 .elementor-element-bba2d15 { width: 51.5625%; }
}

/*
 * Floating contact buttons (phone / email / WhatsApp / WeChat).
 *
 * The markup and stylesheet here are the reference's own; what is missing is the
 * plugin's JS, which positions the stack (pinned 200px above the viewport bottom,
 * each channel lifted above the list in 52px steps). Without it the six buttons pile
 * up on one spot, so the same geometry is expressed in CSS.
 */
.chaty-widget .chaty-channel-list,
.chaty-widget .chaty-channels {
	position: static;
	background: transparent;
	box-shadow: none;
}

/*
 * Every button is pinned individually. Chaty's geometry is viewport independent:
 * 44x44, 29px from the right edge, the bottom button 200px above the viewport
 * bottom, 52px between buttons. Anchoring the container instead of the buttons
 * makes the stack drift and paint a panel whenever the plugin's container rules win.
*/
.chaty-widget .chaty-channel-list .chaty-channel,
.chaty-widget .chaty-cta-main,
.chaty-widget .chaty-cta-close {
	position: fixed;
	right: 29px;
	bottom: 200px;
	width: 44px;
	height: 44px;
	/* The plugin's own 4px margins are for its JS layout and shift these off by 4px. */
	margin: 0;
}

.chaty-widget .chaty-channel-list .chaty-channel:nth-child(1) { bottom: 408px; }
.chaty-widget .chaty-channel-list .chaty-channel:nth-child(2) { bottom: 356px; }
.chaty-widget .chaty-channel-list .chaty-channel:nth-child(3) { bottom: 304px; }
.chaty-widget .chaty-channel-list .chaty-channel:nth-child(4) { bottom: 252px; }

/*
 * The plugin positions the channels with a per-child translateY; this build pins them
 * with "bottom" instead, so the two must not both apply (they doubled the offset).
 */
.chaty-widget .chaty-channel-list .chaty-channel {
	transform: none !important;
}


/*
 * The plugin pins every channel - and the <a> / .chaty-svg inside it - at 54px,
 * which is its default size. The reference runs them at 44px, so the icon would
 * overflow its 44px circle here and read as a bigger, brighter button.
 */
.chaty-widget .chaty-channel > a,
.chaty-widget .chaty-channel .chaty-svg,
.chaty-widget .chaty-cta-main > a,
.chaty-widget .chaty-cta-main .chaty-svg,
.chaty-widget .chaty-cta-close > a,
.chaty-widget .chaty-cta-close .chaty-svg,
.chaty-widget .chaty-channel svg,
.chaty-widget .chaty-cta-main svg,
.chaty-widget .chaty-cta-close svg {
	width: 44px;
	height: 44px;
}

/*
 * Call-to-action cards ("Engineering Case").
 *
 * The reference's cards are the Pro CTA widget in the "cover" skin: a photo
 * behind white text and a transparent button with a white outline. This build
 * keeps the skin class, but the kit's primary colour fills the button solid green.
 */
.elementor-cta--skin-cover .elementor-cta__button.elementor-button {
	background-color: transparent;
	border: 1px solid #ffffff;
	color: #ffffff;
}

.elementor-cta--skin-cover .elementor-cta__button.elementor-button:hover {
	background-color: #ffffff;
	color: #1f7a5e;
}

/*
 * Language entry flag.
 *
 * The reference's English item is a TranslatePress switcher that prints a flag image
 * before the label. The flag asset ships with the (inactive) TranslatePress plugin,
 * so the same image is used as the link's background.
 */
.elementor-nav-menu--main .elementor-nav-menu > li.menu-item-english > a.elementor-item {
	/* Flag on the left and the caret on the right, in one declaration: the generic
	   caret rule for items with children would otherwise replace the flag. */
	background-image:
		url("/wp-content/plugins/translatepress-multilingual/assets/flags/4x3/en_US.svg"),
		url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512'%3E%3Cpath fill='%23ffffff' d='M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z'/%3E%3C/svg%3E");
	background-repeat: no-repeat, no-repeat;
	background-position: left center, right center;
	background-size: 20px 15px, 10px 10px;
	padding-inline-start: 28px !important;
	padding-inline-end: 18px !important;
}

/*
 * Sub-menu caret.
 *
 * The reference's nav-menu renders the `submenu_icon` SVG inside the parent link;
 * this build keeps the setting but never emits the element. A pseudo-element is
 * not an option - Elementor uses ::after on the same anchor for the active
 * underline - so the glyph is painted as the link's own background.
 */
.elementor-nav-menu > li.menu-item-has-children > a.elementor-item {
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512'%3E%3Cpath fill='%23ffffff' d='M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right center;
	background-size: 10px 10px;
	padding-inline-end: 18px !important;
}

/*
 * Elementor 3.x always renders the blockquote footer (author / tweet button) even
 * when the widget has neither, and its margins add ~63px. The reference blockquote
 * is content-only, so the empty footer is dropped.
 */
.elementor-element-9927174 blockquote.elementor-blockquote > .e-q-footer {
	display: none;
}

.elementor-widget-blockquote blockquote.elementor-blockquote > .e-q-footer:not(:has(*)) {
	display: none;
}

/*
 * Elementor 3.x separates widgets with margin-bottom:20px; the reference (4.x)
 * separates them with the container's own gap. With both applied every stack is
 * taller by 20px per widget, which is most of the residual height delta.
 */
.e-con > .e-con-inner > .elementor-widget:not(:last-child),
.e-con-inner > .elementor-widget:not(:last-child),
.e-con-inner > .elementor-element:not(:last-child) {
	margin-bottom: 0;
}

/*
 * Case-study body container (post 561) is full-bleed in the reference: its children
 * span the whole 1440px viewport, while this build treats the container as boxed and
 * caps the inner at 1280 (80px of side padding), which re-wraps every text block.
 */
.elementor-561 .elementor-element.elementor-element-07f8035 > .e-con-inner {
	max-width: 100%;
	width: 100%;
	padding-left: 0;
	padding-right: 0;
	/* The reference's inner container computes to an inline box, so its 20px row-gap
	   never applies and the stacked sections sit flush. Keeping flex here adds 20px
	   between each of the 24 children (~460px in total). */
	display: block;
}



/*
 * The "Leave a message" bar is hidden by the plugin on narrow viewports here, while
 * the reference keeps it at the bottom-right at every width. Force the same behaviour.
 */
#nbb2b-leave-message-widget {
	display: block !important;
}

/*
 * The plugin adds its own mobile action bar (Products / List / Contact / Message /
 * Top) on narrow viewports. The reference runs with that feature off, so the bar is
 * hidden and the spacing it reserves is removed; the "Leave a message" bar then sits
 * where the reference has it.
 */
#nbb2b-mobile-menu,
.nbb2b-mobile-menu {
	display: none !important;
}

html.nbb2b-has-mobile-menu body {
	padding-bottom: 0 !important;
}


/*
 * Desktop dropdowns.
 *
 * Elementor Pro's nav bundle aborts on init in this build: it reads
 * `getElementSettings().submenu_icon.value` and the settings object is not registered
 * for widgets rendered inside the header template, so nothing opens the sub-menus.
 *
 * Only the display is toggled here. The panel itself - position, automatic width, white
 * background, 0 5px 20px rgba(0,0,0,.25) shadow, 12px 35px item padding, #1E1C1F text
 * and the 1px separators - already comes from the reference's own header stylesheet.
 */
@media (min-width: 1025px) {
	/* The panel keeps the reference styling; only the parts the collapsed state
	   cannot express are set here: enough width for the longest label and a layer
	   above the hero image. */
	.elementor-nav-menu--main .elementor-nav-menu > li.menu-item-has-children > ul.sub-menu {
		display: none;
		/* SmartMenus sizes the panel to its content when it opens; the collapsed CSS
		   width (12em) is not what the reference shows. */
		width: auto;
		max-width: 320px;
		z-index: 1000;
	}

	/* The reference opens the panel on click (the parent link does not navigate), so the
	   open state is a class the theme script toggles - not :hover. */
	.elementor-nav-menu--main .elementor-nav-menu > li.menu-item-has-children.xy-submenu-open > ul.sub-menu {
		display: block;
	}
}

/* Language rows carry their flag inside the item's own left padding. */
.elementor-nav-menu--dropdown li.menu-item-lang-de > a {
	background-image: url("/wp-content/plugins/translatepress-multilingual/assets/flags/4x3/de_DE.svg");
	background-repeat: no-repeat;
	background-position: 10px center;
	background-size: 20px 15px;
	padding-left: 40px;
}

.elementor-nav-menu--dropdown li.menu-item-lang-fr > a {
	background-image: url("/wp-content/plugins/translatepress-multilingual/assets/flags/4x3/fr_FR.svg");
	background-repeat: no-repeat;
	background-position: 10px center;
	background-size: 20px 15px;
	padding-left: 40px;
}

.elementor-nav-menu--dropdown li.menu-item-lang-it > a {
	background-image: url("/wp-content/plugins/translatepress-multilingual/assets/flags/4x3/it_IT.svg");
	background-repeat: no-repeat;
	background-position: 10px center;
	background-size: 20px 15px;
	padding-left: 40px;
}

.elementor-nav-menu--dropdown li.menu-item-lang-es > a {
	background-image: url("/wp-content/plugins/translatepress-multilingual/assets/flags/4x3/es_ES.svg");
	background-repeat: no-repeat;
	background-position: 10px center;
	background-size: 20px 15px;
	padding-left: 40px;
}

.elementor-nav-menu--dropdown li.menu-item-lang-ar > a {
	background-image: url("/wp-content/plugins/translatepress-multilingual/assets/flags/4x3/ar.svg");
	background-repeat: no-repeat;
	background-position: 10px center;
	background-size: 20px 15px;
	padding-left: 40px;
}

.elementor-nav-menu--dropdown li.menu-item-lang-he > a {
	background-image: url("/wp-content/plugins/translatepress-multilingual/assets/flags/4x3/he_IL.svg");
	background-repeat: no-repeat;
	background-position: 10px center;
	background-size: 20px 15px;
	padding-left: 40px;
}

.elementor-nav-menu--dropdown li.menu-item-lang-id > a {
	background-image: url("/wp-content/plugins/translatepress-multilingual/assets/flags/4x3/id_ID.svg");
	background-repeat: no-repeat;
	background-position: 10px center;
	background-size: 20px 15px;
	padding-left: 40px;
}


/*
 * Mobile navigation.
 *
 * Elementor renders the burger panel as a max-height:0, overflow:hidden container and
 * relies on its nav script to expand it - the script aborts on init in this build, so the
 * theme opens it with a class instead. Sub-menus inside the panel use the same click
 * toggle as the desktop ones.
 */
@media (max-width: 1024px) {
	.elementor-widget-nav-menu.xy-mobile-open .elementor-nav-menu--dropdown.elementor-nav-menu__container {
		display: block !important;
		height: auto !important;
		max-height: 80vh !important;
		overflow-y: auto !important;
	}

	.elementor-widget-nav-menu .elementor-nav-menu--dropdown ul.sub-menu {
		display: none;
	}

	.elementor-widget-nav-menu .elementor-nav-menu--dropdown li.xy-submenu-open > ul.sub-menu {
		display: block;
	}
}

/* xinye-language-dropdown-fix */
/* 语言下拉菜单文字可见性修复：原来用 --e-global-color-secondary（白色）画在白底上 */
.elementor-225 .elementor-element.elementor-element-1fbe3cb9 .elementor-nav-menu--dropdown a,
.elementor-225 .elementor-element.elementor-element-1fbe3cb9 .elementor-nav-menu--dropdown .elementor-sub-item,
.elementor-225 .elementor-element.elementor-element-1fbe3cb9 .elementor-nav-menu--dropdown .elementor-item {
  color: #1f2a24 !important;
  fill: #1f2a24 !important;
}
.elementor-225 .elementor-element.elementor-element-1fbe3cb9 .elementor-nav-menu--dropdown a:hover,
.elementor-225 .elementor-element.elementor-element-1fbe3cb9 .elementor-nav-menu--dropdown a:focus,
.elementor-225 .elementor-element.elementor-element-1fbe3cb9 .elementor-nav-menu--dropdown a.highlighted {
  color: #0d5c3f !important;
  fill: #0d5c3f !important;
}
/* 移动端汉堡菜单里的语言项同样处理 */
.elementor-nav-menu--dropdown a.elementor-sub-item,
.elementor-nav-menu--dropdown a.elementor-item {
  color: #1f2a24 !important;
}

/* xinye-language-dropdown-fix-v2 */
/* v2：header 里有一行内联 #masthead a{color:#fff !important}，必须用 ID 级选择器压过去 */
#masthead .elementor-nav-menu--dropdown a.elementor-sub-item,
#masthead .elementor-nav-menu--dropdown a.elementor-item,
#masthead .elementor-nav-menu li.menu-item-lang > a,
#masthead .elementor-nav-menu li.menu-item-english > ul.sub-menu a {
  color: #1f2a24 !important;
  fill: #1f2a24 !important;
}
#masthead .elementor-nav-menu--dropdown a.elementor-sub-item:hover,
#masthead .elementor-nav-menu--dropdown a.elementor-sub-item:focus,
#masthead .elementor-nav-menu li.menu-item-lang > a:hover,
#masthead .elementor-nav-menu li.menu-item-lang > a:focus {
  color: #0d5c3f !important;
  fill: #0d5c3f !important;
}

/* xinye-language-dropdown-fix-v3-vi-flag */
/* 越南语国旗（与其它语言项同一套写法） */
.elementor-nav-menu--dropdown li.menu-item-lang-vi > a {
  background-image: url("/wp-content/plugins/translatepress-multilingual/assets/flags/4x3/vi.svg");
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 20px 15px;
  padding-left: 40px;
}
