/*==================================================================
  AL-FAJR FOUNDATION — HEADER, NAV, FOOTER, PAGE HEADER

  Modelled on pchf.org.pk: a utility bar carrying phone and social
  links, then a solid header with the logo, a horizontal menu with
  dropdown submenus, and a standing Donate action.
==================================================================*/

/*==============================
  UTILITY BAR
==============================*/

.topbar {
    background: var(--navy-950);
    color: var(--on-invert-muted);
    font-size: var(--step--1);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-5);
    min-height: var(--topbar-h);
    flex-wrap: wrap;
}

.topbar-group { display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap; }

.topbar-item {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding-block: .3rem;
    color: inherit;
    text-decoration: none;
}

.topbar-item:hover { color: var(--white); }
.topbar-item i { color: var(--gold); font-size: .85em; }

.topbar-social { display: flex; gap: var(--sp-1); }

.topbar-social a {
    display: grid;
    place-items: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 50%;
    color: var(--on-invert-muted);
    text-decoration: none;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.topbar-social a:hover { background: var(--gold); color: var(--navy); }

.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: .28rem .8rem;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: var(--pill);
    color: var(--white);
    font-family: var(--font-head);
    font-size: var(--step--1);
    font-weight: 600;
    text-decoration: none;
    line-height: 1.4;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.lang-switch:hover { background: var(--gold); border-color: var(--gold); color: var(--navy); }

@media (max-width: 900px) {
    .topbar-inner { justify-content: center; }
    .topbar-group:first-child { display: none; }
}

/*==============================
  HEADER
==============================*/

.site-header {
    position: sticky;
    top: 0;
    z-index: 500;
    background: var(--white);
    box-shadow: 0 1px 0 var(--rule);
    transition: box-shadow var(--dur) var(--ease);
}

.site-header.is-stuck { box-shadow: var(--shadow); }

.header-inner {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    min-height: var(--header-h);
}

/* ---- Brand ---- */

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-3);
    flex: 0 0 auto;
    text-decoration: none;
    color: var(--navy);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    flex: 0 0 auto;
}

.brand-mark img { width: 100%; height: 100%; object-fit: contain; }

.brand-text { display: flex; flex-direction: column; min-width: 0; }

.brand-name {
    font-family: var(--font-head);
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -.01em;
    color: var(--navy);
}

.brand-tagline {
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--gold-dark);
    line-height: 1.4;
    margin-top: .1rem;
}

/* ---- Primary navigation ---- */

.site-nav { margin-inline-start: auto; }

.nav-list {
    display: flex;
    align-items: center;
    gap: clamp(.2rem, 1vw, .9rem);
    list-style: none;
}

.nav-item { position: relative; }

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem .7rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-head);
    font-size: .92rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.nav-link:hover, .nav-link:focus-visible { color: var(--gold-dark); }

.nav-item.is-active > .nav-link { color: var(--navy); font-weight: 700; }

/* gold-dark, not gold: a 3px bar of plain gold measured 2.42:1 on white
   and was genuinely hard to see. The active item also changes colour and
   weight, so this bar reinforces rather than carries the state. */
.nav-item.is-active > .nav-link::after {
    content: "";
    position: absolute;
    inset-inline: .7rem;
    bottom: -2px;
    height: 3px;
    border-radius: var(--pill);
    background: var(--gold-dark);
}

.nav-caret { font-size: .6em; opacity: .7; transition: transform var(--dur) var(--ease); }

/* ---- Dropdown ---- */

.nav-submenu {
    position: absolute;
    top: 100%;
    inset-inline-start: 0;
    z-index: 10;
    min-width: 15rem;
    padding: var(--sp-2);
    margin: 0;
    list-style: none;
    background: var(--white);
    border: 1px solid var(--rule);
    border-top: 3px solid var(--gold);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-lg);

    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity var(--dur) var(--ease),
                transform var(--dur) var(--ease),
                visibility var(--dur) var(--ease);
}

