/* ==========================================================================
   Al Masa -- site design system
   One file that gives every public page the same typography, spacing, page
   header, buttons, cards and call-to-action. Loaded by frontend/app.blade.php
   after the compiled Tailwind stylesheet, so it wins where they overlap.

   Brand      navy #0B1556 / #031169, gold #B78E3B, cream #F8F2E6
   Type       Arabic  : Bahij (the site's existing font), Tajawal as fallback
              English : Poppins for headings, Inter for text -- clear, bold, global-brand feel
   Scale      one H1 per page, H2 for sections, H3 for cards, H4 for small groups.
              Body text never below 16px; supporting text never below 14px.
   ========================================================================== */

:root {
    --am-navy: #0B1556;
    --am-navy-deep: #031169;
    --am-gold: #B78E3B;
    --am-gold-light: #D9B25A;
    --am-gold-deep: #7A5A1A;
    --am-cream: #F8F2E6;
    --am-cream-deep: #F1E8D3;
    --am-ink: #1F2937;
    --am-ink-soft: #475569;
    --am-line: rgba(183, 142, 59, 0.32);
    --am-radius: 14px;
    --am-shadow: 0 18px 40px -22px rgba(11, 21, 86, 0.35);

    --am-font-head-en: 'Poppins', 'Inter', 'Helvetica Neue', Arial, sans-serif;
    --am-font-body-en: 'Inter', 'Helvetica Neue', Arial, sans-serif;
    --am-font-ar: 'Bahij Helvetica Neue', 'Bahij', 'Tajawal', 'Segoe UI', sans-serif;
}

/* ---------- fonts ---------- */
html[lang="en"] body,
html[lang="en"] body :is(p, a, span, li, td, th, label, button, input, select, textarea, summary, small, strong, em, div, nav, figcaption, blockquote) {
    font-family: var(--am-font-body-en) !important;
}
html[lang="en"] body :is(h1, h2, h3, h4, h5, h6) {
    font-family: var(--am-font-head-en) !important;
}
html[lang="ar"] body :is(h1, h2, h3, h4, h5, h6, p, a, span, li, td, th, label, button, input, select, textarea, summary, small, strong, em, div, nav, figcaption, blockquote) {
    font-family: var(--am-font-ar) !important;
}
/* icon fonts must keep their own family */
body i[class*="fa-"], body .fa, body .fas, body .far, body .fab, body i[class*="ri-"] { font-family: inherit; }
body i.fa-solid, body i.fas { font-family: 'Font Awesome 6 Free', 'Font Awesome 5 Free' !important; }
body i.fa-brands, body i.fab { font-family: 'Font Awesome 6 Brands', 'Font Awesome 5 Brands' !important; }

