/*
 * tq-site/modules/app-promo: the app promo box (one look, four places). Theme tokens only (they flip in dark mode),
 * brand blue = the theme's --g-color, logical properties. The store row (src/Badges.php): the official Google Play badge,
 * unaltered (no filter, no recolour), then ONE pill component (Microsoft Store, iPhone, Chrome Web Store) built on its
 * measures. One visible height per place (--tq-store-h): the Play PNG carries its own clear space (badge = 168 of its
 * 250px), so it is drawn taller.
 * Inside our apps every box is hidden (html.tq-in-app from the head state script, html.tq-app from the app itself);
 * the iPhone pill is hidden in an installed web app (display-mode: standalone, or html.tq-standalone on iOS).
 */
.tq-in-app .tq-app-promo,
.tq-in-app .tq-app-strip,
.tq-in-app .tq-apps__lead,
.tq-in-app .tq-apps-ios,
.tq-app .tq-app-promo,
.tq-app .tq-app-strip,
.tq-app .tq-apps__lead,
.tq-app .tq-apps-ios {
	display: none;
}

.tq-app-promo {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 16px;
	box-sizing: border-box;
	padding-block: 16px;
	padding-inline: 20px;
	border: 1px solid var(--flex-gray-15);
	border-inline-start: 4px solid var(--g-color);
	border-radius: var(--round-7);
	background: var(--solid-white);
	color: var(--body-fcolor);
}

.tq-app-promo__ic {
	flex: none;
	inline-size: 48px;
	block-size: 48px;
	border-radius: 22.5%;
}

.tq-app-promo__txt {
	flex: 1 1 200px;
	min-inline-size: 0;
}

.tq-app-promo__title {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.4;
}

.tq-app-promo__line {
	margin: 0;
	margin-block-start: 4px;
	color: var(--meta-fcolor);
	font-size: 14px;
	line-height: 1.6;
}

.tq-app-promo {
	--tq-store-h: 40px;
}

.tq-app-promo__stores {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	/* ONE black, ONE edge, ONE outer ring for every badge (Sherif 19/11). */
	--tq-badge-black: #000;
	--tq-badge-edge: #a6a6a6;
}

/* One badge family (Sherif 19/11). The model is the official Google Play badge, unaltered: black, a thin grey edge,
   corners 19/168 of its height, the colour icon on the left, a small Arabic line on top and the big store name under
   it. Everything is sized from --tq-store-h = the VISIBLE badge height (the Play PNG carries 41/168 of clear space on
   every side, taken back with a negative margin so the gaps are equal). All four share ONE box (564 x 168). The exact
   badge colours #000 / #a6a6a6 are the stores' own (allowlisted R5). */
.tq-app-promo__badge {
	position: relative;
	flex: none;
	display: inline-flex;
	box-sizing: border-box;
	inline-size: calc(var(--tq-store-h) * 564 / 168);
	block-size: var(--tq-store-h);
	border-radius: calc(var(--tq-store-h) * 19 / 168);
	line-height: 0;
}

/* The thin white outer ring, the same on every badge (it shows on dark pages; invisible on white). */
.tq-app-promo__badge,
.tq-app-promo__pill {
	box-shadow: 0 0 0 1px var(--awhite);
}

.tq-app-promo .tq-app-promo__badge img {
	inline-size: auto;
	block-size: calc(var(--tq-store-h) * 250 / 168);
	max-inline-size: none;
	margin: calc(var(--tq-store-h) * -41 / 168);
}

/* THE pill (Microsoft Store, iPhone, Chrome Web Store), measured on the Play badge: icon 104/168 high, 34/168 from the
   left edge, 26/168 before the text; the text ends 37/168 from the right edge; Arabic line 0.21 of the height, the
   store name as big as its box allows (Play's «Google Play» is 0.44; the longer Latin names are fitted, never cut). */
.tq-app-promo__pill {
	display: inline-flex;
	flex: none;
	flex-direction: row-reverse;
	align-items: center;
	gap: calc(var(--tq-store-h) * 26 / 168);
	box-sizing: border-box;
	inline-size: calc(var(--tq-store-h) * 564 / 168);
	block-size: var(--tq-store-h);
	padding-inline-start: calc(var(--tq-store-h) * 37 / 168);
	padding-inline-end: calc(var(--tq-store-h) * 34 / 168);
	overflow: hidden;
	border: 1px solid var(--tq-badge-edge);
	border-radius: calc(var(--tq-store-h) * 19 / 168);
	background: var(--tq-badge-black);
	color: var(--awhite);
	text-decoration: none;
	white-space: nowrap;
	--tq-pill-b: 0.44;
}

.tq-app-promo__pill:hover,
.tq-app-promo__pill:focus {
	color: var(--awhite);
	text-decoration: none;
}

.tq-app-promo .tq-app-promo__pill-ic {
	flex: none;
	inline-size: calc(var(--tq-store-h) * 104 / 168);
	block-size: calc(var(--tq-store-h) * 104 / 168);
	max-inline-size: none;
	margin: 0;
}

.tq-app-promo__pill-t {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	align-items: flex-start;
	min-inline-size: 0;
	line-height: 1.15;
}

.tq-app-promo__pill-s {
	font-size: calc(var(--tq-store-h) * 0.21);
	font-weight: 500;
}

