/* chertBI — additions on top of the shared CHERT site styles (site.css, shell.css), the same way
   chertfleet.css and cherttt.css extend them. The doors, capabilities, engines and gallery blocks are
   chertfleet's (fl-*), kept identical so the family reads as one; bi-* is what only chertBI has:
   the hero KPI card, the chart library, the chertERP embedding diagram. Tokens only. */

/* ------------------------------------------------------------- brand --- */
.bi-brand img { width: auto; }

/* ---------------------------------------------------- hero: KPI card --- */
.bi-kpi { position: absolute; right: 0; bottom: calc(-86 * var(--u)); width: calc(258 * var(--u)); padding: 14px 16px; border-radius: var(--radius-card);
  border: 1px solid var(--chert-dark-border); background: color-mix(in srgb, var(--chert-dark-surface) 82%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: var(--shadow-modal); animation: sx-float 7s ease-in-out infinite; color: var(--chert-dark-text); }
.bi-kpi__head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--chert-dark-muted); }
.bi-kpi__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chert-orange); animation: sx-blink 1.6s ease-in-out infinite; flex: none; }
.bi-kpi__tag { margin-inline-start: auto; font-size: 10.5px; padding: 1px 7px; border-radius: var(--radius-pill); border: 1px solid var(--chert-dark-border); }
.bi-kpi__value { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; direction: ltr; }
.bi-kpi__value b { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.bi-kpi__delta { font-size: 13px; font-weight: 700; color: var(--chert-success); }
.bi-kpi__vs { font-size: 11.5px; color: var(--chert-dark-muted); }
.bi-kpi__bars { display: flex; align-items: flex-end; gap: 4px; height: 44px; margin: 12px 0 10px; direction: ltr; }
.bi-kpi__bars span { flex: 1; height: var(--h); border-radius: 2px 2px 0 0; background: color-mix(in srgb, var(--chert-orange) 38%, transparent); transform-origin: bottom;
  animation: bi-grow 1.2s var(--ease) both; }
.bi-kpi__bars span.is-now { background: var(--chert-orange); }
@keyframes bi-grow { from { transform: scaleY(.15); opacity: .3; } }
.bi-kpi__regions { list-style: none; margin: 0; padding: 10px 0 0; border-top: 1px solid var(--chert-dark-border); display: grid; gap: 6px; }
.bi-kpi__regions li { display: grid; grid-template-columns: 62px 1fr 34px; align-items: center; gap: 8px; font-size: 11.5px; color: var(--chert-dark-muted); }
.bi-kpi__regions i { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--chert-orange) var(--w), color-mix(in srgb, var(--chert-dark-border) 70%, transparent) var(--w)); }
.bi-kpi__regions b { font-weight: 600; color: var(--chert-dark-text); text-align: end; font-variant-numeric: tabular-nums; }
.bi-kpi__foot { margin-top: 10px; font-family: var(--font-mono); font-size: 11px; color: var(--chert-dark-muted); }
@media (max-width: 760px) { .bi-kpi { display: none; } }

/* ------------------------------------------------------------- doors --- */
.fl-doors { background: var(--chert-surface-alt); }

/* ------------------------------------------------------ capabilities --- */
.fl-caps { background: var(--chert-surface-alt); }
.fl-caps__grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); }
.fl-cap { display: flex; flex-direction: column; padding: 22px 22px 18px; border-radius: 18px; border: 1px solid var(--chert-border); background: var(--chert-surface);
  transition: translate var(--dur-slow) var(--ease), box-shadow var(--dur-slow), border-color var(--dur-slow), opacity .8s var(--ease), transform .8s var(--ease); }