/* ---------- reading size ---------- */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
.am-page { font-size: 1rem; line-height: 1.75; color: var(--am-ink); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html[lang="ar"] .am-page { line-height: 1.95; }
.am-page p { line-height: inherit; }
/* the template uses text-xs / text-sm for body copy; lift them to a readable size */
.am-page :is(main, footer) .text-xs { font-size: 0.875rem !important; line-height: 1.65 !important; }
.am-page main .text-sm { font-size: 1rem !important; line-height: 1.75 !important; }
.am-page :is(main, footer) :is([class*="text-[10px]"], [class*="text-[11px]"]) { font-size: 0.8125rem !important; }
.am-page :is(main, footer) .font-light { font-weight: 400 !important; }
.am-page :is(main, footer) .text-slate-400 { color: #64748b; }
.am-page :is(main, footer) .text-slate-500 { color: #55657a; }

/* ---------- heading hierarchy ---------- */
.am-page :is(h1, h2, h3, h4) {
    text-transform: none !important;
    font-weight: 800;
    letter-spacing: -0.01em !important;
}
html[lang="ar"] .am-page :is(h1, h2, h3, h4) { letter-spacing: 0 !important; font-weight: 700; line-height: 1.4; }
.am-page h1 { font-size: clamp(2rem, 4.6vw, 3.4rem) !important; line-height: 1.14; }
.am-page h2 { font-size: clamp(1.65rem, 3.2vw, 2.35rem) !important; line-height: 1.22; font-weight: 700; }
.am-page h3 { font-size: clamp(1.2rem, 1.9vw, 1.45rem) !important; line-height: 1.3; font-weight: 700; }
.am-page h4 { font-size: 1.05rem !important; line-height: 1.4; font-weight: 700; }
.am-page :is(h1, h2, h3, h4, h5, h6):not([class*="text-white"]):not([class*="text-[#"]):not([class*="text-slate"]) { color: var(--am-navy); }
.am-navy :is(h1, h2, h3, h4, h5, h6):not([class*="text-[#"]):not([class*="text-slate"]),
.am-page .text-white :is(h1, h2, h3, h4, h5, h6):not([class*="text-[#"]):not([class*="text-slate"]) { color: #fff; }
html.dark .am-page :is(h1, h2, h3, h4, h5, h6):not([class*="text-white"]):not([class*="text-[#b78e3b]"]) { color: #f1f5f9; }
.am-page .am-hero-page :is(h1, h2, h3), .am-page .am-cta :is(h1, h2, h3) { color: #fff; }

/* ---------- layout ---------- */
.am-container { max-width: 80rem; margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.am-section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.am-section--tight { padding-block: clamp(2rem, 4.5vw, 3.5rem); }

/* ---------- page header (shared by every inner page) ---------- */
.am-hero-page {
    position: relative;
    padding: clamp(2.75rem, 6vw, 4.75rem) 0 clamp(2.5rem, 5vw, 4rem);
    color: var(--am-cream);
    border-bottom: 1px solid rgba(183, 142, 59, 0.65);
    overflow: hidden;
    isolation: isolate;
}
.am-hero-page::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(60% 80% at 50% 0%, rgba(217, 178, 90, 0.18), transparent 70%);
}
.am-hero-page__image {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.22;
}
.am-hero-page__inner { max-width: 56rem; margin-inline: auto; text-align: center; padding-inline: clamp(1rem, 4vw, 2rem); }
.am-hero-page h1 { color: #fff !important; margin: 0.6rem 0 1rem; }
.am-hero-page .am-lead { color: rgba(248, 242, 230, 0.88); font-size: clamp(1rem, 1.7vw, 1.2rem) !important; line-height: 1.8 !important; max-width: 46rem; margin-inline: auto; }
.am-eyebrow-line {
    display: inline-block;
    font-size: 0.8125rem !important;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--am-gold-light);
}
html[lang="ar"] .am-eyebrow-line { letter-spacing: 0.04em; font-size: 0.95rem !important; text-transform: none; }

.am-crumbs { margin-bottom: 1.1rem; }
.am-crumbs ol { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem 0.6rem; list-style: none; margin: 0; padding: 0; font-size: 0.875rem; }
.am-crumbs li { display: inline-flex; align-items: center; gap: 0.6rem; color: rgba(248, 242, 230, 0.75); }
.am-crumbs li + li::before { content: '/'; color: rgba(217, 178, 90, 0.7); }
html[dir="rtl"] .am-crumbs li + li::before { content: '\\'; }
.am-crumbs a { color: var(--am-gold-light); text-decoration: none; }
.am-crumbs a:hover { text-decoration: underline; }
.am-crumbs [aria-current] { color: #fff; font-weight: 600; }

/* ---------- section heading block ---------- */
.am-section-head { text-align: center; max-width: 48rem; margin: 0 auto clamp(2rem, 4vw, 3rem); }
.am-section-head h2 { margin: 0.5rem 0 0.9rem; }
.am-section-head .am-lead { color: var(--am-ink-soft); }
.am-section-head::after { content: ''; display: block; width: 3.5rem; height: 3px; margin: 1.1rem auto 0; background: var(--am-gold); border-radius: 3px; }

/* ---------- buttons ---------- */
.am-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 3rem;
    padding: 0.75rem 1.6rem;
    border-radius: 0.7rem;
    font-weight: 700;
    font-size: 0.95rem !important;
    line-height: 1.2 !important;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.am-btn:hover { transform: translateY(-2px); }
.am-btn:focus-visible { outline: 3px solid var(--am-gold-light); outline-offset: 3px; }
.am-btn--gold { background: var(--am-gold); color: var(--am-navy); }
.am-btn--gold:hover { background: var(--am-gold-light); color: var(--am-navy); }
.am-btn--navy { background: var(--am-navy); color: #fff; }
.am-btn--navy:hover { background: var(--am-navy-deep); }
.am-btn--ghost { border-color: rgba(255, 255, 255, 0.55); color: #fff; background: transparent; }
.am-btn--ghost:hover { border-color: var(--am-gold-light); color: var(--am-gold-light); }

/* ---------- cards ---------- */
.am-card {
    background: #fffdf8;
    border: 1px solid var(--am-line);
    border-radius: var(--am-radius);
    box-shadow: var(--am-shadow);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.am-card:hover { transform: translateY(-3px); border-color: var(--am-gold); }

/* ---------- closing call to action ---------- */
.am-cta { text-align: center; color: var(--am-cream); padding: clamp(3rem, 7vw, 5rem) clamp(1rem, 4vw, 2rem); border-top: 1px solid rgba(183, 142, 59, 0.65); }
.am-cta h2 { color: #fff !important; margin: 0 0 0.8rem; }
.am-cta p { max-width: 42rem; margin: 0 auto 1.6rem; color: rgba(248, 242, 230, 0.88); }
.am-cta__actions { display: flex; flex-wrap: wrap; gap: 0.9rem; justify-content: center; }

/* ---------- prose (articles, long descriptions) ---------- */
.am-prose { max-width: 44rem; font-size: 1.0625rem; line-height: 1.9; color: var(--am-ink); }
.am-prose h2 { margin: 2.2rem 0 0.8rem; }
.am-prose h3 { margin: 1.8rem 0 0.6rem; }
.am-prose p, .am-prose ul, .am-prose ol { margin: 0 0 1.15rem; }
.am-prose ul { list-style: disc; padding-inline-start: 1.4rem; }
.am-prose ol { list-style: decimal; padding-inline-start: 1.4rem; }
.am-prose a { color: var(--am-gold-deep); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- keyboard focus everywhere ---------- */
.am-page a:focus-visible, .am-page button:focus-visible, .am-page summary:focus-visible,
.am-page input:focus-visible, .am-page select:focus-visible, .am-page textarea:focus-visible {
    outline: 3px solid var(--am-gold);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .am-btn, .am-card { transition: none; }
    .am-btn:hover, .am-card:hover { transform: none; }
}

/* ---------- additions: navy surfaces, skip link, stats, small headings ---------- */
.am-hero-page, .am-cta, .am-navy { background: linear-gradient(160deg, var(--am-navy) 0%, var(--am-navy-deep) 100%); }

.am-skip {
    position: fixed; inset-inline-start: 1rem; top: -4rem; z-index: 100;
    background: var(--am-gold); color: #fff; font-weight: 700; padding: 0.7rem 1.2rem; border-radius: 0.6rem;
    text-decoration: none; transition: top 0.2s ease;
}
.am-skip:focus { top: 1rem; outline: 3px solid #fff; outline-offset: 2px; }
#main-content:focus { outline: none; }

.am-page :is(h5, h6) { text-transform: none !important; font-weight: 700; letter-spacing: 0 !important; }
.am-page h5 { font-size: 1rem !important; line-height: 1.45; }
.am-page h6 { font-size: 0.9375rem !important; }

/* light pages sit on the brand cream instead of cold grey */
.am-page div.bg-\[\#F5F7FA\], .am-page div.bg-\[\#F8FAFC\] { background-color: var(--am-cream); }

.am-hero-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem 2.5rem; margin-top: 1.6rem; }
.am-hero-stats strong { display: block; font-size: 2rem; line-height: 1.1; color: var(--am-gold-light); font-weight: 800; }
.am-hero-stats span { font-size: 0.875rem; color: rgba(248, 242, 230, 0.8); }

/* anchor offset for the sticky header */
:target { scroll-margin-top: 6rem; }

/* headings that the old templates sized small keep a compact (but still readable) step */
.am-page h2:is(.text-lg, .text-xl) { font-size: clamp(1.3rem, 2.2vw, 1.55rem) !important; }
.am-page h2.text-sm { font-size: 1.1rem !important; }
.am-page h2.section-title-concept { font-size: clamp(1.4rem, 2.6vw, 1.75rem) !important; text-transform: none; }
.am-page h3:is(.text-xs, .text-sm, .text-base, .text-lg, [class*="text-[11px]"]) { font-size: 1.0625rem !important; line-height: 1.4; }

/* figures keep the heading face */
html[lang="en"] body .am-stat__num, html[lang="en"] body .am-stat__num * { font-family: var(--am-font-head-en) !important; }

/* ---------- partners: slow logo strip on the homepage ---------- */
.am-partners { padding-block: clamp(2.5rem, 6vw, 4.5rem); overflow: hidden; }
.am-eyebrow-line--dark { color: var(--am-gold-deep); }
.am-marquee {
    direction: ltr; overflow: hidden; padding-block: 0.5rem;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.am-marquee__track {
    display: flex; align-items: center; width: max-content; gap: clamp(2.5rem, 5vw, 4.5rem); margin: 0; padding: 0;
    list-style: none; animation: am-marquee var(--am-marquee-duration, 90s) linear infinite; will-change: transform;
}
html[dir="rtl"] .am-marquee__track { animation-direction: reverse; }
.am-marquee:hover .am-marquee__track, .am-marquee:focus-within .am-marquee__track { animation-play-state: paused; }
.am-marquee__item { flex: none; display: grid; place-items: center; height: 5.5rem; min-width: 8rem; }
.am-marquee__item img { max-height: 5.5rem; max-width: 11rem; width: auto; height: auto; object-fit: contain; transition: transform 0.35s ease; }
.am-marquee__item:hover img { transform: scale(1.08); }
.am-marquee__name { font-size: 1.15rem; font-weight: 800; letter-spacing: 0.04em; color: var(--am-navy); opacity: 0.75; white-space: nowrap; }
.am-partners__more { text-align: center; margin-top: 1.75rem; }
@keyframes am-marquee { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
    .am-marquee { -webkit-mask-image: none; mask-image: none; }
    .am-marquee__track { animation: none; width: auto; flex-wrap: wrap; justify-content: center; padding-inline: 1rem; }
    .am-marquee__item[aria-hidden="true"] { display: none; }
}

/* ---------- partners page: logo cards ---------- */
.am-partner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1.6rem; }
.am-partner-card {
    background: linear-gradient(160deg, #ffffff 0%, #fbf8f1 100%); border: 1px solid rgba(183, 142, 59, 0.18); border-radius: 1.4rem;
    box-shadow: 0 16px 36px -22px rgba(11, 21, 86, 0.35); padding: 1.6rem 1.6rem 1.3rem; display: flex; flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.am-partner-card:hover { transform: translateY(-4px); border-color: var(--am-gold); box-shadow: 0 24px 44px -22px rgba(122, 90, 26, 0.5); }
/* A fixed frame for every logo: the picture always fits inside it, centred and uncropped, whatever its
   shape or size (tall seal, wide wordmark, square badge). Positioning is absolute on purpose: a percentage
   max-height inside a grid cell lets a big upload stretch the cell and get clipped. */
.am-partner-card__logo { position: relative; height: 12.5rem; border-radius: 0.9rem; }
.am-partner-card__logo img { position: absolute; inset: 1rem; width: calc(100% - 2rem); height: calc(100% - 2rem); object-fit: contain; object-position: center; }
.am-partner-card__name { font-size: 1.35rem; font-weight: 800; text-align: center; color: var(--am-navy); }
.am-partner-card__desc { margin: 0.6rem 0 0; font-size: 0.95rem; color: var(--am-ink-soft); text-align: center; }
.am-partner-card__foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(15, 23, 42, 0.07); }
.am-partner-pill {
    display: flex; align-items: center; justify-content: center; gap: 0.7rem; min-height: 3rem; padding: 0.55rem 1rem;
    border-radius: 0.9rem; background: #f4efe4; color: var(--am-navy); font-weight: 600; font-size: 1rem; text-decoration: none;
    direction: ltr; unicode-bidi: isolate; transition: background-color 0.25s ease, color 0.25s ease;
}
.am-partner-pill i { color: var(--am-gold); }
a.am-partner-pill:hover { background: var(--am-navy); color: #fff; }
a.am-partner-pill:hover i { color: var(--am-gold-light); }
a.am-partner-pill:focus-visible { outline: 3px solid var(--am-gold); outline-offset: 2px; }
html.dark .am-partner-card { background: #131d38; border-color: rgba(217, 178, 90, 0.25); }
html.dark .am-partner-card__logo { background: #fff; }
html.dark .am-partner-card__name, html.dark .am-partner-card__desc { color: #f1f5f9; }
html.dark .am-partner-pill { background: #0b1120; color: #f1f5f9; }

/* ---------- portfolio statistics: flash cards ---------- */
.am-metrics { padding-block: clamp(3rem, 7vw, 5rem); border-block: 1px solid rgba(217, 178, 90, 0.6); color: var(--am-cream); }
.am-metrics__head { text-align: center; max-width: 52rem; margin: 0 auto clamp(1.8rem, 4vw, 3rem); }
.am-metrics__head h2 { margin: 0.6rem 0 0; }

.am-flash {
    position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 0.7rem;
    min-height: 10.5rem; padding: 1.5rem 1.4rem 1.4rem; text-align: center; border-radius: 1rem;
    border: 1px solid rgba(217, 178, 90, 0.4);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.03));
    box-shadow: 0 22px 40px -26px rgba(0, 0, 0, 0.7);
    transition: transform 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
}
.am-flash::before {            /* gold edge that draws across the top */
    content: ''; position: absolute; inset-inline: 0; top: 0; height: 3px;
    background: linear-gradient(90deg, transparent, var(--am-gold-light), transparent);
}
.am-flash::after {             /* one light sweep when the card appears */
    content: ''; position: absolute; inset-block: 0; width: 45%; inset-inline-start: -60%;
    background: linear-gradient(100deg, transparent, rgba(255, 244, 205, 0.35), transparent); transform: skewX(-18deg);
}
.am-flash:hover { transform: translateY(-4px); border-color: var(--am-gold-light); background-color: rgba(217, 178, 90, 0.08); }
.am-flash__num {
    display: block; direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums;
    font-size: clamp(2.7rem, 5.2vw, 4.2rem); line-height: 1.05; font-weight: 800; letter-spacing: -0.01em;
    color: #F6DE9A; background: linear-gradient(180deg, #FBEBB6 0%, #D9B25A 55%, #B78E3B 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.am-flash__label { font-size: clamp(1.05rem, 1.7vw, 1.3rem); font-weight: 700; line-height: 1.4; color: var(--am-cream); }

.am-flash--total { margin-bottom: 1.25rem; min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 2.5rem; padding-block: 1.6rem; border-color: var(--am-gold-light); }
.am-flash--total .am-flash__num { font-size: clamp(3.4rem, 8vw, 6.5rem); }
.am-flash--total .am-flash__label { font-size: clamp(1.15rem, 2vw, 1.6rem); text-transform: uppercase; letter-spacing: 0.08em; }
html[lang="ar"] .am-flash--total .am-flash__label { text-transform: none; letter-spacing: 0; }

.am-flash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (min-width: 640px) { .am-flash-grid { grid-template-columns: repeat(3, 1fr); gap: 1.15rem; } }
@media (min-width: 1100px) { .am-flash-grid { grid-template-columns: repeat(4, 1fr); gap: 1.25rem; } }

.am-flash-js .am-flash:not(.is-in) { opacity: 0; transform: translateY(20px) scale(0.96); }
.am-flash-js .am-flash.is-in { animation: am-flash-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; animation-delay: calc(var(--i, 0) * 70ms); }
.am-flash-js .am-flash.is-in::after { animation: am-flash-sweep 1.1s ease-out backwards; animation-delay: calc(var(--i, 0) * 70ms + 250ms); }
@keyframes am-flash-in { from { opacity: 0; transform: translateY(20px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes am-flash-sweep { to { inset-inline-start: 130%; } }
@media (prefers-reduced-motion: reduce) {
    .am-flash-js .am-flash:not(.is-in) { opacity: 1; transform: none; }
    .am-flash-js .am-flash.is-in, .am-flash-js .am-flash.is-in::after { animation: none; }
}

/* gold surfaces carry navy text (white on #B78E3B is only 3:1) */
.am-page :is(a, span, button, div).bg-\[\#b78e3b\], .am-page :is(a, span, button, div).bg-\[\#b78e3b\] :is(span, i) { color: var(--am-navy) !important; }
.am-page .bg-\[\#b78e3b\].text-white, .am-page .bg-\[\#b78e3b\] .text-white { color: var(--am-navy) !important; }

/* ---------- contrast fixes found by the audit (light theme) ---------- */
/* headings on navy bands must win over the navy heading colour */
.am-page .am-navy :is(h1, h2, h3, h4, h5, h6):not([class*="text-[#"]):not([class*="text-slate"]) { color: #fff; }
.am-page .am-navy .am-stats__title { color: #fff; }

/* small gold text on cream/white: deep gold (6:1); on navy surfaces: light gold */
html:not(.dark) .am-page main .text-\[\#b78e3b\], html:not(.dark) .am-page main .counter-val:not(.am-flash__num) { color: var(--am-gold-deep); }
html:not(.dark) .am-page :is(.am-navy, .am-hero-page, .am-cta, .am-metrics, .bg-\[\#031169\], [class*="from-[#031169]"], [class*="bg-gradient"]) :is(.text-\[\#b78e3b\], .counter-val:not(.am-flash__num)),
html:not(.dark) .am-page :is(.bg-\[\#031169\], .am-navy)[class*="text-[#b78e3b]"] { color: var(--am-gold-light); }

/* default paragraph colour from the theme (#777) is too faint */
html:not(.dark) .am-page p:not([class*="text-"]):not(.am-navy *):not(footer *):not(.am-hero-page *):not(.am-cta *) { color: var(--am-ink-soft); }
.am-page footer p:not([class*="text-"]), .am-page footer span:not([class*="text-"]) { color: rgba(255, 255, 255, 0.78); }
