/*
 * Mass Gear — search: the header button, the panel it opens and the results
 * page ("Usta's bench"). Markup in inc/search.php. Logical properties
 * throughout, so Arabic needs no separate rules.
 */

/* ---------- 1. The header button: Usta's face as a magnifying glass ---------- */

.mg-seek {
	--px: 0px;
	--py: 0px;
	position: relative;
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	text-decoration: none;
}
.mg-lens { display: block; width: 42px; height: 42px; overflow: visible; }
.mg-lens__rim { transform-box: fill-box; transform-origin: center; transition: transform 900ms var(--wp--custom--ease); }
.mg-lens__pupils { transform: translate(var(--px, 0), var(--py, 0)); transition: transform 120ms ease-out; }
.mg-lens__eyes { transform-box: fill-box; transform-origin: center; }
.mg-seek .mg-lens { transition: transform 320ms cubic-bezier(.3, 1.6, .5, 1); }
.mg-seek:hover .mg-lens, .mg-seek:focus-visible .mg-lens { transform: rotate(-9deg) scale(1.1); }
.mg-seek:hover .mg-lens__rim, .mg-seek:focus-visible .mg-lens__rim { transform: rotate(180deg); }
.mg-seek__word {
	position: absolute;
	top: calc(100% + 4px);
	left: 50%;
	padding: .3rem .55rem;
	border-radius: 2px;
	background: var(--wp--preset--color--navy-deep);
	color: #fff;
	font-family: var(--wp--preset--font-family--mono);
	font-size: .6875rem;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: .08em;
	text-transform: uppercase;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transform: translate(-50%, -4px);
	transition: opacity 150ms, transform 150ms;
	z-index: 2;
}
.mg-seek:hover .mg-seek__word, .mg-seek:focus-visible .mg-seek__word { opacity: 1; transform: translate(-50%, 0); }
@media (hover: none) { .mg-seek__word { display: none; } }
@media (prefers-reduced-motion: no-preference) {
	.mg-seek .mg-lens__eyes { animation: mg-blink 5.2s infinite; }
}
@keyframes mg-blink { 0%, 95%, 100% { transform: scaleY(1); } 97.5% { transform: scaleY(.1); } }

/* ---------- 2. The field ---------- */

.mg-ask {
	position: relative;
	display: flex;
	align-items: stretch;
	min-height: 68px;
	background: #fff;
	border-radius: 4px;
	box-shadow: 0 0 0 2px var(--wp--preset--color--gold), 0 24px 50px -24px rgba(0, 0, 0, .55);
	transition: box-shadow 200ms var(--wp--custom--ease);
}
.mg-ask:focus-within { box-shadow: 0 0 0 4px var(--wp--preset--color--gold-bright), 0 24px 50px -24px rgba(0, 0, 0, .55); }
.mg-ask__icon { flex: 0 0 auto; display: grid; place-items: center; padding-inline: .9rem .2rem; }
.mg-ask__icon .mg-lens { width: 46px; height: 46px; }
.mg-ask.is-busy .mg-lens__rim { animation: mg-turn 1.4s linear infinite; }
@keyframes mg-turn { to { transform: rotate(360deg); } }
.mg-ask input[type="search"] {
	flex: 1 1 auto;
	min-width: 0;
	padding: .6rem .75rem;
	border: 0;
	background: none;
	box-shadow: none;
	outline: none;
	-webkit-appearance: none;
	        appearance: none;
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(1.1rem, 2.4vw, 1.6rem);
	font-weight: 600;
	letter-spacing: -.01em;
	color: var(--wp--preset--color--navy-deep);
}
.mg-ask input[type="search"]::placeholder { color: var(--wp--preset--color--steel); opacity: .8; font-weight: 500; }
.mg-ask input[type="search"]::-webkit-search-cancel-button { display: none; }
[dir="rtl"] .mg-ask input[type="search"]:placeholder-shown { direction: rtl; }
.mg-ask__clear {
	flex: 0 0 44px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--wp--preset--color--steel);
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
}
.mg-ask__clear[hidden] { display: none; }
.mg-ask__go, .mg-go {
	border: 0;
	background: var(--wp--preset--color--gold);
	color: var(--wp--preset--color--navy-deep);
	font-family: var(--wp--preset--font-family--mono);
	font-size: .8125rem;
	font-weight: 600;
	letter-spacing: .1em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 200ms;
}
.mg-ask__go { padding: 0 1.6rem; border-start-end-radius: 4px; border-end-end-radius: 4px; }
.mg-go { display: inline-block; padding: .95em 1.5em; border-radius: 2px; line-height: 1.3; text-align: center; text-decoration: none; }
.mg-ask__go:hover, .mg-go:hover { background: var(--wp--preset--color--gold-bright); }
.mg-go--line { background: none; box-shadow: inset 0 0 0 1px var(--wp--preset--color--navy); color: var(--wp--preset--color--navy); }
.mg-go--line:hover { background: rgba(0, 45, 76, .06); }

