/* =============================================================================
   Royal CIC - Design tokens
   Royal Canadian International Education Community (short form: Royal CIC)
   Version 1.0  |  Mobile first  |  EN (LTR), Kurdish Sorani (RTL), Arabic (RTL)

   HOW TO USE
   1. Load this file first, before any component CSS.
   2. Put lang and dir on <html>:
        English        <html lang="en"  dir="ltr">
        Kurdish Sorani <html lang="ckb" dir="rtl">
        Arabic         <html lang="ar"  dir="rtl">
   3. Fonts are self-hosted: css/fonts.css (files in assets/fonts/). No Google Fonts requests.

   RTL-SAFE SPACING RULES (logical properties) - hawkar_FrontEnd please follow
   ----------------------------------------------------------------------------
   NEVER write left / right in component CSS. Use the logical version:
     margin-left / margin-right     ->  margin-inline-start / margin-inline-end
     padding-left / padding-right   ->  padding-inline-start / padding-inline-end
     margin: 0 16px                 ->  margin-inline: 16px
     padding: 8px 16px              ->  padding-block: 8px; padding-inline: 16px
     left: 0 / right: 0             ->  inset-inline-start: 0 / inset-inline-end: 0
     top / bottom                   ->  inset-block-start / inset-block-end (top/bottom are fine too)
     text-align: left / right       ->  text-align: start / end
     float: left / right            ->  float: inline-start / inline-end (or use flex/grid)
     border-left / border-right     ->  border-inline-start / border-inline-end
     border-radius: 8px 0 0 8px     ->  border-start-start-radius / border-end-start-radius ...
     width / height                 ->  inline-size / block-size (optional, width/height are fine)
   Flexbox and grid flip automatically with dir="rtl", so do not add manual
   "row-reverse" for RTL. Do not use :dir() hacks unless a rule below says so.
   Transforms and background positions do not flip by themselves. Use
   --flip (1 in LTR, -1 in RTL) like:  transform: scaleX(var(--flip));
   Icons that must mirror: use class .icon-flip (defined at the bottom).
   Things that must NOT mirror are listed in design-brief.md (section F.1).
   ============================================================================= */


/* ----------------------------------------------------------------------------
   1. COLOR - raw palette
   Brand colors sampled from the logo: blue #29529c, red #de282e, white.
   ---------------------------------------------------------------------------- */
:root {
  color-scheme: light;               /* v1 is light only (no dark mode) */

  /* Blue (primary) */
  --blue-900: #14284f;               /* deepest: footer base strip, overlays */
  --blue-800: #1d3a70;               /* headings on light, hover/pressed for blue */
  --blue-700: #29529c;               /* BRAND BLUE. Header accents, links, primary fills, footer bg */
  --blue-600: #3a66b5;               /* decorative only (icons, borders, gradients). Not for text */
  --blue-300: #9db6e0;               /* decorative only (dividers on blue, illustrations) */
  --blue-100: #dbe5f6;               /* tint: chips, hover bg, text on brand blue */
  --blue-50:  #eef3fb;               /* tint: alternate section bg */
  --blue-25:  #f6f8fc;               /* tint: page wash, card bg on white sections */

  /* Red (accent / action) */
  --red-800: #a6192a;                /* pressed state for red buttons */
  --red-700: #c41f25;                /* ACTION RED. Any button/text that carries small red text or white-on-red text */
  --red-600: #de282e;                /* BRAND RED. Large shapes, stripes, icons, large text only (see rules) */
  --red-50:  #fdecee;                /* error background tint */

  /* Neutrals (slightly blue-tinted so they sit with the brand) */
  --ink:        #1b1f2a;             /* main text */
  --slate-700:  #4a5263;             /* secondary text */
  --slate-600:  #5d6676;             /* tertiary text (captions, placeholders). Lightest allowed text color */
  --slate-400:  #7b859b;             /* form control borders (3.7:1 on white, meets 3:1 non-text) */
  --slate-200:  #dbe3f0;             /* decorative dividers, card borders (not required for contrast) */
  --white:      #ffffff;

  /* Status */
  --green-700: #1e6b3a;  --green-50: #e8f5ec;     /* success */
  --amber-700: #8a5a00;  --amber-50: #fff4d6;     /* notice / warning */
  /* error uses --red-700 on --red-50 (5.16:1). Info uses --blue-700 on --blue-50. */
}


