/*
Theme Name: Roadmap for Sudan's Future
Theme URI: https://anwarelhadi.org
Author: Built for Anwar El-Hadi Abdel-Rahman
Description: Bilingual (English / Arabic) theme for the Roadmap for Sudan's Future. Includes a one-click setup under Appearance → Roadmap Setup that builds the full sitemap, menus, article categories and pillar tags. Requires the free Polylang plugin.
Version: 1.0.0
Requires at least: 6.4
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: roadmap-sudan
*/

/* Layout: one reading column like a book's pages; wider bands for the pillar grid, listings and footer.
   The flag stripe across the top is the only loud element. */
:root {
	--paper: #f6f6f1;
	--panel: #ebeee6;
	--ink: #17201b;
	--muted: #57615a;
	--rule: #d3d9cf;
	--green: #0b6b4c;
	--green-deep: #08523a;
	--red: #b3261e;
	--on-dark: #eef1ea;

	--display: "Yrsa", "Spectral", Georgia, serif;
	--body: "Spectral", Georgia, "Times New Roman", serif;
	--label: "Archivo", "Helvetica Neue", Arial, sans-serif;

	--step--1: 0.875rem;
	--step-0: 1.125rem;
	--step-1: 1.35rem;
	--step-2: 1.75rem;
	--step-3: 2.25rem;
	--step-4: clamp(2.5rem, 6.5vw, 4.25rem);

	--measure: 42rem;
	--wide: 72rem;
	--gutter: 16px;
}

[dir="rtl"] {
	--display: "Amiri", "Noto Naskh Arabic", "Traditional Arabic", serif;
	--body: "Noto Naskh Arabic", "Amiri", "Geeza Pro", "Traditional Arabic", serif;
	--label: "Noto Naskh Arabic", "Geeza Pro", Tahoma, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--body);
	font-size: var(--step-0);
	line-height: 1.65;
	overflow-wrap: break-word;
}
[dir="rtl"] body { line-height: 1.9; }

img, video, iframe { max-width: 100%; height: auto; }

a { color: var(--green); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--green-deep); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

h1, h2, h3, h4 { font-family: var(--display); line-height: 1.12; text-wrap: balance; margin: 2.2rem 0 0.8rem; font-weight: 700; }
[dir="rtl"] :is(h1, h2, h3, h4) { line-height: 1.45; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
p { margin: 0 0 1.1rem; }

.rm-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rm-skip { position: absolute; inset-inline-start: 1rem; top: -4rem; z-index: 20; background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; font-family: var(--label); }
.rm-skip:focus { top: 1rem; }

.rm-wrap {
	max-width: var(--measure);
	margin-inline: auto;
	padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
	padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.rm-wrap--wide { max-width: var(--wide); }

/* ---------- Flag stripe ---------- */
.rm-flag { display: grid; grid-template-rows: repeat(3, 5px); position: relative; }
.rm-flag span:nth-child(1) { background: var(--red); }
.rm-flag span:nth-child(2) { background: var(--paper); }
.rm-flag span:nth-child(3) { background: var(--ink); }
.rm-flag::before {
	content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 20px;
	background: var(--green); clip-path: polygon(0 0, 100% 50%, 0 100%);
}
/* The flag's triangle sits at the hoist, which stays on the left in both languages. */
[dir="rtl"] .rm-flag::before { inset-inline-start: auto; left: 0; }

/* ---------- Header ---------- */
.rm-header { border-bottom: 1px solid var(--rule); background: var(--paper); }
.rm-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1rem; }
.rm-brand { text-decoration: none; color: var(--ink); display: grid; gap: 0.1rem; min-width: 0; }
.rm-brand:hover { color: var(--ink); }
.rm-brand-title { font-family: var(--display); font-weight: 700; font-size: var(--step-1); line-height: 1.15; }
.rm-brand-author { font-family: var(--label); font-size: var(--step--1); color: var(--muted); letter-spacing: 0.02em; }
.rm-header-tools { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.rm-lang {
	font-family: var(--label); font-weight: 600; font-size: 0.95rem; text-decoration: none;
	padding: 0.45rem 0.8rem; border: 1.5px solid var(--green); border-radius: 999px; color: var(--green);
}
.rm-lang[lang="ar"] { font-family: "Noto Naskh Arabic", "Geeza Pro", serif; font-size: 1.05rem; padding-block: 0.25rem; }
.rm-lang[lang="en"] { font-family: "Archivo", Arial, sans-serif; }
.rm-lang:hover { background: var(--green); color: var(--paper); }
.rm-icon-btn {
	display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%;
	background: transparent; color: var(--ink); cursor: pointer;
}
.rm-icon-btn:hover, .rm-icon-btn[aria-expanded="true"] { background: var(--panel); }

.rm-search-panel { border-top: 1px solid var(--rule); padding-block: 1rem; background: var(--panel); }
.rm-searchform { display: flex; gap: 0.5rem; max-width: 40rem; }
.rm-searchform input[type="search"] {
	flex: 1; min-width: 0; font: inherit; font-size: 1rem; padding: 0.7rem 0.9rem;
	border: 1.5px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink);
}
.rm-searchform input[type="search"]:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }

