/*
Theme Name: Heslal
Theme URI: https://heslal.com
Author: Heslal
Description: A news theme built for ADLaM. Right-to-left by default, Noto Sans Adlam served locally, ADLaM digits for dates and page numbers, WhatsApp-first sharing, and every interface word editable in Appearance → Customize → Heslal theme.
Version: 1.2.1
Requires at least: 6.3
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: heslal
Tags: news, rtl-language-support, custom-logo, custom-menu, featured-images, two-columns
*/

:root {
	--brand: #0f2147;
	--accent: #c8102e;
	--gold: #c99a2e;
	--ink: #16181d;
	--muted: #5d6470;
	--line: #e3e1da;
	--paper: #ffffff;
	--wash: #f6f4ef;
	--radius: 6px;
	--wrap: 1200px;
	--font: "Heslal Ebrima", Ebrima, "Noto Sans Adlam", Kigelia, "Segoe UI", system-ui, sans-serif;
	--gap: clamp(16px, 2.5vw, 28px);
}

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

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

body {
	margin: 0;
	background: var(--wash);
	color: var(--ink);
	font-family: var(--font);
	font-size: 17px;
	line-height: 1.85;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
}

img, svg, video, iframe { max-width: 100%; height: auto; }
img { display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

h1, h2, h3, h4 { line-height: 1.5; margin: 0 0 .5em; font-weight: 700; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 16px; }
.narrow { max-width: 820px; }

.screen-reader-text {
	border: 0; clip: rect(1px,1px,1px,1px); clip-path: inset(50%);
	height: 1px; width: 1px; margin: -1px; overflow: hidden; padding: 0;
	position: absolute !important; word-wrap: normal !important;
}
.skip-link:focus {
	clip: auto; clip-path: none; height: auto; width: auto; margin: 0;
	inset-inline-start: 8px; top: 8px; z-index: 1000;
	background: var(--paper); padding: 8px 14px; border-radius: var(--radius);
}

.icon { display: inline-block; vertical-align: middle; flex: none; }

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

.site-header { background: var(--brand); color: #fff; }

.topbar { background: rgba(0,0,0,.22); font-size: 14px; }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; min-height: 36px; gap: 12px; }
.topbar__date { opacity: .85; }

.social { display: flex; gap: 6px; flex-wrap: wrap; }
.social a { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; border-radius: 50%; color: inherit; opacity: .85; }
.social a:hover { opacity: 1; color: var(--gold); }
.social .icon { width: 17px; height: 17px; }

.masthead { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: 22px; }
.brand { min-width: 0; }
.brand__name { display: inline-block; font-size: clamp(30px, 5vw, 46px); font-weight: 700; line-height: 1.3; color: #fff; letter-spacing: 0; }
.brand__name:hover { color: #fff; }
.brand__tagline { margin: 2px 0 0; font-size: 15px; opacity: .8; }
.custom-logo { max-height: 72px; width: auto; }

.search-form { display: flex; align-items: stretch; background: #fff; border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.search-field {
	flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 16px;
	font: inherit; font-size: 16px; color: var(--ink); direction: rtl;
}
.search-field:focus { outline: none; }
.search-submit { border: 0; background: transparent; color: var(--brand); padding: 0 14px; cursor: pointer; }
.masthead__search { width: min(340px, 40vw); }
.mainnav__search { display: none; }

.mainnav { background: var(--paper); color: var(--ink); border-bottom: 3px solid var(--accent); position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 0 var(--line); }
.admin-bar .mainnav { top: 32px; }
.mainnav__inner { display: flex; align-items: center; min-height: 52px; }
.mainnav__toggle { display: none; }
.mainnav .menu { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.mainnav .menu > li { position: relative; }
.mainnav .menu a { display: block; padding: 12px 14px; font-weight: 600; font-size: 16px; white-space: nowrap; }
.mainnav .menu .current-menu-item > a,
.mainnav .menu .current-cat > a,
.mainnav .menu .current-menu-ancestor > a { color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.mainnav .sub-menu { display: none; position: absolute; inset-inline-start: 0; top: 100%; min-width: 220px; list-style: none; margin: 0; padding: 6px 0; background: var(--paper); border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.mainnav li:hover > .sub-menu, .mainnav li:focus-within > .sub-menu { display: block; }
.mainnav .sub-menu a { font-weight: 400; padding: 8px 16px; }

/* Arrow on menu items that open a dropdown. */
.mainnav .menu > .menu-item-has-children > a { display: flex; align-items: center; gap: 7px; }
.mainnav .menu > .menu-item-has-children > a::after {
	content: ""; width: 7px; height: 7px; flex: none;
	border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
	transform: translateY(-2px) rotate(45deg); transition: transform .2s; opacity: .75;
}
.mainnav .menu > .menu-item-has-children:hover > a::after,
.mainnav .menu > .menu-item-has-children:focus-within > a::after { transform: translateY(2px) rotate(-135deg); }

/* Category names always shown in capital letters (ADLaM has upper and lower case). */
.mainnav .menu-item-object-category > a,
.mainnav .cat-item > a,
.badge,
.section-title > a:first-child,
.category .archive-header .page-title,
.site-footer .cat-item > a,
.site-footer .menu-item-object-category > a { text-transform: uppercase; }

/* Headline bar */
.ticker { background: var(--paper); color: var(--ink); border-bottom: 1px solid var(--line); }
.ticker__inner { display: flex; align-items: center; gap: 14px; min-height: 44px; overflow: hidden; }
.ticker__label { flex: none; background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; padding: 2px 12px; border-radius: 3px; }
.ticker__list { list-style: none; margin: 0; padding: 0; position: relative; flex: 1; min-width: 0; height: 30px; }
.ticker__list li { position: absolute; inset: 0; opacity: 0; transform: translateY(8px); transition: opacity .4s, transform .4s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 30px; pointer-events: none; }
.ticker__list li.is-active { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- Content layout ---------- */

.site-content { padding-block: var(--gap); }

.home__columns { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--gap); align-items: start; }
.home__main { min-width: 0; }

.top-stories { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: var(--gap); margin-bottom: var(--gap); background: var(--paper); padding: var(--gap); border-radius: var(--radius); }
.top-stories__side { display: flex; flex-direction: column; gap: 14px; }
.top-stories__side .story--row + .story--row { border-top: 1px solid var(--line); padding-top: 14px; }

.section-block { background: var(--paper); padding: var(--gap); border-radius: var(--radius); margin-bottom: var(--gap); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 22px; border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 18px; }
.section-title > a:first-child, .section-title > span:first-child { position: relative; }
.section-title > a:first-child::after, .section-title > span:first-child::after { content: ""; position: absolute; inset-inline-start: 0; bottom: -10px; width: 100%; height: 4px; background: var(--accent); }
.section-title__more { font-size: 14px; font-weight: 600; color: var(--muted); }
.section-block__grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--gap); }
.section-block__list { display: flex; flex-direction: column; gap: 14px; }
.section-block__list .story--row + .story--row { border-top: 1px solid var(--line); padding-top: 14px; }

.grid { display: grid; gap: var(--gap); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.home__main > .grid { background: var(--paper); padding: var(--gap); border-radius: var(--radius); }

/* ---------- Story cards ---------- */

.story { min-width: 0; }
.story__media { display: block; overflow: hidden; border-radius: var(--radius); background: var(--wash); aspect-ratio: 16 / 9; }
.story__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.story:hover .story__media img { transform: scale(1.03); }
.story__body { padding-top: 10px; }
.story__title { font-size: 19px; margin: 4px 0 6px; }
.story__title a:hover { color: var(--accent); }
.story__excerpt { color: var(--muted); font-size: 16px; margin: 0 0 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.story__meta { color: var(--muted); font-size: 14px; }

.story--lead .story__title { font-size: clamp(24px, 3vw, 34px); line-height: 1.45; }
.story--lead .story__excerpt { font-size: 17px; -webkit-line-clamp: 4; }

.story--row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: start; }
.story--row .story__media { aspect-ratio: 3 / 2; }
.story--row .story__body { padding-top: 0; }
.story--row .story__title { font-size: 16px; margin-top: 0; line-height: 1.6; }

.badge { display: inline-block; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; padding: 1px 10px; border-radius: 3px; line-height: 1.8; }
.badge:hover { color: #fff; filter: brightness(1.1); }

/* Placeholder for stories without a photo: a pattern inspired by Fulani embroidery. */
.no-thumb {
	display: block; width: 100%; height: 100%; min-height: 80px;
	background-color: var(--brand);
	background-image:
		linear-gradient(135deg, var(--gold) 25%, transparent 25%),
		linear-gradient(225deg, var(--gold) 25%, transparent 25%),
		linear-gradient(315deg, var(--accent) 25%, transparent 25%),
		linear-gradient(45deg, var(--accent) 25%, transparent 25%);
	background-size: 28px 28px;
	background-position: 0 0, 0 0, 14px 14px, 14px 14px;
	opacity: .9;
}

/* ---------- Sidebar ---------- */

.sidebar { position: sticky; top: 76px; display: flex; flex-direction: column; gap: var(--gap); }
.admin-bar .sidebar { top: 108px; }
.widget { background: var(--paper); padding: 20px; border-radius: var(--radius); }
.widget-title { font-size: 19px; border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 14px; }
.widget-title span { box-shadow: 0 10px 0 -6px var(--accent); }
.widget ul { margin: 0; padding-inline-start: 18px; }
.numbered { list-style: none; margin: 0; padding: 0; }
.numbered li { display: flex; gap: 12px; padding-block: 10px; border-bottom: 1px solid var(--line); }
.numbered li:last-child { border-bottom: 0; }
.numbered__n { flex: none; font-size: 26px; font-weight: 700; color: var(--accent); line-height: 1.2; min-width: 28px; }
.numbered a { font-weight: 600; line-height: 1.6; }

/* ---------- Single article ---------- */

.entry { background: var(--paper); padding: clamp(18px, 4vw, 40px); border-radius: var(--radius); margin-bottom: var(--gap); }
.entry-title { font-size: clamp(26px, 4vw, 40px); line-height: 1.45; margin: 10px 0 12px; }
.entry-standfirst { font-size: 20px; color: var(--muted); margin: 0 0 16px; line-height: 1.75; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 15px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.entry-meta a { color: var(--ink); font-weight: 600; }
.entry-hero { margin: 20px 0; }
.entry-hero img { width: 100%; border-radius: var(--radius); }
.entry-hero figcaption, .entry-content figcaption { font-size: 14px; color: var(--muted); padding-top: 6px; }

.entry-content { font-size: 19px; line-height: 2; }
.entry-content > * { max-width: 760px; }
.entry-content p { margin: 0 0 1.2em; }
.entry-content h2 { font-size: 26px; margin-top: 1.4em; }
.entry-content h3 { font-size: 22px; margin-top: 1.2em; }
.entry-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.entry-content blockquote { margin: 1.5em 0; padding: 4px 22px; border-inline-start: 4px solid var(--accent); background: var(--wash); font-size: 20px; }
.entry-content img { border-radius: var(--radius); }
.entry-content ul, .entry-content ol { padding-inline-start: 1.4em; }
.entry-content table { border-collapse: collapse; width: 100%; }
.entry-content th, .entry-content td { border: 1px solid var(--line); padding: 8px 10px; }
.entry-content :is(pre, code) { direction: ltr; text-align: left; }
.entry-content [lang="ar"], .entry-content .arabic { font-family: "Noto Naskh Arabic", "Amiri", "Traditional Arabic", serif; font-size: 1.15em; }

.entry-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 8px; }
.entry-tags a { background: var(--wash); border: 1px solid var(--line); padding: 2px 12px; border-radius: 999px; font-size: 14px; }

.share { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.share__label { font-weight: 700; font-size: 15px; margin-inline-end: 4px; }
.share__btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; background: var(--brand); }
.share__btn:hover { color: #fff; filter: brightness(1.12); }
.share__btn--whatsapp { background: #25d366; }
.share__btn--facebook { background: #1877f2; }
.share__btn--telegram { background: #229ed9; }
.share__btn--x { background: #111; }
.share__btn--copy { background: var(--muted); }
.share__btn.is-done { background: var(--gold); }

.page-title { font-size: clamp(26px, 3.5vw, 36px); margin-bottom: 16px; }
.archive-header { background: var(--paper); padding: var(--gap); border-radius: var(--radius); margin-bottom: var(--gap); border-inline-start: 6px solid var(--accent); }
.archive-header .page-title { margin: 0; }
.archive-description { color: var(--muted); }
.archive-search { margin-top: 12px; max-width: 480px; }
.search-term { color: var(--accent); }

.pagination { margin-top: var(--gap); }
.pagination ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pagination a, .pagination span { display: inline-flex; min-width: 42px; height: 42px; align-items: center; justify-content: center; padding: 0 12px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line); font-weight: 600; }
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }

.button { display: inline-block; background: var(--brand); color: #fff; padding: 8px 22px; border-radius: 999px; font-weight: 600; }
.button:hover { color: #fff; background: var(--accent); }
.more-link-wrap { text-align: center; margin: var(--gap) 0 0; }

.empty, .empty-state, .error-404 { background: var(--paper); padding: 40px; border-radius: var(--radius); text-align: center; }
.empty-state .no-thumb { height: 140px; border-radius: var(--radius); margin-bottom: 20px; }
.error-404__code { font-size: 80px; font-weight: 700; color: var(--accent); margin: 0; line-height: 1.2; }
.error-404 .search-form { max-width: 460px; margin: 0 auto 20px; }

/* Comments */
.comments { background: var(--paper); padding: var(--gap); border-radius: var(--radius); margin-bottom: var(--gap); }
.comment-list { list-style: none; padding: 0; margin: 0 0 24px; }
.comment-list .children { list-style: none; padding-inline-start: 24px; }
.comment-body { padding: 14px 0; border-bottom: 1px solid var(--line); }
.comment-author img { float: inline-start; margin-inline-end: 10px; border-radius: 50%; }
.comment-form input:not([type="checkbox"]):not([type="submit"]), .comment-form textarea { width: 100%; font: inherit; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.comment-form .submit { background: var(--brand); color: #fff; border: 0; padding: 10px 24px; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer; }

/* WordPress core alignment classes */
.alignwide { max-width: 100% !important; }
.alignleft { float: left; margin: 0 1.5em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.5em; }
.aligncenter { margin-inline: auto; }
.wp-caption-text { font-size: 14px; color: var(--muted); }

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

.site-footer { background: var(--brand); color: rgba(255,255,255,.88); margin-top: var(--gap); }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; padding-block: 40px; }
.brand__name--footer { font-size: 32px; margin-bottom: 8px; }
.footer__heading { font-size: 18px; color: #fff; margin-bottom: 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 20px; }
.site-footer li { padding-block: 3px; }
.site-footer a:hover { color: var(--gold); }
.site-footer .widget { background: transparent; padding: 0; }
.site-footer .widget-title { color: #fff; border-color: rgba(255,255,255,.3); }
.footer__bottom { border-top: 1px solid rgba(255,255,255,.15); padding-block: 16px; font-size: 14px; text-align: center; opacity: .8; }

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

@media (max-width: 1024px) {
	.home__columns { grid-template-columns: minmax(0, 1fr); }
	.sidebar { position: static; }
	.grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 782px) {
	.admin-bar .mainnav { top: 0; }
	.masthead { padding-block: 14px; }
	.masthead__search { display: none; }
	.mainnav__inner { flex-wrap: wrap; }
	.mainnav__toggle {
		display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent;
		font: inherit; font-weight: 700; color: var(--ink); padding: 12px 0; cursor: pointer;
	}
	.mainnav__menu { display: none; width: 100%; padding-bottom: 12px; }
	.mainnav.is-open .mainnav__menu { display: block; }
	.mainnav .menu { flex-direction: column; }
	.mainnav .menu a { padding: 10px 4px; border-bottom: 1px solid var(--line); }
	.mainnav .menu .current-menu-item > a { box-shadow: none; }
	.mainnav .sub-menu { display: block; position: static; border: 0; box-shadow: none; padding-inline-start: 16px; }
	.mainnav__search { display: block; margin-top: 12px; }
	.top-stories, .section-block__grid { grid-template-columns: minmax(0, 1fr); }
	.grid--2, .grid--3 { grid-template-columns: minmax(0, 1fr); }
	.footer__grid { grid-template-columns: minmax(0, 1fr); }
	.entry-content { font-size: 18px; }
	.story--row { grid-template-columns: 96px minmax(0, 1fr); }
}

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

@media print {
	.site-header, .site-footer, .sidebar, .share, .related, .comments { display: none; }
	body { background: #fff; }
	.home__columns { display: block; }
}
