/**
 * The fatwa page: its number and date and counters, the share row, the two
 * neighbours, and what all of that becomes on paper.
 *
 * Everything here is laid out with wrap rather than with breakpoints: the
 * chips, the share buttons and the two neighbour cards each decide for
 * themselves when there is no longer room beside them, which holds at every
 * width between a phone and a wide screen instead of at three of them.
 */
.as-fs-bar,
.as-fs-actions,
.as-fs-nav,
.as-ask.is-single {
	--fx-ink: #14231c;
	--fx-ink-2: #3c5147;
	--fx-faint: #6d7f76;
	--fx-green: #2e6e51;
	--fx-green-deep: #1a4232;
	--fx-gold: #7d5f27;
	--fx-gold-dark: #dcbc7e;
	--fx-cream: #f2ede1;
	--fx-paper: #fbf9f4;
	--fx-line: #ded6c4;
	--fx-line-soft: #ece6da;

	font-family: Tajawal, sans-serif;
	direction: rtl;
	text-align: right;
}

/*
 * A default size, not only a flex rule. Without one an icon whose specific
 * rule lives in a stylesheet this page does not load renders at the SVG's
 * own size, which is the whole column wide.
 */
.as-g {
	flex: none;
	width: 16px;
	height: 16px;
}

/*
 * The ask button appears on the listing and on the fatwa, and the two pages
 * load different stylesheets. Its rules are therefore in both, kept the same
 * on purpose: one shared file for forty lines would cost every reader an
 * extra request.
 */
.as-ask {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	flex: none;
	font: 700 15px/1 Tajawal, sans-serif;
	color: #fff;
	background: linear-gradient( 135deg, #35815f, var(--fx-green-deep) );
	border: 0;
	border-radius: 999px;
	padding: 14px 26px;
	text-decoration: none;
	box-shadow: 0 6px 18px rgba( 26, 66, 50, 0.26 );
	transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.as-ask:hover,
.as-ask:focus-visible {
	color: #fff;
	text-decoration: none;
	transform: translateY( -2px );
	box-shadow: 0 12px 26px rgba( 26, 66, 50, 0.34 );
	filter: saturate( 1.1 );
}

.as-ask:focus-visible {
	outline: 2px solid var(--fx-gold-dark);
	outline-offset: 3px;
}

.as-ask .as-g {
	width: 17px;
	height: 17px;
	transition: transform 0.18s ease;
}

.as-ask:hover .as-g {
	transform: rotate( -12deg );
}

/* ------------------------------------------------------------- the strip */

.as-fs-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 10px;
	margin-top: 16px;
}

.as-fs-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font: 400 12.5px/1 Tajawal, sans-serif;
	color: var(--fx-ink-2);
	background: var(--fx-paper);
	border: 1px solid var(--fx-line-soft);
	border-radius: 999px;
	padding: 8px 13px;
	white-space: nowrap;
}

.as-fs-chip .as-g {
	width: 14px;
	height: 14px;
	color: var(--fx-faint);
}

.as-fs-chip b {
	font-weight: 700;
	color: var(--fx-ink);
}

.as-fs-chip-t {
	color: var(--fx-faint);
}

/* The number is the one thing on the strip a reader may want to quote. */
.as-fs-chip.is-no {
	color: var(--fx-gold);
	background: var(--fx-cream);
	border-color: rgba( 169, 133, 69, 0.3 );
}

.as-fs-chip.is-no .as-g,
.as-fs-chip.is-no b {
	color: var(--fx-gold);
}

.as-fs-greg {
	color: var(--fx-faint);
}

.as-fs-greg::before {
	content: "\00B7";
	margin-inline-end: 6px;
}

.as-ask.is-single {
	margin-top: 18px;
	align-self: flex-start;
}

/* ------------------------------------------------------------ share & print */

.as-fs-actions {
	position: relative;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px 18px;
	margin-top: 26px;
	padding: 16px 18px;
	background: var(--fx-paper);
	border: 1px solid var(--fx-line-soft);
	border-radius: 12px;
}