/* ----------------------------------------------------------------------------
   2. COLOR - semantic roles (components should use ONLY these)
   Contrast values are WCAG 2.x ratios, calculated. AA needs 4.5:1 for normal
   text, 3:1 for large text (>=24px, or >=18.66px bold) and for UI/graphics.
   ---------------------------------------------------------------------------- */
:root {
  /* Surfaces */
  --bg-page:        var(--white);
  --bg-alt:         var(--blue-50);    /* alternate sections */
  --bg-wash:        var(--blue-25);
  --bg-card:        var(--white);
  --bg-brand:       var(--blue-700);   /* hero overlay band, footer, CTA band */
  --bg-brand-deep:  var(--blue-900);
  --border:         var(--slate-200);
  --border-control: var(--slate-400);

  /* Text on light surfaces (white, blue-25, blue-50)
     ink            on white 16.46, on blue-50 14.77
     slate-700      on white 7.84,  on blue-50 7.04
     slate-600      on white 5.79,  on blue-50 5.20   (minimum text color)
     blue-800       on white 11.10, on blue-50 9.97
     blue-700       on white 7.55,  on blue-50 6.78   */
  --text:           var(--ink);
  --text-muted:     var(--slate-700);
  --text-subtle:    var(--slate-600);
  --text-heading:   var(--blue-800);
  --text-link:      var(--blue-700);
  --text-link-hover:var(--blue-800);

  /* Text on brand blue (#29529c)
     white on blue-700 7.55, blue-100 on blue-700 5.95 */
  --text-on-brand:        var(--white);
  --text-on-brand-muted:  var(--blue-100);

  /* Text on deep blue (#14284f): white 14.52, blue-100 11.44 */
  --text-on-deep:         var(--white);
  --text-on-deep-muted:   var(--blue-100);

  /* Red usage RULES
     white on red-700 5.88 (AA, any size)      -> USE for button text
     white on red-800 7.52                     -> pressed state
     white on red-600 4.72 (passes AA but borderline, thin Arabic strokes suffer)
       -> red-600 may carry white text ONLY at >=18.66px bold or >=24px (large text)
          and never for Arabic-script text under 24px.
     red-700 text on white 5.88, on blue-50 5.28, on red-50 5.16 -> OK for small text (e.g. "Required", links in alerts)
     red-600 text on white 4.72, on blue-50 4.24 (FAILS) -> large text on white only; never on tinted bg
     red-600 on blue-700 = 1.6 (FAILS everything) -> never place red text/icons on brand blue.
       Separate red from blue with a white gap or white line.                          */
  --action:          var(--red-700);   /* primary CTA background */
  --action-hover:    var(--red-800);
  --action-pressed:  #8f1523;          /* white on this 8.9:1 */
  --on-action:       var(--white);
  --accent:          var(--red-600);   /* decorative: stripes, underline bars, icons >=24px on white */

  /* Status (text on tint)  success 5.81, warning 5.41, error 5.16 */
  --success-text: var(--green-700);   --success-bg: var(--green-50);
  --warning-text: var(--amber-700);   --warning-bg: var(--amber-50);
  --error-text:   var(--red-700);     --error-bg:   var(--red-50);
  --error-border: var(--red-700);

  /* Focus: 3px, offset 2px. Blue ring on light (7.55:1 on white), white ring on blue/dark. */
  --focus-color:         var(--blue-700);
  --focus-color-on-dark: var(--white);
  --focus-width:  3px;
  --focus-offset: 2px;
}


/* ----------------------------------------------------------------------------
   3. TYPOGRAPHY
   Latin:        Poppins (geometric, friendly, open source), self-hosted, 400/500/600/700
   Arabic script (Sorani Kurdish + Arabic): Noto Kufi Arabic, self-hosted, 400/600/700
     - covers Sorani letters: ڕ ڵ ۆ ێ ە ڤ پ چ ژ گ ک ی and the Arabic letters (checked by tools/check-fonts.py)
     - Latin letters and digits inside Arabic-script text fall back to Poppins
     - alternatives if needed: Vazirmatn, Noto Naskh Arabic (body only). To change fonts see README.md "Changing the font".
   Weights used: 400, 600, 700. Never synthesize bold/italic.
   Arabic script rules: no letter-spacing, no uppercase, no italics, no underline
   under long runs (use bold/color + underline only on links), min size 16px.
   ---------------------------------------------------------------------------- */
