/* ==========================================================================
   VIVID — DESIGN TOKENS
   --------------------------------------------------------------------------
   High-energy, image-led DTC commerce for an industrial packaging printer.
   The theme's signature is a CONTRAST RHYTHM: crisp white sections alternating
   with full-bleed INK bands, with the Bakkar red used as a FLAT, confident
   block colour (never a gradient — that belongs to Momentum).

   ==========================================================================
   DARK MODE — READ THIS BEFORE YOU TOUCH A COLOUR
   ==========================================================================
   Vivid's identity IS the light → dark → light band rhythm. Dark mode does NOT
   flatten the page into one black sheet. It INVERTS the rhythm:

              LIGHT                          DARK
     page     #FFFFFF  white           →     #0A0B10  near-black
     .band--ink #0E1016  near-black    →     #262C3C  a LIFTED graphite slab
     .band--red #DA1920  solid red     →     #DA1920  solid red (unchanged)

   So in dark the page still reads as a STACK OF ALTERNATING BANDS — the band is
   simply the lighter tone instead of the darker one. Everything that used to
   live "on ink" (white headings, ink-200 body) still works, because the slab is
   still dark enough to carry white text (12.4:1).

   Cards sit one step above the page (--surface), and a card ON the band sits one
   step above the band (--surface-ink-card). The rhythm survives at every depth.

   THE RULE: never type a raw ramp value (--ink-900, --white) for a SURFACE, a
   BORDER or a TEXT colour. Use the semantic tokens in §2. The only legitimate
   raw usage is on top of a PHOTOGRAPH (a scrim, a badge sitting on an image) —
   those are theme-independent by nature.

   Driven by <html data-theme="light|dark">, stamped BEFORE first paint by the
   inline boot script in every page's <head>. The same block is repeated inside
   @media (prefers-color-scheme: dark) for :root:not([data-theme]) so a
   JS-disabled visitor on a dark OS still gets dark. KEEP THE TWO IN SYNC.
   ========================================================================== */


/* ==========================================================================
   0. SULTAN NAHIA — the self-hosted Arabic face, and the theme's DEFAULT.
   Ships as a single weight; the browser synthesises the bold, so the range is
   declared 400–700 rather than lying about a 700 file that does not exist.
   Self-hosted, so it works offline and over file:// — no network round-trip.
   ========================================================================== */
