/* EMG theme styles. Tokens come from the Figma "Design system" page. */

/* ---------- Appearance tokens ---------- */
:root {
	--emg-red: #fe0038;
	--emg-red-dark: #780705;
	--emg-bg: #f5f5f5;
	--emg-text: #101010;
	--emg-surface: #f5f5f5;
	--emg-inverse: #1e1e1e;
	--emg-on-inverse: #f5f5f5;
	--emg-line: #9a9a9a;
	--emg-card-border: #1e1e1e;
	--emg-muted: #4a4a4a;
	--emg-field: #ffffff;
	--emg-btn-bg: #1e1e1e;
	--emg-btn-text: #f5f5f5;
	--emg-partner: #4f4f4f;
	--emg-shadow: 0 10px 30px rgb(16 16 16 / 0.08);
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--emg-bg: #101010;
		--emg-text: #f5f5f5;
		--emg-surface: #161616;
		--emg-inverse: #f5f5f5;
		--emg-on-inverse: #101010;
		--emg-line: #4a4a4a;
		--emg-card-border: #5a5a5a;
		--emg-muted: #bdbdbd;
		--emg-field: #1e1e1e;
		--emg-btn-bg: #f5f5f5;
		--emg-btn-text: #101010;
		--emg-partner: #2b2b2b;
		--emg-shadow: 0 10px 30px rgb(0 0 0 / 0.45);
		color-scheme: dark;
	}
}

:root[data-theme="dark"] {
	--emg-bg: #101010;
	--emg-text: #f5f5f5;
	--emg-surface: #161616;
	--emg-inverse: #f5f5f5;
	--emg-on-inverse: #101010;
	--emg-line: #4a4a4a;
	--emg-card-border: #5a5a5a;
	--emg-muted: #bdbdbd;
	--emg-field: #1e1e1e;
	--emg-btn-bg: #f5f5f5;
	--emg-btn-text: #101010;
	--emg-partner: #2b2b2b;
	--emg-shadow: 0 10px 30px rgb(0 0 0 / 0.45);
	color-scheme: dark;
}

body {
	background: var(--emg-bg);
	color: var(--emg-text);
	overflow-x: clip;
	-webkit-font-smoothing: antialiased;
}

:where(body) * { transition: background-color 0.25s ease, border-color 0.25s ease, color 0.2s ease; }

::selection { background: var(--emg-red); color: #fff; }

:focus-visible {
	outline: 2px solid var(--emg-red);
	outline-offset: 3px;
	border-radius: 4px;
}

.has-accent-color { color: var(--emg-red) !important; }

.skip-link.screen-reader-text:focus { background: var(--emg-bg); color: var(--emg-text); }

img { height: auto; }

/* ---------- Header ---------- */
.emg-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: var(--emg-bg); /* Solid: a backdrop-filter here would trap the fixed mobile menu overlay. */
}
.admin-bar .emg-header { top: var(--wp-admin--admin-bar--height, 32px); }

.emg-header__inner { gap: clamp(0.75rem, 2vw, 1.5rem); }

.emg-logo { display: inline-flex; color: var(--emg-text); line-height: 0; }
.emg-logo svg { width: clamp(96px, 9vw, 124px); height: auto; }