.js .fl-cap.sx-reveal { transition-delay: 0s, 0s, 0s, calc(var(--k, 0) * 60ms), calc(var(--k, 0) * 60ms); }
.fl-cap:hover { translate: 0 -3px; box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--chert-orange) 50%, var(--chert-border)); }
.fl-cap__top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.fl-cap__top .sx-pillar__icon { margin: 0; flex: none; }
.fl-cap h3 { margin: 0; font-size: 18px; line-height: 1.25; }
.fl-cap ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.fl-cap li { position: relative; padding-inline-start: 18px; font-size: 14.5px; color: var(--chert-muted); line-height: 1.45; }
.fl-cap li::before { content: ""; position: absolute; left: 2px; top: .55em; width: 7px; height: 7px; border-radius: 2px; background: var(--chert-orange); transform: rotate(45deg); }
[lang="ar"] .fl-cap li { line-height: var(--lh-ar); }

/* ----------------------------------------------------- chart library --- */
.bi-charts { background: var(--chert-surface); }
.bi-charts__groups { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); }
.bi-charts__group { padding: 22px; border-radius: 20px; border: 1px solid var(--chert-border); background: var(--chert-surface-alt); }
.js .bi-charts__group.sx-reveal { transition-delay: calc(var(--k, 0) * 90ms); }
.bi-charts__group h3 { margin: 0 0 14px; font-size: 16px; font-weight: 600; color: var(--chert-ink); }
.bi-charts__grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.bi-viz { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px 10px; border-radius: 14px; border: 1px solid var(--chert-border); background: var(--chert-surface);
  font-size: 13px; text-align: center; color: var(--chert-ink); line-height: 1.3;
  transition: translate var(--dur-slow) var(--ease), box-shadow var(--dur-slow), border-color var(--dur-slow); }
.bi-viz:hover { translate: 0 -3px; box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--chert-orange) 50%, var(--chert-border)); }
.bi-viz svg { width: 100%; max-width: 96px; height: auto; overflow: visible; }
.bi-viz svg * { stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bi-viz .s { fill: none; stroke: var(--chert-orange); }
.bi-viz .t { fill: none; stroke: color-mix(in srgb, var(--chert-ink) 30%, transparent); stroke-width: 1.4; }
.bi-viz .fa { fill: var(--chert-orange); stroke: none; }
.bi-viz .fb { fill: color-mix(in srgb, var(--chert-ink) 72%, var(--chert-surface)); stroke: none; }
.bi-viz .fc { fill: color-mix(in srgb, var(--chert-orange) 30%, var(--chert-surface)); stroke: none; }
.bi-viz .hd { fill: color-mix(in srgb, var(--chert-ink) 14%, var(--chert-surface)); stroke: none; }
.bi-viz .a { fill: var(--chert-orange); }
.bi-viz .b { fill: color-mix(in srgb, var(--chert-ink) 72%, var(--chert-surface)); }
.bi-viz .track { stroke: color-mix(in srgb, var(--chert-ink) 12%, var(--chert-surface)); }
.bi-viz .arc { stroke: var(--chert-orange); }
.bi-viz .flow { fill: color-mix(in srgb, var(--chert-orange) 35%, transparent); stroke: none; }
.bi-viz .flow2 { fill: color-mix(in srgb, var(--chert-ink) 22%, transparent); stroke: none; }
.bi-viz .bg { fill: none; stroke: color-mix(in srgb, var(--chert-ink) 12%, var(--chert-surface)); stroke-width: 6; }
.bi-viz .ring { stroke: var(--chert-orange); stroke-width: 6; stroke-linecap: butt; }
.bi-viz text { font-family: var(--font-ui); }
@media (max-width: 520px) { .bi-charts__grid { grid-template-columns: repeat(2, 1fr); } }

/* --------------------------------------------- chertERP embedding --- */
.bi-embed { color: var(--chert-dark-text); background:
  radial-gradient(55% 45% at 85% 10%, color-mix(in srgb, var(--chert-orange) 12%, transparent), transparent 70%), var(--chert-dark); }
.bi-embed .sx-eyebrow { color: var(--chert-orange); }
.bi-embed__grid { display: grid; gap: 26px; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 980px) { .bi-embed__grid { grid-template-columns: 1fr; } }

.bi-flow { padding: 22px; border-radius: 20px; border: 1px solid var(--chert-dark-border); background: color-mix(in srgb, var(--chert-dark-surface) 70%, transparent); }
.bi-flow__lanes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.bi-flow__lane { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px; border-radius: 14px; text-align: center;
  border: 1px solid var(--chert-dark-border); background: var(--chert-dark-surface); font-size: 14px; }
.bi-flow__lane:last-child { border-color: color-mix(in srgb, var(--chert-orange) 55%, var(--chert-dark-border)); }
.bi-flow__laneicon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: var(--chert-orange);
  background: color-mix(in srgb, var(--chert-orange) 14%, transparent); }
