/**
 * Visual enhancements v1.4 — layered after main.css
 * (rhythm, patterns, chips, display type, dark mode)
 */

/* Inline Arabic (honorifics) — uses Amiri; avoids “tofu” when Latin/display fonts lack Arabic glyphs. */
.arabic-inline {
	font-family: var(--font-arabic);
	font-weight: 400;
	font-size: 0.92em;
	line-height: 1.35;
	unicode-bidi: embed;
}

/* Stacked salawat calligraphy (PNG) — classic emblem style alongside Latin UI text */
.arabic-calligraphy-wrap {
	display: inline-block;
	vertical-align: middle;
	line-height: 0;
	margin-inline: 0.12em 0.2em;
}

.arabic-calligraphy {
	display: block;
	width: auto;
	height: auto;
	object-fit: contain;
}

.arabic-calligraphy--title {
	max-height: 2.1rem;
	max-width: min(100%, 6.5rem);
}

.arabic-calligraphy--inline {
	max-height: 2.65rem;
	max-width: min(100%, 7.25rem);
}

.course-detail__desc .arabic-calligraphy--inline {
	max-height: 3.1rem;
	max-width: min(100%, 8rem);
}

.footer-col .arabic-calligraphy--title {
	max-height: 1.45rem;
	max-width: 5.25rem;
}

[data-theme="dark"] .arabic-calligraphy {
	filter: invert(1);
}

:root {
	--font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
	--section-rhythm-y: clamp(3.75rem, 9vw, 6.25rem);
	--line-length: 65ch;
	--band-bg: #ebe8e0;
	--band-bg-alt: #e3ddd2;
	--pattern-islamic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cg fill='none' stroke='%231c1917' stroke-width='0.4' stroke-opacity='0.11'%3E%3Cpath d='M44 6 L50 34 L78 20 L60 44 L78 68 L50 54 L44 82 L38 54 L10 68 L28 44 L10 20 L38 34 Z'/%3E%3Ccircle cx='44' cy='44' r='5'/%3E%3C/g%3E%3C/svg%3E");
}

/* Dark mode — layered depth (not flat black): soft glows + warm charcoal */
[data-theme="dark"] {
	color-scheme: dark;
	--color-bg: #1a1917;
	--color-surface: #252320;
	--color-text: #fafaf9;
	--color-muted: #b0aaa4;
	/* On dark UI, sky reads for links/chips; deep blue stays in gradients & footer */
	--color-primary: #77a4f5;
	--color-primary-hover: #a3c0fa;
	--color-accent: #5c8fe8;
	--color-accent-hover: #8eb6f5;
	--color-border: #3f3c38;
	--shadow: 0 8px 36px rgba(0, 0, 0, 0.38);
	--band-bg: #22211e;
	--band-bg-alt: #1d1c19;
	--pattern-islamic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cg fill='none' stroke='%23fafaf9' stroke-width='0.4' stroke-opacity='0.09'%3E%3Cpath d='M44 6 L50 34 L78 20 L60 44 L78 68 L50 54 L44 82 L38 54 L10 68 L28 44 L10 20 L38 34 Z'/%3E%3Ccircle cx='44' cy='44' r='5'/%3E%3C/g%3E%3C/svg%3E");
}

/* Filled primary actions stay on deep brand blue; --color-primary in dark is tuned for links/chips */
[data-theme="dark"] .header-top {
	background: var(--brand-900);
}

[data-theme="dark"] .btn--primary {
	background: var(--brand-900);
	color: #fff;
}

[data-theme="dark"] .btn--primary:hover {
	background: var(--brand-900-hover);
	color: #fff;
}