.nav-item:hover > .nav-submenu,
.nav-item:focus-within > .nav-submenu,
.nav-item.is-open > .nav-submenu {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.nav-item:hover > .nav-link .nav-caret,
.nav-item.is-open > .nav-link .nav-caret { transform: rotate(180deg); }

.nav-submenu a {
    display: block;
    padding: .6rem .85rem;
    border-radius: var(--radius-sm);
    color: var(--text-mid);
    font-size: .9rem;
    text-decoration: none;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.nav-submenu a:hover, .nav-submenu a:focus-visible {
    background: var(--cream-200);
    color: var(--navy);
}

.nav-submenu .is-current > a { color: var(--gold-dark); font-weight: 600; }

/* Keep the last dropdowns inside the viewport. */
.nav-item:nth-last-child(-n+2) > .nav-submenu {
    inset-inline-start: auto;
    inset-inline-end: 0;
}

.header-actions { display: flex; align-items: center; gap: var(--sp-3); flex: 0 0 auto; }

/* ---- Mobile toggle ---- */

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 2.85rem;
    height: 2.85rem;
    padding: 0;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 1.15rem;
    height: 2px;
    margin-inline: auto;
    border-radius: 2px;
    background: var(--navy);
    transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

.menu-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- Mobile drawer ---- */

@media (max-width: 1140px) {
    .menu-toggle { display: flex; }

    .site-nav {
        position: fixed;
        inset: 0 0 0 auto;
        width: min(23rem, 88vw);
        z-index: 600;
        margin: 0;
        padding: var(--sp-6) var(--sp-5) var(--sp-8);
        background: var(--white);
        box-shadow: var(--shadow-lg);
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform var(--dur) var(--ease);
    }

    .site-nav.is-open { transform: none; }

    .nav-list { flex-direction: column; align-items: stretch; gap: 0; }

    .nav-item { border-bottom: 1px solid var(--rule); }

    .nav-link {
        justify-content: space-between;
        padding: var(--sp-4) var(--sp-2);
        border-radius: 0;
        font-size: 1rem;
    }

    .nav-item.is-active > .nav-link::after { display: none; }

    /* Submenus become accordions. */
    .nav-submenu {
        position: static;
        min-width: 0;
        padding: 0 0 var(--sp-3);
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: transparent;

        display: none;
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .nav-item.is-open > .nav-submenu { display: block; }
    .nav-item:hover > .nav-submenu { display: none; }
    .nav-item.is-open:hover > .nav-submenu { display: block; }

    .nav-submenu a {
        padding: .6rem var(--sp-5);
        border-inline-start: 2px solid var(--rule);
        border-radius: 0;
    }

    .nav-submenu a:hover { border-inline-start-color: var(--gold); }

    body.nav-open { overflow: hidden; }

    body.nav-open::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 550;
        background: rgba(4, 18, 37, .58);
    }

    .header-actions .btn { display: none; }
}

@media (max-width: 560px) {
    .brand-tagline { display: none; }
    .brand-name { font-size: .98rem; }
    .brand-mark { width: 2.6rem; height: 2.6rem; }
}

/*==================================================================
  PAGE HEADER
  Every detail page opens with a navy banner carrying the title and
  a breadcrumb.
==================================================================*/

.page-header {
    position: relative;
    padding-block: clamp(2.75rem, 6vw, 4.5rem);
    background: var(--navy);
    color: var(--on-invert);
    overflow: hidden;
}

.page-header::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .05;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cpath d='M30 0 L60 30 L30 60 L0 30 Z' fill='none' stroke='%23C9A227' stroke-width='1.5'/%3E%3C/svg%3E");
    background-size: 60px 60px;
}

.page-header > .container { position: relative; z-index: 1; }

.page-header h1 { color: var(--white); max-width: 30ch; }

.page-header .lede {
    margin-top: var(--sp-4);
    color: var(--on-invert-muted);
    max-width: 62ch;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-4);
    font-size: var(--step--1);
    color: var(--on-invert-muted);
}