nav.emg-nav-pill {
	flex: 1 1 auto;
	border: 1px solid var(--emg-card-border);
	border-radius: var(--wp--custom--radius--button);
	padding: 0.55rem clamp(1rem, 2vw, 1.6rem);
	justify-content: space-between;
	max-width: 840px;
}
.emg-nav-pill .wp-block-navigation__container { width: 100%; justify-content: space-between; gap: clamp(0.75rem, 2.5vw, 2.5rem); }
.emg-nav-pill .wp-block-navigation-item__content { font-size: 1.05rem; padding-block: 0.15rem; position: relative; }
.emg-nav-pill .current-menu-item > .wp-block-navigation-item__content,
.emg-nav-pill .wp-block-navigation-item__content[aria-current="page"] { font-weight: 600; }
.emg-nav-pill .current-menu-item > .wp-block-navigation-item__content::after,
.emg-nav-pill .wp-block-navigation-item__content[aria-current="page"]::after,
.emg-nav-pill .wp-block-navigation-item__content:hover::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	bottom: -3px;
	height: 2px;
	background: var(--emg-red);
}
.emg-nav-phone .wp-block-navigation-item__content::before {
	content: "";
	display: inline-block;
	width: 1em;
	height: 1em;
	margin-right: 0.35em;
	vertical-align: -0.12em;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.6 10.8a15.1 15.1 0 0 0 6.6 6.6l2.2-2.2a1 1 0 0 1 1-.25 11.4 11.4 0 0 0 3.6.57 1 1 0 0 1 1 1V20a1 1 0 0 1-1 1A17 17 0 0 1 3 4a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1c0 1.25.2 2.45.57 3.6a1 1 0 0 1-.25 1z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.6 10.8a15.1 15.1 0 0 0 6.6 6.6l2.2-2.2a1 1 0 0 1 1-.25 11.4 11.4 0 0 0 3.6.57 1 1 0 0 1 1 1V20a1 1 0 0 1-1 1A17 17 0 0 1 3 4a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1c0 1.25.2 2.45.57 3.6a1 1 0 0 1-.25 1z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Services dropdown, reproducing the Figma "Frame 43" panel. */
.emg-nav-pill .wp-block-navigation__submenu-container {
	border: 1px solid var(--emg-card-border) !important;
	border-radius: var(--wp--custom--radius--card);
	background: var(--emg-bg) !important;
	color: var(--emg-text) !important;
	padding: 1rem 1.5rem !important;
	min-width: 260px !important;
	box-shadow: var(--emg-shadow);
	top: calc(100% + 0.9rem) !important;
}
.emg-nav-pill .wp-block-navigation__submenu-container .wp-block-navigation-item__content { padding: 0.45rem 0 !important; font-size: 1.15rem; }
.emg-nav-pill .wp-block-navigation__submenu-container .wp-block-navigation-item:first-child .wp-block-navigation-item__content { font-weight: 600; border-bottom: 1px solid var(--emg-line); margin-bottom: 0.35rem; }

.emg-header__actions { gap: 0.75rem; }
.emg-header .wp-block-button__link { padding: 0.7rem 1.1rem; white-space: nowrap; }

.wp-block-navigation__responsive-container.is-menu-open {
	background: var(--emg-bg) !important;
	color: var(--emg-text) !important;
	padding: 1.5rem;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content { font-size: 1.4rem; }
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container { border: 0 !important; box-shadow: none; padding: 0 0 0 1rem !important; }

/* Appearance switcher */
.emg-appearance {
	display: inline-flex;
	gap: 2px;
	padding: 3px;
	margin: 0;
	border: 1px solid var(--emg-card-border);
	border-radius: 999px;
}
.emg-appearance[hidden] { display: inline-flex; visibility: hidden; } /* Reserve space until JS enables it: no layout shift. */
.emg-appearance__option { position: relative; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 999px; cursor: pointer; color: var(--emg-muted); }
.emg-appearance__option input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.emg-appearance__option:has(input:checked) { background: var(--emg-text); color: var(--emg-bg); }
.emg-appearance__option:has(input:focus-visible) { outline: 2px solid var(--emg-red); outline-offset: 2px; }
.emg-appearance__option:hover { color: var(--emg-text); }
.emg-appearance__option:has(input:checked):hover { color: var(--emg-bg); }

/* ---------- Sections ---------- */
.emg-section { position: relative; padding-block: var(--wp--preset--spacing--50); }
.emg-section + .emg-section::before,
.emg-divider-top::before {
	content: "";
	position: absolute;
	top: 0;
	left: 50%;
	width: min(1150px, calc(100% - 2 * clamp(1rem, 4vw, 2.5rem)));
	transform: translateX(-50%);
	border-top: 1px solid var(--emg-line);
}

.emg-hero { min-height: clamp(420px, 60vh, 640px); }

.emg-section-title { text-align: center; margin-bottom: var(--wp--preset--spacing--40) !important; }

/* Decorative arcs and rings scattered around sections, as in the Figma frames. Neutral shapes swap colour per appearance. */
:root { --emg-decor-line: url("../images/decor/arc-line.svg"); --emg-decor-dark: url("../images/decor/arc-dark.svg"); }
:root[data-theme="dark"] { --emg-decor-line: url("../images/decor/arc-line-light.svg"); --emg-decor-dark: url("../images/decor/arc-dark-light.svg"); }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) { --emg-decor-line: url("../images/decor/arc-line-light.svg"); --emg-decor-dark: url("../images/decor/arc-dark-light.svg"); }
}
.is-style-decor, .emg-section { isolation: isolate; }
.is-style-decor::after, .emg-section.has-decor::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background:
		url("../images/decor/ring-red.svg") 6% 16% / clamp(30px, 3.8vw, 56px) no-repeat,
		var(--emg-decor-line) 88% 9% / clamp(40px, 4.5vw, 62px) no-repeat,
		var(--emg-decor-dark) 94% 72% / clamp(30px, 3.5vw, 52px) no-repeat,
		url("../images/decor/half-red.svg") 12% 88% / clamp(28px, 3.2vw, 46px) no-repeat,
		url("../images/decor/rings-red.svg") 72% 94% / clamp(26px, 3vw, 44px) no-repeat;
	opacity: 0.85;
}

