/*
Theme Name: إدارة بالعربي
Theme URI: https://edarablarabi.com/
Description: قالب كتلي خفيف وسريع لمنصة إدارة بالعربي، مستوحى من الشعار الكوفي. Lightweight Arabic block theme with Kufi-inspired details.
Version: 1.0.3
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: edara
Tags: rtl-language-support, blog, news, full-site-editing, block-patterns, wide-blocks
*/

/* ---------- Base ---------- */
:root {
	--edara-ink: var(--wp--preset--color--ink);
	--edara-teal: var(--wp--preset--color--teal);
	--edara-line: var(--wp--preset--color--line);
	--edara-cut: 56px;
}
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img { height: auto; max-width: 100%; }
:where(.wp-site-blocks) > * { margin-block-start: 0; }
.wp-site-blocks { overflow-x: clip; }
.skip-link:focus { background: #fff; color: var(--edara-ink); }

/* ---------- Header ---------- */
.edara-header__bar {
	padding: 0.9rem 1rem;
	gap: 1rem;
	max-width: calc(1200px + 2rem);
	margin-inline: auto;
	box-sizing: border-box;
}
.edara-logo { display: block; line-height: 0; }
.edara-logo img { height: 54px; width: auto; }
.edara-header__actions { gap: 0.25rem; }
.edara-nav .wp-block-navigation-item__content { padding: 0.5rem 0.8rem; }
.edara-nav a[aria-current="page"],
.home .edara-nav .menu-item-home > a { color: var(--edara-teal); }
.edara-nav a[aria-current="page"]::before,
.home .edara-nav .menu-item-home > a::before {
	content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-end: 0.5rem;
	background: currentColor; transform: rotate(45deg) translateY(-2px);
}
@media (min-width: 600px) {
	.edara-nav .wp-block-navigation__submenu-container {
		border: 1px solid var(--edara-line) !important; padding: 0.4rem 0; min-width: 14rem;
	}
}
/* Mobile overlay menu, right-aligned for Arabic */
.edara-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.edara-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
.edara-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container,
.edara-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	align-items: flex-start !important;
}
.edara-nav .wp-block-navigation__responsive-container.is-menu-open { padding: 1.5rem 1.25rem; }
.edara-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-size: var(--wp--preset--font-size--x-large); padding: 0.35rem 0;
}
.edara-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	font-size: var(--wp--preset--font-size--large); color: #5A5448;
}
.edara-search .wp-block-search__button {
	width: 44px; height: 44px; padding: 0; border-radius: 4px; margin: 0;
	background: transparent; color: var(--edara-ink); border: 1px solid var(--edara-line);
	display: grid; place-items: center;
}
.edara-search .wp-block-search__input { border-radius: 4px; border-color: var(--edara-line); }

/* Kufi strip: block rhythm taken from the logo */
.edara-strip { display: flex; height: 6px; }
.edara-strip span { background: var(--edara-ink); }
.edara-strip span:nth-of-type(1) { flex: 1; }
.edara-strip span:nth-of-type(2) { width: 40px; }
.edara-strip span:nth-of-type(3) { width: 14px; background: var(--edara-teal); }
.edara-strip i { width: 6px; background: transparent; }
.edara-strip i:last-child { width: 28px; }