.as-fs-actions-label {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin: 0;
	font: 700 12px/1 Tajawal, sans-serif;
	letter-spacing: 0.8px;
	color: var(--fx-gold);
}

.as-fs-actions-label .as-g {
	width: 15px;
	height: 15px;
}

.as-fs-btns {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	margin-inline-start: auto;
}

.as-fs-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	color: var(--fx-ink-2);
	background: #fff;
	border: 1px solid var(--fx-line);
	border-radius: 50%;
	cursor: pointer;
	text-decoration: none;
	transition: transform 0.16s ease, color 0.16s ease,
		background 0.16s ease, border-color 0.16s ease;
}

.as-fs-btn[hidden] {
	display: none;
}

.as-fs-btn .as-g {
	width: 18px;
	height: 18px;
}

.as-fs-btn:hover,
.as-fs-btn:focus-visible {
	color: #fff;
	text-decoration: none;
	transform: translateY( -2px );
}

/* Each network in its own colour, but only once it is asked for. */
.as-fs-btn.is-whatsapp:hover,
.as-fs-btn.is-whatsapp:focus-visible {
	background: #25d366;
	border-color: #25d366;
}

.as-fs-btn.is-telegram:hover,
.as-fs-btn.is-telegram:focus-visible {
	background: #2aabee;
	border-color: #2aabee;
}

.as-fs-btn.is-facebook:hover,
.as-fs-btn.is-facebook:focus-visible {
	background: #1877f2;
	border-color: #1877f2;
}

.as-fs-btn.is-x:hover,
.as-fs-btn.is-x:focus-visible {
	background: #14171a;
	border-color: #14171a;
}

.as-fs-btn.is-mail:hover,
.as-fs-btn.is-mail:focus-visible,
.as-fs-btn.is-copy:hover,
.as-fs-btn.is-copy:focus-visible,
.as-fs-btn.is-native:hover,
.as-fs-btn.is-native:focus-visible {
	background: var(--fx-green);
	border-color: var(--fx-green);
}

.as-fs-btn.is-print:hover,
.as-fs-btn.is-print:focus-visible {
	background: var(--fx-green-deep);
	border-color: var(--fx-green-deep);
}

.as-fs-btn.is-copy.is-done {
	color: #fff;
	background: var(--fx-green);
	border-color: var(--fx-green);
}

.as-fs-toast {
	position: absolute;
	inset-inline-end: 18px;
	bottom: calc( 100% + 8px );
	font: 700 12px/1 Tajawal, sans-serif;
	color: #fff;
	background: var(--fx-green-deep);
	border-radius: 999px;
	padding: 9px 14px;
	box-shadow: 0 6px 16px rgba( 20, 35, 28, 0.22 );
	animation: as-fs-toast 0.25s ease both;
}

.as-fs-toast[hidden] {
	display: none;
}

@keyframes as-fs-toast {
	from {
		opacity: 0;
		transform: translateY( 6px );
	}

	to {
		opacity: 1;
		transform: none;
	}
}

/* -------------------------------------------------------- the neighbours */

.as-fs-nav {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 240px, 1fr ) );
	gap: 12px;
	margin-top: 30px;
	padding-top: 24px;
	border-top: 1px solid var(--fx-line-soft);
}

/*
 * An empty cell, deliberately not display:none: the first and last fatwa have
 * only one neighbour, and without something holding the other half the lone
 * card would stretch across the row and read as though it were both.
 */
.as-fs-nav-gap {
	display: block;
}

@media ( max-width: 560px ) {
	.as-fs-nav-gap {
		display: none;
	}
}

.as-fs-nav-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	background: #fff;
	border: 1px solid var(--fx-line);
	border-radius: 12px;
	text-decoration: none;
	color: inherit;
	transition: border-color 0.16s ease, background 0.16s ease,
		transform 0.16s ease;
}