/* Main menu: horizontal with drop-downs on wide screens, a stacked list on phones and portrait iPads */
.rm-nav { border-top: 1px solid var(--rule); }
.rm-menu, .rm-menu ul { list-style: none; margin: 0; padding: 0; }
.rm-menu { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.rm-menu > li { position: relative; }
.rm-menu a { display: block; text-decoration: none; color: var(--ink); font-family: var(--label); font-weight: 500; font-size: 0.95rem; padding-block: 0.75rem; }
[dir="rtl"] .rm-menu a { font-size: 1.05rem; font-weight: 600; }
.rm-menu > li > a { border-bottom: 2px solid transparent; }
.rm-menu > li > a:hover, .rm-menu > .current-menu-item > a, .rm-menu > .current-menu-ancestor > a { border-bottom-color: var(--green); color: var(--green); }
.rm-menu .menu-item-has-children > a::after { content: "▾"; font-size: 0.7em; margin-inline-start: 0.35em; color: var(--muted); }
.rm-menu .sub-menu {
	position: absolute; inset-inline-start: -1rem; top: 100%; z-index: 30; min-width: 20rem; max-width: 26rem;
	background: var(--paper); border: 1px solid var(--rule); border-top: 3px solid var(--green);
	box-shadow: 0 12px 30px rgb(23 32 27 / 12%); padding: 0.5rem 0; display: none;
}
.rm-menu .sub-menu a { padding: 0.5rem 1rem; font-size: 0.92rem; line-height: 1.35; }
.rm-menu .sub-menu a:hover { background: var(--panel); color: var(--green); }
.rm-menu > li:hover > .sub-menu, .rm-menu > li:focus-within > .sub-menu, .rm-menu > li.is-open > .sub-menu { display: block; }
.rm-menu-btn { display: none; }

@media (max-width: 600px) {
	.rm-brand-title { font-size: 1.1rem; }
	.rm-brand-author { display: none; }
	.rm-lang { padding-inline: 0.65rem; }
}

@media (max-width: 900px) {
	.rm-menu-btn { display: inline-grid; }
	.rm-nav { display: none; }
	.rm-header.is-menu-open .rm-nav { display: block; }
	.rm-menu { flex-direction: column; gap: 0; padding-block: 0.5rem 1rem; }
	.rm-menu > li { border-bottom: 1px solid var(--rule); }
	.rm-menu a { padding-block: 0.8rem; font-size: 1.05rem; }
	.rm-menu .menu-item-has-children > a::after { content: none; }
	.rm-menu .sub-menu { position: static; display: block; min-width: 0; max-width: none; border: 0; box-shadow: none; background: transparent; padding: 0 0 0.6rem; }
	.rm-menu .sub-menu a { padding: 0.4rem 0; padding-inline-start: 1rem; color: var(--muted); font-size: 0.98rem; }
}

/* ---------- Page heads ---------- */
.rm-page-head { padding-block: 3rem 1.5rem; position: relative; overflow: hidden; }
.rm-page-title { font-size: var(--step-4); margin: 0; letter-spacing: -0.01em; }
[dir="rtl"] .rm-page-title { letter-spacing: 0; font-size: clamp(2.2rem, 5.5vw, 3.6rem); }
.rm-eyebrow, .rm-kicker {
	font-family: var(--label); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase;
	color: var(--green); margin: 0 0 0.9rem;
}
[dir="rtl"] :is(.rm-eyebrow, .rm-kicker) { letter-spacing: 0; font-size: 1rem; }
.rm-eyebrow a { color: inherit; text-decoration: none; }
.rm-page-head--pillar .rm-wrap { position: relative; }
.rm-head-num {
	position: absolute; inset-inline-end: max(var(--gutter), env(safe-area-inset-right, 0px)); top: -1.5rem;
	font-family: "Yrsa", Georgia, serif; font-weight: 700; font-size: clamp(6rem, 18vw, 11rem); line-height: 1;
	color: var(--panel); z-index: -1; user-select: none;
}
.rm-other-lang { font-family: var(--label); font-weight: 600; }

/* ---------- Content ---------- */
.entry-content { padding-bottom: 4rem; }
.entry-content > :first-child { margin-top: 0; }
.entry-content ul, .entry-content ol { padding-inline-start: 1.3em; margin: 0 0 1.2rem; }
.entry-content li { margin-bottom: 0.4rem; }
.rm-lead, .entry-content .rm-lead { font-size: var(--step-1); line-height: 1.5; color: var(--ink); }
[dir="rtl"] .rm-lead { line-height: 1.8; }

.wp-block-quote, .entry-content blockquote {
	margin: 2rem 0; padding: 0; padding-inline-start: 1.3rem; border-inline-start: 3px solid var(--red);
	font-family: var(--display); font-size: var(--step-2); line-height: 1.3;
}
.wp-block-quote p { margin-bottom: 0.6rem; }
.wp-block-quote cite { display: block; font-family: var(--label); font-size: var(--step--1); color: var(--muted); font-style: normal; }

.wp-block-buttons { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0; }
.rm-button, .wp-block-button__link {
	display: inline-block; font-family: var(--label); font-weight: 600; font-size: 1rem; line-height: 1.2;
	text-decoration: none; padding: 0.85rem 1.35rem; border-radius: 3px; border: 1.5px solid var(--green);
	background: var(--green); color: var(--paper); cursor: pointer;
}
.rm-button:hover, .wp-block-button__link:hover { background: var(--green-deep); border-color: var(--green-deep); color: var(--paper); }
.is-style-outline .wp-block-button__link { background: transparent; color: var(--green); }
.is-style-outline .wp-block-button__link:hover { background: var(--green); color: var(--paper); }

/* Paragraph index: the manuscript's own numbering, ¶ by ¶ */
.entry-content .rm-para-index { list-style: none; padding: 0; border-top: 1px solid var(--rule); font-size: 1.02rem; }
.rm-para-index li { display: grid; grid-template-columns: 3rem 1fr; gap: 0.75rem; padding-block: 0.55rem; margin: 0; border-bottom: 1px solid var(--rule); }
.rm-para-index strong { font-family: var(--label); font-weight: 600; color: var(--green); font-variant-numeric: tabular-nums; }
.rm-para-index strong::before { content: "¶ "; color: var(--muted); font-weight: 500; }

.entry-content .rm-appendix-list { list-style: none; padding: 0; border-top: 1px solid var(--rule); }
.rm-appendix-list li { padding-block: 0.7rem; margin: 0; border-bottom: 1px solid var(--rule); }
.rm-appendix-list a { font-family: var(--display); font-weight: 700; font-size: var(--step-1); text-decoration: none; }

/* Marked placeholder: text still to be supplied from the manuscript */
.rm-placeholder {
	border: 1.5px dashed var(--rule); border-radius: 4px; padding: 0.9rem 1.1rem;
	color: var(--muted); font-style: italic; background: color-mix(in srgb, var(--panel) 50%, transparent);
}
[dir="rtl"] .rm-placeholder { font-style: normal; }

/* ---------- Homepage ---------- */
.rm-home-content > .wp-block-group {
	max-width: var(--measure); margin-inline: auto;
	padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
	padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.rm-home-content > .rm-hero { max-width: var(--wide); padding-block: clamp(3rem, 8vw, 6rem) 3rem; }
.rm-hero .rm-hero-title { font-size: clamp(2.8rem, 9vw, 6.2rem); line-height: 0.98; letter-spacing: -0.02em; margin: 0 0 1.5rem; max-width: 14ch; }
[dir="rtl"] .rm-hero .rm-hero-title { letter-spacing: 0; line-height: 1.35; font-size: clamp(2.6rem, 8vw, 5.2rem); max-width: none; }
.rm-hero .rm-lead { max-width: 38rem; font-size: clamp(1.25rem, 2.6vw, 1.55rem); color: var(--muted); }
.rm-hero .rm-byline { font-family: var(--label); font-weight: 600; font-size: 1rem; margin-top: 1.5rem; }

.rm-home-content > .rm-verse { text-align: center; padding-block: 3rem; border-top: 1px solid var(--rule); }
.rm-arabic-verse { font-family: "Amiri", "Noto Naskh Arabic", serif; font-size: clamp(1.5rem, 3.5vw, 1.9rem); line-height: 2.1; direction: rtl; margin-bottom: 1rem; }
.rm-verse-translation { font-style: italic; color: var(--muted); }
.rm-verse-cite { font-family: var(--label); font-size: var(--step--1); letter-spacing: 0.06em; color: var(--muted); }

.rm-home-content > .rm-intro { padding-block: 3rem; border-top: 1px solid var(--rule); }
.rm-intro h2 { margin-top: 0; }

.rm-section-title { font-size: var(--step-3); margin: 0 0 0.6rem; }
.rm-section-intro { color: var(--muted); max-width: 40rem; margin-bottom: 2rem; }

.rm-pillars { background: var(--panel); padding-block: 4rem; }
.rm-pillar-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1rem; }
.rm-pillar-card {
	display: grid; grid-template-columns: 4.2rem 1fr; grid-template-rows: auto auto 1fr; column-gap: 1rem; row-gap: 0.4rem;
	height: 100%; padding: 1.4rem 1.3rem; background: var(--paper); border-top: 3px solid var(--ink);
	text-decoration: none; color: var(--ink); transition: border-color 0.15s, transform 0.15s;
}
.rm-pillar-card:hover { border-top-color: var(--green); color: var(--ink); transform: translateY(-2px); }
.rm-pillar-num { grid-row: 1 / 4; font-family: "Yrsa", Georgia, serif; font-weight: 700; font-size: 2.4rem; line-height: 1; color: var(--green); }
.rm-pillar-title { font-family: var(--display); font-weight: 700; font-size: 1.3rem; line-height: 1.2; }
[dir="rtl"] .rm-pillar-title { line-height: 1.5; }
.rm-pillar-desc { font-size: 0.98rem; color: var(--muted); line-height: 1.5; }
.rm-pillar-paras { font-family: var(--label); font-size: 0.8rem; color: var(--muted); letter-spacing: 0.03em; align-self: end; font-variant-numeric: tabular-nums; }

.rm-living { padding-block: 4rem; }
.rm-living-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 2rem; }
.rm-living h3 { font-size: var(--step-1); margin: 0 0 0.8rem; padding-bottom: 0.6rem; border-bottom: 2px solid var(--ink); }
.rm-living h3 a { color: var(--ink); text-decoration: none; }
.rm-linklist { list-style: none; margin: 0; padding: 0; font-size: 1rem; }
.rm-linklist li { padding-block: 0.45rem; border-bottom: 1px solid var(--rule); }
.rm-linklist a { text-decoration: none; }
.rm-linklist--posts span { display: block; font-family: var(--label); font-size: 0.8rem; color: var(--muted); }

