/* Kayan — Single article page */

.kf-post {
	--kf-primary: #001428;
	--kf-primary-container: #0f2942;
	--kf-secondary: #904d00;
	--kf-secondary-container: #fe932c;
	--kf-surface: #f7f9fb;
	--kf-surface-low: #f2f4f6;
	--kf-surface-container: #eceef0;
	--kf-border: #e3e6e9;
	--kf-text: #191c1e;
	--kf-muted: #43474d;
	--kf-subtle: #74777e;
	--kf-white: #fff;

	padding-top: 112px;
	background: var(--kf-surface);
	color: var(--kf-text);
	font-family: "IBM Plex Sans Arabic", "IBM Plex Sans", sans-serif;
}

.kf-post *,
.kf-post *::before,
.kf-post *::after { box-sizing: border-box; }
.kf-post a { text-decoration: none; color: inherit; }
.kf-post img { max-width: 100%; height: auto; }

/* Progress bar */
.kfa-progress {
	position: fixed;
	inset-inline: 0;
	top: 0;
	height: 3px;
	z-index: 60;
	pointer-events: none;
}
.kfa-progress span {
	display: block;
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, var(--kf-secondary-container), #ffc078);
	transition: width .1s linear;
}

/* ---------- Hero ---------- */
.kfa-hero {
	position: relative;
	overflow: hidden;
	color: #fff;
	padding: 24px 0 44px;
	background:
		radial-gradient(900px 420px at 88% -20%, rgba(254, 147, 44, .22), transparent 62%),
		radial-gradient(700px 360px at 8% 110%, rgba(209, 228, 255, .12), transparent 60%),
		linear-gradient(135deg, #001428 0%, #0f2942 52%, #12395c 100%);
}
.kfa-hero::before {
	content: "";
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
	background-size: 56px 56px;
	mask-image: radial-gradient(70% 70% at 50% 30%, #000 20%, transparent 100%);
	pointer-events: none;
}
.kfa-hero > .kf-container { position: relative; z-index: 1; }

.kfa-hero-inner { max-width: 960px; }

.kfa-cat {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 13px;
	border-radius: 999px;
	background: rgba(254, 147, 44, .16);
	border: 1px solid rgba(254, 147, 44, .32);
	color: #ffd9b3;
	font-size: 12.5px;
	font-weight: 700;
	margin-bottom: 14px;
}
.kfa-cat .material-symbols-outlined { font-size: 16px; color: var(--kf-secondary-container); }

.kfa-hero h1 {
	margin: 0 0 18px;
	font-size: clamp(26px, 2.9vw, 40px);
	line-height: 1.45;
	font-weight: 700;
	letter-spacing: -.2px;
	color: #fff;
}

.kfa-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 18px;
	font-size: 13px;
	color: rgba(255, 255, 255, .68);
}
.kfa-meta span { display: inline-flex; align-items: center; gap: 5px; }
.kfa-meta .material-symbols-outlined { font-size: 16px; color: rgba(255, 255, 255, .5); }

.kfa-share {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 22px;
}
.kfa-share-label {
	font-size: 12.5px;
	font-weight: 700;
	color: rgba(255, 255, 255, .62);
	margin-inline-end: 2px;
}
.kfa-share a,
.kfa-share button {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 7px 12px;
	border-radius: 9px;
	border: 1px solid rgba(255, 255, 255, .18);
	background: rgba(255, 255, 255, .08);
	color: #fff;
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: background .18s, border-color .18s, transform .18s;
}
.kfa-share a:hover,
.kfa-share button:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .3); transform: translateY(-1px); }
.kfa-share .material-symbols-outlined { font-size: 16px; color: var(--kf-secondary-container); }

/* Feature image */
.kfa-feature { margin-top: 26px; }
.kfa-feature img {
	width: 100%;
	aspect-ratio: 16 / 8;
	object-fit: cover;
	border-radius: 20px;
	box-shadow: 0 18px 40px -24px rgba(15, 41, 66, .45);
	background: var(--kf-surface-container);
}