:root {
  --font-latin:  "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-arabic: "Noto Kufi Arabic", "Poppins", "Segoe UI", Tahoma, "Geeza Pro", Arial, sans-serif;
  --font-body:    var(--font-latin);
  --font-heading: var(--font-latin);
  --font-weight-regular: 400;
  --font-weight-medium:  600;
  --font-weight-bold:    700;
  --font-weight-display: 700;

  /* Size scale (mobile first, rem; 1rem = 16px). Latin values. */
  --text-xs:   0.875rem;   /* 14  captions, legal, form hints (smallest allowed) */
  --text-sm:   0.9375rem;  /* 15  card meta, footer links */
  --text-base: 1rem;       /* 16  body */
  --text-lg:   1.125rem;   /* 18  lead paragraph, buttons */
  --text-h4:   1.125rem;   /* 18 */
  --text-h3:   1.25rem;    /* 20 */
  --text-h2:   1.625rem;   /* 26 */
  --text-h1:   2rem;       /* 32 */

  /* Line heights (Latin) */
  --lh-body:    1.6;
  --lh-heading: 1.2;
  --lh-tight:   1.15;      /* h1 */
  --lh-ui:      1.3;       /* buttons, labels */

  --letter-spacing-eyebrow: 0.08em;   /* Latin eyebrow labels only; forced to 0 for Arabic script */
  --measure: 40rem;        /* ~65 characters max line length for body copy */
}

/* Tablet 600px+ and desktop 900px+ type steps. Breakpoints cannot be variables
   in @media, so they are fixed here and used across the whole site:
     sm 600px  |  md 900px  |  lg 1200px   (mobile base = 360px design width)  */
@media (min-width: 600px) {
  :root { --text-h1: 2.5rem;  --text-h2: 2rem;     --text-h3: 1.375rem; }
}
@media (min-width: 900px) {
  :root { --text-base: 1.0625rem; --text-lg: 1.25rem;
          --text-h1: 3rem; --text-h2: 2.25rem; --text-h3: 1.5rem; }
}

/* Arabic-script override (Sorani Kurdish and Arabic).
   Arabic glyphs have a smaller visual size and tall marks, so: +6% size, more line height. */
:lang(ckb), :lang(ar) {
  --font-body:    var(--font-arabic);
  --font-heading: var(--font-arabic);
  --text-xs:   0.9375rem;  /* 15 */
  --text-sm:   1rem;       /* 16 */
  --text-base: 1.0625rem;  /* 17 */
  --text-lg:   1.1875rem;  /* 19 */
  --text-h4:   1.1875rem;  /* 19 */
  --text-h3:   1.375rem;   /* 22 */
  --text-h2:   1.75rem;    /* 28 */
  --text-h1:   2.125rem;   /* 34 */
  --lh-body:    1.85;      /* Latin 1.6 */
  --lh-heading: 1.45;      /* Latin 1.2 */
  --lh-tight:   1.4;
  --lh-ui:      1.5;
  --letter-spacing-eyebrow: 0;
  --font-weight-display: 700;   /* Noto Kufi Arabic is loaded to 700 */
}
@media (min-width: 600px) {
  :lang(ckb), :lang(ar) { --text-h1: 2.625rem; --text-h2: 2.125rem; --text-h3: 1.5rem; }
}
@media (min-width: 900px) {
  :lang(ckb), :lang(ar) { --text-base: 1.125rem; --text-lg: 1.3125rem;
                          --text-h1: 3.125rem; --text-h2: 2.375rem; --text-h3: 1.625rem; }
}
/* Never letter-space Arabic script: it breaks letter joining. */
:lang(ckb) *, :lang(ar) * { letter-spacing: 0 !important; text-transform: none !important; }


/* ----------------------------------------------------------------------------
   4. SPACING (4px base), LAYOUT, TARGET SIZES
   Use with logical properties (see header comment).
   ---------------------------------------------------------------------------- */