.breadcrumb a { color: var(--gold-light); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { opacity: .45; font-size: .7em; }
.breadcrumb [aria-current] { color: var(--on-invert); }

.page-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3) var(--sp-6);
    margin-top: var(--sp-5);
    font-size: var(--step--1);
    color: var(--on-invert-muted);
}

.page-meta-item { display: inline-flex; align-items: center; gap: var(--sp-2); }
.page-meta-item i { color: var(--gold); font-size: .9em; }

/*==============================
  LONG-FORM BODY COPY
==============================*/

.prose { max-width: var(--measure); line-height: 1.8; }

.prose > * + * { margin-top: var(--sp-5); }

.prose h2 { margin-top: var(--sp-8); font-size: var(--step-2); }
.prose h3 { margin-top: var(--sp-7); font-size: var(--step-1); }

.prose ul, .prose ol { padding-inline-start: 1.4em; }
.prose li + li { margin-top: var(--sp-2); }

.prose blockquote {
    padding: var(--sp-4) var(--sp-5);
    border-inline-start: 4px solid var(--gold);
    background: var(--cream-200);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-mid);
}

.prose strong { color: var(--navy); font-weight: 600; }

.figure { margin-block: var(--sp-6); }

.figure img {
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.figure figcaption { margin-top: var(--sp-3); font-size: var(--step--1); color: var(--muted); }

/* Sidebar block on detail pages */
.aside-box {
    padding: var(--sp-5);
    background: var(--white);
    border: 1px solid var(--rule);
    border-top: 3px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.aside-box + .aside-box { margin-top: var(--sp-5); }

.aside-title {
    font-family: var(--font-head);
    font-size: var(--step--1);
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--navy);
    margin-bottom: var(--sp-4);
}

/*==============================
  CLOSING CTA BAND
==============================*/

.cta-band {
    padding-block: clamp(2.75rem, 6vw, 4.25rem);
    background: var(--navy);
    color: var(--on-invert);
}

.cta-band-inner {
    display: grid;
    gap: var(--sp-5) var(--sp-8);
    align-items: center;
    grid-template-columns: 1fr;
}

@media (min-width: 900px) {
    .cta-band-inner { grid-template-columns: minmax(0, 1.7fr) auto; }
}

.cta-band h2 { color: var(--white); font-size: var(--step-3); max-width: 32ch; }
.cta-band p  { margin-top: var(--sp-3); color: var(--on-invert-muted); max-width: 56ch; }

/*==============================
  404
==============================*/

.page-404 { text-align: center; padding-block: var(--sp-9); }

.page-404-code {
    font-family: var(--font-head);
    font-size: clamp(4.5rem, 15vw, 9.5rem);
    font-weight: 700;
    line-height: .9;
    letter-spacing: -.05em;
    color: var(--gold);
    opacity: .35;
}

.page-404 h1 { margin-top: var(--sp-3); }
.page-404 .lede { margin: var(--sp-4) auto 0; }
.page-404 .btn-group { justify-content: center; margin-top: var(--sp-6); }

/*==================================================================
  FOOTER
==================================================================*/

.site-footer { background: var(--navy-950); color: var(--on-invert-muted); }

/* ---- Newsletter strip ---- */

.footer-newsletter {
    background: var(--navy-900);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.footer-newsletter-inner {
    display: grid;
    gap: var(--sp-5) var(--sp-8);
    align-items: center;
    padding-block: var(--sp-6);
    grid-template-columns: 1fr;
}

@media (min-width: 900px) {
    .footer-newsletter-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.footer-newsletter h2 { font-size: var(--step-2); color: var(--white); }
.footer-newsletter p { margin-top: var(--sp-2); font-size: .95rem; }

.newsletter-form { display: flex; flex-wrap: wrap; gap: var(--sp-3); }

.newsletter-form .input {
    flex: 1 1 14rem;
    background: rgba(255, 255, 255, .07);
    border-color: rgba(255, 255, 255, .2);
    color: var(--white);
}

.newsletter-form .input::placeholder { color: rgba(234, 240, 248, .5); }

.newsletter-form .input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, .22);
}

/* ---- Body ---- */

.footer-body {
    display: grid;
    gap: var(--sp-7) var(--sp-8);
    padding-block: var(--sp-8);
    grid-template-columns: 1fr;
}

@media (min-width: 700px)  { .footer-body { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .footer-body { grid-template-columns: 1.6fr 1fr 1fr 1.2fr; } }

.footer-brand .brand { color: var(--white); }
.footer-brand .brand-name { color: var(--white); }

.footer-about { margin-top: var(--sp-4); font-size: .93rem; line-height: 1.75; max-width: 40ch; }

.footer-col-title {
    font-family: var(--font-head);
    font-size: var(--step--1);
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--white);
    margin-bottom: var(--sp-4);
    padding-bottom: var(--sp-3);
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.footer-links { list-style: none; }
.footer-links li + li { margin-top: var(--sp-2); }

.footer-links a {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    color: var(--on-invert-muted);
    font-size: .93rem;
    text-decoration: none;
    transition: color var(--dur) var(--ease), gap var(--dur) var(--ease);
}

.footer-links a::before { content: "›"; color: var(--gold); font-size: 1em; }

.footer-links a:hover { color: var(--white); gap: var(--sp-3); }

.footer-contact { list-style: none; }
.footer-contact li { display: flex; gap: var(--sp-3); font-size: .93rem; line-height: 1.7; }
.footer-contact li + li { margin-top: var(--sp-3); }
.footer-contact i { flex: 0 0 auto; margin-top: .35em; color: var(--gold); font-size: .85em; }
.footer-contact a { color: var(--on-invert-muted); text-decoration: none; }
.footer-contact a:hover { color: var(--white); text-decoration: underline; }

.footer-social { display: flex; gap: var(--sp-2); margin-top: var(--sp-5); }

.footer-social a {
    display: grid;
    place-items: center;
    width: 2.3rem; height: 2.3rem;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 50%;
    color: var(--on-invert-muted);
    text-decoration: none;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.footer-social a:hover { background: var(--gold); border-color: var(--gold); color: var(--navy); }

/* ---- Trust / registration block ---- */

.footer-trust { font-size: .88rem; line-height: 1.7; }

.trust-badges { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }

.trust-badge {
    display: inline-flex;
    align-items: center;
    gap: .4em;
    padding: .35em .8em;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: var(--radius-sm);
    font-size: .76rem;
    font-weight: 600;
    color: var(--on-invert);
}

.trust-badge i { color: var(--gold); }

.footer-reg {
    margin-top: var(--sp-4);
    padding-top: var(--sp-4);
    border-top: 1px solid rgba(255, 255, 255, .12);
    font-size: .85rem;
}

.footer-reg strong { color: var(--white); }

/* ---- Bottom bar ---- */

.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .1); }

.footer-bottom-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3) var(--sp-5);
    padding-block: var(--sp-5);
    font-size: var(--step--1);
}

.footer-legal { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); }
.footer-legal a { color: var(--on-invert-muted); text-decoration: none; }
.footer-legal a:hover { color: var(--white); text-decoration: underline; }
.footer-legal .sep { opacity: .35; }

/*==============================
  BACK TO TOP
==============================*/

.scroll-top {
    position: fixed;
    inset-block-end: var(--sp-5);
    inset-inline-end: var(--sp-5);
    z-index: 400;
    display: grid;
    place-items: center;
    width: 2.9rem; height: 2.9rem;
    border: 0;
    border-radius: 50%;
    background: var(--gold);
    color: var(--navy);
    cursor: pointer;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity var(--dur) var(--ease),
                transform var(--dur) var(--ease),
                visibility var(--dur) var(--ease);
}

.scroll-top.show { opacity: 1; visibility: visible; transform: none; }
.scroll-top:hover { background: var(--gold-light); }
