/* ==========================================================================
   Fekra — Brand Design System
   Source: Fekra brand guidelines (Untitled-1.pdf) + fekra-app-assets
   --------------------------------------------------------------------------
   0. Fonts
   1. Tokens
   2. Legacy bridge (maps the old --main / --hover / --main2 to the brand)
   3. Base & typography
   4. Primitives (container, section, eyebrow, buttons, cards, badges)
   5. Brand motifs (cover gradient, watermark mark)
   6. Motion & accessibility
   ========================================================================== */

/* 0. Fonts — Thmanyah Serif family (per guidelines: 4 weights only)
   ========================================================================== */
@font-face {
    font-family: "Fekra Display";
    src: url("../fonts/thmanyah-serif/thmanyahserifdisplay-Light.woff2") format("woff2");
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Fekra Display";
    src: url("../fonts/thmanyah-serif/thmanyahserifdisplay-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Fekra Display";
    src: url("../fonts/thmanyah-serif/thmanyahserifdisplay-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Fekra Text";
    src: url("../fonts/thmanyah-serif/thmanyahseriftext-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Fekra Text";
    src: url("../fonts/thmanyah-serif/thmanyahseriftext-Medium.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Fekra Text";
    src: url("../fonts/thmanyah-serif/thmanyahseriftext-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* 1. Tokens
   ========================================================================== */
:root {
    /* Brand palette (guidelines p.4) */
    --fk-blue: #245176;        /* أزرق فكرة — primary */
    --fk-blue-deep: #16364F;   /* أزرق داكن — depths & backgrounds */
    --fk-ink: #0D1B26;         /* حبر — text & logo */
    --fk-ice: #EEF9FE;         /* جليد — page background */
    --fk-sky: #9FDAE2;         /* سماوي — accent */
    --fk-gold: #BF9A4A;        /* ذهبي — small touches only, never a full background */
    --fk-white: #FFFFFF;

    /* Derived tints (kept inside the palette) */
    --fk-blue-700: #193B58;
    --fk-blue-600: #1E4566;
    --fk-blue-50: #E6F0F7;
    --fk-gold-600: #A9853B;
    --fk-gold-100: #F3E9D2;
    --fk-gold-50: #F7F1E4;
    --fk-sky-50: #EAF7F9;

    /* Semantic colors */
    --fk-bg: var(--fk-ice);
    --fk-surface: var(--fk-white);
    --fk-text: var(--fk-ink);
    --fk-text-muted: #4A5A68;
    --fk-muted: var(--fk-text-muted);
    --fk-text-subtle: #6B7B88;
    --fk-border: #D6E6EE;
    --fk-border-strong: #B9D2DE;
    --fk-on-dark: var(--fk-white);
    --fk-on-dark-muted: rgba(255, 255, 255, 0.78);

    /* Cover gradient — cover & closing sections only (guidelines p.4) */
    --fk-gradient-cover: linear-gradient(135deg, #3A6A92 0%, var(--fk-blue) 38%, var(--fk-blue-deep) 72%, var(--fk-ink) 100%);

    /* Typography */
    --fk-font-display: "Fekra Display", "Thmanyah Serif Display", "Noto Naskh Arabic", Georgia, serif;
    --fk-font-text: "Fekra Text", "Thmanyah Serif Text", "Noto Naskh Arabic", Georgia, serif;
    --fk-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --fk-leading-heading: 1.24;
    --fk-leading-text: 1.7;

    /* Fluid type scale (desktop px from guidelines p.6 scaled for web) */
    --fk-fs-hero: clamp(2.5rem, 1.6rem + 4vw, 5rem);
    --fk-fs-h1: clamp(2.125rem, 1.5rem + 2.6vw, 3.5rem);
    --fk-fs-h2: clamp(1.75rem, 1.3rem + 1.8vw, 2.75rem);
    --fk-fs-h3: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
    --fk-fs-lead: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
    --fk-fs-body: 1rem;
    --fk-fs-small: 0.875rem;
    --fk-fs-eyebrow: 0.9375rem;

    /* Spacing (8pt) */
    --fk-space-1: 0.25rem;
    --fk-space-2: 0.5rem;
    --fk-space-3: 0.75rem;
    --fk-space-4: 1rem;
    --fk-space-5: 1.5rem;
    --fk-space-6: 2rem;
    --fk-space-7: 3rem;
    --fk-space-8: 4rem;
    --fk-space-9: 4.5rem;
    --fk-space-10: clamp(2.5rem, 4vw, 4.5rem);
    --fk-space-12: clamp(4rem, 2.5rem + 6vw, 7.5rem);
    --fk-section-y: clamp(4rem, 2.5rem + 6vw, 7.5rem);
    --fk-container: 1200px;
    --fk-gutter: clamp(1.25rem, 0.5rem + 3vw, 2rem);

    /* Shape — gracefully rounded cards & components */
    --fk-radius-xs: 8px;
    --fk-radius-sm: 12px;
    --fk-radius: 18px;
    --fk-radius-md: 20px;
    --fk-radius-lg: 24px;
    --fk-radius-xl: 28px;
    --fk-radius-2xl: 32px;
    --fk-radius-pill: 999px;

    /* Elevation (tinted with ink, never neutral grey) */
    --fk-shadow-sm: 0 1px 2px rgba(13, 27, 38, 0.06), 0 1px 3px rgba(13, 27, 38, 0.04);
    --fk-shadow: 0 10px 30px -12px rgba(22, 54, 79, 0.18);
    --fk-shadow-lg: 0 30px 60px -20px rgba(22, 54, 79, 0.30);
    --fk-shadow-xl: 0 36px 80px -20px rgba(13, 27, 38, 0.38), 0 12px 28px -8px rgba(22, 54, 79, 0.22);

    /* Intrinsic sizing keyword interpolation (Modern Web Guidance) */
    interpolate-size: allow-keywords;

    /* Motion */
    --fk-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --fk-dur-fast: 160ms;
    --fk-dur: 280ms;
    --fk-dur-slow: 600ms;

    /* Layers */
    --fk-z-header: 1000;
    --fk-z-drawer: 1010;
}

/* 2. Legacy bridge
   The old theme reads --main / --hover / --main2 from admin settings
   (Vuexy purple #7367F0). Until every section is rebuilt, we remap them
   to the brand so no purple leaks anywhere. Loaded after the inline
   <style> block, so these win the cascade.
   ========================================================================== */
:root {
    --main: var(--fk-blue);
    --hover: var(--fk-blue-deep);
    --main2: var(--fk-gradient-cover);
    --gray: var(--fk-text-muted);
}

/* 3. Base & typography
   ========================================================================== */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--fk-font-text);
    font-size: var(--fk-fs-body);
    line-height: var(--fk-leading-text);
    color: var(--fk-text);
    background-color: var(--fk-bg);
    background-image: none;
    word-spacing: normal;
    font-size-adjust: from-font;
    font-feature-settings: "calt" 1, "liga" 1;
}

p, li, blockquote {
    text-wrap: pretty;
}

body,
input,
button,
select,
textarea {
    font-family: var(--fk-font-text);
}

/* Old CSS forces headings with !important; match it so the brand wins. */
h1, h2, h3, h4, h5, h6,
.fk-display {
    font-family: var(--fk-font-display) !important;
    line-height: var(--fk-leading-heading);
    color: inherit;
    font-weight: 700;
    letter-spacing: 0; /* guidelines: never track Arabic */
    text-wrap: balance;
}

/* Arabic numerals in body copy */
.fk-num {
    font-family: var(--fk-font-display);
    font-weight: 300;
    font-variant-numeric: tabular-nums;
}

::selection {
    background: var(--fk-sky);
    color: var(--fk-ink);
}

a {
    color: var(--fk-blue);
    transition: color var(--fk-dur-fast) var(--fk-ease);
}
a:hover {
    color: var(--fk-blue-deep);
}

img,
svg {
    max-width: 100%;
}

/* 4. Primitives
   ========================================================================== */
.fk-container {
    width: 100%;
    max-width: calc(var(--fk-container) + var(--fk-gutter) * 2);
    margin-inline: auto;
    padding-inline: var(--fk-gutter);
}

.fk-section {
    padding-block: var(--fk-section-y);
    position: relative;
}
.fk-section--white { background: var(--fk-surface); }
.fk-section--ice { background: var(--fk-ice); }
.fk-section--deep {
    background: var(--fk-blue-deep);
    color: var(--fk-on-dark);
}

/* Section heading block: eyebrow + gold rule + title + lead (guidelines p.1/p.6) */
.fk-head {
    max-width: 720px;
    margin-block-end: var(--fk-space-7);
}
.fk-head--center {
    margin-inline: auto;
    text-align: center;
}
.fk-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--fk-space-3);
    font-family: var(--fk-font-text);
    font-size: var(--fk-fs-eyebrow);
    font-weight: 700;
    color: var(--fk-gold);
    margin-block-end: var(--fk-space-4);
}
.fk-eyebrow__dot {
    inline-size: 8px;
    block-size: 8px;
    border-radius: 50%;
    background: var(--fk-gold);
    box-shadow: 0 0 0 4px rgba(247, 179, 53, 0.2);
    flex-shrink: 0;
}
.fk-eyebrow::after {
    content: "";
    inline-size: 40px;
    block-size: 2px;
    background: currentColor;
    border-radius: 2px;
}
.fk-head--center .fk-eyebrow::before {
    content: "";
    inline-size: 40px;
    block-size: 2px;
    background: currentColor;
    border-radius: 2px;
}
.fk-title {
    font-size: var(--fk-fs-h2);
    color: var(--fk-blue);
    margin: 0 0 var(--fk-space-4);
}
.fk-section--deep .fk-title { color: var(--fk-on-dark); }
.fk-lead {
    font-size: var(--fk-fs-lead);
    color: var(--fk-text-muted);
    margin: 0;
}
.fk-section--deep .fk-lead { color: var(--fk-on-dark-muted); }
.fk-gold { color: var(--fk-gold); }

/* Buttons */
.fk-btn {
    --_bg: var(--fk-blue);
    --_fg: var(--fk-white);
    --_bd: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--fk-space-2);
    min-block-size: 48px;
    padding: 0.75rem 1.75rem;
    border: 1.5px solid var(--_bd);
    border-radius: var(--fk-radius-pill);
    background: var(--_bg);
    color: var(--_fg);
    font-family: var(--fk-font-text);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color var(--fk-dur) var(--fk-ease),
        color var(--fk-dur) var(--fk-ease),
        border-color var(--fk-dur) var(--fk-ease),
        transform var(--fk-dur) var(--fk-ease),
        box-shadow var(--fk-dur) var(--fk-ease);
}
.fk-btn:hover {
    color: var(--_fg);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--fk-shadow);
}
.fk-btn:active { transform: translateY(0); }
.fk-btn--primary:hover { --_bg: var(--fk-blue-deep); }
.fk-btn--gold { --_bg: var(--fk-gold); --_fg: var(--fk-ink); }
.fk-btn--gold:hover { --_bg: var(--fk-gold-600); }
.fk-btn--ghost { --_bg: transparent; --_fg: var(--fk-blue); --_bd: var(--fk-border-strong); }
.fk-btn--ghost:hover { --_bg: var(--fk-blue-50); --_bd: var(--fk-blue); }
.fk-btn--outline { --_bg: var(--fk-surface); --_fg: var(--fk-blue); --_bd: var(--fk-border-strong); }
.fk-btn--outline:hover { --_bg: var(--fk-blue-50); --_fg: var(--fk-blue-deep); --_bd: var(--fk-blue); }
.fk-btn--on-dark { --_bg: transparent; --_fg: var(--fk-white); --_bd: rgba(255, 255, 255, 0.35); }
.fk-btn--on-dark:hover { --_bg: rgba(255, 255, 255, 0.1); --_bd: var(--fk-white); }
.fk-btn--sm { min-block-size: 40px; padding: 0.5rem 1.125rem; font-size: 0.9375rem; }
.fk-btn--block { display: flex; inline-size: 100%; }

/* Cards */
.fk-card {
    position: relative;
    background: var(--fk-surface);
    border: 1px solid var(--fk-border);
    border-radius: var(--fk-radius-lg);
    padding: var(--fk-space-6);
    box-shadow: var(--fk-shadow-sm);
    transition:
        transform var(--fk-dur) var(--fk-ease),
        box-shadow var(--fk-dur) var(--fk-ease),
        border-color var(--fk-dur) var(--fk-ease);
}
.fk-card--hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--fk-shadow);
    border-color: var(--fk-border-strong);
}
.fk-card--blue {
    background: var(--fk-blue);
    border-color: var(--fk-blue);
    color: var(--fk-on-dark);
}
.fk-card--sky {
    background: var(--fk-sky);
    border-color: var(--fk-sky);
    color: var(--fk-ink);
}