/* ---------- Cards ---------- */
.is-style-card {
	border: 1px solid var(--emg-card-border);
	border-radius: var(--wp--custom--radius--card);
	background: var(--emg-surface);
	overflow: hidden;
	height: 100%;
	transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.25s ease;
}
a:hover > .is-style-card, .is-style-card:hover, .is-style-card:focus-within { transform: translateY(-4px); box-shadow: var(--emg-shadow); }

.is-style-card-dark {
	background: #1e1e1e;
	color: #f5f5f5;
	border-radius: var(--wp--custom--radius--card);
	position: relative;
	padding: 1.6rem 1.4rem 1.8rem;
	height: 100%;
}
.is-style-card-dark::before {
	content: "\201C\201C";
	position: absolute;
	top: -0.62em;
	right: 1.1rem;
	font: 700 4rem/1 Rajdhani, sans-serif;
	letter-spacing: -0.1em;
	color: var(--emg-red);
}
.is-style-card-dark::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -10px;
	border-left: 28px solid #1e1e1e;
	border-bottom: 10px solid transparent;
}
:root[data-theme="dark"] .is-style-card-dark { background: #232323; box-shadow: inset 0 0 0 1px #3a3a3a; }

.emg-feature-icon {
	width: 88px;
	height: 88px;
	margin-inline: auto;
	display: grid;
	place-items: center;
	border: 1px solid var(--emg-card-border);
	border-radius: var(--wp--custom--radius--card);
}
.emg-feature-icon img { width: 52px; height: 52px; object-fit: contain; }
:root[data-theme="dark"] .emg-feature-icon img { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .emg-feature-icon img { filter: invert(1); } }

/* Post / project / case cards from query loops */
.emg-card-grid .wp-block-post-featured-image { margin: 0; aspect-ratio: 362 / 225; }
.emg-card-grid .wp-block-post-featured-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.emg-card-grid .is-style-card:hover .wp-block-post-featured-image img { transform: scale(1.04); }
.emg-card-grid .wp-block-post-featured-image a { display: block; height: 100%; overflow: hidden; }
.emg-card__body { padding: 1rem 1.2rem 1.1rem !important; display: flex; flex-direction: column; gap: 1.6rem; flex: 1; }
.emg-card__body .wp-block-post-excerpt__excerpt, .emg-card__body .wp-block-post-title { font-size: 1.05rem; line-height: 1.4; }
.emg-card-grid .wp-block-post-template > li { display: flex; }
.emg-card-grid .wp-block-post-template > li > .is-style-card { display: flex; flex-direction: column; width: 100%; }

.is-style-chevron, .emg-see-more a, a.emg-see-more { font-size: 1rem; color: var(--emg-muted) !important; text-decoration: none; margin-top: auto; }
.is-style-chevron::after, .emg-see-more a::after, a.emg-see-more::after { content: " \203A"; font-size: 1.15em; transition: margin 0.2s ease; }
.is-style-chevron:hover::after, .emg-see-more a:hover::after, a.emg-see-more:hover::after { margin-left: 0.3em; }
.is-style-chevron:hover, .emg-see-more a:hover { color: var(--emg-red) !important; }

/* Horizontal project cards on the home page */
.emg-project-card { padding: 1.25rem 1.5rem !important; align-items: center !important; }
.emg-project-card .wp-block-image img { border-radius: 10px; aspect-ratio: 256/235; object-fit: cover; }

/* Avatars with the red ring */
.is-style-avatar-ring { position: relative; width: 64px; margin-inline: auto !important; }
.is-style-avatar-ring img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; display: block; margin: 10px; }
.is-style-avatar-ring::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 5px solid var(--emg-red);
	border-top-color: transparent;
	transform: rotate(0deg);
}

