/* Base: reset, body, type, numbers, buttons, inputs, small utilities. Tokens: tokens.css. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4, p { margin: 0; font-weight: 400; }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
a { color: var(--text); text-underline-offset: 4px; }
a:hover { color: var(--ac); }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; }
::selection { background: var(--ac); color: var(--ink); }

/* The logo («بينهم»: two eyes + the word) as a CSS mask, so its colour follows the theme (--logo-ac, tokens.css).
   .bm = the eyes mark (fills its box), .bf = the full logo with the word. The box sets the size. */
.bm, .bf {
  display: block; width: 100%; height: 100%; background-color: var(--logo-ac);
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
}
.bm { -webkit-mask-image: url(../img/brand/logo-mark.png); mask-image: url(../img/brand/logo-mark.png); }
.bf { -webkit-mask-image: url(../img/brand/logo-full.png); mask-image: url(../img/brand/logo-full.png); }

/* Loading screen (index.html #boot): the full logo centred on the page background until the first page is drawn
   (js/core/router.js removes it). The eyes blink gently, only while neither the OS nor the site asks for less
   motion (<html data-motion>, set before the first paint by js/lang.js, and prefers-reduced-motion). */
.boot {
  position: fixed; inset: 0; z-index: 2000; background: var(--bg);
  display: grid; place-items: center;
}
.boot-logo { position: relative; width: 120px; height: 150px; }
.boot-logo .bf { position: absolute; inset: 0; }
.boot-logo .eyes { -webkit-mask-image: url(../img/brand/logo-full-eyes.png); mask-image: url(../img/brand/logo-full-eyes.png); transform-origin: 50% 24.9%; }
.boot-logo .word { -webkit-mask-image: url(../img/brand/logo-full-word.png); mask-image: url(../img/brand/logo-full-word.png); }
@keyframes boot-blink { 0%, 86%, 100% { transform: scaleY(1); } 92% { transform: scaleY(.12); } }
html:not([data-motion="reduce"]) .boot-logo .eyes { animation: boot-blink 2.8s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .boot-logo .eyes { animation: none !important; } }

/* Numbers: always Urbanist, left-to-right (design rule), on the reading side: right-aligned in Arabic, left in English
   (a .num has dir="ltr" itself, so "start" would be left in both: the page's direction decides) */
.num {
  font-family: var(--font-num);
  font-weight: 500;
  line-height: 1;
  text-align: right; /* dir-ok: the ltr rule below */
  font-variant-numeric: lining-nums;
}
:root[dir="ltr"] .num { text-align: left; }
.num .unit { font-size: .45em; color: var(--muted-2); }
.on-light .num .unit, .num.on-light .unit { color: #444; }
.num-hero { font-size: var(--fs-hero); }
.num-tile { font-size: var(--fs-tile); }
.num-kpi { font-size: var(--fs-kpi); }
.num-stat { font-size: var(--fs-stat); }
.num-md { font-size: 24px; }
.num-sm { font-size: 20px; }
.num-xs { font-size: 15px; }
bdi.n, .n { font-family: var(--font-num); }

/* Page titles: "eyebrow" (period · place) over a 32px h1 (design pages) */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.eyebrow { font-size: var(--fs-ui); color: var(--muted-2); }
.h1 { font-size: var(--fs-title); font-weight: 400; line-height: 1.3; }
.h2 { font-size: var(--fs-h2); font-weight: 400; line-height: 1.4; }
.h-section { font-size: var(--fs-section); font-weight: 400; }
.hint { font-size: var(--fs-small); color: var(--muted-2); }
.hint-row { display: flex; align-items: center; gap: 6px; font-size: var(--fs-small); color: var(--muted-2); }
.hint-row .ph, .hint-row .ph-fill { color: var(--ac); font-size: 15px; }
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.good-text { color: var(--good-text); }
.bad-text { color: var(--bad-text); }
.ac-text { color: var(--ac); }
.text-body { font-size: var(--fs-body); line-height: 1.7; }
.text-start { text-align: start; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.clamp-2, .clamp-4, .clamp-5 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; }
.clamp-4 { -webkit-line-clamp: 4; line-clamp: 4; }
.clamp-5 { -webkit-line-clamp: 5; line-clamp: 5; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: var(--gap); }
.row-wrap { display: flex; align-items: center; gap: var(--gap); flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.stack-section { display: flex; flex-direction: column; gap: var(--gap-section); }

/* A row that scrolls sideways on a phone (period chips, filter chips, carousels): no visible scrollbar */
.hscroll { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.hscroll::-webkit-scrollbar { width: 0; height: 0; }
@media (max-width: 700px) {
  .hscroll.bleed { margin: 0 calc(-1 * var(--page-pad)); padding: 0 var(--page-pad); }
}

/* Buttons (design: go 44 accent, big 52 accent, ghost 52 white, card buttons 40 black, circles 44/52) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--hit); padding: 0 20px; border: none; border-radius: var(--r-pill);
  background: var(--card); color: var(--text); font-size: var(--fs-ui); white-space: nowrap;
  text-decoration: none; transition: filter var(--t-fast), opacity var(--t-fast), background var(--t-fast);
}
.btn:hover { color: inherit; }
.btn .ph, .btn .ph-fill { font-size: 16px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.btn-ac { background: var(--ac); color: var(--ink); font-weight: 500; }
.btn-ac:hover { color: var(--ink); filter: brightness(1.05); }
.btn-white { background: var(--white); color: var(--ink); }
.btn-white:hover { color: var(--ink); }
.btn-black { background: #000; color: var(--text); }
.btn-inner { background: var(--card-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-big { height: var(--hit-lg); font-size: var(--fs-body); }
.btn-sm { height: 40px; padding: 0 16px; font-size: var(--fs-meta); }
.btn-wide { flex: 1; }
.btn-icon { width: var(--hit); height: var(--hit); padding: 0; border-radius: 50%; flex: none; }
.btn-icon.lg { width: var(--hit-lg); height: var(--hit-lg); }
.btn-icon .ph, .btn-icon .ph-fill { font-size: 18px; }

/* Text inputs: the design's pill field */
.field {
  display: flex; align-items: center; gap: 8px; height: 56px; padding-block: 0; padding-inline: 6px 18px;
  border-radius: var(--r-pill); background: #000; border: 1.5px solid var(--divider);
}
.field:focus-within { border-color: var(--ac); }
.field.bad { border-color: var(--bad); }
.field input {
  flex: 1; min-width: 0; border: none; background: transparent; color: var(--text);
  font: inherit; font-size: var(--fs-ui); outline: none;
}
.input {
  height: 48px; border: none; border-radius: var(--r-pill); background: var(--track);
  padding: 0 18px; font: inherit; font-size: var(--fs-ui); color: var(--text); outline: none;
}
.input:focus-visible { outline: 2px solid var(--ac); outline-offset: 0; }

@media (max-width: 700px) {
  .btn, .btn-sm { min-height: var(--hit); }
}

/* Direction: icons that point along the line (back / next / open / a menu row's caret) turn around in English, so a
   page never picks an icon per language. ICONS.back is arrow-right in Arabic and shows as arrow-left in English. */
:root[dir="ltr"] :is(.ph, .ph-fill):is(.ph-caret-left, .ph-caret-right, .ph-caret-double-left, .ph-caret-double-right,
  .ph-arrow-left, .ph-arrow-right, .ph-arrow-up-left, .ph-arrow-up-right) { display: inline-block; transform: scaleX(-1); }
body > noscript .empty { position: fixed; z-index: 2001; inset-inline: 16px; top: 62%; text-align: center; } /* above #boot */
