/* ==========================================================================
   Taknia Systems — base styles
   Colours come from the logo: dot-matrix blue with a red trace.
   ========================================================================== */

:root {
	--bg: #F3F5F9;
	--bg-2: #E9EDF4;
	--surface: #FFFFFF;
	--ink: #0F1D3A;
	--ink-2: #46526D;
	--ink-3: #6B7690;
	--line: #D8DFEA;
	--line-2: #C4CDDD;
	--blue: #2150B8;
	--blue-ink: #FFFFFF;
	--blue-soft: #E3EBFB;
	--red: #D7262D;
	--red-ink: #FFFFFF;
	--dot: #B8C5DF;
	--navy: #0B1838;
	--navy-ink: #EEF2FA;
	--shadow: 0 1px 2px rgba(15, 29, 58, .06), 0 8px 28px -12px rgba(15, 29, 58, .18);
	--chip: #FFFFFF;

	--f-display: "Alexandria", "IBM Plex Sans Arabic", system-ui, sans-serif;
	/* Arabic pages use Alexandria throughout; English pages pair it with IBM Plex Sans. */
	--f-body: "Alexandria", "IBM Plex Sans Arabic", system-ui, sans-serif;
	--f-ui: "Alexandria", "IBM Plex Sans Arabic", system-ui, sans-serif;
	--fs-body: 1rem;
	--lh-body: 1.95;

	--wrap: 1280px;
	--gutter: clamp(16px, 4vw, 48px);
	--header-h: 76px;
	--r-sm: 6px;
	--r-md: 10px;
	--r-lg: 18px;
	--ease: cubic-bezier(.2, .7, .2, 1);
	color-scheme: light;
}

:root[data-mode="dark"] {
	--bg: #08122A;
	--bg-2: #0C1834;
	--surface: #0F1D3D;
	--ink: #E8EDF7;
	--ink-2: #A9B5CD;
	--ink-3: #8592AE;
	--line: #1C2B50;
	--line-2: #2A3B64;
	--blue: #5B8CFF;
	--blue-ink: #06102A;
	--blue-soft: #14244A;
	--red: #FF4A51;
	--red-ink: #1A0507;
	--dot: #2B3C66;
	--navy: #0E1D42;
	--navy-ink: #EEF2FA;
	--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
	--chip: #F4F6FA;
	color-scheme: dark;
}

html[lang="en"] {
	--f-body: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, sans-serif;
	--f-ui: "IBM Plex Sans", "Alexandria", system-ui, sans-serif;
	--fs-body: 1.0625rem;
	--lh-body: 1.65;
}

/* ---------- Reset ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--f-body);
	font-size: var(--fs-body);
	line-height: var(--lh-body);
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
	transition: background-color .35s var(--ease), color .35s var(--ease);
}

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--f-display); font-weight: 700; line-height: 1.3; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }

:focus-visible {
	outline: 2px solid var(--blue);
	outline-offset: 3px;
	border-radius: 4px;
}

.skip-link {
	position: absolute;
	inset-inline-start: 16px;
	top: -100px;
	z-index: 100;
	padding: 10px 16px;
	background: var(--ink);
	color: var(--bg);
	border-radius: var(--r-sm);
}
.skip-link:focus { top: 12px; }

.wrap {
	width: 100%;
	max-width: calc(var(--wrap) + var(--gutter) * 2);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.tk-icon { width: 1.25em; height: 1.25em; flex: none; }
[dir="rtl"] .tk-icon--arrow { transform: scaleX(-1); }

/* ---------- Buttons and links ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .55em;
	min-height: 46px;
	padding: .6em 1.35em;
	border: 1.5px solid transparent;
	border-radius: 999px;
	font-family: var(--f-ui);
	font-size: .98rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color .2s, color .2s, border-color .2s, transform .2s var(--ease);
}
.btn:active { transform: translateY(1px); }
/* Long labels wrap on narrow screens instead of running off the page. */
.btn { max-width: 100%; }
@media (max-width: 560px) {
	.btn { white-space: normal; text-align: center; }
	.btn > span { min-width: 0; }
}
.btn--sm { min-height: 40px; padding: .45em 1.1em; font-size: .9rem; }
.btn--lg { min-height: 54px; padding: .7em 1.6em; font-size: 1.02rem; }