:root {
  --space-0:  0;
  --space-1:  0.25rem;   /*   4 */
  --space-2:  0.5rem;    /*   8 */
  --space-3:  0.75rem;   /*  12 */
  --space-4:  1rem;      /*  16 */
  --space-5:  1.25rem;   /*  20 */
  --space-6:  1.5rem;    /*  24 */
  --space-8:  2rem;      /*  32 */
  --space-10: 2.5rem;    /*  40 */
  --space-12: 3rem;      /*  48 */
  --space-16: 4rem;      /*  64 */
  --space-20: 5rem;      /*  80 */
  --space-24: 6rem;      /*  96 */

  /* Page gutter (inline padding of every container) */
  --gutter: var(--space-4);          /* 16 mobile */
  --section-gap: var(--space-12);    /* 48 vertical padding of a section, mobile */
  --grid-gap: var(--space-4);        /* 16 */
  --container-max: 75rem;            /* 1200 */
  --container-narrow: 48rem;         /* 768 for forms and long text */

  /* Targets and chrome */
  --tap-min: 44px;                   /* absolute minimum for any tappable thing */
  --control-h: 48px;                 /* default height of buttons and inputs */
  --control-h-lg: 56px;              /* hero and bar buttons */
  --header-h: 64px;                  /* mobile */
  --bottom-bar-h: 64px;              /* mobile action bar (plus env(safe-area-inset-bottom)) */
  --tap-gap: 8px;                    /* minimum space between two tappable things */
}
@media (min-width: 600px) { :root { --gutter: var(--space-6); --section-gap: var(--space-16); --grid-gap: var(--space-6); } }
@media (min-width: 900px) { :root { --gutter: var(--space-8); --section-gap: var(--space-24); --grid-gap: var(--space-8); --header-h: 80px; } }


/* ----------------------------------------------------------------------------
   5. RADIUS, BORDERS, SHADOWS
   ---------------------------------------------------------------------------- */
:root {
  --radius-sm:   6px;      /* chips, small inputs inside cards */
  --radius-md:   10px;     /* buttons, inputs */
  --radius-lg:   16px;     /* cards, images */
  --radius-xl:   24px;     /* hero image container on tablet/desktop, CTA bands */
  --radius-pill: 999px;    /* language switcher, tags */
  --border-width: 1px;
  --border-width-control: 1.5px;

  /* Shadows use deep-blue tint, never pure black */
  --shadow-1: 0 1px 2px rgba(20, 40, 79, 0.08), 0 1px 3px rgba(20, 40, 79, 0.06);                 /* resting card */
  --shadow-2: 0 4px 12px rgba(20, 40, 79, 0.10), 0 2px 4px rgba(20, 40, 79, 0.06);                /* hover card, sticky header */
  --shadow-3: 0 12px 32px rgba(20, 40, 79, 0.16), 0 4px 8px rgba(20, 40, 79, 0.08);              /* menu sheet, modal */
  --shadow-bar: 0 -2px 12px rgba(20, 40, 79, 0.14);                                               /* mobile bottom bar */
  /* Shadows are vertical only, so they never need RTL changes. */
}


/* ----------------------------------------------------------------------------
   6. MOTION (subtle; respects prefers-reduced-motion)
   Allowed: fade, 8px slide-up on scroll reveal, hover lift of 2px, menu sheet slide.
   Not allowed: parallax, autoplay carousels, looping animation, auto-playing video with sound.
   ---------------------------------------------------------------------------- */
