/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
    --green-primary: #2B7736;
    --green-accent: #3C935E;
    --green-primary-hover: #1F5A28;
    /* Exact shades measured from the original site's header/section bars —
       distinct from the button/accent greens above, kept as their own
       tokens rather than approximated from the palette already in use. */
    --green-header-logo: #0E523B;
    --green-header-nav: #146950;
    --green-section-bar: #227540;
    --green-footer: #254B2B;
    --text-heading: #54595F;
    --text-body: #4A4A4A;
    --text-muted: #7A7A7A;
    --text-contact: #404040;
    --surface: #FFFFFF;
    --surface-alt: #F5F8F6;
    --border: #E6EAE7;
    --radius-card: 15px;
    --radius-button: 20px;
    --shadow-card: 0 0 10px rgba(0, 0, 0, 0.1);
    --shadow-card-hover: 0 10px 24px rgba(43, 119, 54, 0.16);
    --font-heading: "Noto Kufi Arabic", sans-serif;
    --font-body: "Noto Naskh Arabic", serif;
    --wrap-width: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--surface-alt);
    color: var(--text-body);
    font-family: var(--font-body);
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

.wrap { max-width: var(--wrap-width); margin: 0 auto; padding: 0 24px; }

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--text-heading);
    line-height: 1.4;
    margin: 0 0 0.6em;
}

.skip-link {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap;
    background: var(--green-primary); color: #fff; padding: 10px 16px;
    z-index: 200; border-radius: 0 0 8px 8px; top: 0; right: 0;
}
.skip-link:focus {
    width: auto; height: auto; overflow: visible; clip: auto;
}

/* ==========================================================================
   Header
   ========================================================================== */
/* Only the navigation row stays pinned while scrolling; the brand row scrolls away,
   so the sticky part of the header is one row tall, not two. */
.site-header { position: relative; z-index: 100; }
@media (min-width: 900px) {
    /* The header box would limit the sticky row to its own height, so it stops being a box on wide screens. */
    .site-header { display: contents; }
    .site-header__nav-row { position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
}
.site-header__brand-row { background: var(--green-header-logo); }
.site-header__brand-inner { display: flex; justify-content: center; padding: 12px 24px; }
.site-header__nav-row { background: var(--green-header-nav); }
.site-header__nav-inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 24px; padding: 10px 24px; flex-wrap: wrap;
}
.site-header__logo-text {
    font-family: var(--font-heading); font-weight: 900; font-size: 18px;
    color: #fff; text-decoration: none;
}
.site-header__logo-img { height: 44px; width: auto; display: block; }
.site-nav { display: flex; gap: 8px; }
.site-nav a {
    text-decoration: none; font-family: var(--font-heading); font-weight: 700;
    color: #fff; padding: 8px 18px; border-radius: var(--radius-button);
    transition: background-color .2s, color .2s;
}
.site-nav a:hover, .site-nav a:focus-visible { background: rgba(255,255,255,.15); }

.site-search { display: flex; align-items: center; background: rgba(255,255,255,.15); border-radius: 999px; padding: 4px 4px 4px 14px; }
.site-search input {
    border: none; background: transparent; padding: 8px; width: 160px;
    font-family: var(--font-body); font-size: 14px; outline: none; color: #fff;
}
.site-search input::placeholder { color: rgba(255,255,255,.75); }
.site-search button {
    background: #fff; color: var(--green-header-nav); border: none; border-radius: 999px;
    width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
    transition: background-color .2s, color .2s;
}
.site-search button:hover { background: var(--surface-alt); }

/* ==========================================================================
   Hero
   ========================================================================== */
/* Measured against the actual source photo: he (turban + robe) occupies
   roughly the 40%-68% horizontal band, with his outstretched arm/book
   reaching to about 30%. That leaves clear, uncluttered bookshelf on both
   the left (0-30%) and right (68-100%). We use the RIGHT zone for text —
   it's naturally where a flex row's lone child sits under dir="rtl", and
   it's also the natural reading-start side for Arabic. A scrim fades out
   before 68%, so text never crosses him. Height is capped independently of
   width (not via aspect-ratio) so cropping only ever trims the desk/book
   area at the bottom (background-position: top), never his head, and never
   turns into a horizontal crop on ultrawide screens. On mobile there's no
   room for a safe side zone, so the layout stacks instead: the photo runs
   full-width and untouched up top (still edge-to-edge, not boxed), text
   below it. */