.bi-flow__steps { list-style: none; margin: 0; padding: 6px 0 0; position: relative;
  background: linear-gradient(90deg, transparent calc(100% / 6 - 1px), var(--chert-dark-border) 0 calc(100% / 6 + 1px), transparent 0 calc(300% / 6 - 1px),
                              var(--chert-dark-border) 0 calc(300% / 6 + 1px), transparent 0 calc(500% / 6 - 1px), var(--chert-dark-border) 0 calc(500% / 6 + 1px), transparent 0); }
.bi-flow__step { display: grid; grid-template-columns: repeat(6, 1fr); padding: 12px 0 6px; }
.bi-flow__arrow { grid-column: var(--from) / var(--to); grid-row: 1; position: relative; height: 26px; }
.bi-flow__arrow::before { content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 2px; background: var(--chert-orange);
  transform-origin: left; animation: bi-draw 1s var(--ease) both; animation-delay: calc(var(--k) * 180ms); }
.bi-flow__step--back .bi-flow__arrow::before { transform-origin: right; background: var(--chert-success); }
.bi-flow__arrow::after { content: ""; position: absolute; top: 7px; width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.bi-flow__step--fwd .bi-flow__arrow::after { right: -2px; border-left: 10px solid var(--chert-orange); }
.bi-flow__step--back .bi-flow__arrow::after { left: -2px; border-right: 10px solid var(--chert-success); }
@keyframes bi-draw { from { transform: scaleX(0); } }
.bi-flow__n { position: absolute; left: 50%; top: 0; translate: -50% 0; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  font-size: 12px; font-weight: 700; color: var(--chert-dark); background: var(--chert-orange); box-shadow: 0 0 0 4px var(--chert-dark); }
.bi-flow__step--back .bi-flow__n { background: var(--chert-success); }
.bi-flow__step p { grid-column: var(--from) / var(--to); grid-row: 2; margin: 6px 0 0; padding: 0 6px; font-size: 13.5px; line-height: 1.45; text-align: center;
  color: var(--chert-dark-muted); }
.bi-flow__step:nth-child(1) p, .bi-flow__step:nth-child(4) p { min-width: 0; }
@media (max-width: 620px) { .bi-flow__step p { grid-column: 1 / -1; } .bi-flow__lane { font-size: 12px; } }

.bi-embed__facts { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.bi-embed__facts li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--chert-dark-border);
  background: color-mix(in srgb, var(--chert-dark-surface) 70%, transparent); font-size: 14.5px; }
.bi-embed__facts .sx-pillar__icon { margin: 0; flex: none; width: 34px; height: 34px; }
.bi-code { margin: 0; border-radius: 16px; overflow: hidden; border: 1px solid var(--chert-dark-border); background: color-mix(in srgb, var(--chert-dark) 60%, #000); }
.bi-code figcaption { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 12.5px; color: var(--chert-dark-muted); border-bottom: 1px solid var(--chert-dark-border); }
.bi-code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; color: var(--chert-dark-text); text-align: left; }

/* ----------------------------------------------------------- engines --- */
.fl-engines { background: var(--chert-cream); }
.fl-engines__grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.fl-engine { position: relative; display: flex; flex-direction: column; padding: 26px; border-radius: 20px; border: 1px solid var(--chert-border); background: var(--chert-surface);
  transition: translate var(--dur-slow) var(--ease), box-shadow var(--dur-slow), border-color var(--dur-slow), opacity .8s var(--ease), transform .8s var(--ease); }
.js .fl-engine.sx-reveal { transition-delay: calc(var(--k, 0) * 90ms), 0s, 0s, calc(var(--k, 0) * 90ms), calc(var(--k, 0) * 90ms); }
.fl-engine:hover { translate: 0 -4px; box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--chert-orange) 50%, var(--chert-border)); }
.fl-engine__kicker { margin: 18px 0 2px; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--chert-orange-deep); }
[lang="ar"] .fl-engine__kicker { letter-spacing: normal; font-size: 13px; text-transform: none; }
.fl-engine h3 { margin: 0 0 8px; font-size: 20px; line-height: 1.25; }
.fl-engine p:not(.fl-engine__kicker) { margin: 0 0 14px; color: var(--chert-muted); }
.fl-engine__link { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 12.5px; color: var(--chert-ink); text-decoration: none; }
a.fl-engine__link:hover { color: var(--chert-orange-deep); }
span.fl-engine__link { color: var(--chert-muted); }