/* Partner logos */
.emg-partner {
	width: clamp(84px, 11vw, 126px);
	aspect-ratio: 1;
	margin: 0 auto !important;
	border-radius: 50%;
	border: 1px solid var(--emg-line);
	padding: 10px;
	display: grid;
	place-items: center;
}
.emg-partner img { width: 100%; aspect-ratio: 1; border-radius: 50%; background: var(--emg-partner); object-fit: scale-down; padding: 22%; transition: transform 0.4s ease; }
.emg-partner:hover img { transform: rotate(-8deg) scale(1.05); }

/* Large rounded media */
.emg-rounded img { border-radius: var(--wp--custom--radius--card); }

/* Case-study slider (Past work Gallery component) */
.emg-gallery {
	position: relative;
	border-radius: var(--wp--custom--radius--card);
	overflow: hidden;
	min-height: clamp(360px, 44vw, 632px);
	color: #fff;
}
.emg-gallery .wp-block-cover__background { background: #1e1e1e !important; opacity: 0.6 !important; }
.emg-gallery h2, .emg-gallery h3 { font-family: Inter, sans-serif; font-weight: 600; font-size: clamp(1.5rem, 2.8vw, 2.25rem); }
.emg-gallery p { font-family: Inter, sans-serif; max-width: 34ch; }

/* Carousels: native scroll-snap, arrows enhance it. */
.is-style-carousel, .wp-block-post-template.is-style-carousel, .emg-carousel .wp-block-post-template {
	display: grid !important;
	grid-auto-flow: column;
	grid-auto-columns: calc((100% - 2 * 1.5rem) / 3);
	grid-template-columns: none !important;
	gap: 1.5rem;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	padding-bottom: 14px;
}
.is-style-carousel::-webkit-scrollbar, .emg-carousel .wp-block-post-template::-webkit-scrollbar { display: none; }
.is-style-carousel > *, .emg-carousel .wp-block-post-template > li { scroll-snap-align: start; margin: 0 !important; }

.emg-progress { height: 10px; border-radius: 99px; background: #a3a3a3; max-width: 535px; margin: 2rem auto 0; overflow: hidden; }
.emg-progress span { display: block; height: 100%; width: 18%; background: #1e1e1e; border-radius: inherit; transition: transform 0.2s linear; }
:root[data-theme="dark"] .emg-progress span { background: var(--emg-red); }

.emg-carousel-controls { display: flex; gap: 0.9rem; }
.emg-carousel-controls[hidden] { display: flex; visibility: hidden; }
.emg-icon-btn {
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	border: 1px solid var(--emg-card-border);
	border-radius: var(--wp--custom--radius--button);
	background: transparent;
	color: var(--emg-text);
	cursor: pointer;
}
.emg-icon-btn:hover { background: var(--emg-text); color: var(--emg-bg); }
.emg-icon-btn:disabled { opacity: 0.35; cursor: default; background: transparent; color: var(--emg-text); }

/* Tabs (portfolio / case-study filters) */
.emg-tabs { display: flex; justify-content: center; flex-wrap: wrap; margin: 0 auto var(--wp--preset--spacing--40); border-bottom: 1px solid var(--emg-line); width: fit-content; max-width: 100%; }
.emg-tabs a { padding: 0.6rem clamp(1rem, 3vw, 2.3rem); text-decoration: none; font-size: 1.1rem; position: relative; color: var(--emg-text); }
.emg-tabs a[aria-current="page"] { font-weight: 700; }
.emg-tabs a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 4px; background: var(--emg-red); border-radius: 2px; }
.emg-tabs a:hover { color: var(--emg-red); }

/* Topic chips */
.is-style-chips { display: flex; flex-wrap: wrap; gap: 0.9rem; list-style: none; padding: 0 !important; }
.is-style-chips li { margin: 0; }
.is-style-chips a {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.5rem 0.9rem;
	border: 1px solid var(--emg-card-border);
	border-radius: var(--wp--custom--radius--button);
	text-decoration: none;
	font-size: 1rem;
}
.is-style-chips a::before {
	content: "";
	width: 18px;
	height: 18px;
	background: currentColor;
	-webkit-mask: url("../images/decor/chip-icon.svg") center / contain no-repeat;
	mask: url("../images/decor/chip-icon.svg") center / contain no-repeat;
}
.is-style-chips a:hover { background: var(--emg-text); color: var(--emg-bg); }

/* ---------- Single post ---------- */
.emg-article-layout { gap: 1.25rem !important; }
.emg-article-sidebar { border-left: 1px solid var(--emg-line); padding-left: 1rem !important; align-self: stretch; }
.emg-article-sidebar h2, .emg-article-sidebar h3 { font-size: 1.25rem; border-bottom: 1px solid var(--emg-line); padding-bottom: 0.3rem; }
.emg-faq .wp-block-details { margin: 0 0 1.2rem; counter-increment: faq; }
.emg-faq { counter-reset: faq; }
.emg-faq summary { list-style: none; font-weight: 600; font-size: 1.05rem; cursor: pointer; }
.emg-faq summary::-webkit-details-marker { display: none; }
.emg-faq summary::before {
	content: counter(faq);
	display: grid;
	place-items: center;
	width: 24px;
	height: 24px;
	margin-bottom: 0.5rem;
	border-radius: 4px;
	background: var(--emg-text);
	color: var(--emg-bg);
	font-size: 0.85rem;
}
.emg-faq .wp-block-details > :not(summary) { background: color-mix(in srgb, var(--emg-text) 6%, var(--emg-bg)); border-radius: 8px; padding: 0.6rem 0.7rem; font-size: 0.85rem; color: var(--emg-muted); margin-top: 0.4rem; }
.emg-suggestions .wp-block-post { position: relative; border-radius: 8px; overflow: hidden; margin-bottom: 0.7rem; }
.emg-suggestions .wp-block-post-featured-image { margin: 0; aspect-ratio: 263/104; }
.emg-suggestions .wp-block-post-featured-image img { height: 100%; object-fit: cover; }
.emg-suggestions .wp-block-post-title { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 1.5rem 0.8rem 0.5rem; font-size: 0.95rem; background: linear-gradient(transparent, rgb(2 2 2 / 0.8)); color: #fff; }
.emg-suggestions .wp-block-post-title a { color: #fff; text-decoration: none; }

.wp-block-post-content.emg-prose { font-family: var(--wp--preset--font-family--inter); font-size: 1.0625rem; line-height: 1.55; text-align: justify; hyphens: auto; }
.wp-block-post-content.emg-prose img { border-radius: var(--wp--custom--radius--card); }

/* Comments */
.wp-block-comments .wp-block-comment-template li { margin-bottom: 2rem; }
.wp-block-comments .wp-block-comment-content { background: color-mix(in srgb, var(--emg-text) 6%, var(--emg-bg)); border-radius: 8px; padding: 0.7rem 0.9rem; font-size: 0.95rem; }
.wp-block-comments .wp-block-avatar img { border-radius: 50%; }
.comment-form textarea, .comment-form input:not([type="submit"]):not([type="checkbox"]) { width: 100%; }

/* ---------- Forms ---------- */
.emg-form { display: grid; gap: 1rem; }
.emg-form__row { display: grid; grid-template-columns: 160px 1fr; align-items: center; gap: 1rem; }
.emg-form__row--top { align-items: start; }
.emg-form label, .emg-form legend { font-weight: 700; font-size: 1.15rem; }
.emg-form input[type="text"], .emg-form input[type="email"], .emg-form input[type="tel"], .emg-form input[type="url"], .emg-form textarea,
.comment-form textarea, .comment-form input:not([type="submit"]):not([type="checkbox"]), .emg-newsletter input[type="email"] {
	font: inherit;
	font-size: 1rem;
	color: var(--emg-text);
	background: var(--emg-field);
	border: 1px solid var(--emg-card-border);
	border-radius: 8px;
	padding: 0.7rem 0.9rem;
	width: 100%;
}
.emg-form textarea { min-height: 120px; resize: vertical; }
.emg-form ::placeholder, .emg-newsletter ::placeholder { color: #8a8a8a; }
.emg-form [aria-invalid="true"] { border-color: var(--emg-red); box-shadow: 0 0 0 1px var(--emg-red); }
.emg-form__error { color: var(--emg-red); font-size: 0.95rem; grid-column: 2; margin: -0.5rem 0 0; }
.emg-form__checks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem 1rem; border: 0; padding: 0; margin: 0; }
.emg-form__checks label { font-weight: 400; font-size: 1rem; display: flex; gap: 0.4rem; align-items: center; }
.emg-form__checks input { width: 16px; height: 16px; accent-color: var(--emg-red); }
.emg-form__hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.emg-form__status { padding: 0.8rem 1rem; border-radius: 8px; font-weight: 600; }
.emg-form__status[hidden] { display: none; }
.emg-form__status.is-success { background: color-mix(in srgb, #1f9d55 14%, var(--emg-bg)); color: color-mix(in srgb, #1f9d55 75%, var(--emg-text)); }
.emg-form__status.is-error { background: color-mix(in srgb, var(--emg-red) 12%, var(--emg-bg)); color: color-mix(in srgb, var(--emg-red) 80%, var(--emg-text)); }
.emg-form button[type="submit"], .emg-newsletter button { justify-self: center; }
button.emg-btn, .emg-newsletter button, .emg-form button[type="submit"], .comment-form .submit {
	font: 500 1rem/1 Rajdhani, sans-serif;
	background: var(--emg-btn-bg);
	color: var(--emg-btn-text);
	border: 0;
	border-radius: var(--wp--custom--radius--button);
	padding: 0.85rem 1.4rem;
	cursor: pointer;
}
button.emg-btn:hover, .emg-newsletter button:hover, .emg-form button[type="submit"]:hover, .comment-form .submit:hover { background: var(--emg-red); color: #fff; }
button[aria-busy="true"] { opacity: 0.7; cursor: progress; }

.emg-newsletter__fields { display: flex; max-width: 427px; margin-inline: auto; }
.emg-newsletter input[type="email"] { border-radius: 8px 0 0 8px; border-right: 0; }
.emg-newsletter button { border-radius: 8px; margin-left: -8px; white-space: nowrap; padding-inline: 1.9rem; }
.emg-newsletter .emg-form__status { max-width: 427px; margin: 0.75rem auto 0; text-align: center; }

/* Contact modal */
dialog.emg-modal {
	width: min(803px, calc(100% - 2rem));
	max-height: calc(100dvh - 2rem);
	border: 1px solid var(--emg-card-border);
	border-radius: var(--wp--custom--radius--card);
	background: var(--emg-bg);
	color: var(--emg-text);
	padding: clamp(1.25rem, 4vw, 3rem) clamp(1rem, 4vw, 3rem) clamp(1.5rem, 4vw, 4rem);
	box-shadow: 0 30px 80px rgb(0 0 0 / 0.35);
}
dialog.emg-modal::backdrop { background: rgb(16 16 16 / 0.55); backdrop-filter: blur(3px); }
dialog.emg-modal[open] { animation: emg-pop 0.28s ease-out; }
.emg-modal__close { position: absolute; top: 1.4rem; right: 1.4rem; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid currentColor; background: transparent; color: inherit; display: grid; place-items: center; cursor: pointer; }
.emg-modal__close:hover { color: var(--emg-red); }
.emg-modal h2 { font-size: clamp(1.75rem, 3vw, 2.25rem); margin: 0 2.5rem 0.75rem 0; }

/* ---------- Footer ---------- */
.emg-footer nav ul, .emg-footer .wp-block-navigation__container { gap: clamp(1rem, 4vw, 3.25rem); justify-content: center; }
.emg-footer .wp-block-navigation-item__content { font-size: 1.05rem; }
.emg-footer .emg-copyright { font-family: Poppins, sans-serif; font-size: 0.75rem; }
.emg-footer-rule { border-top: 1px solid var(--emg-line); }

/* ---------- Motion ---------- */
@keyframes emg-pop { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes emg-float { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-14px) rotate(2.5deg); } }
@keyframes emg-spin { to { transform: rotate(360deg); } }

.is-style-float img, .emg-float img { animation: emg-float 7s ease-in-out infinite; }

.emg-reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.emg-reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
	.emg-reveal { opacity: 1; transform: none; }
	.is-style-carousel, .emg-carousel .wp-block-post-template { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
	.emg-nav-pill .wp-block-navigation__container { gap: 1rem; }
	.emg-nav-pill .emg-nav-phone { display: none; }
}

@media (max-width: 900px) {
	nav.emg-nav-pill { border: 0; padding: 0; flex: 0 0 auto; justify-content: flex-end; margin-left: auto; }
	.emg-header__actions .wp-block-buttons { display: none; }
	.emg-form__row { grid-template-columns: 1fr; gap: 0.4rem; }
	.emg-form__error { grid-column: 1; margin: 0; }
	.emg-form__checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.emg-article-sidebar { border-left: 0; padding-left: 0 !important; border-top: 1px solid var(--emg-line); padding-top: 1.5rem !important; }
	.emg-reverse-mobile { flex-direction: column-reverse !important; }
	.is-style-carousel, .emg-carousel .wp-block-post-template { grid-auto-columns: minmax(260px, 78%); }
}

@media (max-width: 781px) {
	.emg-section { padding-block: var(--wp--preset--spacing--40); }
	.emg-mobile-center, .emg-mobile-center * { text-align: center !important; justify-content: center !important; }
	.emg-project-card { flex-direction: column; align-items: stretch !important; }
	.emg-tabs { width: 100%; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
	.emg-tabs a { white-space: nowrap; }
	.emg-footer nav ul, .emg-footer .wp-block-navigation__container { gap: 0.75rem 1.5rem; }
	.is-style-decor::after, .emg-section.has-decor::after { opacity: 0.5; }
}

@media (max-width: 480px) {
	.emg-form__checks { grid-template-columns: 1fr; }
	.emg-newsletter__fields { flex-direction: column; gap: 0.6rem; }
	.emg-newsletter input[type="email"] { border-right: 1px solid var(--emg-card-border); border-radius: 8px; }
	.emg-newsletter button { margin-left: 0; }
	.is-style-carousel, .emg-carousel .wp-block-post-template { grid-auto-columns: 86%; }
}

@media print {
	.emg-header, .emg-footer, .emg-appearance, dialog { display: none !important; }
}

/* Services listing: alternate image side like the Figma "Our Services" frame. */
.emg-service-rows .wp-block-post:nth-child(even) .emg-service-row { flex-direction: row-reverse; }
.emg-service-rows .wp-block-post-title a { text-decoration: none; }
.emg-service-rows .wp-block-post-featured-image img { max-width: min(420px, 100%); margin-inline: auto; }
.emg-justify { text-align: justify; }
.emg-btn-link.wp-block-read-more { display: inline-block; width: fit-content; background: var(--emg-btn-bg); color: var(--emg-btn-text) !important; padding: 0.7rem 1.1rem; border-radius: var(--wp--custom--radius--button); text-decoration: none; }
.emg-btn-link.wp-block-read-more:hover { background: var(--emg-red); color: #fff !important; }
.emg-circle img, .wp-block-post-featured-image.emg-circle img { border-radius: 50%; aspect-ratio: 1; object-fit: cover; }
.emg-other-services .wp-block-post-featured-image.emg-circle { margin-inline: auto; max-width: 100%; }
.emg-other-services .wp-block-post-title a { text-decoration: none; }
@media (max-width: 781px) {
	.emg-service-rows .wp-block-post:nth-child(even) .emg-service-row { flex-direction: column; }
}

/* Case gallery slider: one slide per view. */
.emg-gallery-track { grid-auto-columns: 100% !important; gap: 1rem; }
.emg-case-gallery .emg-carousel-controls { justify-content: flex-end; margin-top: 1rem; }
.emg-gallery .wp-block-cover__inner-container { max-width: 520px; padding: clamp(1rem, 4vw, 3rem); }

/* Black line-art illustrations stay visible in dark mode. */
:root[data-theme="dark"] .emg-hero-art img { filter: invert(1) hue-rotate(180deg) saturate(1.4); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .emg-hero-art img { filter: invert(1) hue-rotate(180deg) saturate(1.4); } }
.emg-hero-art img { max-width: min(505px, 100%); margin-inline: auto; display: block; }
@media (max-width: 781px) { .emg-hero-art img { max-width: min(320px, 80%); } }
.emg-nav-contact { display: none !important; }
.wp-block-navigation__responsive-container.is-menu-open .emg-nav-contact { display: flex !important; }

/* ---------- Company-profile content ---------- */
.emg-nav-email .wp-block-navigation-item__content::before {
	content: "";
	display: inline-block;
	width: 1em;
	height: 1em;
	margin-right: 0.35em;
	vertical-align: -0.12em;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='M3 7l9 6 9-6'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='M3 7l9 6 9-6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.emg-footnote { font-size: 0.85rem; color: var(--emg-muted); max-width: 820px; margin-inline: auto; line-height: 1.45; }
.emg-partner img { padding: 0; object-fit: cover; background: none; }
.emg-partners { margin-bottom: 1.5rem; }
.emg-result .emg-result__figure { font-size: clamp(2.2rem, 4vw, 3rem); font-weight: 700; line-height: 1; color: var(--emg-red); margin: 1rem 0 0.4rem; }
.emg-result .is-style-avatar-ring img { object-fit: cover; }
.emg-capability h3 { margin-bottom: 0.3rem; }
.emg-step__num { font-size: 2.6rem; font-weight: 700; color: var(--emg-red); line-height: 1; margin: 0; }
.emg-case-meta { font-size: 1rem; color: var(--emg-muted); border-bottom: 1px solid var(--emg-line); padding-bottom: 0.8rem; }
.wp-block-post-content :where(ul.wp-block-list) li { margin-bottom: 0.35rem; }
.wp-block-post-content .wp-block-cover.emg-gallery { margin-bottom: var(--wp--preset--spacing--40); }
.wp-block-post-content h2.wp-block-heading { font-size: var(--wp--preset--font-size--large); margin-top: 2rem; }
.wp-block-post-content a { color: var(--emg-red); }
.is-style-card-dark.emg-result::before { content: none; }
.emg-case-logo img { aspect-ratio: 1448 / 600; object-fit: cover; width: 100%; }
.emg-lead { font-size: var(--wp--preset--font-size--medium); line-height: 1.4; }
.emg-gallery .emg-lead { color: #fff; max-width: 46ch; }