.as-fs-nav-item:hover,
.as-fs-nav-item:focus-visible {
	text-decoration: none;
	border-color: var(--fx-green);
	background: var(--fx-paper);
	transform: translateY( -2px );
}

/* The next fatwa sits to the left, where the page is heading. */
.as-fs-nav-item.is-next {
	flex-direction: row-reverse;
	text-align: left;
}

.as-fs-nav-item .as-g {
	width: 18px;
	height: 18px;
	color: var(--fx-line);
	transition: color 0.16s ease, transform 0.16s ease;
}

.as-fs-nav-item:hover .as-g {
	color: var(--fx-green);
}

.as-fs-nav-item.is-prev:hover .as-g {
	transform: translateX( 3px );
}

.as-fs-nav-item.is-next:hover .as-g {
	transform: translateX( -3px );
}

.as-fs-nav-text {
	min-width: 0;
	flex: 1 1 auto;
}

.as-fs-nav-label {
	display: block;
	font: 700 10.5px/1 Tajawal, sans-serif;
	letter-spacing: 0.9px;
	color: var(--fx-gold);
	margin-bottom: 5px;
}

.as-fs-nav-title {
	display: block;
	font: 700 14.5px/1.5 Tajawal, sans-serif;
	color: var(--fx-ink);
	/* Two lines at most, so one long title cannot outgrow its neighbour. */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ----------------------------------------------------------------- small */

@media ( max-width: 560px ) {
	.as-fs-actions {
		gap: 12px;
		padding: 14px;
	}

	/*
	 * Seven buttons will not fit one line on a phone, and shrinking them to
	 * make them fit would take the tap target under the size a thumb needs.
	 * So they wrap, and they are centred: a second row that is centred reads
	 * as a deliberate block, where space-between would strand the last one
	 * against an edge.
	 */
	.as-fs-btns {
		margin-inline-start: 0;
		width: 100%;
		justify-content: center;
		gap: 10px;
	}

	.as-fs-btn {
		width: 44px;
		height: 44px;
	}

	.as-fs-actions-label {
		width: 100%;
		justify-content: center;
	}

	.as-fs-chip {
		font-size: 12px;
		padding: 7px 11px;
	}

	.as-fs-toast {
		inset-inline-end: 50%;
		transform: translateX( 50% );
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.as-fs-bar *,
	.as-fs-actions *,
	.as-fs-nav *,
	.as-ask {
		transition: none !important;
		animation: none !important;
	}
}

/* ----------------------------------------------------------------- paper */

@media print {
	/*
	 * On paper the fatwa is the only thing wanted. Everything that exists to
	 * be clicked is dropped, the greens go to black so a grey printer does
	 * not turn them to mud, and every link's address is written out after it
	 * because a printed page cannot be clicked.
	 */
	.as-fs-actions,
	.as-fs-nav,
	.as-ask,
	.as-back-link,
	.as-side-card-dark,
	.ast-above-header-wrap,
	.ast-main-header-wrap,
	.ast-below-header-wrap,
	.site-header,
	.site-footer,
	#ast-scroll-top,
	.elementor-location-header,
	.elementor-location-footer {
		display: none !important;
	}

	.as-fs-bar {
		gap: 6px 14px;
		margin-top: 8px;
	}

	.as-fs-chip {
		padding: 0;
		border: 0;
		background: none !important;
		color: #000 !important;
		font-size: 11pt;
	}

	.as-fs-chip .as-g {
		display: none;
	}

	.as-fs-chip.is-no::before {
		content: "فتوى رقم ";
	}

	.as-qa-block-q,
	.as-qa-block {
		break-inside: avoid;
		background: none !important;
		border: 1px solid #bbb !important;
	}

	.as-page-title {
		break-after: avoid;
	}

	a[href]::after {
		content: " (" attr( href ) ")";
		font-size: 9pt;
		color: #444;
	}

	.as-fs-bar a[href]::after,
	.as-link-item a[href]::after {
		content: "";
	}
}