.btn--primary { background: var(--red); color: var(--red-ink); }
.btn--primary:hover { background: color-mix(in srgb, var(--red) 86%, #000); }
:root[data-mode="dark"] .btn--primary:hover { background: color-mix(in srgb, var(--red) 85%, #fff); }

.btn--ghost { border-color: var(--line-2); color: var(--ink); background: transparent; }
.btn--ghost:hover { border-color: var(--ink); }

.btn--light { background: var(--navy-ink); color: var(--navy); }
.btn--light:hover { background: #fff; }

.link-arrow {
	display: inline-flex;
	align-items: center;
	gap: .45em;
	font-family: var(--f-ui);
	font-weight: 600;
	font-size: .98rem;
	color: var(--blue);
	text-decoration: none;
}
.link-arrow .tk-icon { transition: transform .25s var(--ease); }
.link-arrow:hover .tk-icon { transform: translateX(4px); }
[dir="rtl"] .link-arrow:hover .tk-icon { transform: scaleX(-1) translateX(4px); }

/* ---------- Header ---------- */

.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	height: var(--header-h);
	background: color-mix(in srgb, var(--bg) 82%, transparent);
	backdrop-filter: saturate(1.4) blur(14px);
	-webkit-backdrop-filter: saturate(1.4) blur(14px);
	border-bottom: 1px solid transparent;
	transition: border-color .3s, background-color .35s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.site-header__bar {
	display: flex;
	align-items: center;
	gap: 28px;
	height: 100%;
}

.brand { display: inline-flex; flex: none; }
.brand img { width: auto; height: 46px; }
:root[data-mode="dark"] .brand img { filter: brightness(1.75) saturate(.85); }

.nav { margin-inline-end: auto; }
.nav__list { display: flex; align-items: center; gap: 2px; list-style: none; }
.nav__item { position: relative; }

.nav__link {
	display: inline-flex;
	align-items: center;
	gap: .35em;
	padding: .5em .8em;
	border: 0;
	background: none;
	border-radius: var(--r-sm);
	font-family: var(--f-ui);
	font-size: .95rem;
	font-weight: 500;
	color: var(--ink-2);
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: color .2s, background-color .2s;
}
.nav__link:hover, .nav__link[aria-expanded="true"], .nav__link[aria-current="page"] { color: var(--ink); }
.nav__link[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--red); border-radius: 0; }
.tk-chev { width: 12px; height: 12px; transition: transform .2s var(--ease); }
.nav__toggle[aria-expanded="true"] .tk-chev { transform: rotate(180deg); }

.nav__panel {
	position: absolute;
	top: calc(100% + 10px);
	inset-inline-start: -8px;
	min-width: 280px;
	padding: 10px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	box-shadow: var(--shadow);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity .18s, transform .18s var(--ease), visibility 0s .18s;
}
.nav__panel::before {
	content: "";
	position: absolute;
	inset: -12px 0 auto;
	height: 12px;
}
.nav__item--sub.is-open > .nav__panel {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition: opacity .18s, transform .18s var(--ease), visibility 0s;
}
.nav__panel ul { list-style: none; }

.nav__panel--mega {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 8px 20px;
	width: min(760px, 80vw);
	padding: 18px;
}

.nav__feature {
	display: grid;
	gap: 4px;
	padding: 14px 16px;
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	background: var(--bg-2);
	text-decoration: none;
	transition: border-color .15s, background-color .15s;
}
.nav__feature strong { color: var(--ink); font-size: .95em; }
.nav__feature span { color: var(--ink-3); font-size: .85em; line-height: 1.6; }
.nav__feature:hover, .nav__feature:focus-visible, .nav__feature[aria-current] { border-color: var(--blue); background: var(--surface); }
.nav__col--loose ul { display: grid; gap: 10px; }

.nav__panel:not(.nav__panel--mega) { min-width: 300px; padding: 8px; }
.nav__head, .nav__sublink {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: .6em .8em;
	border-radius: var(--r-sm);
	text-decoration: none;
	line-height: 1.5;
	transition: background-color .15s, color .15s;
}
.nav__sublink::before {
	content: "";
	width: 6px;
	height: 6px;
	flex: none;
	border-radius: 50%;
	background: var(--dot);
	transition: background-color .15s, transform .15s;
}
.nav__head { font-family: var(--f-ui); font-weight: 600; font-size: .95rem; color: var(--ink); }
.nav__col > .nav__head {
	margin-bottom: 4px;
	padding-bottom: .7em;
	border-bottom: 1px solid var(--line);
	border-radius: var(--r-sm) var(--r-sm) 0 0;
	color: var(--blue);
}
.nav__sublink { font-size: .93rem; color: var(--ink-2); }
.nav__sublink--parent { margin-bottom: 4px; font-weight: 600; color: var(--blue); border-bottom: 1px solid var(--line); border-radius: var(--r-sm) var(--r-sm) 0 0; }
.nav__sublink--parent::before { display: none; }
.nav__nested .nav__sublink { padding-inline-start: 1.6em; font-size: .9rem; }
.nav__head[href]:hover, .nav__sublink[href]:hover { background: var(--bg-2); color: var(--ink); }
.nav__sublink[href]:hover::before { background: var(--red); transform: scale(1.3); }
.nav__sublink[aria-current="page"] { color: var(--ink); background: var(--bg-2); }
.nav__sublink[aria-current="page"]::before { background: var(--red); }

.site-header__tools { display: flex; align-items: center; gap: 6px; }

.tool {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .4em;
	min-width: 42px;
	height: 42px;
	padding: 0 .6em;
	border: 1px solid transparent;
	border-radius: 999px;
	background: none;
	font-family: var(--f-ui);
	font-size: .88rem;
	font-weight: 500;
	color: var(--ink-2);
	text-decoration: none;
	cursor: pointer;
	transition: color .2s, border-color .2s;
}
.tool:hover { color: var(--ink); border-color: var(--line); }
.tool--lang[lang="ar"] span { font-family: "Alexandria", var(--f-ui); }
.tool--mode .tk-icon--sun { display: none; }
:root[data-mode="dark"] .tool--mode .tk-icon--sun { display: block; }
:root[data-mode="dark"] .tool--mode .tk-icon--moon { display: none; }
.tool--menu { display: none; }
.site-header__cta { margin-inline-start: 6px; }

/* ---------- Drawer (mobile navigation) ---------- */

/* Above the Chaty chat bubble, which sits around z-index 9999. */
.drawer { position: fixed; inset: 0; z-index: 100000; }
.drawer[hidden] { display: none; }
.drawer__scrim {
	position: absolute;
	inset: 0;
	background: rgba(8, 18, 42, .45);
	opacity: 0;
	transition: opacity .25s;
}
/* The sheet slides in from the reading start: right in Arabic, left in English. */
.drawer__sheet {
	position: absolute;
	inset-block: 0;
	inset-inline-start: 0;
	display: flex;
	flex-direction: column;
	width: min(420px, 100%);
	background: var(--bg);
	transform: translateX(-100%);
	transition: transform .32s var(--ease);
}
[dir="rtl"] .drawer__sheet { transform: translateX(100%); }
.drawer.is-open .drawer__scrim { opacity: 1; }
.drawer.is-open .drawer__sheet { transform: none; }

.drawer__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: var(--header-h);
	padding-inline: 16px;
	border-bottom: 1px solid var(--line);
}
.drawer__nav { flex: 1; overflow-y: auto; padding: 8px 16px 24px; overscroll-behavior: contain; }
.drawer__list { list-style: none; }
.drawer__list--d0 > li { border-bottom: 1px solid var(--line); }
.drawer__link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	min-height: 52px;
	padding: .4em 0;
	border: 0;
	background: none;
	font-family: var(--f-ui);
	font-size: 1.02rem;
	font-weight: 500;
	text-align: start;
	text-decoration: none;
	cursor: pointer;
}
.drawer__toggle[aria-expanded="true"] .tk-chev { transform: rotate(180deg); }
.drawer__sub { padding-bottom: 10px; padding-inline-start: 14px; border-inline-start: 2px solid var(--line); }
.drawer__sub .drawer__link { min-height: 44px; font-size: .95rem; color: var(--ink-2); }
.drawer__link--parent { color: var(--blue) !important; }
.drawer__foot { display: grid; gap: 10px; padding: 16px; border-top: 1px solid var(--line); }

/* ---------- Sections ---------- */

.section-title {
	font-size: clamp(1.7rem, 1.2rem + 2vw, 2.6rem);
	font-weight: 700;
	letter-spacing: -.01em;
	max-width: 22ch;
}
html[lang="en"] .section-title { letter-spacing: -.02em; }
.section-lead { margin-top: 14px; max-width: 56ch; color: var(--ink-2); font-size: 1.08rem; }
.section-head { margin-bottom: clamp(28px, 4vw, 48px); }
.section-head--row { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; }

/* ---------- Shared lists: module dots and numbered steps ---------- */

.modules {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 2px 24px;
	list-style: none;
	border-top: 1px solid var(--line);
	padding-top: 6px;
}
.modules__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding-block: 10px;
	border-bottom: 1px solid var(--line);
	font-weight: 500;
}
.modules__dot {
	width: 10px;
	height: 10px;
	flex: none;
	border-radius: 50%;
	background: var(--blue);
	box-shadow: 14px 0 0 -1px var(--dot);
	margin-inline-end: 14px;
}
[dir="rtl"] .modules__dot { box-shadow: -14px 0 0 -1px var(--dot); }

.steps { display: grid; gap: 0; list-style: none; counter-reset: step; }
.steps__item {
	position: relative;
	display: flex;
	align-items: center;
	gap: 14px;
	padding-block: 10px;
	counter-increment: step;
	font-weight: 500;
}
.steps__item::before {
	content: counter(step);
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	flex: none;
	border: 1.5px solid var(--line-2);
	border-radius: 50%;
	background: var(--bg);
	font-family: var(--f-ui);
	font-size: .88rem;
	font-weight: 600;
	z-index: 1;
}
.steps__item:not(:last-child)::after {
	content: "";
	position: absolute;
	inset-inline-start: 16px;
	top: 44px;
	height: calc(100% - 34px);
	border-inline-start: 1.5px dashed var(--line-2);
}
.steps__item:last-child::before { border-color: var(--red); color: var(--red); }

.modules--single { grid-template-columns: 1fr; }

/* ---------- Footer ---------- */

.site-footer {
	margin-top: clamp(64px, 9vw, 120px);
	padding-top: clamp(48px, 6vw, 72px);
	border-top: 1px solid var(--line);
	background: var(--bg-2);
	font-size: .96rem;
}
.site-footer__grid {
	display: grid;
	grid-template-columns: 1.4fr 1fr 1fr 1.1fr;
	gap: 40px;
}
.site-footer__about p { margin-top: 18px; max-width: 38ch; color: var(--ink-2); }
.site-footer__h { margin-bottom: 14px; font-size: 1rem; font-weight: 600; }
.site-footer__col ul { list-style: none; display: grid; gap: 6px; }
.site-footer__col a { color: var(--ink-2); text-decoration: none; }
.site-footer__col a:hover { color: var(--ink); text-decoration: underline; }
.site-footer__contact a { display: inline-flex; align-items: center; gap: .6em; }
.site-footer__contact .tk-icon { color: var(--blue); }
.site-footer__base {
	margin-top: 48px;
	padding-block: 22px;
	border-top: 1px solid var(--line);
	color: var(--ink-3);
	font-size: .88rem;
}

.social { display: flex; gap: 8px; margin-top: 22px; list-style: none; }
.social a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 1px solid var(--line-2);
	border-radius: 50%;
	color: var(--ink-2);
	transition: color .2s, border-color .2s;
}
.social a:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- Fallback pages ---------- */

.page-fallback { min-height: 50vh; }
.prose { padding-block: 56px; max-width: 78ch; }
.prose h1 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); margin-bottom: 24px; }
.prose p + p { margin-top: 1em; }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
	.site-header__bar { gap: 16px; }
	.nav__link { padding-inline: .55em; font-size: .9rem; }
}

@media (max-width: 1023px) {
	.nav { display: none; }
	.tool--menu { display: inline-flex; margin-inline-start: -8px; }
	.site-header__bar { gap: 6px; }
	.site-header__tools { margin-inline-start: auto; }
	.site-footer__grid { grid-template-columns: 1fr 1fr; }
	.site-footer__about { grid-column: 1 / -1; }
}

@media (max-width: 599px) {
	:root { --header-h: 64px; }
	.brand img { height: 38px; }
	.site-header__cta, .tool--lang span { display: none; }
	.site-footer__grid { grid-template-columns: 1fr; gap: 32px; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
		scroll-behavior: auto !important;
	}
}