[data-theme="dark"] body {
	min-height: 100vh;
	background-color: #141312;
	background-image:
		radial-gradient(ellipse 130% 85% at 50% -22%, rgba(119, 164, 245, 0.14) 0%, transparent 52%),
		radial-gradient(ellipse 50% 45% at 100% 8%, rgba(27, 67, 115, 0.18) 0%, transparent 55%),
		radial-gradient(ellipse 45% 50% at 0% 95%, rgba(119, 164, 245, 0.06) 0%, transparent 50%),
		linear-gradient(172deg, #232220 0%, #181716 40%, #0f0e0d 100%);
	background-attachment: scroll;
}

html {
	color-scheme: light dark;
}

body {
	font-size: clamp(1.03rem, 0.4vw + 0.95rem, 1.08rem);
	line-height: 1.65;
	transition: background-color 0.22s ease, color 0.22s ease;
}

@media (max-width: 600px) {
	body {
		font-size: 1.0625rem;
		line-height: 1.68;
	}
}

@media (prefers-reduced-motion: reduce) {
	body {
		transition: none;
	}

	html {
		scroll-behavior: auto;
	}
}

/* Display headings + Arabic hero */
.hero__title {
	font-family: var(--font-display);
	font-size: clamp(2rem, 4.5vw, 3rem);
	font-weight: 600;
	letter-spacing: -0.02em;
	line-height: 1.12;
}

.hero__bg {
	background:
		linear-gradient(135deg, rgba(27, 67, 115, 0.94) 0%, rgba(27, 67, 115, 0.85) 42%, rgba(119, 164, 245, 0.82) 100%),
		url("data:image/svg+xml,%3Csvg width='88' height='88' viewBox='0 0 88 88' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23ffffff' fill-opacity='0.055' d='M44 4 L52 36 L84 20 L62 44 L84 68 L52 52 L44 84 L36 52 L4 68 L26 44 L4 20 L36 36 Z'/%3E%3C/svg%3E"),
		url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.section-title {
	font-family: var(--font-display);
	font-size: clamp(1.65rem, 3.2vw, 2.35rem);
	font-weight: 600;
	letter-spacing: 0.01em;
}

.section-subtitle {
	max-width: var(--line-length);
	margin-left: auto;
	margin-right: auto;
}

.section-lead {
	max-width: var(--line-length);
	margin-left: auto;
	margin-right: auto;
}

.section.section--rhythm {
	padding-block: var(--section-rhythm-y);
}

.section__head {
	text-align: center;
	margin-bottom: 0.5rem;
}

.section__head--accent::after {
	content: "";
	display: block;
	width: 3.25rem;
	height: 3px;
	margin: 1rem auto 0;
	border-radius: 2px;
	background: linear-gradient(90deg, var(--color-accent), var(--color-primary));
}

.section--divider-top {
	border-top: 1px solid var(--color-border);
}

.section--pattern-soft {
	position: relative;
	isolation: isolate;
}

.section--pattern-soft::before {
	content: "";
	position: absolute;
	inset: 0;
	background-image: var(--pattern-islamic);
	background-size: 88px 88px;
	opacity: 0.55;
	pointer-events: none;
	z-index: 0;
}

.section--pattern-soft > .container {
	position: relative;
	z-index: 1;
}

.section--pattern-strong {
	position: relative;
	isolation: isolate;
}

.section--pattern-strong::before {
	content: "";
	position: absolute;
	inset: 0;
	background-image: var(--pattern-islamic);
	background-size: 88px 88px;
	opacity: 0.72;
	pointer-events: none;
	z-index: 0;
}

.section--pattern-strong > .container {
	position: relative;
	z-index: 1;
}

.section--band {
	background-color: var(--band-bg);
}

.section--band-alt {
	background-color: var(--band-bg-alt);
}

.section--contact-surface {
	background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg) 100%);
	border-top: 3px solid var(--color-primary);
}

.section.section--courses.section--band {
	background-color: var(--band-bg);
}

.section--courses {
	background: transparent;
}

.section--steps {
	background: transparent;
}

.section--testimonials {
	background: linear-gradient(180deg, var(--color-bg) 0%, var(--band-bg) 100%);
}

.section--contact {
	background: transparent;
	border-top: none;
}

[data-theme="dark"] .contact-teaser__trial-visual {
	background-color: color-mix(in srgb, var(--color-surface) 88%, #0a0a0a);
}

[data-theme="dark"] .contact-page__panel {
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
	border-color: var(--color-border);
}

.split__text > p {
	max-width: var(--line-length);
}

/* Course chips */
.course-card__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin-bottom: 0.65rem;
}

.chip {
	display: inline-flex;
	align-items: center;
	max-width: 100%;
	padding: 0.22rem 0.6rem;
	border-radius: 999px;
	font-size: 0.68rem;
	font-weight: 600;
	line-height: 1.35;
	border: 1px solid var(--color-border);
	background: var(--color-bg);
	color: var(--color-muted);
}

.chip--duration {
	background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
	border-color: color-mix(in srgb, var(--color-primary) 28%, var(--color-border));
	color: var(--color-primary);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
	.chip--duration {
		background: rgba(27, 67, 115, 0.09);
		border-color: rgba(27, 67, 115, 0.22);
	}
}

