/* ==========================================================================
   Al Noor Institute — style.css
   Reset · Design tokens · Typography · Layout primitives
   ========================================================================== */

/* ---------- Local fonts ---------------------------------------------------
   Cairo (SIL OFL 1.1) is self-hosted from assets/fonts/ as a VARIABLE font:
   one file per unicode subset covers the whole 400–800 weight range, so the
   Arabic reader downloads ~30KB instead of five static weights.
   The unicode-range split means Latin subsets are only fetched if the page
   actually contains Latin text. See assets/fonts/README.txt.
--------------------------------------------------------------------------- */
@font-face {
    font-family: "Cairo";
    src: url("../fonts/Cairo-arabic.woff2") format("woff2");
    font-weight: 400 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
    font-family: "Cairo";
    src: url("../fonts/Cairo-latin-ext.woff2") format("woff2");
    font-weight: 400 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Cairo";
    src: url("../fonts/Cairo-latin.woff2") format("woff2");
    font-weight: 400 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens -------------------------------------------------------- */
:root {
    /* Azhari Identity Colors — emerald & gold led */
    --primary: #0B4D30;            /* Deep Azhari Forest Emerald */
    --primary-700: #072F1D;        /* Dark Malachite for hover/dark surfaces */
    --primary-800: #041A11;        /* Deepest Green-Black for headers/footers */
    --primary-100: #E3F2EA;        /* Soft Emerald tint background */
    --primary-50: #F1F9F4;

    --secondary: #0D5C3A;          /* Bright Islamic Emerald Green (icons/accents) */
    --secondary-700: #083E26;      /* Deep Islamic Forest Green */
    --secondary-100: #E6F5EF;      /* Soft Emerald tint */
    --secondary-50: #F2FAF6;

    --accent: #C59A27;             /* Royal Azhari Warm Gold */
    --accent-dark: #A47D18;        /* Deep Burnished Gold */
    --accent-light: #F0D78C;       /* Light Luminous Gold */
    --accent-100: #FDF7E7;        /* Gentle Warm Gold Cream */
    --accent-50: #FFFDF8;

    --islamic-green: #0D5C3A;
    --islamic-green-light: #E6F5EF;
    --islamic-gold: #C59A27;

    --background: #F8FAF9;         /* Soft pure off-white with subtle warm tone */
    --background-alt: #F1F5F3;     /* Alternate soft section tone */
    --white: #FFFFFF;
    --text: #1A2B22;              /* Rich dark green-black text for crisp readability */
    --muted: #52685C;             /* Harmonious green-grey for body copy */
    --border: #D8E6DC;            /* Refined subtle green-tinted border */
    --border-light: #EDF5EF;

    --success: #0D5C3A;
    --success-bg: #E6F5EF;
    --danger: #C53030;
    --danger-bg: #FEEBEB;
    --warning: #D97706;
    --warning-bg: #FEF3C7;

    --font: "Cairo", "Segoe UI", "Tahoma", "Noto Sans Arabic", system-ui, -apple-system, sans-serif;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;
    --space-9: 96px;

    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 22px;
    --radius-xl: 30px;
    --radius-pill: 999px;

    --shadow-xs: 0 1px 3px rgba(11, 77, 48, .05);
    --shadow-sm: 0 4px 12px rgba(11, 77, 48, .08);
    --shadow-md: 0 12px 32px rgba(11, 77, 48, .10);
    --shadow-lg: 0 24px 64px rgba(11, 77, 48, .14);
    --shadow-gold: 0 8px 24px rgba(197, 154, 39, .22);

    --container: 1220px;
    --header-h: 80px;
    --topbar-h: 40px;
    --ease: cubic-bezier(.4, 0, .2, 1);
}

/* Set by the inline head script while the stored language is still being
   applied; i18n.js removes it. Prevents a flash of untranslated markup. */
.i18n-pending body { visibility: hidden; }

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

* { margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
    font-family: var(--font);
    font-size: 17px;
    font-weight: 400;
    line-height: 1.8;
    color: var(--text);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

img,
svg,
video { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }

ul, ol { list-style: none; }

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button { background: none; border: 0; cursor: pointer; }

table { border-collapse: collapse; width: 100%; }

/* ---------- Typography ---------------------------------------------------- */
h1, h2, h3, h4, h5 {
    line-height: 1.25;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.2rem, 1.5rem + 2.8vw, 3.5rem); }
h2 { font-size: clamp(1.8rem, 1.3rem + 1.8vw, 2.6rem); }
h3 { font-size: clamp(1.25rem, 1.1rem + .7vw, 1.5rem); font-weight: 700; }
h4 { font-size: 1.15rem; font-weight: 700; }

p { color: var(--muted); line-height: 1.8; }

strong { font-weight: 700; color: var(--text); }

::selection { background: var(--accent); color: var(--primary-700); }

/* ---------- Layout -------------------------------------------------------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--space-5);
}

.section { padding-block: var(--space-9); }
.section--tight { padding-block: var(--space-8); }
.section--alt { background: var(--white); }

.grid { display: grid; gap: var(--space-5); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.stack-2 > * + * { margin-top: var(--space-2); }
.stack-4 > * + * { margin-top: var(--space-4); }
.stack-5 > * + * { margin-top: var(--space-5); }

.text-center { text-align: center; }
.mx-auto { margin-inline: auto; }
.measure { max-width: 62ch; }

/* Section heading block */
.section-head {
    max-width: 680px;
    margin-bottom: var(--space-7);
}
.section-head--center {
    margin-inline: auto;
    text-align: center;
}
.section-head .eyebrow { margin-bottom: var(--space-3); }
.section-head p { margin-top: var(--space-3); font-size: 1.05rem; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--secondary);
}
.eyebrow::before {
    content: "";
    inline-size: 22px;
    block-size: 2px;
    border-radius: 2px;
    background: var(--accent);
}

/* ---------- Accessibility helpers ---------------------------------------- */
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    inset-inline-start: var(--space-4);
    inset-block-start: -100px;
    z-index: 200;
    padding: var(--space-3) var(--space-5);
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: inset-block-start .2s var(--ease);
}
.skip-link:focus { inset-block-start: var(--space-4); }

:focus-visible {
    outline: 3px solid var(--secondary);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ---------- Reveal on scroll --------------------------------------------- */
.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
    .reveal { opacity: 1; transform: none; }
}

/* ---------- Direction-aware helpers -------------------------------------- */
[dir="ltr"] body { line-height: 1.7; }

.flip-x { transition: transform .25s var(--ease); }
[dir="rtl"] .flip-x { transform: scaleX(-1); }