.mg-chips { display: flex; align-items: baseline; gap: .9rem; font-family: var(--wp--preset--font-family--mono); font-size: .8125rem; color: rgba(255, 255, 255, .72); }
.mg-chips > span { flex: 0 0 auto; letter-spacing: .1em; text-transform: uppercase; }
.mg-chips ul { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.mg-chips a { display: block; padding: .45rem .7rem; border: 1px solid rgba(255, 255, 255, .28); border-radius: 2px; color: #fff; text-decoration: none; line-height: 1.2; transition: background-color 160ms, color 160ms, border-color 160ms; }
.mg-chips a:hover { background: var(--wp--preset--color--gold); border-color: var(--wp--preset--color--gold); color: var(--wp--preset--color--navy-deep); }

/* Navy drawing sheet, shared by the panel and the top of the results page. */
.mg-panel__sheet, .mg-search__top {
	color: #fff;
	background-color: var(--wp--preset--color--navy);
	background-image:
		linear-gradient(to right, rgba(255, 255, 255, .06) 1px, transparent 1px),
		linear-gradient(to bottom, rgba(255, 255, 255, .06) 1px, transparent 1px),
		linear-gradient(160deg, var(--wp--preset--color--navy) 0%, var(--wp--preset--color--navy-deep) 100%);
	background-size: 44px 44px, 44px 44px, auto;
}
.mg-panel .mg-eyebrow, .mg-search__top .mg-eyebrow { color: var(--wp--preset--color--gold-bright); }

/* ---------- 3. The panel ---------- */

.mg-panel {
	width: 100%;
	max-width: none;
	height: 100%;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	overflow: hidden;
}
.mg-panel::backdrop { background: rgba(0, 26, 44, .55); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.mg-panel__sheet {
	position: relative;
	max-height: 100%;
	overflow: hidden auto;
	padding: clamp(1.5rem, 4vw, 3rem) var(--wp--custom--gutter) clamp(1.5rem, 3vw, 2.25rem);
	box-shadow: 0 40px 80px -40px #000;
}
/* The knurled roller the sheet hangs from. */
.mg-panel__sheet::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	height: 8px;
	background: repeating-linear-gradient(90deg, var(--wp--preset--color--gold) 0 2px, transparent 2px 7px);
}
.mg-panel__in { position: relative; max-width: 920px; margin-inline: auto; }
.mg-panel__h {
	margin: 0 0 1.4rem;
	padding-inline-end: 150px;
	min-height: 2.4em;
	display: flex;
	align-items: flex-end;
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(1.7rem, 4.4vw, 3rem);
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -.02em;
	text-wrap: balance;
}
/* He stands on the top edge of the field. */
.mg-panel__stand { --usta-w: 124px; position: relative; height: 0; width: 124px; margin-inline-start: auto; margin-inline-end: 18px; z-index: 3; }
.mg-panel__close {
	position: absolute;
	top: 1rem;
	inset-inline-end: 1rem;
	z-index: 4;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, .28);
	border-radius: 2px;
	background: none;
	color: #fff;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}
.mg-panel__close:hover { background: var(--wp--preset--color--gold); border-color: var(--wp--preset--color--gold); color: var(--wp--preset--color--navy-deep); }
.mg-panel__list { background: #fff; border-radius: 0 0 4px 4px; }
.mg-panel.has-rows .mg-panel__list { margin-top: 6px; padding: .4rem; }
.mg-panel .mg-chips { margin-top: 1.3rem; }
.mg-panel__keys { margin: 1rem 0 0; font-family: var(--wp--preset--font-family--mono); font-size: .75rem; color: rgba(255, 255, 255, .6); }
@media (hover: none) { .mg-panel__keys { display: none; } }

.mg-row { display: flex; align-items: center; gap: .9rem; min-height: 56px; padding: .4rem .8rem .4rem .4rem; border-radius: 3px; color: var(--wp--preset--color--ink); text-decoration: none; }
[dir="rtl"] .mg-row { padding: .4rem .4rem .4rem .8rem; }
.mg-row:hover, .mg-row[aria-selected="true"] { background: var(--wp--preset--color--paper); box-shadow: inset 3px 0 0 var(--wp--preset--color--gold); }
[dir="rtl"] .mg-row:hover, [dir="rtl"] .mg-row[aria-selected="true"] { box-shadow: inset -3px 0 0 var(--wp--preset--color--gold); }
.mg-row__img { flex: 0 0 64px; height: 48px; border-radius: 2px; overflow: hidden; background: var(--wp--preset--color--hairline); }
.mg-row__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mg-row__title { flex: 1 1 auto; min-width: 0; font-weight: 600; line-height: 1.3; }
.mg-row__kind { flex: 0 0 auto; font-family: var(--wp--preset--font-family--mono); font-size: .75rem; color: var(--wp--preset--color--steel); }
.mg-row--calc, .mg-row--all { padding-inline: .8rem; }
.mg-row--calc .mg-row__title { color: var(--wp--preset--color--navy); }
.mg-row--all { border-top: var(--wp--custom--rule); border-radius: 0 0 3px 3px; }
.mg-row--all .mg-row__title { font-family: var(--wp--preset--font-family--mono); font-size: .8125rem; color: var(--wp--preset--color--gold-deep); }
.mg-row mark, .mg-fit mark { background: color-mix(in srgb, var(--wp--preset--color--gold) 34%, transparent); color: inherit; border-radius: 2px; }

html.mg-panel-open { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
	.mg-panel[open] .mg-panel__sheet { animation: mg-unroll 420ms var(--wp--custom--ease); }
	.mg-panel[open]::backdrop { animation: mg-fade 300ms; }
	.mg-panel.is-closing .mg-panel__sheet { animation: mg-unroll 220ms ease-in reverse forwards; }
	.mg-panel.is-closing::backdrop { opacity: 0; transition: opacity 220ms; }
	.mg-row { animation: mg-rise 260ms var(--wp--custom--ease) backwards; animation-delay: calc(var(--i, 0) * 35ms); }
}
@keyframes mg-unroll { from { clip-path: inset(0 0 100% 0); transform: translateY(-24px); } to { clip-path: inset(0 0 0 0); } }
@keyframes mg-fade { from { opacity: 0; } }
@keyframes mg-rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------- 4. The results page ---------- */

.mg-search__top { padding: clamp(2.5rem, 6vw, 4.5rem) var(--wp--custom--gutter) clamp(1.75rem, 3vw, 2.5rem); }
.mg-search__in, .mg-search__main { max-width: 1280px; margin-inline: auto; }
.mg-search__h {
	margin: 0 0 1.6rem;
	font-size: clamp(1.9rem, 5vw, 3.6rem);
	line-height: 1.08;
	color: #fff;
	overflow-wrap: anywhere;
	text-wrap: balance;
}
.mg-search__stand { --usta-w: 96px; display: none; position: relative; height: 0; width: 96px; margin-inline-start: auto; margin-inline-end: 8px; z-index: 3; }
.mg-search__under { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .8rem 2rem; margin-top: 1.3rem; }
.mg-search__count { margin: 0; font-family: var(--wp--preset--font-family--mono); font-size: .9375rem; font-weight: 600; color: var(--wp--preset--color--gold-bright); }
.mg-search__count:empty { display: none; }

.mg-search__main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: clamp(2rem, 4vw, 4rem); padding: clamp(2rem, 4vw, 3.5rem) var(--wp--custom--gutter) var(--wp--preset--spacing--70); box-sizing: content-box; }
.mg-found { --roll: 0; min-width: 0; }
.mg-found__h { margin: 0 0 1.2rem; font-size: clamp(1.35rem, 2.4vw, 1.9rem); }
.mg-found > * + * { margin-top: clamp(2.25rem, 4vw, 3.25rem); }
.mg-found > .mg-drive, .mg-found > .mg-corrected + *, .mg-found > .mg-drawers + * { margin-top: 1.5rem; }
.mg-corrected { margin-bottom: 0; font-weight: 600; color: var(--wp--preset--color--navy); }

/* Drawers */
.mg-drawers { display: flex; flex-wrap: wrap; gap: .5rem; }
.mg-drawer {
	position: relative;
	padding: .75rem 1rem .95rem;
	border: 1px solid rgba(0, 45, 76, .2);
	border-radius: 3px;
	background: linear-gradient(#fff, var(--wp--preset--color--paper));
	color: var(--wp--preset--color--navy);
	font-family: var(--wp--preset--font-family--mono);
	font-size: .8125rem;
	font-weight: 500;
	line-height: 1.2;
	cursor: pointer;
	transition: transform 200ms var(--wp--custom--ease), background-color 200ms, color 200ms;
}
/* the pull */
.mg-drawer::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 22px; height: 3px; margin-left: -11px; border-radius: 2px; background: var(--wp--preset--color--gold); }
.mg-drawer span { color: var(--wp--preset--color--steel); }
.mg-drawer:hover { transform: translateY(2px); }
.mg-drawer[aria-pressed="true"] { background: var(--wp--preset--color--navy); color: #fff; transform: translateY(3px); }
.mg-drawer[aria-pressed="true"] span { color: var(--wp--preset--color--gold-bright); }

/* The chain drive: a sprocket per result, one chain round them all. The
   chain and the wheels move by the same distance, so they stay in mesh. */
.mg-drive { --gap: 1.25rem; --c: 52px; margin-block-end: 0; padding: 0; list-style: none; }
.mg-fit { position: relative; display: grid; grid-template-columns: 66px minmax(0, 1fr); gap: 1.25rem; }
.mg-fit[hidden] { display: none; }
.mg-fit + .mg-fit { margin-top: var(--gap); }
.mg-fit__wheel { position: relative; z-index: 1; width: 66px; height: 66px; margin-top: calc(var(--c) - 33px); display: grid; place-items: center; }
.mg-fit__wheel svg { position: absolute; inset: 0; transform: rotate(calc(var(--roll) * 1.976deg)); }
.mg-fit__wheel path { fill: var(--wp--preset--color--gold); stroke: var(--wp--preset--color--navy-deep); stroke-width: 1.4; }
.mg-fit__wheel circle { fill: #fff; stroke: var(--wp--preset--color--navy-deep); stroke-width: 1.4; }
.mg-fit--good .mg-fit__wheel path { fill: var(--wp--preset--color--navy-soft); }
.mg-fit--loose .mg-fit__wheel path { fill: var(--wp--preset--color--steel-light); }
.mg-fit__wheel b { position: relative; font-family: var(--wp--preset--font-family--mono); font-size: .875rem; font-weight: 600; color: var(--wp--preset--color--navy); }
.mg-fit:not(:last-child):not(.is-last)::before {
	--link: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 24'%3E%3Crect x='2.6' y='9' width='4.8' height='18' rx='2.4' fill='%23b9c3cc'/%3E%3Crect x='2.6' y='-15' width='4.8' height='18' rx='2.4' fill='%23b9c3cc'/%3E%3Crect x='1' y='-1' width='8' height='14' rx='4' fill='%235d6b78'/%3E%3Ccircle cx='5' cy='3' r='1.6' fill='%23fff'/%3E%3Ccircle cx='5' cy='9.500' r='1.6' fill='%23fff'/%3E%3C/svg%3E");
	content: "";
	position: absolute;
	inset-inline-start: -1px;
	top: var(--c);
	width: 68px;
	height: calc(100% + var(--gap));
	background-image: var(--link), var(--link);
	background-repeat: repeat-y;
	background-size: 10px 24px;
	background-position: left calc(var(--roll) * -1px), right calc(var(--roll) * 1px);
}

.mg-fit__card {
	display: grid;
	grid-template-columns: 220px minmax(0, 1fr);
	background: #fff;
	border: var(--wp--custom--rule);
	border-radius: 3px;
	overflow: clip;
	color: inherit;
	text-decoration: none;
	transition: transform var(--wp--custom--speed) var(--wp--custom--ease), box-shadow var(--wp--custom--speed) var(--wp--custom--ease), border-color var(--wp--custom--speed);
}
.mg-fit__card:hover, .mg-fit__card:focus-visible { transform: translateY(-3px); border-color: var(--wp--preset--color--gold); box-shadow: var(--wp--preset--shadow--lift); }
.mg-fit--best .mg-fit__card { grid-template-columns: minmax(0, 46%) minmax(0, 1fr); border-color: color-mix(in srgb, var(--wp--preset--color--gold) 60%, transparent); }
.mg-fit__img { position: relative; min-height: 150px; background: var(--wp--preset--color--paper); overflow: hidden; }
.mg-fit--best .mg-fit__img { min-height: 270px; }
.mg-fit__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 700ms var(--wp--custom--ease); }
.mg-fit__card:hover .mg-fit__img img { transform: scale(1.04); }
.mg-fit__body { display: flex; flex-direction: column; gap: .5rem; padding: 1.2rem 1.4rem; }
.mg-fit--best .mg-fit__body { justify-content: center; padding: 1.6rem 1.9rem; }
.mg-fit__meta { display: flex; justify-content: space-between; gap: 1rem; font-family: var(--wp--preset--font-family--mono); font-size: .75rem; color: var(--wp--preset--color--steel); }
.mg-fit__grade { display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; color: var(--wp--preset--color--gold-deep); }
/* a vernier scale that fills to the match */
.mg-fit__grade i { position: relative; width: 62px; height: 10px; background: repeating-linear-gradient(90deg, rgba(0, 45, 76, .35) 0 1px, transparent 1px 6.200px); }
.mg-fit__grade i::after { content: ""; position: absolute; inset-inline-start: 0; bottom: 0; width: calc(var(--v) * 1%); height: 4px; background: var(--wp--preset--color--gold); }
.mg-fit__title { font-family: var(--wp--preset--font-family--display); font-size: 1.3rem; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; color: var(--wp--preset--color--navy); }
.mg-fit--best .mg-fit__title { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.mg-fit__text { font-size: .9375rem; line-height: 1.55; color: var(--wp--preset--color--ink); }
.mg-fit__more { font-family: var(--wp--preset--font-family--mono); font-size: .8125rem; font-weight: 600; color: var(--wp--preset--color--gold-deep); }
.mg-fit__more::after { content: " →"; }
[dir="rtl"] .mg-fit__more::after { content: " ←"; }

/* Usta's inspection stamp */
.mg-stamp {
	position: absolute;
	top: 16px;
	inset-inline-start: 16px;
	display: grid;
	place-items: center;
	width: 88px;
	height: 88px;
	padding: .5rem;
	border: 3px solid var(--wp--preset--color--navy-deep);
	border-radius: 50%;
	background: var(--wp--preset--color--gold-bright);
	box-shadow: inset 0 0 0 4px var(--wp--preset--color--gold-bright), inset 0 0 0 5.500px var(--wp--preset--color--navy-deep);
	color: var(--wp--preset--color--navy-deep);
	font-family: var(--wp--preset--font-family--mono);
	font-size: .8125rem;
	font-weight: 600;
	line-height: 1.15;
	text-align: center;
	text-transform: uppercase;
	transform: rotate(-12deg);
}

/* Calculator and quick answer */
.mg-calc { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); border-radius: 4px; overflow: hidden; background: var(--wp--preset--color--navy); color: #fff; }
.mg-calc__draw { display: grid; place-items: center; padding: 1.2rem; background: #0f5c96 linear-gradient(rgba(255, 255, 255, .1) 1px, transparent 1px) 0 0 / 22px 22px; background-image: linear-gradient(rgba(255, 255, 255, .1) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .1) 1px, transparent 1px); background-size: 22px 22px; }
.mg-calc__draw svg { width: 100%; max-width: 260px; }
.mg-calc__gear path, .mg-calc__bore { fill: rgba(255, 255, 255, .08); stroke: #fff; stroke-width: 1.4; stroke-linejoin: round; }
.mg-calc__pitch { fill: none; stroke: var(--wp--preset--color--gold-bright); stroke-width: 1.2; stroke-dasharray: 8 3 2 3; }
.mg-calc__axis { stroke: rgba(255, 255, 255, .55); stroke-width: .8; stroke-dasharray: 14 4 3 4; }
.mg-calc__body { padding: clamp(1.3rem, 3vw, 2.2rem); }
.mg-calc .mg-eyebrow { color: var(--wp--preset--color--gold-bright); }
.mg-calc__h { margin: 0 0 1rem; font-size: clamp(1.5rem, 3vw, 2.2rem); color: #fff; }
.mg-calc dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .2rem 1.5rem; margin: 0 0 1rem; }
.mg-calc dl > div { padding: .55rem 0; border-top: 1px solid rgba(255, 255, 255, .2); }
.mg-calc dt { font-size: .8125rem; color: rgba(255, 255, 255, .78); }
.mg-calc dd { margin: 0; font-family: "IBM Plex Mono", monospace; font-size: 1.2rem; font-weight: 600; color: var(--wp--preset--color--gold-bright); }
.mg-calc__note { margin: 0 0 1.2rem; font-size: .8125rem; line-height: 1.5; color: rgba(255, 255, 255, .78); }
.mg-answer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; padding: clamp(1.2rem, 3vw, 2rem); border-inline-start: 5px solid var(--wp--preset--color--gold); background: var(--wp--preset--color--cream); border-radius: 3px; }
.mg-answer__h { margin: 0 0 .4rem; font-size: 1.5rem; }
.mg-answer p { margin: 0; }
.mg-answer .mg-eyebrow { margin-bottom: .6rem; }
.mg-answer__big { font-size: 1.2rem; font-weight: 600; line-height: 1.6; }
.mg-answer__big a { display: inline-block; margin-inline-end: 1.2rem; color: var(--wp--preset--color--navy); }

/* Films and photos */
.mg-films ul, .mg-photos ul, .mg-wall__pegs { margin: 0; padding: 0; list-style: none; display: grid; gap: 1rem; }
.mg-films ul { grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); }
.mg-films a { display: grid; gap: .35rem; color: var(--wp--preset--color--navy); text-decoration: none; }
.mg-films__frame { position: relative; aspect-ratio: 4 / 3; border-radius: 3px; overflow: hidden; background: var(--wp--preset--color--navy-deep); border-block: 8px solid var(--wp--preset--color--navy-deep); }
.mg-films__frame::before, .mg-films__frame::after { content: ""; position: absolute; inset-inline: 0; height: 4px; z-index: 1; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .85) 0 7px, transparent 7px 14px); }
.mg-films__frame::before { top: -6px; }
.mg-films__frame::after { bottom: -6px; }
.mg-films__frame { overflow: visible; }
.mg-films__frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mg-films__play { position: absolute; top: 50%; left: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: var(--wp--preset--color--gold); transition: transform 200ms var(--wp--custom--ease); }
.mg-films__play::after { content: ""; position: absolute; top: 15px; left: 19px; border: solid transparent; border-width: 9px 0 9px 14px; border-left-color: var(--wp--preset--color--navy-deep); }
.mg-films a:hover .mg-films__play { transform: scale(1.12); }
.mg-films__dur { position: absolute; right: 8px; bottom: 8px; padding: .1rem .4rem; border-radius: 2px; background: rgba(0, 26, 44, .85); color: #fff; font-family: var(--wp--preset--font-family--mono); font-size: .75rem; }
.mg-films__name { font-weight: 600; line-height: 1.35; }
.mg-films__watch { font-size: .8125rem; color: var(--wp--preset--color--gold-deep); }
.mg-photos ul { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.mg-photos a { display: block; overflow: hidden; border-radius: 3px; }
.mg-photos img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; transition: transform 600ms var(--wp--custom--ease); }
.mg-photos a:hover img { transform: scale(1.05); }

/* Nothing found, and the tool wall */
.mg-none { padding: clamp(1.5rem, 4vw, 2.75rem); border: 2px dashed color-mix(in srgb, var(--wp--preset--color--gold) 70%, transparent); border-radius: 4px; }
.mg-none h2 { margin: 0 0 .6rem; font-size: clamp(1.6rem, 3.4vw, 2.5rem); }
.mg-none p { overflow-wrap: anywhere; }
.mg-none__go { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1.3rem 0 0; }
.mg-wall__p { margin: -.6rem 0 1.4rem; color: var(--wp--preset--color--steel); }
.mg-wall__pegs {
	grid-template-columns: repeat(auto-fill, minmax(min(46%, 168px), 1fr));
	gap: 1.9rem 1.1rem;
	padding: 2rem 1.3rem 1.7rem;
	border-radius: 4px;
	background: var(--wp--preset--color--cream) radial-gradient(circle, rgba(0, 45, 76, .2) 0 2px, transparent 2.500px) 0 0 / 22px 22px;
}
.mg-peg a { position: relative; display: block; padding: .4rem .4rem .7rem; border-radius: 3px; background: #fff; box-shadow: 0 10px 18px -12px rgba(0, 45, 76, .6); color: var(--wp--preset--color--navy); text-decoration: none; transform-origin: 50% -12px; }
/* hook and string */
.mg-peg a::before { content: ""; position: absolute; left: 50%; top: -20px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--wp--preset--color--gold); border: 2px solid var(--wp--preset--color--navy-deep); }
.mg-peg a::after { content: ""; position: absolute; left: 50%; top: -9px; height: 9px; border-inline-start: 2px solid var(--wp--preset--color--navy-deep); margin-left: -1px; }
.mg-peg__img { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 2px; background: var(--wp--preset--color--paper); }
.mg-peg__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mg-peg__name { display: block; padding: .6rem .3rem 0; font-size: .9375rem; font-weight: 600; line-height: 1.25; text-align: center; }

/* Usta's workbench */
.mg-bench__in { position: sticky; top: calc(var(--mg-header-h, 96px) + 1rem); }
.mg-bench__stand { --usta-w: 160px; position: relative; height: 272px; }
.mg-bench__stand .mgu-bubble { right: auto; left: 50%; bottom: calc(100% + 4px); max-width: 230px; border-radius: 12px; font-size: .9375rem; text-align: center; translate: -50% 0; transform-origin: 50% 100%; }
.mg-bench__stand .mgu-bubble::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 12px; height: 12px; margin-left: -6px; background: #fff; border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.mg-bench__top { position: relative; height: 18px; margin-inline: -10px; border-radius: 3px; background: linear-gradient(var(--wp--preset--color--gold-bright), var(--wp--preset--color--gold) 45%, #a9740f); box-shadow: 0 10px 14px -8px rgba(0, 26, 44, .5); }
.mg-bench__box { padding: 1.1rem; border-radius: 0 0 4px 4px; background: var(--wp--preset--color--navy); }
.mg-bench__box p { margin: 0 0 .7rem; font-family: var(--wp--preset--font-family--mono); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--wp--preset--color--gold-bright); }
.mg-bench__box a { position: relative; display: block; padding: .85rem 1rem 1.1rem; border: 1px solid rgba(255, 255, 255, .16); border-radius: 3px; background: var(--wp--preset--color--navy-soft); color: #fff; font-size: .9375rem; font-weight: 500; line-height: 1.3; text-decoration: none; transition: transform 220ms var(--wp--custom--ease), background-color 220ms; }
.mg-bench__box a + a { margin-top: .5rem; }
.mg-bench__box a::after { content: ""; position: absolute; left: 50%; bottom: 6px; width: 34px; height: 4px; margin-left: -17px; border-radius: 2px; background: var(--wp--preset--color--gold); }
.mg-bench__box a:hover { transform: translateY(3px) scale(1.015); background: #17557f; }

@media (prefers-reduced-motion: no-preference) {
	.mg-fit { animation: mg-rise 420ms var(--wp--custom--ease) backwards; animation-delay: calc(var(--i, 0) * 60ms); }
	.mg-stamp { animation: mg-stamp 380ms cubic-bezier(.3, 1.5, .5, 1) 650ms backwards; }
	.mg-calc__gear { animation: mg-turn 26s linear infinite; }
	.mg-peg:hover a, .mg-peg a:focus-visible { animation: mg-swing 900ms ease-in-out; }
}
@keyframes mg-stamp { from { opacity: 0; transform: rotate(14deg) scale(2.4); } }
@keyframes mg-swing { 20% { transform: rotate(5deg); } 45% { transform: rotate(-4deg); } 70% { transform: rotate(2deg); } }

/* Arabic letters join: no tracking, no capitals. */
.mg-lang-ar :is(.mg-seek__word, .mg-ask__go, .mg-go, .mg-ask input, .mg-chips > span, .mg-bench__box p, .mg-panel__h, .mg-fit__title) { letter-spacing: 0; text-transform: none; }
.mg-lang-ar :is(.mg-panel__h, .mg-search__h, .mg-fit__title) { line-height: 1.35; }

/* ---------- 5. Smaller screens ---------- */

@media (max-width: 1079px) {
	/* He leaves the bench and stands on the field. */
	.mg-search__main { grid-template-columns: minmax(0, 1fr); }
	.mg-search__stand { display: block; }
	.mg-search__h { padding-inline-end: 112px; min-height: 2.5em; }
	/* above his head, clear of the heading */
	.mg-search__stand .mgu-bubble { right: 0; left: auto; bottom: calc(100% + 2px); border-radius: 12px 12px 3px 12px; transform-origin: 100% 100%; }
	[dir="rtl"] .mg-search__stand .mgu-bubble { right: auto; left: 0; border-radius: 12px 12px 12px 3px; transform-origin: 0 100%; }
	.mg-bench__stand { display: none; }
	.mg-bench__in { position: static; }
	.mg-bench__top { margin-inline: 0; }
}
@media (max-width: 781px) {
	.mg-ask { min-height: 60px; }
	.mg-ask__icon { padding-inline: .6rem 0; }
	.mg-ask__icon .mg-lens { width: 38px; height: 38px; }
	.mg-ask__go { padding: 0 1rem; font-size: .75rem; }
	.mg-panel__h { padding-inline-end: 104px; min-height: 3.2em; }
	.mg-panel__stand { --usta-w: 88px; width: 88px; margin-inline-end: 6px; }
	/* clear of the close button */
	.mg-panel__sheet { padding-top: 3.75rem; }
	.mg-chips { flex-direction: column; align-items: flex-start; gap: .55rem; }
	.mg-fit { grid-template-columns: minmax(0, 1fr); }
	.mg-fit__wheel { position: absolute; z-index: 2; top: 8px; inset-inline-start: 8px; width: 44px; height: 44px; margin: 0; }
	.mg-fit--best .mg-fit__wheel { inset-inline: auto 8px; }
	.mg-fit__wheel b { font-size: .6875rem; }
	.mg-fit:not(:last-child):not(.is-last)::before { display: none; }
	.mg-fit__card { grid-template-columns: 34% minmax(0, 1fr); }
	.mg-fit--best .mg-fit__card { grid-template-columns: minmax(0, 1fr); }
	.mg-fit__img { min-height: 130px; }
	.mg-fit--best .mg-fit__img { min-height: 0; aspect-ratio: 16 / 10; }
	.mg-fit__body, .mg-fit--best .mg-fit__body { padding: 1rem; }
	.mg-fit:not(.mg-fit--best) .mg-fit__grade i { display: none; }
	.mg-fit:not(.mg-fit--best) .mg-fit__text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
	.mg-fit__title { font-size: 1.1rem; }
	.mg-calc { grid-template-columns: minmax(0, 1fr); }
	.mg-calc__draw svg { max-width: 190px; }
	.mg-photos ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.mg-films ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
	.mg-seek, .mg-seek .mg-lens { width: 40px; height: 40px; }
	.mg-search__stand, .mg-panel__stand { --usta-w: 80px; width: 80px; }
}

/* On the navy sheet his dark outline needs a light one around it. */
.mg-panel__stand .mgu-svg, .mg-search__stand .mgu-svg { filter: drop-shadow(1.5px 0 0 #f7f3e9) drop-shadow(-1.5px 0 0 #f7f3e9) drop-shadow(0 -1.5px 0 #f7f3e9); }

/* Beside the bench, which has its own WhatsApp drawer, the floating button
   would only cover it. */
@media (min-width: 1080px) {
	.search .mg-chat { visibility: hidden; }
}
