/* Base layer: reset, typography, layout primitives. Uses logical properties so
   the same CSS serves English (LTR) and Arabic (RTL) without a separate sheet. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs-md)/var(--lh-body) var(--font);
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  min-block-size: 100vh; display: flex; flex-direction: column;
}
body > main { flex: 1 0 auto; }
img, svg, video { max-inline-size: 100%; display: block; }
img { block-size: auto; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); line-height: var(--lh-tight); letter-spacing: -0.022em; font-weight: 600; text-wrap: balance; }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-xl); letter-spacing: -0.015em; }
h3 { font-size: var(--fs-lg); line-height: var(--lh-snug); letter-spacing: -0.01em; }
html[dir="rtl"] :is(h1, h2, h3, h4) { letter-spacing: 0; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
hr { border: 0; border-block-start: 1px solid var(--border); margin-block: var(--s-6); }
small { font-size: var(--fs-sm); }
code, kbd { font-family: var(--font-mono); font-size: .86em; background: var(--surface-2); padding: .12em .4em; border-radius: var(--r-xs); direction: ltr; unicode-bidi: embed; }
code { word-break: break-all; }
kbd { border: 1px solid var(--border); border-block-end-width: 2px; color: var(--text-2); font-size: var(--fs-2xs); }
table { border-collapse: collapse; inline-size: 100%; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }
[hidden] { display: none !important; }
html[dir="rtl"] .ltr, .ltr { unicode-bidi: isolate; }
.ltr { direction: ltr; }

/* Accessibility helpers */
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; inset-inline-start: var(--s-4); inset-block-start: -100px; z-index: 100; background: var(--text); color: var(--bg); padding: var(--s-2) var(--s-4); border-radius: var(--r-md); }
.skip:focus { inset-block-start: var(--s-3); }

/* Layout primitives */
.container { inline-size: 100%; max-inline-size: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.stack > * + * { margin-block-start: var(--stack, var(--s-4)); }
.stack-1 { --stack: var(--s-1); } .stack-2 { --stack: var(--s-2); } .stack-3 { --stack: var(--s-3); } .stack-6 { --stack: var(--s-6); } .stack-8 { --stack: var(--s-8); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--s-3)); }
.cluster-1 { --gap: var(--s-1); } .cluster-2 { --gap: var(--s-2); } .cluster-4 { --gap: var(--s-4); }
.between { justify-content: space-between; }
.end-x { margin-inline-start: auto; }
.grow { flex: 1 1 auto; min-inline-size: 0; }
.grid { display: grid; gap: var(--gap, var(--s-6)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 240px)), 1fr)); }
.gap-3 { --gap: var(--s-3); } .gap-4 { --gap: var(--s-4); }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }

/* Text utilities */
.muted { color: var(--text-2); } .subtle { color: var(--text-3); }
.small { font-size: var(--fs-sm); } .xs { font-size: var(--fs-xs); }
.strong { font-weight: 600; } .medium { font-weight: 500; } .nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: .92em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-inline-size: 0; }
.eyebrow { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
html[dir="rtl"] .eyebrow { letter-spacing: 0; text-transform: none; font-size: var(--fs-sm); }
.up { color: var(--success); } .down { color: var(--danger); }

/* Icons: <svg class="i"><use href="#i-name"/></svg> */
.i { display: inline-block; vertical-align: -0.2em; inline-size: 1.15em; block-size: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { inline-size: 1em; block-size: 1em; } .i-lg { inline-size: 1.5em; block-size: 1.5em; }
html[dir="rtl"] .i-flip { transform: scaleX(-1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .no-print, .site-header, .site-footer, .announce, .admin-side, .admin-top, .flash-stack { display: none !important; }
  body { background: #fff; color: #000; }
}

.sprite { position: absolute; inline-size: 0; block-size: 0; overflow: hidden; }
.contents { display: contents; }
fieldset { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
legend { padding: 0; margin-block-end: var(--s-2); }
