/* ڕێزمانی کوردی — front-end styles */

@font-face { font-family: "RKN Vazirmatn"; src: url("../fonts/Vazirmatn-VF.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "RKN Sahel"; src: url("../fonts/Sahel-Light.woff2") format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "RKN Sahel"; src: url("../fonts/Sahel.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "RKN Sahel"; src: url("../fonts/Sahel-SemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "RKN Sahel"; src: url("../fonts/Sahel-Bold.woff2") format("woff2"); font-weight: 700 900; font-style: normal; font-display: swap; }

.rkn-book.rkn-font-vazir { --rkn-font: "RKN Vazirmatn"; }
.rkn-book.rkn-font-sahel { --rkn-font: "RKN Sahel"; }

/* The chosen font wins over any theme styling, on every element */
.rkn-book,
.rkn-book *,
.rkn-book *::placeholder {
	font-family: var(--rkn-font), Tahoma, "Noto Naskh Arabic", sans-serif !important;
}

.rkn-book {
	--ink: #1b2430;
	--muted: #5b6878;
	--line: #e1e6ed;
	--bg: #f3f5f8;
	--panel: #ffffff;
	--ok: #1d7a4b;
	--ok-soft: #e6f4ec;
	--bad: #b3261e;
	--bad-soft: #fcebea;
	--c: #2f5d9e;
	--soft: rgba(47, 93, 158, .09);
	--mid: rgba(47, 93, 158, .3);

	direction: rtl;
	text-align: right;
	color: var(--ink);
	background: var(--bg);
	border-radius: 20px;
	padding: 16px;
	line-height: 1.9;
	font-size: 17px;
	box-sizing: border-box;
	position: relative;
}
.rkn-book *, .rkn-book *::before, .rkn-book *::after { box-sizing: border-box; }
.rkn-book a { color: inherit; text-decoration: none; }
.rkn-book :focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; border-radius: 6px; }
.rkn-book button { cursor: pointer; }

.rkn-single .entry-title, .rkn-single .page-title, .rkn-single .post-title, .rkn-single .wp-block-post-title { display: none; }

.rkn-shell { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 16px; align-items: start; }

/* ---------- Table of contents ---------- */

.rkn-toc {
	position: sticky;
	top: calc(84px + var(--wp-admin--admin-bar--height, 0px));
	max-height: calc(100vh - 100px - var(--wp-admin--admin-bar--height, 0px));
	overflow-y: auto;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 16px;
	padding: 14px 12px 18px;
	scrollbar-width: thin;
}
.rkn-toc-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; position: sticky; top: -14px; background: var(--panel); padding: 14px 0 8px; margin-top: -14px; z-index: 2; }
.rkn-search { flex: 1; width: 100%; border: 1px solid var(--line); background: #f8fafc; border-radius: 10px; padding: 9px 12px; font-size: 15px; color: var(--ink); }
.rkn-search:focus { border-color: #1a73e8; background: #fff; }
.rkn-toc-close, .rkn-toc-open { display: none; }
.rkn-nores { color: var(--muted); font-size: 15px; padding: 6px 8px; margin: 0; }

.rkn-list { list-style: none; margin: 0; padding: 0; }
.rkn-list .rkn-list { margin-inline-start: 14px; padding-inline-start: 8px; border-inline-start: 1px solid var(--line); }
.rkn-item { margin: 0; padding: 0; }
.rkn-item[hidden], .rkn-item.rkn-hide { display: none; }
.rkn-row { display: flex; align-items: flex-start; gap: 2px; }
.rkn-tog { flex: none; width: 26px; height: 32px; border: 0; background: none; padding: 0; position: relative; color: var(--muted); }
.rkn-tog::before { content: ""; position: absolute; inset: 0; margin: auto; width: 7px; height: 7px; border-inline-start: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-1px, -1px); transition: transform .15s; }
.rkn-item.is-open > .rkn-row > .rkn-tog::before { transform: rotate(-45deg); }
.rkn-item:not(.has-kids) > .rkn-row { padding-inline-start: 26px; }
.rkn-item > .rkn-list { display: none; }
.rkn-item.is-open > .rkn-list { display: block; }

.rkn-link { flex: 1; display: flex; gap: 8px; padding: 3px 8px; border-radius: 8px; line-height: 1.6; font-size: 15px; color: #2d3948; }
.rkn-link:hover { background: #f0f3f7; }
.rkn-n { flex: none; color: var(--c); font-weight: 700; min-width: 2.4em; font-size: .92em; padding-top: 1px; }
.rkn-item.is-active > .rkn-row > .rkn-link { background: var(--soft); color: var(--ink); font-weight: 600; box-shadow: inset -3px 0 0 var(--c); }

/* top-level chapters carry their own colour */
.rkn-list > .rkn-item { --c: #2f5d9e; margin: 2px 0 6px; }
.rkn-list > .rkn-item > .rkn-row > .rkn-link { font-size: 16.5px; font-weight: 700; color: var(--ink); }
.rkn-list > .rkn-item > .rkn-row > .rkn-link .rkn-n { color: #fff; background: var(--c); border-radius: 7px; min-width: 2em; text-align: center; padding: 0 6px; height: 26px; line-height: 26px; margin-top: 1px; }
.rkn-list > .rkn-item .rkn-item { --c: inherit; }

.rkn-no-nums .rkn-n { display: none; }
.rkn-no-nums .rkn-num { display: none; }

/* ---------- Article ---------- */

.rkn-main { min-width: 0; outline: none; transition: opacity .15s; }
.rkn-main.is-loading { opacity: .45; }
.rkn-article { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: clamp(18px, 4vw, 44px); }

.rkn-crumbs { font-size: 14px; color: var(--muted); margin-bottom: 14px; line-height: 1.7; }
.rkn-crumbs a:hover { color: var(--c); text-decoration: underline; }
.rkn-sep { margin: 0 8px; opacity: .5; }

.rkn-head { display: flex; align-items: center; gap: 16px; padding-bottom: 16px; margin-bottom: 22px; border-bottom: 3px solid var(--c); }
.rkn-num { flex: none; color: var(--c); font-weight: 800; line-height: 1.2; background: var(--soft); border-radius: 12px; padding: 4px 12px; font-size: 1.15rem; }
.rkn-title { margin: 0; padding: 0; font-size: clamp(1.4rem, 3.2vw, 1.9rem); line-height: 1.5; font-weight: 700; color: var(--ink); outline: none; }
.rkn-depth-1 .rkn-num { font-size: clamp(2.6rem, 7vw, 4.2rem); padding: 0 18px; border-radius: 16px; line-height: 1.35; }
.rkn-depth-1 .rkn-title { font-size: clamp(1.8rem, 4.4vw, 2.7rem); font-weight: 800; }

.rkn-body { max-width: 46em; font-size: 1.06rem; line-height: 2.05; }
.rkn-body > :first-child { margin-top: 0; }
.rkn-body h3, .rkn-body h4 { color: var(--c); line-height: 1.6; margin: 1.6em 0 .5em; font-weight: 700; }
.rkn-body h3 { font-size: 1.3rem; } .rkn-body h4 { font-size: 1.12rem; }
.rkn-body p { margin: 0 0 1em; }
.rkn-body ul, .rkn-body ol { padding-inline-start: 1.4em; margin: 0 0 1em; }
.rkn-body li { margin-bottom: .3em; }
.rkn-body table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: .98rem; display: block; overflow-x: auto; }
.rkn-body th, .rkn-body td { border: 1px solid var(--line); padding: 8px 12px; text-align: right; }
.rkn-body th { background: var(--soft); color: var(--ink); font-weight: 700; }
.rkn-body img { max-width: 100%; height: auto; border-radius: 10px; }

.rkn-example, .rkn-note { margin: 1.3em 0; padding: 12px 18px 6px; border-radius: 12px; }
.rkn-example { background: var(--soft); border-inline-start: 4px solid var(--c); }
.rkn-note { border: 1.5px dashed var(--mid); }
.rkn-box-title { font-weight: 700; color: var(--c); margin-bottom: 2px; }
.rkn-empty-note { color: var(--muted); }

/* grammar building blocks */
.rkn-body strong { color: var(--ink); font-weight: 700; }
.rkn-formulas { margin: .9em 0; display: grid; gap: 4px; }
.rkn-formulas p { margin: 0; background: var(--soft); border-radius: 8px; padding: 3px 14px; font-weight: 600; line-height: 1.9; unicode-bidi: plaintext; }
.rkn-rule { margin: 1.5em 0 .3em; font-weight: 700; border-inline-start: 4px solid var(--c); padding-inline-start: 12px; }
.rkn-eg { margin: .15em 0; font-weight: 600; }
.rkn-gloss { margin: 0 0 .5em; color: var(--muted); font-size: .92em; }
.rkn-example .rkn-gloss { padding-inline-start: 1em; }
.rkn-table-wrap { overflow-x: auto; margin: 1.2em 0; }
.rkn-table-wrap table { display: table; margin: 0; }
.rkn-body td { font-weight: 500; }
.rkn-footnotes { margin-top: 2.2em; padding-top: 1em; border-top: 1px solid var(--line); font-size: .86rem; line-height: 1.8; color: var(--muted); max-width: 46em; }
.rkn-footnotes ol { margin: 0; padding-inline-start: 1.6em; }
.rkn-footnotes li { margin-bottom: .5em; }

/* contents of a section, like a printed index */
.rkn-index { margin-top: 2em; max-width: 46em; }
.rkn-index h3 { font-size: 1.05rem; color: var(--muted); font-weight: 600; margin: 0 0 8px; }
.rkn-index ol { list-style: none; margin: 0; padding: 0; }
.rkn-index li { margin: 0; }
.rkn-index a { display: flex; align-items: baseline; gap: 10px; padding: 7px 8px; border-radius: 8px; }
.rkn-index a:hover { background: var(--soft); }
.rkn-index .rkn-n { min-width: 3.2em; }
.rkn-index .rkn-t { font-weight: 600; }
.rkn-lead { flex: 1; border-bottom: 2px dotted var(--mid); transform: translateY(-4px); min-width: 20px; }

/* ---------- Quiz ---------- */

.rkn-quiz { margin-top: 2.4em; background: var(--soft); border-radius: 14px; padding: clamp(14px, 3vw, 26px); max-width: 46em; }
.rkn-quiz > h3 { margin: 0 0 14px; font-size: 1.3rem; color: var(--c); }
.rkn-q { background: #fff; border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; border: 1px solid var(--line); }
.rkn-qt { margin: 0 0 10px; font-weight: 600; display: flex; gap: 10px; }
.rkn-qn { flex: none; width: 1.9em; height: 1.9em; line-height: 1.9em; text-align: center; border-radius: 50%; background: var(--c); color: #fff; font-size: .85em; margin-top: .3em; }
.rkn-opts { display: grid; gap: 8px; }
.rkn-opt { text-align: right; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 14px; font-size: 1rem; color: var(--ink); line-height: 1.7; transition: border-color .12s, background .12s; }
.rkn-opt:hover:not(:disabled) { border-color: var(--c); background: var(--soft); }
.rkn-opt:disabled { cursor: default; }
.rkn-opt.is-right { border-color: var(--ok); background: var(--ok-soft); font-weight: 700; }
.rkn-opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.rkn-opt.is-right::after { content: "  ✓"; color: var(--ok); }
.rkn-opt.is-wrong::after { content: "  ✕"; color: var(--bad); }
.rkn-why { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: #f6f8fa; font-size: .97rem; }
.rkn-why p { margin: 4px 0 0; color: var(--muted); }
.rkn-why.is-ok .rkn-verdict { color: var(--ok); }
.rkn-why.is-no .rkn-verdict { color: var(--bad); }
.rkn-result { text-align: center; padding: 10px 0 2px; }
.rkn-score { font-size: 1.25rem; font-weight: 700; margin: 0 0 8px; }
.rkn-retry { border: 0; background: var(--c); color: #fff; border-radius: 10px; padding: 9px 22px; font-size: 1rem; }
.rkn-retry:hover { filter: brightness(1.1); }

/* ---------- Previous / next ---------- */

.rkn-pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 2.6em; padding-top: 18px; border-top: 1px solid var(--line); }
.rkn-pager a { flex: 0 1 48%; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; line-height: 1.6; min-width: 0; }
.rkn-pager a:hover { border-color: var(--c); background: var(--soft); }
.rkn-pager small { color: var(--muted); font-size: .8rem; }
.rkn-pager span { font-weight: 600; overflow-wrap: anywhere; }
.rkn-next { margin-inline-start: auto; text-align: left; }

/* ---------- Small screens ---------- */

@media (max-width: 900px) {
	.rkn-book { padding: 10px; border-radius: 14px; }
	.rkn-shell { grid-template-columns: 1fr; }
	.rkn-bar { margin-bottom: 10px; }
	.rkn-toc-open { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 18px; font-size: 1rem; color: var(--ink); }
	.rkn-toc {
		position: fixed; z-index: 99999; top: 0; bottom: 0; right: 0; width: min(88vw, 360px); max-height: none; border-radius: 0; border-width: 0 0 0 1px;
		transform: translateX(105%); transition: transform .22s ease; box-shadow: -8px 0 30px rgba(0, 0, 0, .15);
	}
	.rkn-book.toc-open .rkn-toc { transform: none; }
	.rkn-toc-close { display: block; border: 0; background: #f0f3f7; border-radius: 8px; width: 36px; height: 36px; font-size: 22px; line-height: 1; color: var(--ink); }
	.rkn-backdrop { position: fixed; inset: 0; z-index: 99998; background: rgba(15, 23, 32, .45); }
	.rkn-backdrop[hidden] { display: none; }
	.rkn-head { gap: 10px; }
	.rkn-pager { flex-direction: column; }
	.rkn-pager a { flex-basis: auto; }
	.rkn-next { text-align: right; margin-inline-start: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.rkn-book * { transition: none !important; }
}

@media print {
	.rkn-toc, .rkn-bar, .rkn-pager, .rkn-quiz { display: none !important; }
	.rkn-book { background: none; padding: 0; }
	.rkn-shell { display: block; }
	.rkn-article { border: 0; padding: 0; }
}


/* ---------- Top bar with the home button (always visible) ---------- */

.rkn-top { position: sticky; top: calc(8px + var(--wp-admin--admin-bar--height, 0px)); z-index: 60; display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 8px 10px; background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 14px; }
.rkn-home { display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; border-radius: 10px; background: var(--ink); color: #fff !important; font-weight: 700; font-size: 1rem; line-height: 1.4; }
.rkn-home:hover { filter: brightness(1.25); }
.rkn-brand { font-weight: 800; font-size: 1.1rem; color: var(--ink); margin-inline-end: auto; }

/* ---------- Cover page ---------- */

.rkn-hero { position: relative; overflow: hidden; border-radius: 18px; padding: clamp(14px, 2vw, 20px) clamp(16px, 4vw, 36px) clamp(14px, 2vw, 20px); background: linear-gradient(135deg, #e6f1fb 0%, #f1f8ee 100%); border: 1px solid #d3e3f1; color: #12304a; text-align: center; }
.rkn-hero::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 6px; background: linear-gradient(90deg, #d9534f 0 33.33%, #ffffff 33.33% 66.66%, #2f9e62 66.66% 100%); box-shadow: 0 1px 0 rgba(18, 48, 74, .08); }
.rkn-hero-title { margin: 4px 0 0; padding: 0; font-size: clamp(1.8rem, 4.6vw, 2.8rem); font-weight: 800; line-height: 1.35; color: #12304a; }
.rkn-credit { margin: .1em 0 0; font-size: clamp(.95rem, 2vw, 1.12rem); color: #3d5f7d; }
.rkn-find { position: relative; max-width: 560px; margin: 12px auto 0; text-align: right; }
.rkn-find-input { width: 100%; border: 1px solid #c7d9ea; border-radius: 14px; padding: 12px 18px; font-size: 1.05rem; color: #12304a; background: #fff; box-shadow: 0 4px 14px rgba(18, 48, 74, .08); }
.rkn-find-input::placeholder { color: #6b86a0; }
.rkn-find-input:focus-visible { outline: 3px solid #7fb4ff; outline-offset: 2px; }
.rkn-results { list-style: none; margin: 8px 0 0; padding: 6px; background: #fff; color: #15202c; border: 1px solid var(--line); border-radius: 14px; max-height: 360px; overflow: auto; box-shadow: 0 14px 34px rgba(18, 48, 74, .18); position: absolute; inset-inline: 0; z-index: 5; }
.rkn-results[hidden] { display: none; }
.rkn-results a { display: block; padding: 9px 12px; border-radius: 10px; }
.rkn-results a:hover, .rkn-results a:focus { background: #eef2f7; }
.rkn-results .rkn-rt { font-weight: 700; }
.rkn-results .rkn-n { display: inline; color: #2f5d9e; }
.rkn-results small { display: block; margin-top: 2px; color: #5b6878; font-size: .84em; line-height: 1.7; font-weight: 400; }
.rkn-results mark { background: #ffe58a; color: inherit; border-radius: 3px; padding: 0 2px; }
.rkn-none { padding: 12px; color: #5b6878; }

.rkn-front { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 14px 0 2px; }
.rkn-front a { padding: 9px 20px; border: 1px solid var(--line); background: #fff; border-radius: 999px; font-weight: 600; }
.rkn-front a:hover { border-color: #15202c; }
.rkn-sec-title { margin: 18px 4px 10px; font-size: 1.35rem; font-weight: 800; color: var(--ink); }
.rkn-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.rkn-tiles li { margin: 0; }
.rkn-tiles a { display: flex; align-items: center; gap: 14px; height: 100%; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-inline-start: 6px solid var(--c); border-radius: 14px; }
.rkn-tiles a:hover { background: var(--soft); }
.rkn-tn { flex: none; min-width: 1.5em; text-align: center; font-size: 2.1rem; font-weight: 800; line-height: 1; color: var(--c); }
.rkn-tt { display: block; font-weight: 700; font-size: 1.1rem; line-height: 1.5; }
.rkn-tc { display: block; font-size: .82rem; color: var(--muted); }
.rkn-hero .rkn-source { margin: .55em 0 0; color: #4d6b87; font-size: .86rem; line-height: 1.8; }
.rkn-hero .rkn-note-line { margin: .15em 0 0; color: #6b86a0; font-size: .8rem; line-height: 1.8; }
.rkn-sign { margin-top: 1.4em; color: var(--muted); font-weight: 600; }
.rkn-item.is-front > .rkn-row > .rkn-link { font-weight: 700; }

/* ---------- Standalone page ---------- */

.rkn-standalone { margin: 0; background: #f3f5f8; }
.rkn-standalone .rkn-book { max-width: 1400px; margin: 0 auto; border-radius: 0; min-height: 100vh; }

@media (max-width: 900px) {
	.rkn-top { top: 6px; }
	.rkn-home span { display: none; }
	.rkn-home { padding: 8px 12px; }
	.rkn-toc-open { margin-inline-start: 0; }
	.rkn-hero { border-radius: 16px; }
}

.rkn-source a { margin-inline-start: 8px; color: #2f5d9e; font-weight: 600; text-decoration: underline; }

/* ---------- Full-text results inside the contents panel ---------- */
.rkn-toc.rkn-searching .rkn-list, .rkn-toc.rkn-searching .rkn-nores { display: none; }
.rkn-toc .rkn-sres .rkn-results { position: static; box-shadow: none; border: 0; padding: 0; max-height: none; margin: 0; background: transparent; }
.rkn-toc .rkn-results a { padding: 7px 8px; }
.rkn-count { padding: 4px 8px 6px; color: #5b6878; font-size: .85rem; font-weight: 600; }
.rkn-toc .rkn-results small { font-size: .8em; }


/* ---------- Lesson blocks of this plugin (same look as the earlier example/note boxes) ---------- */

.rkn-def, .rkn-ex { margin: 1.3em 0; padding: 12px 18px 6px; border-radius: 12px; background: var(--soft); border-inline-start: 4px solid var(--c); }
.rkn-ex { background: #fffaf0; border-inline-start-color: #e8b44c; }
.rkn-def p, .rkn-ex p, .rkn-note p { margin: 0 0 .6em; }
.rkn-note { margin: 1.3em 0; padding: 12px 18px 6px; border-radius: 12px; border: 1.5px dashed var(--mid); }
.rkn-body mark { background: #ffe58a; border-radius: 3px; padding: 0 2px; }

/* Exercises whose answers open on a click */
.rkn-qa { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; margin: 12px 0; }
.rkn-qa > p { margin: 0 0 6px; }
.rkn-qa details { background: var(--soft); border-radius: 10px; padding: 2px 12px; }
.rkn-qa summary { cursor: pointer; color: var(--c); font-weight: 700; padding: 4px 0; }
.rkn-qa details[open] { background: var(--ok-soft); }
.rkn-qa details p { margin: 4px 0 8px; }

.rkn-article[hidden], .rkn-cover[hidden] { display: none; }
.rkn-empty { padding: 20px; }