/* ----------------------------------------------------------- gallery --- */
.fl-gallery { color: var(--chert-dark-text); background:
  radial-gradient(60% 50% at 50% 0%, color-mix(in srgb, var(--chert-orange) 14%, transparent), transparent 70%), var(--chert-dark); }
.fl-gallery .sx-eyebrow { color: var(--chert-orange); }
.fl-gallery__grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
@media (min-width: 900px) { .bi-gallery { grid-template-columns: repeat(2, 1fr); } .bi-shot--wide { grid-column: 1 / -1; } }
.fl-shot { margin: 0; border-radius: 16px; overflow: hidden; border: 1px solid var(--chert-dark-border); background: var(--chert-dark-surface); box-shadow: var(--shadow-modal);
  transition: translate var(--dur-slow) var(--ease), border-color var(--dur-slow), opacity .8s var(--ease), transform .8s var(--ease); }
.js .fl-shot.sx-reveal { transition-delay: 0s, 0s, calc(var(--k, 0) * 110ms), calc(var(--k, 0) * 110ms); }
.fl-shot:hover { translate: 0 -4px; border-color: color-mix(in srgb, var(--chert-orange) 55%, var(--chert-dark-border)); }
.fl-shot__frame { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--chert-dark-border); }
.fl-shot__frame span { width: 9px; height: 9px; border-radius: 50%; background: var(--chert-dark-border); }
.fl-shot img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
.fl-shot figcaption { padding: 12px 16px 14px; font-size: 14px; color: var(--chert-dark-muted); }

/* ------------------------------------------------------------ Arabic --- */
[lang="ar"] .sx-eyebrow { text-transform: none; }
/* Labels that mix Arabic with Latin product names ("لماذا chertBI") take their direction from their first
   strong character, like shell.css does for text blocks; Arabic never sits in the mono face. */
[lang="ar"] .fl-shot figcaption, [lang="ar"] .fl-cap li, [lang="ar"] .fl-engine__kicker, [lang="ar"] .bi-viz span,
[lang="ar"] .bi-flow__step p, [lang="ar"] .bi-flow__lane b, [lang="ar"] .bi-embed__facts li, [lang="ar"] .bi-charts__group h3,
[lang="ar"] .bi-kpi__head, [lang="ar"] .bi-kpi__vs, [lang="ar"] .bi-kpi__regions span { unicode-bidi: plaintext; }
[lang="ar"] .sx-nav__links a, [lang="ar"] .sx-nav__actions a, [lang="ar"] .btn, [lang="ar"] .sx-btn-ghost,
[lang="ar"] .sx-jbtn, [lang="ar"] .sx-foot__links a { unicode-bidi: plaintext; }
[lang="ar"] span.fl-engine__link, [lang="ar"] .bi-kpi__foot, [lang="ar"] .bi-code figcaption { font-family: var(--font-ar); font-size: 13px; unicode-bidi: plaintext; }
[lang="ar"] .bi-charts__group, [lang="ar"] .bi-embed__facts li, [lang="ar"] .bi-kpi__head { direction: rtl; }
[lang="ar"] .bi-flow__step p, [lang="ar"] .bi-embed__facts li { line-height: var(--lh-ar); }