/* ---------- Cards (listings, search, related) ---------- */
.rm-cards, .entry-content .rm-cards { list-style: none; margin: 1rem 0 2rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: 1rem; }
.rm-card a { display: grid; gap: 0.4rem; height: 100%; padding: 1.2rem; background: var(--paper); border: 1px solid var(--rule); border-top: 3px solid var(--green); text-decoration: none; color: var(--ink); }
.rm-card a:hover { border-color: var(--green); color: var(--ink); }
.rm-card-kicker { font-family: var(--label); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--green); }
[dir="rtl"] .rm-card-kicker { letter-spacing: 0; font-size: 0.95rem; }
.rm-card-title { font-family: var(--display); font-weight: 700; font-size: 1.3rem; line-height: 1.25; }
.rm-card-text { font-size: 0.98rem; color: var(--muted); line-height: 1.5; }
.rm-related { margin-top: 3rem; padding-top: 1rem; border-top: 2px solid var(--ink); }
.rm-related h2 { font-size: var(--step-2); margin-top: 0.5rem; }
.rm-empty { color: var(--muted); padding-block: 2rem 4rem; }

.rm-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 1.5rem 0 0; }
.rm-chip { display: inline-block; font-family: var(--label); font-size: 0.9rem; font-weight: 500; text-decoration: none; padding: 0.4rem 0.85rem; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink); background: var(--paper); }
.rm-chip:hover, .rm-chip.is-current { border-color: var(--green); background: var(--green); color: var(--paper); }
.rm-post-pillars { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-family: var(--label); font-size: 0.9rem; color: var(--muted); }
.rm-search-inline { margin-top: 1.5rem; }

