/* ══════════════════════════════════════════════════════════════
   קאסטומדיה — סדרת מודעות

   ⚠ צבע המבטא הוא המג'נטה מהאתר שלהם (#CE4A87) ולא הצבעים
   שבתוך הלוגו. הלוגו בנוי על גרדיאנט סגול→ציאן, והציאן שבו
   קרוב מדי לציאן של פרונט מוטורס — שתי הסדרות רצות באותן
   משבצות והיו מתחילות להיקרא כמפרסם אחד. הלוגו נשאר כמו
   שהוא; רק הריהוט לובש מג'נטה.

   ⚠ הרקע הוא ה-RX-7 המשופר מתוך האתר. הסגול-מג'נטה של הרכב
   יושב על אותה משפחת צבע של המותג, ולכן ההצללה לא צריכה
   לחנוק אותו.

   ⚠ הגבהים מגיעים מטוקני --ad-h-* שב-ad-rotation.css.
   ══════════════════════════════════════════════════════════════ */

.cmad {
	--cm-mag: #ce4a87;
	--cm-ink: #0c0a11;

	container-type: size;
	position: relative;
	display: block;
	overflow: hidden;
	width: 100%;
	box-sizing: border-box;
	color: #fff;
	background: var(--cm-ink);
	font-family: 'Heebo', 'Segoe UI', 'Arial Hebrew', Arial, sans-serif;
}

/* ⚠ אותה בעיית ספציפיות כמו בשאר הסטים: Hello Elementor מגדיר
   `.page-content a` במשקל (0,1,1), ו-`.cmad` לבדו מפסיד לו. */
.page-content a.cmad,
a.cmad { text-decoration: none; }

.cmad--inline { height: var(--ad-h-inline, 280px); }
.cmad--end    { height: var(--ad-h-end, 250px); }
.cmad--rail   { height: var(--ad-h-rail, 600px); }

@media (max-width: 68rem) {
	.cmad--rail { height: var(--ad-h-rail-narrow, 280px); }
}

/* ══ הרקע ══ */
.cmad__media {
	position: absolute;
	inset: 0;
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
}

.cmad__scrim { position: absolute; inset: 0; }