:root {
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}
@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0.01ms; --dur-base: 0.01ms; --dur-slow: 0.01ms; }
  html:focus-within { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ----------------------------------------------------------------------------
   7. Z-INDEX
   ---------------------------------------------------------------------------- */
:root {
  --z-base: 0;
  --z-sticky: 100;       /* header */
  --z-bar: 110;          /* mobile bottom action bar */
  --z-menu: 200;         /* mobile menu sheet */
  --z-skip: 300;         /* skip link */
}


/* ----------------------------------------------------------------------------
   8. IMAGE PLACEHOLDERS
   Every image slot is a box with a fixed aspect ratio. Real photo = <img> with
   object-fit: cover inside the same box, so nothing shifts when swapped.
   Placeholder look: brand gradient + subtle diagonal line pattern + white shield
   watermark + thin red corner bar. Pattern is an inline SVG (no extra request).
   ---------------------------------------------------------------------------- */
:root {
  --ph-gradient: linear-gradient(135deg, #29529c 0%, #1d3a70 60%, #14284f 100%);
  --ph-gradient-light: linear-gradient(135deg, #eef3fb 0%, #dbe5f6 100%);   /* for slots on blue sections */
  /* 24px diagonal lines, white at 7% opacity. */
  --ph-pattern: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><path d='M-6 6 L6 -6 M0 24 L24 0 M18 30 L30 18' stroke='white' stroke-opacity='0.07' stroke-width='2'/></svg>");
  --ph-watermark: url("assets/shield.png");   /* path relative to the CSS file; shown white at 12% via filter */
  --ph-accent-bar: 6px;                       /* red bar on the inline-start edge, width */
}

/* Ready-to-use placeholder block. Usage:
   <div class="ph" style="aspect-ratio: 4 / 3" role="img" aria-label="Photo placeholder: [slot name]"></div> */
.ph {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background-color: var(--blue-700);
  background-image: var(--ph-pattern), var(--ph-gradient);
  isolation: isolate;
}
.ph::before {                       /* red accent bar on the start edge (flips in RTL) */
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  inline-size: var(--ph-accent-bar);
  background: var(--red-600);       /* decorative, no text on it */
}
.ph::after {                        /* shield watermark, centered, does not flip */
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ph-watermark) center / auto 38% no-repeat;
  filter: brightness(0) invert(1);
  opacity: 0.12;
  z-index: -1;
}
.ph > img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }


/* ----------------------------------------------------------------------------
   9. RTL SUPPORT
   --flip is 1 in LTR and -1 in RTL. Use it for transforms and gradients that
   must mirror. .icon-flip mirrors directional icons only (arrows, chevrons,
   back/next, "read more", external-list bullets). Do NOT put it on logos,
   play button, phone/mail/pin/clock/check icons, or social brand icons.
   ---------------------------------------------------------------------------- */
:root { --flip: 1; }
:root[dir="rtl"], [dir="rtl"] { --flip: -1; }
.icon-flip { transform: scaleX(var(--flip)); }

/* Text that must stay left-to-right inside RTL pages (phone, email, URL, digits groups).
   Wrap in <bdi dir="ltr"> or add the class; keep it aligned to the start edge. */
.ltr-isolate { direction: ltr; unicode-bidi: isolate; text-align: start; }
[dir="rtl"] .ltr-isolate { text-align: right; }   /* the only allowed physical value: LTR strings sit at the visual right edge of an RTL block, which is the inline-start */

/* Language switcher keeps its visual order EN | کوردی | العربية in every language. */
.lang-switch { direction: ltr; unicode-bidi: isolate; }


/* ----------------------------------------------------------------------------
   10. COMPONENT TOKENS (so buttons, cards and forms stay consistent)
   ---------------------------------------------------------------------------- */
:root {
  /* Buttons: 48px high (56px large), 10px radius, 600 weight, text 16-18px.
     Primary  : bg --action,  text --on-action,  hover --action-hover
     Secondary: bg white,     text --blue-700, 2px border --blue-700, hover bg --blue-50
     On-dark  : bg white,     text --blue-700, hover bg --blue-100   (use on blue bands)
     Ghost    : no bg, text --blue-700, underline on hover (tertiary links)            */
  --btn-h: var(--control-h);
  --btn-h-lg: var(--control-h-lg);
  --btn-pad-inline: var(--space-6);
  --btn-radius: var(--radius-md);
  --btn-border: 2px;

  /* Cards: white, 1px --border, --radius-lg, --shadow-1, hover --shadow-2 and 2px lift.
     Card inner padding 20px mobile, 24px desktop. Whole card is one link target. */
  --card-pad: var(--space-5);
  --card-radius: var(--radius-lg);

  /* Forms: label above field (never placeholder-only labels), 48px fields,
     1.5px --border-control, white bg, radius 10px, label 15-16px weight 600,
     hint 14px --text-subtle. Error: border + text --error-text, message with icon,
     never color alone. Focus: see focus tokens. */
  --field-h: var(--control-h);
  --field-radius: var(--radius-md);
  --field-pad-inline: var(--space-4);
  --field-gap: var(--space-5);       /* vertical gap between fields */
}

/* Global focus style (keyboard only). Components must not remove it. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: var(--focus-offset);
}
/* On blue/dark bands add class .on-dark to the band to get a white ring. */
.on-dark :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline-color: var(--focus-color-on-dark);
}