.navigation.pagination { margin: 1rem 0 4rem; font-family: var(--label); }
.nav-links { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.page-numbers { padding: 0.45rem 0.8rem; border: 1px solid var(--rule); text-decoration: none; }
.page-numbers.current { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- Contact form ---------- */
.rm-form { display: grid; gap: 1rem; max-width: 34rem; margin-top: 2rem; padding: 1.5rem; background: var(--panel); border-radius: 4px; }
.rm-form-row { display: grid; gap: 0.35rem; }
.rm-form label { font-family: var(--label); font-weight: 600; font-size: 0.95rem; }
.rm-form input, .rm-form select, .rm-form textarea {
	font: inherit; font-size: 1rem; padding: 0.7rem 0.85rem; border: 1.5px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); width: 100%;
}
.rm-form :is(input, select, textarea):focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }
.rm-form .rm-button { justify-self: start; }
.rm-form-note { font-size: 0.9rem; color: var(--muted); margin: 0; }
.rm-hp { position: absolute; inset-inline-start: -9999px; }
.rm-notice { padding: 0.9rem 1.1rem; border-radius: 4px; font-family: var(--label); }
.rm-notice--ok { background: color-mix(in srgb, var(--green) 14%, var(--paper)); border: 1px solid var(--green); }
.rm-notice--err { background: color-mix(in srgb, var(--red) 10%, var(--paper)); border: 1px solid var(--red); }