/* קו הגרדיאנט התחתון — לקוח מהלוגו, ולכן סגול→ציאן ולא מג'נטה */
.cmad::after {
	content: '';
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	z-index: 2;
	height: 3px;
	background: linear-gradient(90deg, #433192, #2562b4 40%, #00a3e0 70%, transparent);
}

/* ══ גוש הטקסט ══ */
.cmad__body {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: center;
	height: 100%;
	box-sizing: border-box;
	min-width: 0;
}

/* ⚠ הלוגו נטען מקובץ שבו הכיתוב הולבן. במקור הוא #454444
   ונעלם על רקע כהה. הגרדיאנטים של הסמל לא נגעו בהם. */
.cmad__logo {
	display: block;
	aspect-ratio: 322.22 / 91.94;
	background: url('img/customedia-logo-light.svg') center right / contain no-repeat;
}

/* ══ צמד הלוגואים — רק בווריאנט built ══
   קאסטומדיה (המפרסם) ו-GripLab (מה שנבנה), עם קו מפריד. */
.cmad__pair {
	display: flex;
	align-items: center;
	gap: .9em;
}

.cmad__pair::after {
	content: '';
	flex: none;
	align-self: stretch;
	width: 1px;
	background: rgba(255, 255, 255, .25);
	order: 1;
}

.cmad__pair .cmad__logo { order: 0; flex: none; }

.cmad__built {
	order: 2;
	flex: none;
	display: block;
	aspect-ratio: 2595 / 657;
	background: url('img/griplab-logo-light.svg') center / contain no-repeat;
}

.cmad__head {
	display: block;
	margin: 0;
	font-weight: 800;
	line-height: 1.14;
	letter-spacing: -.015em;
	text-wrap: balance;
	text-shadow: 0 2px 14px rgba(12, 10, 17, .9);
}

.cmad__head em { font-style: normal; color: var(--cm-mag); }

.cmad__sub {
	display: block;
	margin: .5em 0 0;
	line-height: 1.45;
	color: rgba(255, 255, 255, .78);
	text-wrap: pretty;
	text-shadow: 0 2px 12px rgba(12, 10, 17, .95);
}

/* ══ קיר המותגים — רק בווריאנט auto ══

   ⚠ הקיר הוא תמונה אחת, לא עשר. כל מודעה מרונדרת פעמיים־שלוש
   בעמוד, ועשר בקשות לכל אחת זה יותר מדי; וכתמונת רקע היא
   נטענת רק כשהמודעה נבחרת, כי הדפדפן אינו מוריד
   background-image של אלמנט מוסתר. אותו שיקול שמנחה את כל
   מנגנון הרוטציה.

   ⚠ הלוגואים צרובים ללבן-על-שקוף בקובץ עצמו, לא ב-CSS.
   הניסיון הקודם עשה זאת עם filter: invert ו-mix-blend-mode,
   וזה נשבר: הסט מעורב. ג'יפ הוא לבן-על-שחור במקור ויגואר כסף
   בהיר — היפוך גורף הפך אותם לבלוקים לבנים או העלים אותם.
   פילטר אחיד אינו יכול לטפל בסט מעורב.

   ⚠ אין כאן מצע כהה. כשהלוגואים היו שקופים-עם-screen הם היו
   נעלמים מעל אזורים בהירים בתצלום והמצע היה תנאי; עכשיו הם
   פיקסלים לבנים אטומים, וההצללה שמתחת מספיקה. */
.cmad__brands {
	display: block;
	margin-top: .8em;
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
}

/* ══ תחתית ══
   ⚠ בלי margin-top: auto. יחד עם justify-content: center על הגוף
   הוא דחף את התחתית לקצה והשאיר חלל מת באמצע. */
.cmad__foot {
	display: flex;
	align-items: center;
	gap: .9em;
}

.cmad__contact {
	display: block;
	direction: ltr;
	unicode-bidi: isolate;
	font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
	line-height: 1;
	white-space: nowrap;
	color: rgba(255, 255, 255, .55);
}

.cmad__cta {
	display: inline-flex;
	align-items: center;
	gap: .45em;
	padding: .7em 1.1em;
	font-weight: 700;
	line-height: 1;
	white-space: nowrap;
	color: #fff;
	background: var(--cm-mag);
	border-radius: 999px;
	transition: background .18s ease;
}

.cmad:hover .cmad__cta,
.cmad:focus-visible .cmad__cta { background: #e0629b; }

.cmad__cta svg {
	width: .9em;
	height: .9em;
	transform: scaleX(-1); /* חץ פונה שמאלה ב-RTL */
}

/* ══════════════════════════════════════════════════════════════
   פריסות
   ══════════════════════════════════════════════════════════════ */

/* ── רוחבי: הצללה מהצד הקורא ── */
@container (max-height: 399px) and (min-width: 620px) {
	.cmad__media { background-image: url('img/cm-rx7-wide.jpg'); }
	.cmad__scrim {
		background: linear-gradient(to left,
			rgba(12, 10, 17, .96) 0%, rgba(12, 10, 17, .9) 38%,
			rgba(12, 10, 17, .55) 60%, rgba(12, 10, 17, .1) 84%);
	}

	.cmad__body { width: 64%; padding: 22px clamp(22px, 3.2cqw, 40px); }

	.cmad__logo    { width: clamp(140px, 16cqw, 186px); }
	.cmad__built   { width: clamp(112px, 12.5cqw, 148px); }
	.cmad__head    { font-size: clamp(19px, 2.5cqw, 26px); margin-top: .75em; }
	.cmad__sub     { font-size: clamp(12px, 1.35cqw, 13.5px); max-width: 52ch; }
	.cmad__contact { font-size: 11px; }
	.cmad__cta     { font-size: 13.5px; }
	.cmad__foot    { padding-top: 16px; }

	/* ⚠ עשרה לוגואים בשורה אחת ברוחב הזה הם כ-40px כל אחד —
	   בלתי מזוהים. הרצועה הרוחבית מסדרת אותם 5×2. */
	.cmad__brands {
		background-image: url('img/brand-wall-wide.png');
		aspect-ratio: 964 / 132;
		margin-top: .6em;
	}

	/* ⚠ קיר של עשרה בשתי שורות מוסיף כ-62px, ובגובה 250 זה מה
	   שדחף את ה-CTA מתחת לקצה. הווריאנט הזה מוותר על משפט
	   המשנה — הקיר הוא ההוכחה, והטקסט רק חוזר עליה. */
	.cmad--auto .cmad__logo  { width: clamp(124px, 14cqw, 150px); }
	.cmad--auto .cmad__head  { font-size: clamp(16px, 2cqw, 20px); margin-top: .5em; }
	.cmad--auto .cmad__sub   { display: none; }
	.cmad--auto .cmad__foot  { padding-top: 10px; }
}

/* ── טור: הצללה מלמטה ── */
@container (min-height: 400px) {
	.cmad__media { background-image: url('img/cm-rx7-box.jpg'); }
	.cmad__scrim {
		background: linear-gradient(to top,
			rgba(12, 10, 17, .97) 0%, rgba(12, 10, 17, .92) 48%,
			rgba(12, 10, 17, .5) 74%, rgba(12, 10, 17, .08) 96%);
	}

	.cmad__body { justify-content: flex-end; padding: 22px; }

	/* ⚠ ב-256px פנויים שורת הקשר וה-CTA לא נכנסים יחד בשורה אחת. */
	.cmad__foot {
		flex-direction: column-reverse;
		align-items: stretch;
		gap: 11px;
		padding-top: 18px;
	}

	.cmad__cta     { justify-content: center; }
	.cmad__contact { text-align: center; }

	.cmad__pair    { flex-direction: column; align-items: flex-start; gap: .7em; }
	.cmad__pair::after { align-self: flex-start; width: 3.2em; height: 1px; }

	.cmad__logo    { width: 168px; }
	.cmad__built   { width: 134px; }
	.cmad__head    { font-size: 25px; margin-top: .85em; }
	.cmad__sub     { font-size: 13px; }
	.cmad__contact { font-size: 11px; }
	.cmad__cta     { font-size: 13px; }

	/* ⚠ כאן הרצועה היא 2×5 ולא 5×2. ברוחב הזה חמש עמודות היו
	   כ-50px ללוגו. הגובה מוגבל ולא נגזר מיחס הצדדים: contain
	   מכווץ את הרצועה כדי להיכנס, ובלי התקרה היא הייתה תופסת
	   כ-240px ודוחפת את ה-CTA אל מחוץ ליחידה. */
	.cmad__brands {
		background-image: url('img/brand-wall-rail.png');
		height: clamp(150px, 30cqh, 205px);
	}
}

/* ── רצועה: אמצע דף הבית וכל הנייד ── */
@container (max-height: 399px) and (max-width: 619px) {
	.cmad__media { background-image: url('img/cm-rx7-wide.jpg'); }
	.cmad__scrim {
		background: linear-gradient(to top,
			rgba(12, 10, 17, .97) 0%, rgba(12, 10, 17, .92) 50%,
			rgba(12, 10, 17, .5) 76%, rgba(12, 10, 17, .08) 96%);
	}

	.cmad__body { justify-content: flex-end; padding: clamp(14px, 4.8cqw, 18px); }

	.cmad__foot {
		flex-direction: column-reverse;
		align-items: stretch;
		gap: 9px;
		padding-top: 11px;
	}

	.cmad__cta     { justify-content: center; }
	.cmad__contact { text-align: center; }

	.cmad__logo    { width: clamp(104px, 34cqw, 140px); }
	.cmad__built   { width: clamp(84px, 27cqw, 112px); }
	.cmad__pair    { gap: .7em; }
	.cmad__head    { font-size: clamp(15px, 4.9cqw, 18px); margin-top: .65em; }
	.cmad__sub     { font-size: clamp(11px, 3.4cqw, 12px); }
	.cmad__contact { font-size: clamp(9px, 2.8cqw, 10px); }
	.cmad__cta     { font-size: clamp(11px, 3.4cqw, 12.5px); }

	/* ⚠ קיר המותגים יורד כאן. ברוחב 300px עשרה לוגואים אינם
	   קריאים בשום סידור, וגובה 250 לא משאיר להם מקום. */
	.cmad__brands  { display: none; }
}

/* ── קיצורים לפי מקום פנוי ── */
@container (max-height: 260px) and (max-width: 619px) {
	.cmad__sub { display: none; }
}

@container (max-width: 300px) and (max-height: 399px) {
	.cmad__sub     { display: none; }
	.cmad__contact { display: none; }
}

.cmad:focus-visible {
	outline: 3px solid var(--cm-mag);
	outline-offset: 2px;
}