[data-theme="dark"] .chip--duration {
	background: rgba(119, 164, 245, 0.12);
	border-color: rgba(119, 164, 245, 0.28);
	color: var(--color-primary);
}

.course-card__title {
	font-family: var(--font-display);
	font-size: 1.2rem;
	font-weight: 600;
}

.course-card__footer {
	justify-content: flex-end;
}

/* Theme switcher — “Theme” label + Light / Dark toggles (outside slide-out nav) */
.header-main__inner .site-logo {
	margin-right: auto;
}

.theme-switcher {
	display: inline-flex;
	align-items: center;
	gap: 0.65rem;
	flex-shrink: 0;
	flex-wrap: wrap;
}

.theme-switcher__legend {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	white-space: nowrap;
}

.theme-switcher__mark {
	flex-shrink: 0;
	width: 1.15rem;
	height: 1.15rem;
	border-radius: 50%;
	background: conic-gradient(
		var(--color-primary) 0deg 180deg,
		var(--color-accent) 180deg 360deg
	);
	box-shadow:
		0 0 0 1px var(--color-border),
		0 1px 3px rgba(28, 25, 23, 0.12);
}

.theme-switcher__label-text {
	font-family: var(--font-display);
	font-size: 1.05rem;
	font-weight: 600;
	font-style: italic;
	letter-spacing: 0.03em;
	background: linear-gradient(115deg, var(--color-primary) 0%, var(--color-accent) 100%);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

@supports not (background-clip: text) {
	.theme-switcher__label-text {
		color: var(--color-primary);
		background: none;
		-webkit-background-clip: unset;
		background-clip: unset;
	}
}

[data-theme="dark"] .theme-switcher__label-text {
	background: linear-gradient(115deg, var(--color-primary) 0%, var(--color-accent-hover) 100%);
	-webkit-background-clip: text;
	background-clip: text;
}

.theme-switcher__track {
	display: inline-flex;
	padding: 3px;
	border-radius: 999px;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	box-shadow: inset 0 1px 2px rgba(28, 25, 23, 0.06);
}

[data-theme="dark"] .theme-switcher__track {
	box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.theme-switcher__btn {
	position: relative;
	z-index: 1;
	margin: 0;
	padding: 0.38rem 0.85rem;
	border: none;
	border-radius: 999px;
	background: transparent;
	color: var(--color-muted);
	font-family: var(--font-sans);
	font-size: 0.78rem;
	font-weight: 600;
	cursor: pointer;
	transition: color 0.15s ease, background 0.15s ease;
	white-space: nowrap;
}

.theme-switcher__btn:hover {
	color: var(--color-text);
}

.theme-switcher__btn.is-active {
	background: var(--color-surface);
	color: var(--color-text);
	box-shadow: 0 1px 4px rgba(28, 25, 23, 0.12);
}

[data-theme="dark"] .theme-switcher__btn.is-active {
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}

@media (max-width: 480px) {
	/* Keep colour dot; hide word “Theme” — group aria-label still names the control */
	.theme-switcher__label-text {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}

	.theme-switcher {
		gap: 0.45rem;
	}

	.theme-switcher__btn {
		padding: 0.35rem 0.65rem;
		font-size: 0.74rem;
	}
}

.primary-nav {
	flex-wrap: wrap;
}

[data-theme="dark"] .nav-toggle__bar {
	background: var(--color-text);
}

[data-theme="dark"] .form-feedback--success {
	background: rgba(119, 164, 245, 0.12);
	color: #dbe8fd;
	border-color: rgba(119, 164, 245, 0.35);
}

[data-theme="dark"] .form-feedback--error {
	background: rgba(248, 113, 113, 0.12);
	color: #fecaca;
	border-color: rgba(248, 113, 113, 0.35);
}

[data-theme="dark"] .form-feedback__hint {
	color: #fecaca;
	opacity: 0.88;
}

[data-theme="dark"] .qa-thanks-overlay__card {
	background: var(--color-surface, #0f172a);
	color: var(--color-text, #e2e8f0);
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .qa-thanks-overlay__title {
	color: #f1f5f9;
}

[data-theme="dark"] .qa-thanks-overlay__body {
	color: #cbd5e1;
}

[data-theme="dark"] .qa-thanks-overlay__signoff {
	color: #f1f5f9;
}

[data-theme="dark"] .qa-thanks-overlay__icon {
	color: var(--brand-400, #77a4f5);
}