.edara-header__cats { border-bottom: 1px solid var(--edara-line); padding-inline: 1rem; margin-top: 0 !important; }
.edara-strip { margin-top: 0 !important; }
.edara-chips { display: flex; gap: 0.5rem; padding-block: 0.6rem; overflow-x: auto; scrollbar-width: none; }
.edara-chips::-webkit-scrollbar { display: none; }
.edara-chips a {
	flex: none; padding: 0.3rem 0.85rem; border-radius: 4px; background: var(--wp--preset--color--sand);
	color: #5A5448; font-size: var(--wp--preset--font-size--small); text-decoration: none; white-space: nowrap;
}
.edara-chips a:hover, .edara-chips a[aria-current] { background: var(--edara-ink); color: #fff; text-decoration: none; }

/* ---------- Kufi details ---------- */
/* Section title: square — title — rule — diamond */
.is-style-edara-section {
	display: flex; align-items: center; gap: 0.85rem; margin: 0;
	font-size: var(--wp--preset--font-size--xx-large);
}
.is-style-edara-section::before {
	content: ""; flex: none; width: 0.5em; height: 0.5em; background: var(--edara-ink);
}
.is-style-edara-section::after {
	content: ""; flex: 1; min-width: 2rem; height: 12px;
	background:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 0l6 6-6 6-6-6z' fill='%23232318'/%3E%3C/svg%3E") left center / 11px 11px no-repeat,
		linear-gradient(var(--edara-ink), var(--edara-ink)) right center / calc(100% - 16px) 2px no-repeat;
}
.edara-sec-head { gap: 1rem; margin-bottom: 1.5rem; align-items: center; }
.edara-sec-head > .is-style-edara-section { flex: 1; }
.edara-sec-head__more { margin: 0; white-space: nowrap; font-weight: 600; font-size: var(--wp--preset--font-size--small); }

/* Category label with a small square */
.edara-cat { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.edara-cat::before { content: ""; flex: none; width: 7px; height: 7px; background: var(--edara-teal); }
.edara-cat a { color: var(--edara-teal); }
.edara-cat a ~ a, .edara-cat .wp-block-post-terms__separator { display: none; }

/* Cut corner taken from the 45° stroke of the ر */
.edara-cut img, .edara-cut.edara-card__img, .edara-hero .wp-block-post-featured-image img {
	clip-path: polygon(0 0, 100% 0, 100% 100%, var(--edara-cut) 100%, 0 calc(100% - var(--edara-cut)));
}

/* Two diamonds (the dots of the ة) */
.edara-dots { display: flex; justify-content: center; gap: 6px; padding-block: 2rem 1.75rem; }
.edara-dots i { width: 12px; height: 12px; background: var(--edara-ink); transform: rotate(45deg); }
.edara-dots--big i { width: 22px; height: 22px; }
.edara-dots--big { gap: 10px; padding-top: 0; }

/* ---------- Home ---------- */
.edara-meta { gap: 0.75rem; margin-top: 1.25rem; align-items: center; }
.edara-hero .wp-block-post-title { margin-block: 0.5rem 0.75rem; line-height: 1.55; }
.edara-hero .wp-block-post-excerpt { margin: 0; max-width: 40rem; }
.edara-kicker {
	display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.25rem;
	font-family: var(--wp--preset--font-family--body); font-size: var(--wp--preset--font-size--small);
	font-weight: 600; color: var(--wp--preset--color--gold-text);
}
.edara-kicker::before {
	content: ""; width: 22px; height: 9px; flex: none;
	background:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 9'%3E%3Cpath d='M4.5 0l4.5 4.5-4.5 4.5L0 4.5zM15.5 0l4.5 4.5-4.5 4.5-4.5-4.5z' fill='%23B7791F'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Numbered list — numbers in solid squares like the logo blocks */
.edara-numbered .wp-block-post-template { counter-reset: edara; }
.edara-numbered .wp-block-post-template > li {
	counter-increment: edara; position: relative; padding-block: 1.1rem; padding-inline-start: 3.5rem;
	border-bottom: 1px solid var(--edara-line); margin: 0;
}
.edara-numbered .wp-block-post-template > li::before {
	content: counter(edara, arabic-indic); position: absolute; inset-inline-start: 0; top: 1.2rem;
	width: 2.4rem; height: 2.4rem; display: grid; place-items: center;
	background: var(--edara-ink); color: var(--wp--preset--color--paper);
	font-family: var(--wp--preset--font-family--ornament); font-weight: 700; font-size: 1.35rem; line-height: 1;
}
.edara-numbered .wp-block-post-title { margin: 0.15rem 0 0; line-height: 1.6; }

/* Cards */
.edara-cards .wp-block-post-template { row-gap: 2.25rem; }
.edara-cards .wp-block-post-featured-image { margin-bottom: 0.9rem; }
.edara-cards .wp-block-post-featured-image img { border-radius: 4px; }
.edara-cards .wp-block-post-title { margin-block: 0.35rem 0.25rem; line-height: 1.6; }
.edara-cards .wp-block-post-template > li > * { margin-block-start: 0; }

/* Glossary cards with a cut top corner */
.edara-terms .wp-block-post-template > li {
	position: relative; background: #fff; padding: 1.4rem 1.5rem 1.25rem; margin: 0;
	clip-path: polygon(18px 0, 100% 0, 100% 100%, 0 100%, 0 18px);
}
.edara-terms .wp-block-post-title { margin: 0 0 0.35rem; line-height: 1.6; }
.edara-terms .wp-block-post-excerpt { margin: 0; color: var(--wp--preset--color--body); }
.edara-terms .wp-block-post-excerpt__excerpt { margin: 0; }

/* Rows (image beside text) */
.edara-rows .wp-block-post-template > li {
	display: flex; gap: 1.25rem; padding-block: 1.25rem; border-bottom: 1px solid var(--edara-line); margin: 0;
}
.edara-rows .wp-block-post-featured-image { flex: none; margin: 0; }
.edara-rows .wp-block-post-featured-image img { border-radius: 4px; }
.edara-rows .wp-block-post-title { margin: 0 0 0.25rem; line-height: 1.6; }
.edara-rows .wp-block-post-excerpt { margin: 0; color: #5A5448; }
.edara-rows .wp-block-post-excerpt__excerpt { margin: 0; }

/* Podcast + boxes */
.edara-podcast { position: relative; }
.edara-podcast::after {
	content: ""; position: absolute; top: 1.1rem; inset-inline-end: 1.1rem; width: 24px; height: 10px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 10'%3E%3Cpath d='M5 0l5 5-5 5-5-5zM19 0l5 5-5 5-5-5z' fill='%23E2C98A'/%3E%3C/svg%3E") center / contain no-repeat;
}
.edara-podcast__kicker { color: #E2C98A; font-weight: 600; margin: 0; }
.edara-podcast h3 { margin-block: 0.5rem 1rem; }
.edara-box { border: 1px solid var(--edara-line); margin-top: 1.5rem; }
.edara-box h3 { margin: 0 0 0.25rem; }
.edara-follow { gap: 0.5rem; }

.edara-news__list { margin-block: 0.75rem 1.25rem; }
.edara-news__list .wp-block-post-template > li { padding-block: 0.7rem; border-bottom: 1px solid rgba(255,255,255,0.14); margin: 0; }
.edara-news__list .wp-block-post-title { margin: 0; line-height: 1.6; }
.edara-news__list .wp-block-post-title a { color: #fff; }
.edara-news__list .wp-block-post-title a:hover { color: #E2C98A; text-decoration: none; }
.edara-news__list .wp-block-post-date { color: #C9C3B3; margin-top: 0.15rem; }

/* ---------- Single article ---------- */
.edara-progress { position: sticky; top: 0; z-index: 30; height: 3px; background: transparent; margin: 0; }
.admin-bar .edara-progress { top: 32px; }
.edara-progress span { display: block; height: 100%; background: var(--edara-teal); transform: scaleX(0); transform-origin: right; }
.edara-crumbs { display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: var(--wp--preset--font-size--small); color: var(--wp--preset--color--muted); }
.edara-crumbs span { color: var(--edara-line); }
.edara-single__head .wp-block-post-title { margin-block: 0.75rem; line-height: 1.55; }
.edara-lede { color: #4A4438; margin: 0; }
.edara-byline {
	gap: 0.85rem; margin-top: 1.25rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--edara-line); align-items: center;
}
.edara-byline .wp-block-post-author-name { font-weight: 600; margin: 0; }
.edara-byline .wp-block-post-date { margin: 0; }
.edara-readtime__sep { color: var(--wp--preset--color--muted); }

.edara-prose { font-size: var(--wp--preset--font-size--large); line-height: 2; }
.edara-prose > * + * { margin-block-start: 1.25em; }
.edara-prose h2 { margin-block-start: 2.2em; scroll-margin-top: 1.5rem; }
.edara-prose h3 { margin-block-start: 1.8em; }
.edara-prose h2::before {
	content: ""; display: inline-block; width: 0.4em; height: 0.4em; margin-inline-end: 0.55em;
	background: var(--edara-ink); vertical-align: 0.15em;
}
.edara-prose a { text-decoration: underline; text-underline-offset: 3px; }
.edara-prose ul, .edara-prose ol { padding-inline-start: 1.4em; }
.edara-prose li + li { margin-top: 0.35em; }
.edara-prose ul > li::marker { content: "◆  "; color: var(--wp--preset--color--gold); font-size: 0.7em; }
.edara-prose img { border-radius: 4px; }
.edara-prose table { border-collapse: collapse; width: 100%; }
.edara-prose th, .edara-prose td { border: 1px solid var(--edara-line); padding: 0.5rem 0.75rem; text-align: start; }
.edara-prose th { background: var(--wp--preset--color--sand); }
.edara-prose .wp-block-table { overflow-x: auto; }

/* «الخلاصة في نقاط» boxes already in the articles (inline-styled) */
.edara-prose .key-takeaways {
	background: var(--wp--preset--color--sand) !important; border: 0 !important;
	border-inline-start: 3px solid var(--wp--preset--color--gold) !important; border-radius: 0 !important;
	padding: 1.25rem 1.5rem !important; font-size: var(--wp--preset--font-size--medium);
}
.edara-prose .key-takeaways > :first-child { margin-top: 0; }
.edara-prose .key-takeaways ul { margin-bottom: 0; }

/* Summary box style for groups («الخلاصة في نقاط») */
.is-style-edara-summary { background: var(--wp--preset--color--sand); padding: 1.25rem 1.5rem; }
.is-style-edara-summary > :first-child { margin-top: 0; }

.edara-tags { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: var(--wp--preset--font-size--small); }
.edara-tags a { padding: 0.2rem 0.7rem; background: var(--wp--preset--color--sand); border-radius: 4px; color: #5A5448; }
.edara-tags .wp-block-post-terms__separator { display: none; }

.edara-share {
	display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 2rem; padding-top: 1.25rem;
	border-top: 1px solid var(--edara-line);
}
.edara-share__label { color: var(--wp--preset--color--muted); font-size: var(--wp--preset--font-size--small); margin-inline-end: 0.25rem; }
.edara-share a {
	min-height: 40px; display: inline-flex; align-items: center; padding: 0 1rem; border: 1px solid var(--edara-line);
	border-radius: 4px; background: #fff; color: var(--edara-ink); font-size: var(--wp--preset--font-size--small);
}
.edara-share a:hover { background: var(--edara-ink); color: #fff; text-decoration: none; }

.edara-sticky { position: sticky; top: 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; }
.edara-toc { background: #fff; border: 1px solid var(--edara-line); padding: 1.25rem 1.4rem; }
.edara-toc__title { margin: 0 0 0.5rem; font-weight: 600; }
.edara-toc ol { list-style: arabic-indic; margin: 0; padding-inline-start: 1.2rem; font-size: var(--wp--preset--font-size--small); line-height: 2; }
.edara-toc a { color: #4A4438; }
.edara-toc a:hover { color: var(--edara-teal); }
.edara-search-box .wp-block-search__input { border-radius: 4px; border: 1px solid #D9D2C2; padding: 0.55rem 0.75rem; }
.edara-search-box .wp-block-search__button { border-radius: 4px; margin-inline-start: 0.4rem; }

.edara-related { margin-top: var(--wp--preset--spacing--60); }
.edara-related h2 { margin-bottom: 1.5rem; }
.edara-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 2rem; }
.edara-card a { display: block; color: var(--edara-ink); text-decoration: none; }
.edara-card__img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 4px; margin-bottom: 0.8rem; }
.edara-card__img--empty { background: var(--wp--preset--color--sand); }
.edara-card .edara-cat { color: var(--edara-teal); font-size: var(--wp--preset--font-size--x-small); font-weight: 600; }
.edara-card__title {
	display: block; margin-top: 0.3rem; font-family: var(--wp--preset--font-family--heading);
	font-weight: 700; font-size: var(--wp--preset--font-size--large); line-height: 1.6;
}
.edara-card a:hover .edara-card__title { color: var(--edara-teal); }

/* ---------- Archive ---------- */
.edara-pager { margin-top: 3rem; gap: 0.35rem; }
.edara-pager .page-numbers, .edara-pager a {
	min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; padding: 0 0.75rem;
	border: 1px solid var(--edara-line); background: #fff; color: var(--edara-ink); border-radius: 4px;
}
.edara-pager .page-numbers.current { background: var(--edara-ink); color: #fff; border-color: var(--edara-ink); }

/* ---------- Footer ---------- */
.edara-footer a { color: var(--wp--preset--color--line); }
.edara-footer a:hover { color: #fff; }
.edara-footer__top { gap: 2.5rem; }
.edara-footer__brand { max-width: 24rem; }
.edara-footer__brand img { height: 76px; width: auto; display: block; }
.edara-footer__links { display: flex; gap: 3rem; }
.edara-footer__links ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.edara-footer__copy { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid #3E3E30; color: #B3AE9F; }

/* ---------- Small screens ---------- */
@media (max-width: 781px) {
	.edara-logo img { height: 42px; }
	.edara-header__bar { padding-block: 0.6rem; }
	.is-style-edara-section { font-size: var(--wp--preset--font-size--x-large); }
	.edara-rows .wp-block-post-featured-image { width: 96px !important; }
	.edara-sticky { position: static; }
	.edara-aside { order: 2; }
	:root { --edara-cut: 32px; }
}
@media (prefers-reduced-motion: reduce) {
	* { scroll-behavior: auto !important; transition: none !important; }
}