.tq-app-promo__pill-b {
	font-size: calc(var(--tq-store-h) * var(--tq-pill-b));
	font-weight: 700;
	line-height: 1.05;
}

.tq-app-promo__pill-b[dir="ltr"] {
	letter-spacing: -0.01em;
}

.tq-app-promo__pill--ms {
	--tq-pill-b: 0.29;
}

.tq-app-promo__pill--chrome {
	--tq-pill-b: 0.25;
	cursor: default;
}

.tq-standalone .tq-app-promo__pill--ios {
	display: none;
}

@media (display-mode: standalone) {
	.tq-app-promo__pill--ios {
		display: none;
	}
}

.tq-app-promo__badge:focus-visible,
.tq-app-promo__pill:focus-visible {
	outline: 2px solid var(--g-color);
	outline-offset: 2px;
}

/* Inline (after the article text / under the game and product hero): one small box with room around it. */
.tq-app-promo--inline {
	margin-block: 24px;
}

.tq-app-promo-slot {
	margin-block: 8px 24px;
}

/* Sidebar: icon + text on one row, the badges under them. */
.tq-app-promo--sidebar .tq-app-promo__txt {
	flex-basis: 150px;
}

.tq-app-promo--sidebar {
	--tq-store-h: 36px;
}

/* Strip above the footer: a full-width band, centred, more air. */
.tq-app-strip {
	padding-block: 32px;
	border-block-start: 1px solid var(--flex-gray-15);
	background: var(--solid-white);
}

.tq-app-strip .tq-app-promo {
	justify-content: center;
	max-inline-size: 960px;
	margin-inline: auto;
	padding: 0;
	border: 0;
	background: none;
}

.tq-app-strip .tq-app-promo__ic {
	inline-size: 56px;
	block-size: 56px;
}

.tq-app-strip .tq-app-promo__title {
	font-size: 22px;
}

.tq-app-strip .tq-app-promo {
	--tq-store-h: 44px;
}

/* The /apps/ page card. */
.tq-apps__head {
	padding-block: 24px 16px;
}

.tq-apps__lead {
	margin: 0;
	margin-block-start: 8px;
	color: var(--meta-fcolor);
}

.tq-app-promo--apps {
	gap: 16px 24px;
	padding-block: 24px;
	padding-inline: 24px;
}

.tq-app-promo--apps .tq-app-promo__ic {
	inline-size: 96px;
	block-size: 96px;
}

.tq-app-promo--apps .tq-app-promo__title {
	font-size: 24px;
}

.tq-app-promo--apps .tq-app-promo__line {
	font-size: 16px;
}

.tq-app-promo--apps {
	--tq-store-h: 44px;
	scroll-margin-block-start: 96px;
}

.tq-apps__list {
	display: grid;
	gap: 24px;
}

.tq-apps__body {
	margin-block: 24px 40px;
}

/* The iPhone section (bottom of /apps/, id «iphone»): numbered steps with our own glyphs, then the desktop note. */
.tq-apps-ios {
	box-sizing: border-box;
	margin-block: 40px 56px;
	padding-block: 28px;
	padding-inline: 24px;
	border: 1px solid var(--flex-gray-15);
	border-radius: var(--round-7);
	background: var(--solid-white);
	color: var(--body-fcolor);
	scroll-margin-block-start: 96px;
}

.tq-apps-ios__h2 {
	margin: 0;
	font-size: 24px;
	font-weight: 700;
	line-height: 1.4;
}

.tq-apps-ios__line {
	margin: 0;
	margin-block-start: 8px;
	color: var(--meta-fcolor);
	font-size: 16px;
	line-height: 1.7;
}

.tq-apps-ios__steps {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 16px;
	margin: 0;
	margin-block-start: 24px;
	padding: 0;
	list-style: none;
}

.tq-apps-ios__step {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
	margin: 0;
	padding: 20px;
	border-radius: var(--round-7);
	background: var(--flex-gray-7);
}

.tq-apps-ios__ic {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: 56px;
	block-size: 56px;
	border-radius: 16px;
	background: var(--dark-accent);
	color: var(--awhite);
}

.tq-apps-ios__svg {
	inline-size: 28px;
	block-size: 28px;
}

.tq-apps-ios__n {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: 28px;
	block-size: 28px;
	border-radius: 50%;
	background: var(--g-color);
	color: var(--awhite);
	font-size: 14px;
	font-weight: 700;
}

.tq-apps-ios__txt {
	font-size: 15px;
	line-height: 1.7;
}

.tq-apps-ios__desk {
	margin-block-start: 28px;
	padding-block-start: 24px;
	border-block-start: 1px solid var(--flex-gray-15);
}

.tq-apps-ios__h3 {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
}

@media (max-width: 400px) {
	.tq-app-promo,
	.tq-app-strip .tq-app-promo {
		--tq-store-h: 40px;
	}
}

@media (max-width: 767px) {
	.tq-app-strip {
		padding-block: 24px;
	}

	.tq-app-strip .tq-app-promo {
		justify-content: flex-start;
	}

	.tq-app-strip .tq-app-promo__title {
		font-size: 19px;
	}

	/* Phones: the badges get their own full row, centred under the text (Sherif 19/11). */
	.tq-app-promo__stores {
		flex-basis: 100%;
		justify-content: center;
	}

	.tq-apps-ios {
		padding-inline: 16px;
	}
}