.hero { position: relative; color: #fff; overflow: hidden; }
.hero__media {
    position: absolute; inset: 0;
    background-size: cover; background-position: 50% top; background-repeat: no-repeat;
    background-color: var(--green-accent);
}
.hero__scrim {
    position: absolute; inset: 0;
    background: linear-gradient(270deg, rgba(10,58,42,.9) 0%, rgba(10,58,42,.9) 22%, rgba(10,58,42,.5) 28%, rgba(10,58,42,0) 33%);
}
/* LTR sites (en/fr) have their text on the left, so the dark side of the
   scrim is on the left. RTL (ar/fa) keeps the right-to-left gradient above. */
html[dir="ltr"] .hero__scrim {
    background: linear-gradient(90deg, rgba(10,58,42,.9) 0%, rgba(10,58,42,.9) 22%, rgba(10,58,42,.5) 28%, rgba(10,58,42,0) 33%);
}
.hero__mobile-image { display: none; }
.hero__inner {
    position: relative; z-index: 1;
    display: flex; align-items: center;
    /* min-height, not height: longer intros (fr/fa) grow the box instead of
       running up under the sticky header. */
    min-height: clamp(420px, 34vw, 560px);
    padding: 56px 5%;
}
.hero__content { max-width: min(360px, 25vw); padding: 0; }
.hero__eyebrow { font-family: var(--font-heading); font-weight: 700; opacity: .85; letter-spacing: .5px; margin-bottom: 12px; }
.hero__title { color: #fff; font-size: clamp(22px, 2.6vw, 32px); margin-bottom: 18px; }
.hero__text { font-size: 15px; line-height: 1.85; opacity: .95; margin-bottom: 26px; }
.hero__actions { display: flex; gap: 14px; flex-wrap: wrap; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--font-heading); font-weight: 700; font-size: 15px;
    padding: 13px 30px; border-radius: var(--radius-button);
    text-decoration: none; border: none; cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.btn-primary { background: var(--green-primary); color: #fff; }
.btn-primary:hover, .btn-primary:focus-visible { background: var(--green-primary-hover); transform: translateY(-2px); box-shadow: 0 10px 20px rgba(43,119,54,.3); }
.btn-outline { background: transparent; color: #fff; border: 2px solid rgba(255,255,255,.7); }
.btn-outline:hover { background: rgba(255,255,255,.15); }

/* ==========================================================================
   Section heading
   ========================================================================== */
.section { padding: 64px 0; }
.section-heading-bar + .section { padding-top: 40px; }
.section-heading-bar {
    background: var(--green-section-bar); padding: 18px 0; text-align: center;
}
.section-heading-bar h1, .section-heading-bar h2 {
    color: #fff; font-size: clamp(20px, 3vw, 28px); margin: 0;
}
.section-heading__sub { text-align: center; color: var(--text-muted); max-width: 640px; margin: 0 auto 40px; }

/* Plain centered heading, used where the full colored bar (above) isn't
   appropriate — category pages, the articles index, "related articles". */
.section-heading { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.section-heading h1, .section-heading h2 { font-size: clamp(22px, 3vw, 30px); }
.section-heading p { color: var(--text-muted); }

/* Category filter pills (articles index) — deliberately separate from
   .site-nav, which is styled white-on-dark-green for the page header and
   is unreadable on this section's light background. */
.category-filter { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 32px; }
.category-filter a {
    text-decoration: none; font-family: var(--font-heading); font-weight: 700; font-size: 14px;
    color: var(--green-primary); background: rgba(43,119,54,.08); padding: 7px 16px; border-radius: var(--radius-button);
    transition: background-color .2s, color .2s;
}
.category-filter a:hover, .category-filter a:focus-visible { background: var(--green-primary); color: #fff; }

/* ==========================================================================
   Article cards / grid
   ========================================================================== */
.article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.article-card {
    background: var(--surface); border-radius: var(--radius-card); overflow: hidden;
    box-shadow: var(--shadow-card); display: flex; flex-direction: column;
    transition: transform .25s ease, box-shadow .25s ease;
}
.article-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-card-hover); }
.article-card__image { aspect-ratio: 16/10; overflow: hidden; background: var(--surface-alt); }
.article-card__image img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.article-card:hover .article-card__image img { transform: scale(1.06); }
.article-card__body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.article-card__badge {
    align-self: flex-start; font-family: var(--font-heading); font-size: 12px; font-weight: 700;
    background: rgba(60,147,94,.12); color: var(--green-accent); padding: 4px 12px; border-radius: 999px;
}
.article-card__title { font-size: 18px; margin: 0; }
.article-card__title a { text-decoration: none; }
.article-card__title a:hover { color: var(--green-primary); }
.article-card__excerpt { color: var(--text-muted); font-size: 14px; line-height: 1.7; flex: 1; }
.article-card__more { font-family: var(--font-heading); font-weight: 700; font-size: 13px; color: var(--green-primary); text-decoration: none; }
.article-card__meta { font-size: 12px; color: var(--text-muted); }

.section-footer { text-align: center; margin-top: 40px; }

/* ==========================================================================
   Publications teaser
   ========================================================================== */
.publications { background: var(--surface); }
.publications__panel {
    display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 40px; align-items: center;
    background: var(--surface-alt); border-radius: var(--radius-card); overflow: hidden; padding: 40px;
}
.publications__image img { border-radius: 12px; }
.publications__badge {
    display: inline-block; font-family: var(--font-heading); font-weight: 700; font-size: 12px;
    background: var(--green-primary); color: #fff; padding: 5px 14px; border-radius: 999px; margin-bottom: 14px;
}
.publications__text { color: var(--text-muted); }

/* ==========================================================================
   Contact
   ========================================================================== */
.contact-panel { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 48px; align-items: start; }
.contact-info { text-align: center; }
.contact-info__logo { max-width: 320px; margin: 0 auto 20px; }
.contact-info__name { font-family: var(--font-heading); font-weight: 700; color: var(--text-heading); font-size: 17px; margin: 0 0 14px; }
.contact-info__label { color: var(--text-contact); margin: 0 0 2px; font-size: 14px; }
.contact-info__phone { margin: 0 0 14px; }
.contact-info__phone a { font-family: var(--font-heading); font-weight: 700; color: var(--text-heading); text-decoration: none; }
.contact-info__email { display: inline-block; margin: 0 0 18px; font-family: var(--font-heading); font-weight: 700; color: var(--green-primary); text-decoration: none; }
.contact-info__social {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(43,119,54,.1); color: var(--green-primary);
    transition: background-color .2s, color .2s;
}
.contact-info__social:hover { background: var(--green-primary); color: #fff; }

.form { background: var(--surface); border-radius: var(--radius-card); padding: 32px; box-shadow: var(--shadow-card); display: grid; gap: 16px; }
.form label { font-family: var(--font-heading); font-weight: 700; font-size: 14px; color: var(--text-heading); display: block; margin-bottom: 6px; }
.form input, .form textarea {
    width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
    font-family: var(--font-body); font-size: 15px; background: var(--surface-alt); transition: border-color .2s, box-shadow .2s;
}
.form input:focus, .form textarea:focus { outline: none; border-color: var(--green-accent); box-shadow: 0 0 0 3px rgba(60,147,94,.15); }
.form textarea { min-height: 140px; resize: vertical; }
.form .btn { justify-self: start; }
.form-success { background: rgba(60,147,94,.1); color: var(--green-primary); padding: 16px; border-radius: 10px; font-family: var(--font-heading); font-weight: 700; }
.form-error { background: rgba(200,60,60,.08); color: #A23434; padding: 16px; border-radius: 10px; font-family: var(--font-heading); font-weight: 700; }

/* ==========================================================================
   Article single page
   ========================================================================== */
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.breadcrumb a { color: var(--green-primary); text-decoration: none; }
.article-header { max-width: 780px; margin: 0 auto 32px; text-align: center; }
.article-header h1 { font-size: clamp(24px, 3.6vw, 36px); }
.article-header__meta { display: flex; gap: 16px; justify-content: center; color: var(--text-muted); font-size: 14px; margin-top: 12px; }
.article-featured-image { max-width: 900px; margin: 0 auto 40px; border-radius: var(--radius-card); overflow: hidden; box-shadow: var(--shadow-card); }
.article-body { max-width: 720px; margin: 0 auto; font-size: 17px; line-height: 2; }
.article-body p { margin: 0 0 1.4em; }
.article-body img { border-radius: 12px; margin: 1.4em 0; }
.article-body h2, .article-body h3 { margin-top: 1.6em; }
.related { background: var(--surface); }

/* ==========================================================================
   Static page (e.g. the founder's essay)
   ========================================================================== */
.static-page { max-width: 780px; margin: 0 auto; }
.static-page__title { text-align: center; margin-bottom: 32px; }
.static-page__body { font-size: 17px; line-height: 2; }
.static-page__body p { margin: 0 0 1.4em; }

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 40px; }
.pagination a, .pagination span {
    display: grid; place-items: center; min-width: 40px; height: 40px; border-radius: 10px;
    text-decoration: none; font-family: var(--font-heading); font-weight: 700; color: var(--text-heading);
    background: var(--surface); box-shadow: var(--shadow-card);
}
.pagination a:hover { color: var(--green-primary); }
.pagination .is-current { background: var(--green-primary); color: #fff; }

/* ==========================================================================
   404
   ========================================================================== */
.not-found { text-align: center; padding: 100px 0; }
.not-found h1 { font-size: 72px; color: var(--green-primary); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { background: var(--green-footer); color: rgba(255,255,255,.8); padding: 48px 0; margin-top: 40px; }
.site-footer__inner { text-align: center; }
.site-footer__name { color: #fff; font-size: 18px; }
.site-footer__social { display: flex; justify-content: center; gap: 16px; margin: 16px 0; }
.site-footer__social a { color: #fff; text-decoration: none; font-family: var(--font-heading); font-size: 14px; opacity: .85; }
.site-footer__social a:hover { opacity: 1; }
.site-footer__tagline { font-size: 13px; opacity: .6; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
    /* No safe empty zone beside him at this width — stop overlaying text on
       the photo entirely and stack instead: full-width image, then text. */
    .hero { display: flex; flex-direction: column; }
    .hero__media, .hero__scrim { display: none; }
    .hero__mobile-image {
        display: block; width: 100%; aspect-ratio: 4 / 3;
        object-fit: cover; object-position: 50% 12%;
        order: 1;
    }
    .hero__inner {
        order: 2; height: auto; min-height: 0;
        background: linear-gradient(160deg, var(--green-accent), var(--green-primary));
        padding: 40px 24px;
    }
    .hero__content { max-width: none; text-align: center; padding: 0; }
    .hero__actions { justify-content: center; }
}
@media (max-width: 960px) {
    .article-grid { grid-template-columns: repeat(2, 1fr); }
    .publications__panel { grid-template-columns: 1fr; }
    .contact-panel { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .site-header__nav-inner { flex-direction: column; align-items: stretch; padding: 10px 16px; gap: 10px; }
    .site-search { width: 100%; box-sizing: border-box; }
    .site-search input { width: auto; flex: 1; min-width: 0; }
    .site-nav { flex-wrap: wrap; justify-content: center; }
    .article-grid { grid-template-columns: 1fr; }
    .section { padding: 44px 0; }
    .section-heading-bar + .section { padding-top: 28px; }
}

/* English site: Latin typography in place of the Arabic faces. Only the
   font tokens change; all layout rules stay shared with the Arabic site. */
html[lang="en"], html[lang="fr"] {
    --font-body: 'Noto Serif', Georgia, 'Times New Roman', serif;
    --font-heading: 'Noto Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
html[lang="fa"] {
    --font-body: 'Vazirmatn', Tahoma, sans-serif;
    --font-heading: 'Vazirmatn', Tahoma, sans-serif;
}

/* Captioned images (migrated WordPress [caption] blocks), all sites. */
figure.wp-caption { margin: 24px auto; max-width: 100%; text-align: center; }
figure.wp-caption img { max-width: 100%; height: auto; border-radius: 10px; }
figure.wp-caption figcaption { font-size: 13px; color: var(--text-muted); margin-top: 8px; line-height: 1.7; }

/* Farsi article page: white card on a grey page, as on the live site. */
body.theme-article-card { background: #f0f1f0; }
body.theme-article-card .article-body {
    background: #fff; border-radius: 14px; padding: 36px 44px;
    box-shadow: 0 2px 14px rgba(0,0,0,.06); max-width: 860px; margin: 0 auto;
}
body.theme-article-card .article-header h1 { font-weight: 900; }
body.theme-article-card .article-featured-image img { border-radius: 14px; }

html[lang="fa"] .site-header__logo-img { height: 60px; }

/* Feature block (a static page teaser on the homepage). */
.feature__panel { display: grid; grid-template-columns: 1fr; gap: 28px; align-items: center; }
@media (min-width: 900px) { .feature__panel { grid-template-columns: 1fr 1.2fr; } }
.feature__image img { width: 100%; height: auto; border-radius: 14px; display: block; }
.feature__body p { line-height: 1.9; margin-bottom: 22px; }

/* Dropdown groups in the header nav (native <details>, no script). */
.site-nav__group { position: relative; }
.site-nav__group > summary {
    list-style: none; cursor: pointer; font-family: var(--font-heading); font-weight: 700;
    color: #fff; padding: 8px 18px; border-radius: var(--radius-button);
}
.site-nav__group > summary::-webkit-details-marker { display: none; }
.site-nav__group > summary::after { content: " ▾"; font-size: 12px; opacity: .8; }
.site-nav__group[open] > summary, .site-nav__group > summary:hover { background: rgba(255,255,255,.15); }
.site-nav__menu {
    position: absolute; top: calc(100% + 6px); inset-inline-start: 0; z-index: 200;
    min-width: 220px; background: #fff; border-radius: 12px; padding: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,.18); display: grid; gap: 2px;
}
.site-nav__menu a {
    color: var(--text-body, #333); text-decoration: none; font-family: var(--font-heading);
    font-weight: 600; padding: 10px 14px; border-radius: 8px; white-space: nowrap;
}
.site-nav__menu a:hover, .site-nav__menu a:focus-visible { background: var(--surface-alt, #eef4ef); }

/* Centred header: logo centred above, nav centred below, search hidden on this layout unless set. */
.theme-nav-centred .site-header__nav-inner { justify-content: center; }
.theme-nav-centred .site-nav { justify-content: center; flex-wrap: wrap; }
.theme-nav-centred .site-header__brand-inner { justify-content: center; }

/* Featured image on a static page (the WordPress page thumbnail). */
.static-page__image { margin: 0 0 28px; }
.static-page__image img { width: 100%; height: auto; border-radius: 14px; display: block; }

/* WordPress emoji images inside migrated text: sized to the text, as WordPress renders them. */
img[src*="/images/core/emoji/"] { width: 1em; height: 1em; display: inline; vertical-align: -0.1em; margin: 0 .05em; border-radius: 0; box-shadow: none; }

/* Child page with its own cover (e.g. a book): the cover floats to the side of the text, as on the live site. */
.static-page--child-image .static-page__image { float: inline-end; width: min(42%, 380px); margin: 0 0 18px 26px; }
.static-page--child-image .static-page__image img { border-radius: 10px; }
.static-page--child-image::after { content: ""; display: block; clear: both; }
.book-lead { font-size: 1.05em; line-height: 1.9; font-weight: 600; }

/* Contact page given as a static page: details centred, form below. */
.contact-page { max-width: 760px; }
.contact-page__details { text-align: center; margin-bottom: 36px; line-height: 2; }
.contact-page__details img { max-width: 100%; height: auto; border-radius: 12px; }
.contact-page__form { background: #fff; border-radius: 14px; padding: 32px; box-shadow: 0 2px 14px rgba(0,0,0,.06); }

/* Homepage contact as one white panel: form on one side, details (centred) on the other. */
body.theme-contact-panel #contact .contact-panel { background: #fff; border-radius: 0 0 14px 14px; padding: 32px; box-shadow: 0 2px 14px rgba(0,0,0,.06); gap: 32px; }
body.theme-contact-panel #contact .contact-panel > div:last-child { background: transparent; box-shadow: none; padding: 0; border-radius: 0; }
body.theme-contact-panel #contact .contact-info { text-align: center; }
body.theme-contact-panel #contact .contact-info__email { color: #333; font-weight: 500; }
body.theme-contact-panel #contact .contact-info__social { background: #111; color: #fff; width: 44px; height: 44px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }
body.theme-contact-panel #contact .contact-info__social svg { width: 20px; height: 20px; }

/* Publication cards: the whole cover, portrait, not cropped to a landscape box. */
.page-children .article-card__image { aspect-ratio: 3 / 4; background: #fff; }
.page-children .article-card__image img { object-fit: contain; padding: 12px; }

/* Homepage feature section text: the WordPress section's sub-heading and paragraphs. */
.feature__text h3 { font-size: 1.15em; margin: 18px 0 8px; }
.feature__text p { line-height: 1.9; margin-bottom: 12px; }

/* Farsi homepage contact: the Instagram button is on its own line, below the email. */
body.theme-contact-panel #contact .contact-info__social { display: flex; margin: 14px auto 0; }