/* ---------- Footer ---------- */
.rm-footer { background: var(--ink); color: var(--on-dark); padding-block: 3rem 2rem; margin-top: 0; }
.rm-footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem; }
.rm-footer-title { font-family: var(--display); font-weight: 700; font-size: var(--step-1); margin: 0 0 0.3rem; }
.rm-footer-sub { color: color-mix(in srgb, var(--on-dark) 70%, transparent); font-size: 0.98rem; max-width: 26rem; }
.rm-footer-menu { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, auto)); gap: 0.4rem 2.5rem; }
.rm-footer a { color: var(--on-dark); text-decoration: none; font-family: var(--label); font-size: 0.95rem; }
.rm-footer a:hover { color: #fff; text-decoration: underline; }
.rm-copy { margin: 2.5rem 0 0; padding-top: 1.2rem; border-top: 1px solid rgb(255 255 255 / 15%); font-family: var(--label); font-size: 0.85rem; color: color-mix(in srgb, var(--on-dark) 65%, transparent); }

/* WordPress core alignment helpers */
.alignwide { max-width: var(--wide); }
.alignfull { width: 100%; }
.aligncenter { margin-inline: auto; }
.wp-block-image figcaption, .wp-caption-text { font-family: var(--label); font-size: var(--step--1); color: var(--muted); }

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