

/* A shared, editorial footer for every standalone MegaGen surface. */

/*
 * The legacy in-page footer is hidden, not styled.
 *
 * This file used to carry about a hundred lines that laid the old
 * `<div class="mg-footer">` out as a six-column grid, gave it the same
 * background and shadow as the real footer, and animated it in — an attempt to
 * make a duplicate look intentional. It could not work: two footers is two
 * footers, and on a narrow window or with a different number of saved columns
 * the second one wrapped into a squeezed strip down the right-hand edge, which
 * is exactly what was reported. All of it is gone.
 *
 * PHP now stops that widget rendering at all (see inc/mg-parts.php); this rule
 * is the safety net for a page that was cached as HTML before the theme was
 * updated. It has to come before everything else and stay unopposed — the old
 * `display: grid !important` sat under a `body.home` selector, which is more
 * specific than this, so a hide rule written later in the file lost to it.
 */
.mg-footer:not(.mg-footer--pro) {
	display: none !important;
}

.mg-pdp-footwrap {
	width: 100%;
	max-width: none;
	min-width: 0;
	margin: 0;
	padding: 0 !important;
	overflow: hidden;
	box-sizing: border-box;
}
.mg-pdp-footwrap .mg-footer--pro {
	display: block;
	width: 100% !important;
	max-width: none !important;
	min-width: 0;
	box-sizing: border-box;
	margin: 0;
	padding: clamp(48px, 6vw, 92px) clamp(20px, 5vw, 76px) 22px;
	border: 1px solid rgba(184, 218, 235, .12);
	border-bottom: 0;
	border-radius: min(var(--mg-footer-radius, 24px), 28px) min(var(--mg-footer-radius, 24px), 28px) 0 0;
	background: var(--mg-footer-bg, #082b40);
	box-shadow: inset 0 1px rgba(255, 255, 255, .035);
	color: var(--mg-footer-text, #d2e0e6);
}
.mg-pdp-footwrap > .mg-news {
	margin-block-end: clamp(26px, 4vw, 58px);
}
.mg-footer--pro .mg-footer__top {
	display: grid;
	grid-template-columns: minmax(240px, 1.35fr) repeat(var(--mg-footer-columns, 4), minmax(145px, 1fr));
	gap: clamp(24px, 2.4vw, 42px);
	width: min(1500px, 100%);
	margin-inline: auto;
	padding-block-end: clamp(36px, 5vw, 62px);
}
/* Keep the footer readable without JavaScript, then let the shared observer
   animate each column in both scroll directions when enhancement is active. */
html:not(.mg-js) .mg-footer--pro [data-reveal] { opacity: 1; transform: none; filter: none; }
html.mg-js .mg-footer--pro [data-reveal] {
	opacity: 0;
	transform: translateY(18px);
	filter: blur(2px);
	transition: opacity .58s ease, transform .72s cubic-bezier(.22, 1, .36, 1), filter .58s ease;
}
html.mg-js .mg-footer--pro [data-reveal].is-visible { opacity: 1; transform: none; filter: none; }
.mg-footer--pro :is(h2,h4) { margin: 0 0 14px; color: var(--mg-footer-heading, #fff); font-size: 17px; font-weight: 780; line-height: 1.35; }
.mg-footer--pro p { margin: 0; color: var(--mg-footer-text, #d2e0e6); font-size: 15px; line-height: 1.75; opacity: .82; }
.mg-footer--pro a { display: block; width: fit-content; color: var(--mg-footer-text, #d2e0e6); font-size: 15px; line-height: 1.65; text-decoration: none; transition: color .2s ease, transform .2s ease; }
.mg-footer--pro a:hover { color: var(--mg-footer-accent, #72c7f4); transform: translateX(-3px); }
.mg-footer__eyebrow { display: block; margin-bottom: 12px; color: var(--mg-footer-accent, #72c7f4); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.mg-footer--pro .mg-footer__brand :is(h2,h4) { margin-bottom: 11px; font-size: clamp(22px, 2vw, 30px); }
.mg-footer__social { display: flex; gap: 9px; margin-top: 22px; }
.mg-footer--pro .mg-footer__social a { display: inline-flex; width: 42px; height: 42px; align-items: center; justify-content: center; border: 0; border-radius: 12px; background: #0a3047; color: #fff; box-shadow: -5px -5px 11px rgba(103,180,212,.08), 6px 7px 12px rgba(1,15,25,.42), inset 1px 1px 2px rgba(118,198,229,.12), inset -2px -2px 4px rgba(1,15,25,.38); }
.mg-footer--pro .mg-footer__social a:hover { background: #0b3852; color: #9de0fb; box-shadow: inset 3px 3px 7px rgba(1,15,25,.48), inset -2px -2px 5px rgba(108,190,224,.1); transform: translateY(-2px); }
.mg-footer__social svg { width: 17px; height: 17px; }
.mg-footer__nav { display: grid; align-content: start; gap: 3px; }
.mg-footer__contact { display: grid; align-content: start; gap: 6px; }
.mg-footer__contact a[dir="ltr"] { direction: ltr; text-align: right; }
.mg-footer__contact-cta { display: inline-flex !important; min-height: 42px; align-items: center; gap: 10px; margin-top: 11px; padding: 8px 14px; border: 1px solid var(--mg-footer-accent, #72c7f4); border-radius: 6px; color: var(--mg-footer-heading, #fff) !important; font-weight: 750; }
.mg-footer__contact-cta:hover { border-color: var(--mg-footer-accent, #72c7f4); background: color-mix(in srgb, var(--mg-footer-accent, #72c7f4) 62%, #004a72); transform: translateY(-2px) !important; }
.mg-footer--pro .mg-footer__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; width: min(1500px, 100%); margin: 0 auto; padding-top: 20px; border-top: 1px solid rgba(201,224,235,.18); color: #a9bec8; font-size: 13px; line-height: 1.7; }
.mg-footer__bar-note { margin-inline-start: auto; text-align: left; }
.mg-footer__legal { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-inline-start: 22px; }
.mg-footer--pro .mg-footer__legal a { font-size: 13px; }
.mg-footer--no-brand .mg-footer__top { grid-template-columns: repeat(var(--mg-footer-columns, 6), minmax(0, 1fr)); }
/*
 * «متعادل» and «فشرده» put the link columns on more than one row on purpose.
 * The brand block used to sit *in* the first of those rows, spanning two of the
 * four (or two of the three) tracks — so only two columns fitted beside it and
 * the rest dropped underneath, starting at the right-hand edge under the brand.
 * With the default set of columns that is precisely two orphans hanging below
 * the footer, which is what «در خط پایینی افتاده و زشت شده» describes.
 *
 * Giving the brand a row of its own means the link columns always form whole,
 * evenly-spaced rows, whatever number of columns the site has saved. This is
 * the same arrangement the narrow breakpoints already used; it was only the two
 * multi-row desktop layouts that had it wrong.
 */
.mg-footer--layout-balanced .mg-footer__top { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mg-footer--layout-compact .mg-footer__top { width: min(1180px, 100%); grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(26px, 3vw, 44px); }
.mg-footer--layout-balanced .mg-footer__brand,
.mg-footer--layout-compact .mg-footer__brand {
	grid-column: 1 / -1;
	max-width: 720px;
	margin-block-end: clamp(6px, 1vw, 18px);
}
/* One block left over on the last row: stretch it across instead of leaving it
   stranded against an edge. mg_build_footer() adds the class when it counts. */
.mg-footer--tail-1 .mg-footer__top > :last-child { grid-column: 1 / -1; }
[data-theme="dark"] .mg-pdp-footwrap .mg-footer--pro { background: var(--mg-footer-dark-bg, #030f18); }
body.home .mg-home-shared-footer {
	margin-top: clamp(28px, 5vw, 72px);
}
/* Elementor's homepage typography is more specific than the standalone page
   shell. Pin the shared footer to its own readable type scale so Home and
   About compute to the same values. */
body.home .mg-home-shared-footer .mg-footer--pro :is(h2,h4) {
	margin-bottom: 14px !important;
	color: var(--mg-footer-heading, #fff) !important;
	font-size: 17px !important;
	font-weight: 780 !important;
	line-height: 1.35 !important;
}
body.home .mg-home-shared-footer .mg-footer--pro .mg-footer__brand :is(h2,h4) {
	margin-bottom: 11px !important;
	font-size: clamp(22px, 2vw, 30px) !important;
}
body.home .mg-home-shared-footer .mg-footer--pro p {
	margin: 0 !important;
	color: var(--mg-footer-text, #d2e0e6) !important;
	font-size: 15px !important;
	line-height: 1.75 !important;
}
body.home .mg-home-shared-footer .mg-footer--pro a {
	color: var(--mg-footer-text, #d2e0e6) !important;
	font-size: 15px !important;
	line-height: 1.65 !important;
}
body.home .mg-home-shared-footer .mg-footer--pro .mg-footer__contact-cta {
	color: var(--mg-footer-heading, #fff) !important;
}
body.home .mg-home-shared-footer .mg-footer--pro .mg-footer__bar {
	color: #a9bec8 !important;
	font-size: 13px !important;
	line-height: 1.7 !important;
}
/* The old seeded hero had an editorial conversion card which duplicated the
   hero heading and could overlap it after address/editor changes. */
body.home .mg-hero-conversion { display: none !important; }

/* The same bidirectional entrance is used by the standalone page footer. */
html.mg-js .mg-footer--pro {
	opacity: 0;
	transform: translateY(32px) scale(.985);
	transition: opacity .8s ease, transform .8s cubic-bezier(.22, 1, .36, 1);
}
html.mg-js .mg-footer--pro.mg-footer--entered { opacity: 1; transform: none; }

/* Front-page templates use this attribute for their module-level entrance. */
html.mg-js body.home [data-mg-reveal] {
	opacity: 0;
	transform: translateY(28px) scale(.987);
	transition: opacity .7s ease, transform .7s cubic-bezier(.22, 1, .36, 1);
}
html.mg-js body.home [data-mg-reveal].is-visible { opacity: 1; transform: none; }

@media (max-width: 820px) {
	.mg-footer--pro .mg-footer__top { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 34px 26px; }
	.mg-footer--pro .mg-footer__brand { grid-column: 1 / -1; max-width: 620px; }
}
@media (min-width: 821px) and (max-width: 1199px) {
}
/* Between tablet and full desktop the brand block and the link columns cannot
   share a row without squeezing the labels to two words per line. Give the
   brand its own full-width row and let the link columns divide the next one
   evenly — which also means the layout no longer depends on how many columns
   the dashboard happens to define. The previous rule hard-coded three link
   columns, so a fourth (the contact block) was pushed onto a row of its own. */
@media (min-width: 821px) and (max-width: 1199px) {
	.mg-footer--pro:not(.mg-footer--layout-compact) .mg-footer__top {
		grid-template-columns: repeat(var(--mg-footer-columns, 4), minmax(0, 1fr));
		gap: clamp(20px, 2.4vw, 34px);
	}
	.mg-footer--pro:not(.mg-footer--layout-compact) .mg-footer__brand {
		grid-column: 1 / -1;
		max-width: 720px;
		margin-block-end: 6px;
	}
	.mg-footer--layout-compact .mg-footer__top { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
	.mg-pdp-footwrap .mg-footer--pro { padding: 48px 20px 104px; border-radius: 24px 24px 0 0; clip-path: none; }
	.mg-footer--pro .mg-footer__top { grid-template-columns: 1fr; gap: 30px; }
	.mg-footer--pro .mg-footer__brand { grid-column: auto; }
	.mg-footer--pro .mg-footer__bar { display: grid; gap: 8px; }
	.mg-footer__bar-note { margin-inline-start: 0; text-align: right; }
	.mg-footer__legal { margin-inline-start: 0; }
}

@media (prefers-reduced-motion: reduce) {
	html.mg-js .mg-footer--pro,
	html.mg-js body.home [data-mg-reveal] {
	opacity: 1 !important;
	transform: none !important;
	transition: none !important;
	}
}