@font-face {
  font-family: 'Sultan Nahia';
  src: url('../fonts/SultanNahia.ttf') format('truetype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}


:root {
  color-scheme: light;

  /* ======================================================================
     1. RAW COLOUR RAMPS  (never used directly for surfaces / text / lines)
     ====================================================================== */

  /* --- Ink: the signature dark. Blue-black, not warm, not pure black. ---- */
  --ink-950: #08090D;
  --ink-900: #0E1016;   /* THE dark band colour in LIGHT mode */
  --ink-850: #14161F;
  --ink-800: #1A1D28;
  --ink-700: #262A38;
  --ink-600: #363B4D;
  --ink-500: #4C5266;
  --ink-400: #6B7186;
  --ink-300: #9096A8;
  --ink-200: #BFC3CF;
  --ink-100: #DFE1E8;
  --ink-050: #EEEFF3;
  --ink-025: #F6F7F9;

  /* --- Bakkar red. Flat block colour. -----------------------------------
     TWO reds, and the reason matters.

     #ED1C24 is the LOGO red. Against it, white text scores 4.38:1 and BLACK
     text scores 4.31:1 — i.e. NOTHING passes AA on it, because it sits at
     exactly the wrong luminance. So it cannot carry small text, full stop.

     --red-brand  #ED1C24  the identity. Used ONLY where no text sits on it:
                           the hero block, the underline rule, dots, ::selection.
     --red-500    #DA1920  the working red. 5.07:1 with white — every surface
                           that carries a LABEL (buttons, badges, the red band,
                           and the customiser's "Bakkar Red" header / sidebar).
     The two differ by 19/255 on one channel: side by side they read as the
     same red, and the brand block colour is genuinely on the page.
     --------------------------------------------------------------------- */
  --red-brand: #ED1C24;   /* logo / decorative fills only — never behind text */
  --red-700: #9E1016;     /* red TEXT on a white plate — 8.1:1 */
  --red-600: #C0161C;
  --red-500: #DA1920;   /* the working red — AA-safe with white text (5.07:1) */
  --red-400: #F4474D;
  --red-300: #FA7B7F;
  --red-200: #FDBFC2;
  --red-100: #FEE4E5;
  --red-050: #FFF1F1;

  /* --- Support: one warm neutral so white sections can breathe. ---------- */
  --sand-100: #F4F2ED;
  --sand-050: #FAF9F6;

  /* --- Utility ---------------------------------------------------------- */
  --white:   #FFFFFF;
  --black:   #08090D;


  /* ======================================================================
     2. SEMANTIC COLOUR — THE ONLY THING COMPONENTS MAY TYPE
     ====================================================================== */

  /* --- Surfaces --------------------------------------------------------- */
  --page:             var(--white);        /* the body canvas */
  --surface:          var(--white);        /* cards, panels, header, dialogs */
  --surface-raised:   var(--white);
  --surface-sunken:   var(--ink-025);      /* hover beds, inset strips, feet */
  --surface-warm:     var(--sand-050);
  --media-bed:        var(--ink-050);      /* the plate an <img> loads onto */

  /* The BAND. Full-bleed, alternating with the page. In dark it becomes the
     LIGHTER tone — that is how the rhythm survives the inversion. */
  --surface-ink:      var(--ink-900);
  --surface-ink-soft: var(--ink-850);
  --surface-ink-card: var(--ink-800);      /* a card sitting ON the band */
  --surface-ink-line: var(--ink-700);      /* its border */
  --band-edge:        transparent;         /* hairline that crisps the band in dark */

  /* The red band. Identical in both themes — the red keeps its punch. */
  --surface-red:      var(--red-500);

  /* --- Text ------------------------------------------------------------- */
  --text:             var(--ink-900);
  --text-strong:      var(--ink-900);
  --text-2:           var(--ink-700);      /* nav links, secondary UI */
  --text-muted:       var(--ink-500);
  --text-subtle:      var(--ink-400);
  --text-inverse:     var(--white);

  /* Text on the ink band (checked against BOTH band tones). */
  --text-on-ink:        var(--white);
  --text-on-ink-muted:  var(--ink-200);
  --text-on-ink-subtle: var(--ink-300);

  /* Text on red. Even on the darkened working red, a tinted "muted" pink only
     reaches ~3.9:1 — so body copy on a red band is PURE WHITE, and hierarchy
     is carried by weight and size instead of by tint. */
  --text-on-red:        var(--white);
  --text-on-red-muted:  var(--white);

  /* --- Brand ------------------------------------------------------------ */
  --brand:            var(--red-500);
  --brand-strong:     var(--red-600);
  --brand-ink:        var(--ink-900);
  /* Red as TEXT on the page is only 4.0:1 at #ED1C24, so link/eyebrow red is
     darkened in light — and BRIGHTENED in dark, where a dark red would vanish. */
  --brand-text:       var(--red-600);
  --brand-soft:       var(--red-050);      /* tinted plate */
  --brand-soft-fg:    var(--red-700);      /* text ON --brand-soft */
  /* Red TEXT sitting ON the ink band (kickers, small labels). The band is the
     one surface whose LUMINANCE MOVES between the themes, so this red has to
     move with it: #F4474D is 5.3:1 on the light-mode band (#0E1016) but only
     3.88:1 on the dark-mode band (#262C3C), which fails at 12px. */
  --brand-on-ink:     var(--red-400);

  /* --- INVERT — "a solid block of the opposite of the page" -------------
     The chunky solid slug behind: the default .btn, .btn--ink, an active chip,
     the .langsw / .viewsw / .seg thumb, .badge--ink, the avatar, a table head.
     In light it is ink-on-white; in dark it flips to white-on-ink, so a solid
     button never becomes a black hole on a black page. */
  --invert-bg:        var(--ink-900);
  --invert-bg-h:      var(--ink-800);
  --invert-fg:        var(--white);

  /* --- Lines. Vivid uses BOLD borders where they earn it. ---------------- */
  --line:             var(--ink-100);
  --line-strong:      var(--ink-200);
  --line-bold:        var(--ink-900);      /* THE signature 2px border */
  --line-on-ink:      rgba(255, 255, 255, 0.14);
  --line-on-red:      rgba(255, 255, 255, 0.28);

  /* --- Overlays: the only safe way to tint over an unknown ground -------- */
  --overlay-1:        rgba(14, 16, 22, 0.06);
  --overlay-2:        rgba(14, 16, 22, 0.12);
  --scrim:            rgba(8, 9, 13, 0.72);   /* dialog / drawer backdrop */

  /* --- Focus ------------------------------------------------------------ */
  --focus:            var(--ink-900);
  --focus-on-ink:     var(--white);
  --focus-on-red:     var(--white);

  /* --- Status ----------------------------------------------------------- */
  --ok-500:  #14804A;
  --ok-050:  #E7F4EC;
  --warn-500:#A66200;
  --warn-050:#FFF3E0;
  --err-500: #C8151C;
  --err-050: #FEE9EA;

  /* The <select> caret, as a token, so it can be recoloured for dark. */
  --caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230E1016' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  /* The checkbox tick, likewise (it is white on red in both themes). */
  --tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");


  /* ======================================================================
     3. TYPE
     ---------------------------------------------------------------------
     Manrope. Characterful, geometric, and it carries an 800 weight that
     looks built rather than merely bold. Headlines run HEAVY and TIGHT.
     ====================================================================== */
  --font-sans: 'Manrope', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --font-head: 'Manrope', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  /* THE ARABIC FACE. Sultan Nahia — the face the real bakkar-printing.com sets
     its Arabic in, self-hosted below. It is the DEFAULT, and it is swappable
     from the customiser (§13). It NEVER touches the Latin stacks above. */
  --font-ar:   'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
  --font-num:  'Manrope', ui-monospace, 'SF Mono', menlo, monospace;

  /* Fluid scale — 360px → 1440px. Display sizes are deliberately oversized. */
  --fs-3xs:  0.6875rem;                              /* 11px — micro labels  */
  --fs-2xs:  0.75rem;                                /* 12px — badges        */
  --fs-xs:   0.8125rem;                              /* 13px — meta          */
  --fs-sm:   0.875rem;                               /* 14px — UI            */
  --fs-md:   0.9375rem;                              /* 15px — body small    */
  --fs-base: 1rem;                                   /* 16px — body          */
  --fs-lg:   clamp(1.0625rem, 0.99rem + 0.32vw, 1.1875rem);
  --fs-xl:   clamp(1.1875rem, 1.09rem + 0.44vw, 1.4375rem);
  --fs-2xl:  clamp(1.375rem, 1.22rem + 0.69vw, 1.75rem);
  --fs-3xl:  clamp(1.625rem, 1.38rem + 1.09vw, 2.25rem);
  --fs-4xl:  clamp(2rem, 1.6rem + 1.78vw, 3rem);
  --fs-5xl:  clamp(2.375rem, 1.72rem + 2.91vw, 4rem);
  --fs-6xl:  clamp(2.75rem, 1.7rem + 4.67vw, 5.25rem);   /* hero h1 */
  --fs-display: clamp(3rem, 1.2rem + 8vw, 7rem);         /* marquee / numerals */

  --fw-normal:   400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;
  --fw-heavy:    800;   /* the theme's voice */

  --lh-tight:  1.02;
  --lh-snug:   1.14;
  --lh-head:   1.2;
  --lh-normal: 1.5;
  --lh-relax:  1.65;

  /* Tight tracking is a huge part of the Vivid voice. */
  --ls-display: -0.035em;
  --ls-head:    -0.025em;
  --ls-tight:   -0.015em;
  --ls-normal:  0;
  --ls-wide:    0.04em;
  --ls-caps:    0.11em;   /* micro-labels are CAPS + wide */


  /* ======================================================================
     4. SPACE  (4px base)
     ====================================================================== */
  --sp-1:  0.25rem;
  --sp-2:  0.5rem;
  --sp-3:  0.75rem;
  --sp-4:  1rem;
  --sp-5:  1.25rem;
  --sp-6:  1.5rem;
  --sp-7:  1.75rem;
  --sp-8:  2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-14: 3.5rem;
  --sp-16: 4rem;
  --sp-20: 5rem;
  --sp-24: 6rem;
  --sp-32: 8rem;

  /* Section rhythm — Vivid is DENSER than Momentum. */
  --section-y:      clamp(3.5rem, 2.6rem + 4vw, 6rem);
  --section-y-lg:   clamp(4.5rem, 3.2rem + 5.5vw, 7.5rem);
  --section-y-tight:clamp(2.5rem, 2rem + 2.4vw, 3.75rem);


  /* ======================================================================
     5. RADII — medium and purposeful. Present, never pillowy.
     ====================================================================== */
  --r-xs:   6px;
  --r-sm:   10px;
  --r-md:   14px;   /* the workhorse */
  --r-lg:   16px;   /* cards, media */
  --r-xl:   20px;   /* only the largest panels */
  --r-pill: 999px;


  /* ======================================================================
     6. BORDERS — Vivid commits to weight.
     ====================================================================== */
  --bw-hair:  1px;
  --bw:       2px;   /* the signature */
  --bw-thick: 3px;

  --border:        var(--bw-hair) solid var(--line);
  --border-strong: var(--bw) solid var(--line-strong);
  --border-bold:   var(--bw) solid var(--line-bold);
  --border-on-ink: var(--bw-hair) solid var(--line-on-ink);


  /* ======================================================================
     7. ELEVATION
     ---------------------------------------------------------------------
     Vivid does NOT do soft pillowy layers (Momentum's move). It does a
     HARD OFFSET SHADOW — a solid block sitting behind the card — plus one
     restrained ambient shadow for floating chrome.

     --block is the colour of that solid offset. In light it is the ink; in
     dark a black block on a black page is INVISIBLE, so it flips to a bright
     graphite. The RED block (--hard-red) never changes: red on black is the
     single loudest thing this theme owns.
     ====================================================================== */
  --block:      var(--ink-900);

  --shadow-xs:  0 1px 2px rgba(8, 9, 13, 0.06);
  --shadow-sm:  0 2px 6px rgba(8, 9, 13, 0.07);
  --shadow-md:  0 6px 18px rgba(8, 9, 13, 0.09);
  --shadow-lg:  0 16px 40px rgba(8, 9, 13, 0.13);
  --shadow-pop: 0 20px 50px rgba(8, 9, 13, 0.20);

  /* Hard offset "solid block" shadows — the Vivid signature. */
  --hard-ink:    6px 6px 0 0 var(--block);
  --hard-ink-sm: 4px 4px 0 0 var(--block);
  --hard-red:    6px 6px 0 0 var(--red-500);
  --hard-red-sm: 4px 4px 0 0 var(--red-500);
  --hard-white:  6px 6px 0 0 var(--white);

  /* Ring used for images on ink so they don't dissolve into the band. */
  --ring-on-ink: inset 0 0 0 1px rgba(255, 255, 255, 0.10);


  /* ======================================================================
     8. MOTION — confident and physical. Snappy, not floaty.
     ====================================================================== */
  --dur-1: 120ms;
  --dur-2: 180ms;   /* the default */
  --dur-3: 220ms;
  --dur-4: 260ms;   /* the ceiling for interactive feedback */
  --dur-reveal: 520ms;
  --dur-slow:   700ms;

  /* Snappy out-quint: fast departure, decisive arrival. NOT springy. */
  --ease:       cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:    cubic-bezier(0.5, 0, 0.75, 0);
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
  /* A single, tiny overshoot reserved for badges/toasts only. */
  --ease-pop:   cubic-bezier(0.2, 1.35, 0.5, 1);

  --t-fast:  var(--dur-2) var(--ease);
  --t-base:  var(--dur-3) var(--ease);
  --t-slow:  var(--dur-4) var(--ease);


  /* ======================================================================
     9. LAYOUT
     ====================================================================== */
  --container:      1280px;
  --container-wide: 1440px;
  --container-text: 68ch;
  --gutter:         clamp(1rem, 0.55rem + 2vw, 2.5rem);

  --hdr-h:      68px;
  --topbar-h:   36px;
  --rail-gap:   clamp(0.875rem, 0.6rem + 1.2vw, 1.5rem);
  --tap:        44px;

  /* Breakpoints (documented; CSS cannot read a custom property in a media
     query, so these are the literal values every stylesheet here uses):
       560  · 768  · 1024  · 1080 (nav ⇄ drawer)  · 1280  · 1440 */


  /* ======================================================================
     10. CHROME — the header + the mobile drawer.
     ---------------------------------------------------------------------
     Everything the header and the drawer paint themselves with resolves
     through these. The customiser's "Bakkar Red" options simply RE-POINT
     them (§12), so no component downstream has to know a red header exists.
     PAGE AGENTS: do not use these outside the chrome.
     ====================================================================== */
  --hdr-bg:          var(--surface);
  --hdr-line:        var(--line);
  --hdr-line-stuck:  var(--line-bold);     /* the hard 2px rule once scrolled */
  --hdr-sh-stuck:    0 10px 30px -18px rgba(8, 9, 13, 0.45);
  --hdr-fg:          var(--text);          /* brand wordmark */
  --hdr-fg-2:        var(--text-2);        /* nav links at rest */
  --hdr-fg-3:        var(--brand-text);    /* brand tagline */
  --hdr-hover-bg:    var(--surface-sunken);
  --hdr-hover-fg:    var(--text);
  --hdr-active-fg:   var(--text);
  --hdr-active-rule: var(--red-500);       /* the solid red block underline */
  --hdr-btn-bg:      var(--surface);
  --hdr-btn-bd:      var(--line);
  --hdr-btn-fg:      var(--text-2);
  --hdr-btn-bg-h:    var(--surface-sunken);
  --hdr-btn-bd-h:    var(--line-bold);
  --hdr-btn-fg-h:    var(--text);
  --hdr-seg-bg:      var(--surface);
  --hdr-seg-bd:      var(--line-bold);
  --hdr-seg-fg:      var(--text-muted);
  --hdr-seg-fg-on:   var(--invert-fg);
  --hdr-seg-thumb:   var(--invert-bg);
  --hdr-cta-bg:      var(--red-500);
  --hdr-cta-fg:      var(--white);
  --hdr-cta-bd:      var(--red-500);
  --hdr-cta-bg-h:    var(--red-600);
  --hdr-cta-block:   var(--block);         /* the hard block it shifts onto */
  --hdr-focus:       var(--focus);
  --hdr-mark-plate:  transparent;          /* white chip behind the logo, on red */

  /* Drawer — same vocabulary, its own switch. */
  --dw-bg:           var(--surface);
  --dw-bg-2:         var(--surface-sunken);  /* head + foot strips */
  --dw-line:         var(--line);
  --dw-line-bold:    var(--line-bold);
  --dw-fg:           var(--text);
  --dw-fg-2:         var(--text-2);
  --dw-fg-3:         var(--text-subtle);
  --dw-hover-bg:     var(--surface-sunken);
  --dw-active-fg:    var(--brand-text);
  --dw-active-rule:  var(--red-500);
  --dw-btn-bd:       var(--line);
  --dw-btn-fg:       var(--text);
  --dw-icon:         var(--brand-text);
  --dw-seg-bg:       var(--surface);
  --dw-seg-bd:       var(--line-bold);
  --dw-seg-fg:       var(--text-muted);
  --dw-seg-fg-on:    var(--invert-fg);
  --dw-seg-thumb:    var(--invert-bg);
  --dw-cta-bg:       var(--red-500);
  --dw-cta-fg:       var(--white);
  --dw-cta-bd:       var(--red-500);
  --dw-focus:        var(--focus);


  /* ======================================================================
     11. Z-INDEX LADDER
     ====================================================================== */
  --z-base:     0;
  --z-raised:   10;
  --z-sticky:   100;
  --z-header:   200;
  --z-dropdown: 300;
  /* The drawer's backdrop. It dims the page, never the drawer, so it must sit
     BELOW the panel it belongs to. */
  --z-scrim:    350;
  --z-drawer:   400;
  --z-overlay:  500;
  --z-modal:    600;
  --z-lightbox: 650;
  --z-toast:    700;
  --z-top:      900;
}


/* ==========================================================================
   DARK — the explicit choice.
   Mirrored VERBATIM in the prefers-color-scheme block at the bottom of this
   file, for the JS-disabled case. IF YOU CHANGE ONE, CHANGE BOTH.
   ========================================================================== */
:root[data-theme="dark"] {
  color-scheme: dark;

  /* The red is re-lit, not re-hued. #DA1920 as TEXT on a near-black page is
     only 4.0:1, so red TEXT comes up the ramp; red SURFACES keep #DA1920,
     which still carries white at 5.07:1. */
  --brand-text:       #FF767C;             /* red text on dark — 6.4:1 */
  --brand-soft:       rgba(218, 25, 32, 0.16);
  --brand-soft-fg:    #FF9BA0;
  --brand-on-ink:     #FF8B90;             /* 5.8:1 on the dark band #262C3C */

  /* --- Surfaces: the rhythm, inverted --------------------------------- */
  --page:             #0A0B10;             /* near-black canvas */
  --surface:          #14161E;             /* cards / header / dialogs, one step up */
  --surface-raised:   #191C25;
  --surface-sunken:   #191C25;
  --surface-warm:     #16181F;
  --media-bed:        #1E2230;

  /* THE BAND becomes the LIGHTER tone. This is the whole trick. */
  --surface-ink:      #262C3C;
  --surface-ink-soft: #2E3546;
  --surface-ink-card: #333B4E;
  --surface-ink-line: #454E64;
  --band-edge:        rgba(255, 255, 255, 0.09);

  --surface-red:      var(--red-500);      /* unchanged. The red keeps its punch. */

  /* --- Text ------------------------------------------------------------ */
  --text:             #F2F3F7;             /* 17:1 on --page */
  --text-strong:      #FFFFFF;
  --text-2:           #CDD2DE;
  --text-muted:       #A2A9BA;             /* 8.0:1 on --page, 5.0:1 on --surface-ink */
  --text-subtle:      #888FA2;             /* 5.6:1 on --page */
  --text-inverse:     var(--ink-900);

  /* On the (now lighter) band: white headings, ink-200 body — 7.4:1. */
  --text-on-ink:        var(--white);
  --text-on-ink-muted:  #C9CDD9;
  --text-on-ink-subtle: #A2A9BA;

  /* --- Invert: a solid LIGHT block on a dark page --------------------- */
  --invert-bg:        #EDEFF5;
  --invert-bg-h:      #FFFFFF;
  --invert-fg:        #0E1016;

  /* --- Lines ---------------------------------------------------------- */
  --line:             #262A35;
  --line-strong:      #373D4E;
  --line-bold:        #525A72;             /* the 2px signature border, lit */
  --line-on-ink:      rgba(255, 255, 255, 0.16);
  --line-on-red:      rgba(255, 255, 255, 0.28);

  --overlay-1:        rgba(255, 255, 255, 0.07);
  --overlay-2:        rgba(255, 255, 255, 0.14);
  --scrim:            rgba(3, 4, 6, 0.80);

  --focus:            #FFFFFF;
  --focus-on-ink:     #FFFFFF;
  --focus-on-red:     #FFFFFF;

  /* --- Status: lifted so the text clears AA on a dark plate ------------ */
  --ok-500:  #35D07F;
  --ok-050:  rgba(53, 208, 127, 0.14);
  --warn-500:#F0A939;
  --warn-050:rgba(240, 169, 57, 0.14);
  --err-500: #FF7078;                      /* 5.9:1 on --surface */
  --err-050: rgba(255, 112, 120, 0.13);

  --caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F2F3F7' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");

  /* --- Elevation: the hard block has to be LIGHT or it is invisible ----- */
  --block:      #C5CBD9;
  --shadow-lg:  0 16px 40px rgba(0, 0, 0, 0.55);
  --shadow-pop: 0 20px 50px rgba(0, 0, 0, 0.65);
  --shadow-md:  0 6px 18px rgba(0, 0, 0, 0.45);
  --shadow-sm:  0 2px 6px rgba(0, 0, 0, 0.40);
  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.35);
  --hard-white: 6px 6px 0 0 #C5CBD9;

  /* --- Chrome ---------------------------------------------------------- */
  --hdr-sh-stuck:    0 10px 30px -14px rgba(0, 0, 0, 0.8);
  --hdr-btn-bg:      var(--surface-raised);
  --hdr-btn-bg-h:    var(--surface-ink);
  --hdr-seg-bg:      var(--surface-raised);
  --dw-bg-2:         #101219;
}


/* ==========================================================================
   12. "BAKKAR RED" CHROME — the customiser's header / sidebar option.
   It does exactly one thing: re-point the chrome tokens at an inverted,
   WHITE-ON-RED treatment. Works in light AND dark, EN AND AR, because nothing
   downstream knows it exists.

   LEGIBILITY. The plate is the working red #DA1920 — white on it is 5.07:1, so
   white nav labels, white icons and white small text all clear AA. (The logo
   red #ED1C24 is only 4.38:1 and could not carry them.) The focus ring goes
   WHITE, because an ink ring on red is invisible. Any control that INVERTS to a
   white plate takes --red-700 (#9E1016 — 8.1:1 on white) for its text, not the
   surface red.

   It is a FLAT solid fill. There is no gradient anywhere in this theme.
   ========================================================================== */
:root[data-header="red"] {
  --hdr-bg:          var(--red-500);
  --hdr-line:        rgba(255, 255, 255, 0.22);
  --hdr-line-stuck:  var(--white);
  --hdr-sh-stuck:    0 10px 30px -16px rgba(8, 9, 13, 0.65);
  --hdr-fg:          var(--white);
  --hdr-fg-2:        var(--white);
  --hdr-fg-3:        var(--white);        /* 0.88 white on #DA1920 is 4.15:1 — it must be PURE white */
  --hdr-hover-bg:    rgba(255, 255, 255, 0.18);
  --hdr-hover-fg:    var(--white);
  --hdr-active-fg:   var(--white);
  --hdr-active-rule: var(--white);
  --hdr-btn-bg:      transparent;
  --hdr-btn-bd:      rgba(255, 255, 255, 0.42);
  --hdr-btn-fg:      var(--white);
  --hdr-btn-bg-h:    var(--white);
  --hdr-btn-bd-h:    var(--white);
  --hdr-btn-fg-h:    var(--red-700);
  --hdr-seg-bg:      rgba(8, 9, 13, 0.24);
  --hdr-seg-bd:      var(--white);
  --hdr-seg-fg:      var(--white);
  --hdr-seg-fg-on:   var(--red-700);       /* red on a white thumb — 8.1:1 */
  --hdr-seg-thumb:   var(--white);
  /* A red CTA on a red bar would vanish. It inverts: a solid white block with
     deep-red type — which is MORE prominent, not less. */
  --hdr-cta-bg:      var(--white);
  --hdr-cta-fg:      var(--red-700);
  --hdr-cta-bd:      var(--white);
  --hdr-cta-bg-h:    var(--white);
  --hdr-cta-block:   var(--ink-900);
  --hdr-focus:       var(--focus-on-red);
  /* The logo is itself a red mark: on a red bar it reads as a smudge, so it
     gets a hard white chip. */
  --hdr-mark-plate:  var(--white);
}

:root[data-sidebar="red"] {
  --dw-bg:           var(--red-500);
  --dw-bg-2:         rgba(8, 9, 13, 0.22);
  --dw-line:         rgba(255, 255, 255, 0.26);
  --dw-line-bold:    var(--white);
  --dw-fg:           var(--white);
  --dw-fg-2:         var(--white);
  --dw-fg-3:         var(--white);         /* tinted white on red never clears AA — hierarchy is weight/size */
  --dw-hover-bg:     rgba(255, 255, 255, 0.18);
  --dw-active-fg:    var(--white);
  --dw-active-rule:  var(--white);
  --dw-btn-bd:       rgba(255, 255, 255, 0.42);
  --dw-btn-fg:       var(--white);
  --dw-icon:         var(--white);
  --dw-seg-bg:       rgba(8, 9, 13, 0.24);
  --dw-seg-bd:       var(--white);
  --dw-seg-fg:       var(--white);
  --dw-seg-fg-on:    var(--red-700);
  --dw-seg-thumb:    var(--white);
  --dw-cta-bg:       var(--white);
  --dw-cta-fg:       var(--red-700);
  --dw-cta-bd:       var(--white);
  --dw-focus:        var(--focus-on-red);
}


/* ==========================================================================
   13. ARABIC FONT — the customiser's fourth choice.
   ---------------------------------------------------------------------------
   ONE token moves: --font-ar. Nothing else. The Latin stacks (--font-sans /
   --font-head in §3) are Manrope and they STAY Manrope — the Latin voice is
   part of Vivid's identity and is not up for negotiation.

   Driven by <html data-font="…">, stamped BEFORE first paint by the boot script
   in every <head>, exactly like data-theme / data-header / data-sidebar.

   No attribute (JS off) and data-font="sultan" both resolve to the :root value
   in §3 — Sultan Nahia, the live site's face. The other ten are Google Fonts,
   and their stylesheets are injected LAZILY by app.js — once, on demand — so a
   visitor who never opens the customiser pays for zero of them.
   ========================================================================== */
:root[data-font="sultan"]    { --font-ar: 'Sultan Nahia', 'Segoe UI', system-ui, 'Tahoma', sans-serif; }
:root[data-font="cairo"]     { --font-ar: 'Cairo', 'Segoe UI', system-ui, 'Tahoma', sans-serif; }
:root[data-font="tajawal"]   { --font-ar: 'Tajawal', 'Segoe UI', system-ui, 'Tahoma', sans-serif; }
:root[data-font="almarai"]   { --font-ar: 'Almarai', 'Segoe UI', system-ui, 'Tahoma', sans-serif; }
:root[data-font="plexar"]    { --font-ar: 'IBM Plex Sans Arabic', 'Segoe UI', system-ui, 'Tahoma', sans-serif; }
:root[data-font="notosans"]  { --font-ar: 'Noto Sans Arabic', 'Segoe UI', system-ui, 'Tahoma', sans-serif; }
:root[data-font="notokufi"]  { --font-ar: 'Noto Kufi Arabic', 'Segoe UI', system-ui, 'Tahoma', sans-serif; }
:root[data-font="vazirmatn"] { --font-ar: 'Vazirmatn', 'Segoe UI', system-ui, 'Tahoma', sans-serif; }
:root[data-font="changa"]    { --font-ar: 'Changa', 'Segoe UI', system-ui, 'Tahoma', sans-serif; }
:root[data-font="elmessiri"] { --font-ar: 'El Messiri', 'Segoe UI', system-ui, 'Tahoma', sans-serif; }
:root[data-font="amiri"]     { --font-ar: 'Amiri', 'Segoe UI', 'Tahoma', serif; }


/* ==========================================================================
   ARABIC — swap the family, and relax the tracking (Arabic must never be
   negatively tracked; the letterforms connect).

   The page's Arabic type resolves through --font-ar, so the customiser's font
   choice reaches every heading and every paragraph without a single component
   knowing about it.
   ========================================================================== */
[dir="rtl"] {
  --font-sans: var(--font-ar);
  --font-head: var(--font-ar);
  --font-num:  'Manrope', var(--font-ar);

  --ls-display: 0;
  --ls-head:    0;
  --ls-tight:   0;
  --ls-caps:    0.02em;

  /* Arabic faces run large on the body and short on the ascenders — pull the
     display sizes back a touch and give the lines a little more air. */
  --fs-6xl:  clamp(2.25rem, 1.45rem + 3.6vw, 4.25rem);
  --fs-5xl:  clamp(2rem, 1.5rem + 2.2vw, 3.25rem);
  --lh-tight: 1.22;
  --lh-snug:  1.35;
  --lh-head:  1.4;
}


/* ==========================================================================
   REDUCED MOTION — collapse every duration to near-zero at the token level,
   so nothing has to opt out individually.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-1: 1ms; --dur-2: 1ms; --dur-3: 1ms; --dur-4: 1ms;
    --dur-reveal: 1ms; --dur-slow: 1ms;
  }
}


/* ==========================================================================
   NO-JS DARK FALLBACK.
   The boot script in <head> stamps data-theme on <html> before first paint, so
   this block only ever fires when scripting is OFF. It is a VERBATIM copy of
   the :root[data-theme="dark"] block above. CHANGE ONE, CHANGE BOTH.
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;

    --brand-text:       #FF767C;
    --brand-soft:       rgba(218, 25, 32, 0.16);
    --brand-soft-fg:    #FF9BA0;
    --brand-on-ink:     #FF8B90;

    --page:             #0A0B10;
    --surface:          #14161E;
    --surface-raised:   #191C25;
    --surface-sunken:   #191C25;
    --surface-warm:     #16181F;
    --media-bed:        #1E2230;

    --surface-ink:      #262C3C;
    --surface-ink-soft: #2E3546;
    --surface-ink-card: #333B4E;
    --surface-ink-line: #454E64;
    --band-edge:        rgba(255, 255, 255, 0.09);

    --surface-red:      var(--red-500);

    --text:             #F2F3F7;
    --text-strong:      #FFFFFF;
    --text-2:           #CDD2DE;
    --text-muted:       #A2A9BA;
    --text-subtle:      #888FA2;
    --text-inverse:     var(--ink-900);

    --text-on-ink:        var(--white);
    --text-on-ink-muted:  #C9CDD9;
    --text-on-ink-subtle: #A2A9BA;

    --invert-bg:        #EDEFF5;
    --invert-bg-h:      #FFFFFF;
    --invert-fg:        #0E1016;

    --line:             #262A35;
    --line-strong:      #373D4E;
    --line-bold:        #525A72;
    --line-on-ink:      rgba(255, 255, 255, 0.16);
    --line-on-red:      rgba(255, 255, 255, 0.28);

    --overlay-1:        rgba(255, 255, 255, 0.07);
    --overlay-2:        rgba(255, 255, 255, 0.14);
    --scrim:            rgba(3, 4, 6, 0.80);

    --focus:            #FFFFFF;
    --focus-on-ink:     #FFFFFF;
    --focus-on-red:     #FFFFFF;

    --ok-500:  #35D07F;
    --ok-050:  rgba(53, 208, 127, 0.14);
    --warn-500:#F0A939;
    --warn-050:rgba(240, 169, 57, 0.14);
    --err-500: #FF7078;
    --err-050: rgba(255, 112, 120, 0.13);

    --caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F2F3F7' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");

    --block:      #C5CBD9;
    --shadow-lg:  0 16px 40px rgba(0, 0, 0, 0.55);
    --shadow-pop: 0 20px 50px rgba(0, 0, 0, 0.65);
    --shadow-md:  0 6px 18px rgba(0, 0, 0, 0.45);
    --shadow-sm:  0 2px 6px rgba(0, 0, 0, 0.40);
    --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.35);
    --hard-white: 6px 6px 0 0 #C5CBD9;

    --hdr-sh-stuck:    0 10px 30px -14px rgba(0, 0, 0, 0.8);
    --hdr-btn-bg:      var(--surface-raised);
    --hdr-btn-bg-h:    var(--surface-ink);
    --hdr-seg-bg:      var(--surface-raised);
    --dw-bg-2:         #101219;
  }
}