/* Icon tile used inside cards */
.fk-icon-tile {
    display: inline-grid;
    place-items: center;
    inline-size: 56px;
    block-size: 56px;
    border-radius: var(--fk-radius);
    background: var(--fk-blue-50);
    color: var(--fk-blue);
    transition: transform var(--fk-dur) var(--fk-ease), background-color var(--fk-dur) var(--fk-ease);
}
.fk-icon-tile--blue {
    background: var(--fk-blue-50);
    color: var(--fk-blue);
}
.fk-icon-tile--gold {
    background: var(--fk-gold-100);
    color: var(--fk-gold-600);
}
.fk-icon-tile--sky {
    background: rgba(154, 192, 232, 0.25);
    color: var(--fk-blue-700);
}
.fk-icon-tile--navy {
    background: rgba(14, 34, 64, 0.08);
    color: var(--fk-blue-deep);
}
.fk-icon-tile svg {
    inline-size: 26px;
    block-size: 26px;
}

/* App store badges */
.fk-store {
    display: inline-flex;
    align-items: center;
    gap: var(--fk-space-3);
    min-block-size: 52px;
    padding: 0.5rem 1.125rem;
    border-radius: var(--fk-radius);
    background: var(--fk-ink);
    color: var(--fk-white);
    border: 1px solid rgba(255, 255, 255, 0.14);
    text-decoration: none;
    transition: transform var(--fk-dur) var(--fk-ease), background-color var(--fk-dur) var(--fk-ease), box-shadow var(--fk-dur) var(--fk-ease);
}
.fk-store:hover {
    color: var(--fk-white);
    text-decoration: none;
    transform: translateY(-2px);
    background: #000;
    box-shadow: var(--fk-shadow);
}
.fk-store svg {
    inline-size: 24px;
    block-size: 24px;
    flex-shrink: 0;
}
.fk-store__text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    text-align: start;
    direction: ltr;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.fk-store__text small {
    font-size: 0.625rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.8;
}
.fk-store__text strong {
    font-size: 1rem;
    font-weight: 600;
}
.fk-store--light {
    background: var(--fk-white);
    color: var(--fk-ink);
    border-color: transparent;
}
.fk-store--light:hover {
    background: var(--fk-ice);
    color: var(--fk-ink);
}

/* 5. Brand motifs
   ========================================================================== */
.fk-cover {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: var(--fk-gradient-cover);
    color: var(--fk-on-dark);
}

/* Large translucent mark behind content (guidelines p.5/p.8/p.15) */
.fk-watermark {
    position: absolute;
    z-index: -1;
    pointer-events: none;
    user-select: none;
    opacity: 0.1;
    inline-size: min(70vw, 760px);
    aspect-ratio: 1330 / 1703;
    background: url("../brand/logo/fekra-mark-white.svg") no-repeat center / contain;
}

/* 6. Motion & accessibility
   ========================================================================== */
:focus-visible {
    outline: 3px solid var(--fk-gold);
    outline-offset: 3px;
    border-radius: 4px;
}

.fk-sr-only {
    position: absolute !important;
    inline-size: 1px;
    block-size: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (prefers-reduced-transparency: reduce) {
    .fk-header,
    .fk-mobile-dock__inner {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    .fk-header {
        background: var(--fk-white) !important;
    }
    .fk-mobile-dock__inner {
        background: var(--fk-ink) !important;
    }
}