/* ---------- Layout ---------- */
.kfa-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 300px;
	gap: 32px;
	align-items: start;
	padding-top: 28px;
	padding-bottom: 56px;
}
.kfa-main { min-width: 0; }

.kfa-card {
	background: #fff;
	border: 1px solid var(--kf-border);
	border-radius: 20px;
	box-shadow: 0 1px 2px rgba(15, 41, 66, .05), 0 8px 26px -18px rgba(15, 41, 66, .18);
	padding: 34px;
}

/* ---------- Content typography ---------- */
.kfa-content { font-size: 15.5px; line-height: 1.95; color: var(--kf-muted); }
.kfa-content > *:first-child { margin-top: 0; }
.kfa-content > *:last-child { margin-bottom: 0; }

.kfa-content h2 {
	font-size: 23px;
	line-height: 1.6;
	font-weight: 700;
	color: var(--kf-primary);
	margin: 36px 0 14px;
	padding-inline-start: 12px;
	border-inline-start: 4px solid var(--kf-secondary-container);
	scroll-margin-top: 116px;
}
.kfa-content h3 {
	font-size: 18px;
	line-height: 1.65;
	font-weight: 700;
	color: var(--kf-primary-container);
	margin: 26px 0 10px;
	scroll-margin-top: 116px;
}
.kfa-content h4 { font-size: 16px; font-weight: 700; color: var(--kf-primary); margin: 20px 0 8px; }

.kfa-content p { margin: 0 0 16px; }
.kfa-content ul,
.kfa-content ol { margin: 0 0 18px; padding-inline-start: 24px; }
.kfa-content li { margin-bottom: 7px; }
.kfa-content li::marker { color: var(--kf-secondary); }

.kfa-content a {
	color: var(--kf-secondary);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}
.kfa-content a:hover { color: var(--kf-primary); }

.kfa-content strong,
.kfa-content b { color: var(--kf-primary); font-weight: 700; }

.kfa-content img {
	border-radius: 12px;
	margin: 18px auto;
	height: auto;
}
.kfa-content figure { margin: 22px 0; }
.kfa-content figure img { margin: 0 auto; }
.kfa-content figcaption {
	margin-top: 8px;
	text-align: center;
	font-size: 12.5px;
	line-height: 1.7;
	color: var(--kf-subtle);
}

.kfa-content table {
	display: block;
	width: 100%;
	max-width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
	font-size: 14px;
	margin: 22px 0;
}
.kfa-content th,
.kfa-content td {
	border: 1px solid var(--kf-border);
	padding: 10px 12px;
	text-align: start;
	vertical-align: top;
}
.kfa-content th { background: var(--kf-surface-low); color: var(--kf-primary); font-weight: 700; }

.kfa-content blockquote {
	margin: 22px 0;
	padding: 14px 18px;
	background: var(--kf-surface-low);
	border-inline-start: 4px solid var(--kf-secondary-container);
	border-radius: 10px;
	color: var(--kf-primary-container);
}
.kfa-content blockquote p:last-child { margin-bottom: 0; }

.kfa-content hr { border: 0; border-top: 1px solid var(--kf-border); margin: 30px 0; }

.kfa-content .material-symbols-outlined { font-size: inherit; }

/* ---------- Sidebar ---------- */
.kfa-sidebar {
	position: sticky;
	top: 96px;
	display: flex;
	flex-direction: column;
	gap: 20px;
	height: calc(100vh - 116px);
}

.kfa-toc-card {
	background: #fff;
	border: 1px solid var(--kf-border);
	border-radius: 16px;
	padding: 18px;
	box-shadow: 0 1px 2px rgba(15, 41, 66, .05);
	display: flex;
	flex-direction: column;
	min-height: 180px;
	flex: 1 1 auto;
}
.kfa-toc-head {
	display: flex;
	align-items: center;
	gap: 7px;
	padding-bottom: 12px;
	margin-bottom: 10px;
	border-bottom: 1px solid var(--kf-surface-low);
	font-size: 14.5px;
	font-weight: 700;
	color: var(--kf-primary);
	flex: none;
}
.kfa-toc-head .material-symbols-outlined { font-size: 18px; color: var(--kf-secondary); }

