/* Base, typography and shared primitives. Owned by lead. */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: auto; }
body { margin: 0; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:where(svg) { flex-shrink: 0; }

/* ---------- Page ---------- */
html { background: var(--page-bg); }
body {
  background: var(--page-bg);
  color: var(--page-ink);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
:lang(ar) body, html:lang(ar) { font-family: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif; }
::selection { background: var(--z-blue); color: #fff; }

/* Film grain: one fixed layer, very light. */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9000;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.2 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* ---------- Layout ---------- */
.container { width: 100%; max-width: calc(var(--maxw) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.container--wide { max-width: calc(1440px + var(--gutter) * 2); }
.section { position: relative; padding-block: var(--section-y); }
.stack > * + * { margin-block-start: var(--stack, var(--s-4)); }
.center { text-align: center; margin-inline: auto; }
.measure { max-width: var(--maxw-text); }

/* Section header (PulseBoard: centred title + one-line sub) */
.sec-head { display: grid; justify-items: center; text-align: center; gap: var(--s-4); margin-inline: auto; max-width: 52rem; margin-block-end: clamp(40px, 5vw, 64px); }
.sec-head--start { justify-items: start; text-align: start; margin-inline: 0; }

/* ---------- Typography ---------- */
.t-display, .t-h2, .t-h3, .t-bonat { font-family: var(--font-display); font-weight: 600; letter-spacing: -.022em; line-height: var(--lh-tight); text-wrap: balance; }
.t-display { font-size: var(--fs-hero); letter-spacing: -.03em; }
.t-h2 { font-size: var(--fs-h2); }
.t-h3 { font-size: var(--fs-h3); line-height: var(--lh-snug); }
.t-h4 { font-family: var(--font-ui); font-size: var(--fs-h4); font-weight: 500; letter-spacing: -.02em; line-height: 1.33; }
.t-bonat { font-weight: 880; letter-spacing: -.01em; line-height: .96; }
:lang(en) .t-bonat { text-transform: uppercase; }
:lang(ar) .t-display, :lang(ar) .t-h2, :lang(ar) .t-h3, :lang(ar) .t-bonat { letter-spacing: 0; line-height: var(--lh-tight); }
.t-lead { font-size: var(--fs-lead); line-height: 1.55; letter-spacing: -.01em; color: var(--page-ink-2); text-wrap: pretty; }
.t-body { font-size: var(--fs-body); line-height: var(--lh-body); color: var(--page-ink-2); text-wrap: pretty; }
.t-small { font-size: var(--fs-small); line-height: 1.5; }
.t-xs { font-size: var(--fs-xs); line-height: 1.5; }
.t-eyebrow { font-family: var(--font-ui); font-size: .8125rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
:lang(ar) .t-eyebrow { letter-spacing: 0; text-transform: none; font-size: .9375rem; }
.t-hand { font-family: var(--font-hand); font-weight: 600; font-size: 1.5rem; line-height: 1.1; color: var(--z-blue); }
:lang(ar) .t-hand { font-family: "IBM Plex Sans Arabic", sans-serif; font-size: 1rem; font-weight: 600; }
.t-num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.ink-2 { color: var(--page-ink-2); }
.ink-3 { color: var(--page-ink-3); }

/* Amount: riyal symbol + number, kept together; symbol leads in both directions like the product UI. */
.amt { display: inline-flex; align-items: baseline; gap: .12em; white-space: nowrap; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.sar { display: inline-block; width: .74em; height: .82em; vertical-align: -.06em; fill: currentColor; flex: none; }
.amt .sar { align-self: center; transform: translateY(-.02em); }

/* Icons (Phosphor via {{icon:name}}) default to 1.25em; size with your own class. */
.ico { width: 1.25em; height: 1.25em; display: inline-block; vertical-align: -.2em; }

/* ---------- Buttons (PulseBoard pills) ---------- */
.btn {
  --btn-bg: var(--z-blue); --btn-ink: #fff;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: 12px 22px;
  border-radius: var(--r-pill);
  background: var(--btn-bg); color: var(--btn-ink);
  font-family: var(--font-ui); font-size: 1rem; font-weight: 500; line-height: 1.2; letter-spacing: -.01em;
  white-space: nowrap;
  transition: transform var(--t-fast) var(--ease-out), background-color var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out), color var(--t-base);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.975); }
.btn--primary { box-shadow: var(--sh-btn); }
.btn--primary:hover { background: var(--z-blue-600); }
.btn--ghost { --btn-bg: rgba(255, 255, 255, .55); --btn-ink: var(--ink); border: 1px solid rgba(0, 0, 0, .1); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.btn--ghost:hover { --btn-bg: #fff; border-color: rgba(0, 0, 0, .16); }
.btn--dark { --btn-bg: var(--ink); --btn-ink: #fff; }
.btn--light { --btn-bg: #fff; --btn-ink: var(--ink); }
.btn--plum { --btn-bg: var(--b-plum); --btn-ink: #fff; }
.btn--lilac { --btn-bg: var(--b-lilac); --btn-ink: var(--b-plum); }
.btn--sm { min-height: 38px; padding: 8px 16px; font-size: .875rem; }
.btn .ico { width: 1.1em; height: 1.1em; }
[dir="rtl"] .btn .ico--dir { transform: scaleX(-1); }

/* ---------- Chips, badges, pills ---------- */
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: var(--r-pill); background: #fff; border: 1px solid var(--line); font-size: .8125rem; font-weight: 500; color: var(--g-700); }
[dir="rtl"] .chip { padding: 6px 8px 6px 12px; }
.delta { display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px; border-radius: var(--r-pill); font-size: .6875rem; font-weight: 600; line-height: 1.5; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.delta--up { color: var(--up); background: var(--up-bg); }
.delta--down { color: var(--down); background: var(--down-bg); }
.delta--warn { color: var(--warn); background: var(--warn-bg); }
.seg { display: inline-flex; gap: 6px; }
.seg > * { padding: 4px 10px; border-radius: var(--r-pill); border: 1px solid var(--g-200); font-size: .6875rem; font-weight: 500; color: var(--g-700); background: #fff; transition: background var(--t-base), color var(--t-base), border-color var(--t-base); }
.seg > [aria-pressed="true"], .seg > .is-on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- PulseBoard cards ---------- */
.card { position: relative; border-radius: var(--r-lg); background: var(--g-50); padding: var(--s-8); overflow: hidden; }
.card--white { background: #fff; box-shadow: var(--sh-card); }
.card--sky { background: var(--pb-sky); }
.card--outline { background: #fff; border: 1px solid var(--g-150); }
.icon-tile { display: grid; place-items: center; width: 60px; height: 60px; border-radius: var(--r-ui); background: var(--z-blue); color: #fff; }
.icon-tile svg { width: 30px; height: 30px; }
.icon-tile--soft { background: var(--z-blue-50); color: var(--z-blue); }

/* ---------- Zimam product UI primitives (look like the real dashboard) ---------- */
.zui { font-family: "Inter", "IBM Plex Sans Arabic", system-ui, sans-serif; color: var(--ink); font-size: 14px; line-height: 1.45; letter-spacing: -.005em; }
:lang(ar) .zui { font-family: "IBM Plex Sans Arabic", "Inter", sans-serif; }
.zcard { position: relative; background: #fff; border: 1px solid var(--g-150); border-radius: var(--r-ui); overflow: hidden; }
.zcard__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-block-end: 1px solid var(--g-150); }
.zcard__title { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 15px; flex: 1; min-width: 0; }
.zcard__title svg { width: 18px; height: 18px; color: var(--g-700); }
.zcard__btn { padding: 5px 10px; border: 1px solid var(--g-200); border-radius: 8px; font-size: 12px; font-weight: 500; color: var(--g-800); background: #fff; white-space: nowrap; }
.zcard__body { padding: 16px; }
.zmetric { font-family: "Inter", sans-serif; font-weight: 500; font-size: 40px; letter-spacing: -.035em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.zlabel { font-size: 12px; color: var(--g-500); }
.zaction { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; font-size: 13px; font-weight: 500; line-height: 1.45; }
.zaction svg { width: 18px; height: 18px; flex: none; margin-block-start: 1px; }
.zaction a, .zaction .zaction__link { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.zaction--ok { background: var(--up-bg); color: #14532D; }
.zaction--ok svg { color: var(--up); }
.zaction--bad { background: var(--down-bg); color: #7F1D1D; }
.zaction--bad svg { color: var(--down); }
.zaction--warn { background: #FFF4EC; color: #7C2D12; }
.zaction--warn svg { color: var(--c-orange); }
.zaction--info { background: var(--info-bg); color: #1E2A78; }
.zaction--info svg { color: var(--z-blue); }
.zbtn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; background: var(--z-blue); color: #fff; font-size: 13px; font-weight: 500; }
.zbar { display: flex; gap: 4px; height: 8px; }
.zbar > i { display: block; height: 100%; border-radius: 99px; background: var(--c, var(--z-blue)); }
.zdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--z-blue)); flex: none; }

/* ---------- Phone frame (shared by hero, story and Bonat section) ---------- */
.phone {
  --pw: 300px;
  position: relative;
  width: var(--pw);
  aspect-ratio: 375 / 812;
  border-radius: calc(var(--pw) * .158);
  padding: calc(var(--pw) * .024);
  background: #121215;
  box-shadow:
    0 0 0 calc(var(--pw) * .0045) #6B6B72,
    0 0 0 calc(var(--pw) * .0095) #232328,
    inset 0 0 0 calc(var(--pw) * .0035) rgba(255, 255, 255, .09),
    var(--sh-float);
  flex: none;
}
/* Side buttons: action + volume on the left, power on the right (physical sides, like the real device). */
.phone::before, .phone::after {
  content: ""; position: absolute;
  width: calc(var(--pw) * .016);
  border-radius: 2px;
  background: linear-gradient(90deg, #3A3A40, #26262B);
}
.phone::before {
  left: calc(var(--pw) * -.022);
  top: 17%; height: 4.6%;
  box-shadow: 0 calc(var(--pw) * .118) 0 #2F2F35, 0 calc(var(--pw) * .25) 0 #2F2F35;
}
.phone::after { right: calc(var(--pw) * -.022); top: 27%; height: 10.5%; }
.phone__screen { position: relative; width: 100%; height: 100%; border-radius: calc(var(--pw) * .134); overflow: hidden; background: var(--b-app-bg); isolation: isolate; container-type: inline-size; }
.phone__screen > img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.phone__island { position: absolute; z-index: 5; left: 50%; width: calc(var(--pw) * .3); height: calc(var(--pw) * .088); transform: translateX(-50%); background: #000; border-radius: 99px; top: calc(var(--pw) * .028); }
.phone > .phone__island { top: calc(var(--pw) * .052); }

/* Bonat tab bar overlay, for home screens cropped from long Figma frames (the real app keeps it pinned). */
.phone__tabbar {
  position: absolute; inset-inline: 0; bottom: 0; z-index: 4;
  height: 21.5cqw;
  padding: 2.6cqw 2cqw 0;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: start;
  background: #fff;
  box-shadow: 0 -1px 0 rgba(0, 0, 0, .06), 0 -6px 16px rgba(0, 0, 0, .04);
  font-family: var(--font-app); color: #868686;
}
.phone__tabbar > span { display: grid; justify-items: center; gap: .9cqw; font-size: 3.1cqw; font-weight: 700; line-height: 1.1; white-space: nowrap; }
.phone__tabbar svg { width: 6.6cqw; height: 6.6cqw; }
.phone__tabbar .is-on { color: #EC6C3B; }
.phone__tabbar::after { content: ""; position: absolute; left: 50%; bottom: 2cqw; width: 35cqw; height: 1.3cqw; border-radius: 99px; background: #9CA3AF; transform: translateX(-50%); }
:lang(ar) .phone__tabbar { background: #111827; box-shadow: 0 -1px 0 rgba(255, 255, 255, .06); color: #8B93A4; }
:lang(ar) .phone__tabbar > span { font-size: 3.3cqw; }
:lang(ar) .phone__tabbar::after { background: #E5E7EB; }
.bui { font-family: var(--font-app); color: rgba(0,0,0,.84); font-size: 13px; line-height: 1.35; }
.bui h1, .bui h2, .bui h3, .bui .bui-h { font-family: var(--font-display); font-weight: 900; letter-spacing: 0; line-height: 1.05; }

/* ---------- Illustrations as stickers ---------- */
.ill { display: block; width: 100%; height: auto; overflow: visible; }
.ill .ik { fill: var(--ill-ink); }
.ill .iks { stroke: var(--ill-ink); }
.ill .ia { fill: var(--ill-accent); }
.ill .ias { stroke: var(--ill-accent); }
.ill .iw { fill: var(--ill-paper); }
.ill .im { fill: var(--ill-mute); }
.sticker { display: inline-block; width: var(--size, 120px); filter: drop-shadow(0 8px 10px rgba(40, 20, 10, .12)); }
.tilt-l { rotate: -5deg; } .tilt-r { rotate: 4deg; } .tilt-s { rotate: -2deg; }
.boil { filter: url(#zboil-0); }
html.zboil-1 .boil { filter: url(#zboil-1); }
html.zboil-2 .boil { filter: url(#zboil-2); }

/* Margin notes */
.annot { position: absolute; display: inline-flex; align-items: center; gap: 6px; pointer-events: none; white-space: nowrap; }
.annot svg { width: 46px; height: 30px; overflow: visible; }
.annot path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Grid paper (PulseBoard hero grid, read as sketchbook paper) */
.gridpaper { position: relative; }
.gridpaper::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(to right, rgba(10, 10, 30, .045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(10, 10, 30, .045) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(120% 75% at 50% 0%, #000 35%, transparent 80%);
  mask-image: radial-gradient(120% 75% at 50% 0%, #000 35%, transparent 80%);
}
.gridpaper > * { position: relative; z-index: 1; }

/* ---------- Rope (SVG) ---------- */
.rope { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.rope { --rope-c: #BDBDC4; }
/* The solid path only times the reveal; the dashed path is what people see. Quiet on purpose. */
.rope__line { fill: none; stroke: transparent; stroke-width: 2; }
.rope__twist { fill: none; stroke: var(--rope-c); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 5 9; }
.rope__end { fill: var(--rope-c); }
html.zone-plum .rope, .on-plum .rope { --rope-c: rgba(255, 255, 255, .38); }

/* ---------- Reveal (only hidden when JS + motion are on) ---------- */
html.js-motion [data-reveal]:not([data-reveal="lines"]) { opacity: 0; }
html.js-motion [data-reveal="lines"] { visibility: hidden; }
.split-line { display: block; overflow: clip; overflow-clip-margin: .2em; padding-block: .06em; margin-block: -.06em; }
.split-line > .split-inner { display: block; }

/* ---------- Accessibility ---------- */
:focus-visible { outline: 2.5px solid var(--z-blue); outline-offset: 3px; border-radius: 6px; }
[data-zone="plum"] :focus-visible, .on-plum :focus-visible { outline-color: var(--b-lilac); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 10000; inset-inline-start: 16px; top: -60px; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 600; transition: top var(--t-base) var(--ease-out); }
.skip-link:focus { top: 16px; }

/* Language-scoped nodes */
html:lang(en) [data-lang="ar"], html:lang(ar) [data-lang="en"] { display: none !important; }

/* Language switch curtain */
.lang-curtain { position: fixed; inset: 0; z-index: 9500; display: grid; place-items: center; background: var(--page-bg); opacity: 0; visibility: hidden; pointer-events: none; }
.lang-curtain svg { width: 56px; height: 56px; }

/* Mirroring helper for direction-aware graphics */
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }

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

/* Real Zimam lockup (inline SVG; wordmark recolours on plum) */
.zl-wrap { display: inline-flex; align-items: center; line-height: 0; }
.zl { display: block; height: var(--zl-h, 34px); width: auto; overflow: visible; }
.zl .zl-word { fill: var(--zl-word, #335CFF); transition: fill var(--t-base) var(--ease-out); }
.zl .zl-disc { fill: var(--zl-disc, #335CFF); }
html.zone-plum .site-nav { --zl-word: #FFFFFF; }