.kfa-toc-scroll {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	min-height: 0;
}

.kfa-toc-list {
	list-style: none;
	margin: 0;
	padding: 0;
	padding-inline-end: 16px;
	overflow-y: auto;
	min-height: 0;
	flex: 1 1 auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
}
.kfa-toc-list::-webkit-scrollbar { display: none; }

.kfa-toc-rail {
	position: absolute;
	inset-block: 0;
	inset-inline-end: 2px;
	width: 6px;
	background: #eef1f3;
	border-radius: 999px;
	pointer-events: none;
}
.kfa-toc-thumb {
	position: absolute;
	inset-inline: 0;
	top: 0;
	height: 40px;
	background: #b7bfc8;
	border-radius: 999px;
	pointer-events: auto;
	cursor: grab;
	transition: background .15s;
}
.kfa-toc-thumb:hover,
.kfa-toc-thumb.is-dragging { background: #8f99a3; cursor: grabbing; }
.kfa-toc-list li { margin: 0; }
.kfa-toc-list a {
	display: block;
	padding: 6px 9px;
	border-radius: 7px;
	font-size: 12.5px;
	line-height: 1.6;
	color: var(--kf-muted);
	border-inline-start: 2px solid transparent;
	transition: background .15s, color .15s, border-color .15s;
}
.kfa-toc-list a:hover { background: var(--kf-surface-low); color: var(--kf-primary); }
.kfa-toc-list a.is-active {
	background: #fff4e8;
	border-inline-start-color: var(--kf-secondary-container);
	color: var(--kf-secondary);
	font-weight: 700;
}

.kfa-side-cta {
	border-radius: 16px;
	padding: 20px 18px;
	color: #fff;
	background:
		radial-gradient(260px 160px at 100% 0%, rgba(254, 147, 44, .3), transparent 70%),
		linear-gradient(150deg, #0f2942, #001428);
	box-shadow: 0 14px 30px -20px rgba(15, 41, 66, .8);
	flex: 0 0 auto;
}
.kfa-sidebar .kf-widget { flex: 0 0 auto; }
.kfa-side-cta h2 { margin: 0 0 6px; font-size: 16px; line-height: 1.5; }
.kfa-side-cta p { margin: 0 0 14px; font-size: 12.5px; line-height: 1.8; color: rgba(255, 255, 255, .7); }

/* ---------- Author / CTA after content ---------- */
.kfa-author {
	display: flex;
	gap: 16px;
	align-items: flex-start;
	margin-top: 28px;
	padding: 20px;
	border-radius: 16px;
	background: var(--kf-surface-low);
	border: 1px solid var(--kf-border);
}
.kfa-author img { width: 56px; height: 56px; object-fit: contain; flex: none; background: #fff; border-radius: 12px; padding: 6px; }
.kfa-author strong { display: block; font-size: 14.5px; color: var(--kf-primary); margin-bottom: 4px; }
.kfa-author p { margin: 0; font-size: 12.8px; line-height: 1.8; color: var(--kf-muted); }

.kfa-inline-cta {
	margin-top: 24px;
	border-radius: 18px;
	padding: 24px;
	color: #fff;
	background:
		radial-gradient(420px 220px at 100% 0%, rgba(254, 147, 44, .28), transparent 70%),
		linear-gradient(140deg, #0f2942, #001428);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}
.kfa-inline-cta h2 { margin: 0 0 4px; font-size: 18px; }
.kfa-inline-cta p { margin: 0; font-size: 13px; color: rgba(255, 255, 255, .7); }
.kfa-inline-cta .kfa-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.kfa-inline-cta .kf-btn { min-width: 130px; }

/* ---------- Prev / next ---------- */
.kfa-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.kfa-nav a {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 16px 18px;
	background: #fff;
	border: 1px solid var(--kf-border);
	border-radius: 14px;
	transition: transform .18s, box-shadow .18s, border-color .18s;
}
.kfa-nav a:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -18px rgba(15, 41, 66, .5); border-color: #cfd4da; }
.kfa-nav span {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 11.5px;
	font-weight: 700;
	color: var(--kf-secondary);
}
.kfa-nav span .material-symbols-outlined { font-size: 15px; }
.kfa-nav strong {
	font-size: 13.5px;
	line-height: 1.6;
	font-weight: 600;
	color: var(--kf-primary);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.kfa-nav .is-next { text-align: end; }
.kfa-nav .is-next span { justify-content: flex-end; }

/* ---------- Related ---------- */
.kfa-related { padding: 8px 0 64px; }
.kfa-related-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.kfa-related-head h2 { margin: 0; font-size: 22px; color: var(--kf-primary); font-weight: 700; }
.kfa-related-head a { font-size: 13px; font-weight: 700; color: var(--kf-secondary); display: inline-flex; align-items: center; gap: 4px; }
.kfa-related-head a:hover { text-decoration: underline; }

/* Mobile TOC */
.kfa-toc-mobile { display: none; margin-bottom: 20px; background: #fff; border: 1px solid var(--kf-border); border-radius: 14px; padding: 0 18px; }
.kfa-toc-mobile summary {
	cursor: pointer;
	list-style: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 15px 0;
	font-size: 14px;
	font-weight: 700;
	color: var(--kf-primary);
}
.kfa-toc-mobile summary::-webkit-details-marker { display: none; }
.kfa-toc-mobile summary::after {
	content: "expand_more";
	font-family: "Material Symbols Outlined";
	font-size: 20px;
	color: var(--kf-secondary);
}
.kfa-toc-mobile[open] summary::after { content: "expand_less"; }
.kfa-toc-mobile ol {
	margin: 0 0 14px;
	padding-inline-start: 20px;
	padding-inline-end: 6px;
	max-height: 45vh;
	overflow-y: auto;
}
@supports not selector(::-webkit-scrollbar) {
	.kfa-toc-mobile ol { scrollbar-width: thin; scrollbar-color: #b7bfc8 #eef1f3; }
}
.kfa-toc-mobile ol::-webkit-scrollbar { width: 8px; }
.kfa-toc-mobile ol::-webkit-scrollbar-button { display: none; height: 0; width: 0; }
.kfa-toc-mobile ol::-webkit-scrollbar-track { background: #eef1f3; border-radius: 999px; }
.kfa-toc-mobile ol::-webkit-scrollbar-thumb { background: #b7bfc8; border-radius: 999px; }
.kfa-toc-mobile li { margin-bottom: 6px; font-size: 13px; line-height: 1.7; }
.kfa-toc-mobile a { color: var(--kf-muted); }
.kfa-toc-mobile a:hover { color: var(--kf-secondary); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
	.kfa-layout { grid-template-columns: 1fr; gap: 24px; }
	.kfa-sidebar { position: static; max-height: none; display: none; }
	.kfa-toc-mobile { display: block; }
}

@media (max-width: 640px) {
	.kf-post { padding-top: 96px; }
	.kfa-hero { padding: 18px 0 34px; }
	.kfa-hero h1 { font-size: 24px; }
	.kfa-meta { gap: 12px; font-size: 12px; }
	.kfa-share { gap: 6px; }
	.kfa-share a, .kfa-share button { padding: 6px 10px; font-size: 11.5px; }
	.kfa-feature { margin-top: 18px; }
	.kfa-feature img { border-radius: 14px; aspect-ratio: 16 / 10; }
	.kfa-card { padding: 18px; border-radius: 16px; }
	.kfa-content { font-size: 15px; }
	.kfa-content h2 { font-size: 20px; margin-top: 28px; }
	.kfa-content h3 { font-size: 17px; }
	.kfa-nav { grid-template-columns: 1fr; }
	.kfa-nav .is-next { text-align: start; }
	.kfa-nav .is-next span { justify-content: flex-start; }
	.kfa-inline-cta { padding: 18px; }
	.kfa-related-head { flex-direction: column; align-items: flex-start; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
	.kf-post *, .kf-post *::before, .kf-post *::after {
		transition: none !important;
		animation: none !important;
	}
}
