/* =========================================================================
   Base: reset, document defaults, icons, shared keyframes.
   ========================================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  overflow-x: clip;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

h1, h2, h3, p, ul, ol, dl, dd, figure, fieldset {
  margin: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

fieldset {
  border: 0;
  padding: 0;
}

a {
  color: var(--color-text-brand);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-flow);
}

a:hover {
  color: var(--color-action-hover);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

[hidden] {
  display: none !important;
}

/* ---- Icons (sprite in index.html) ---- */
.icon {
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--icon-stroke, 1.75);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--thin { --icon-stroke: 1.6; }
.icon--bold { --icon-stroke: 2; }

.icon--fill {
  fill: currentColor;
  stroke: none;
}

/* Arrows point the reading direction. */
[dir="rtl"] .icon--dir {
  transform: scaleX(-1);
}

/* ---- Shared keyframes ---- */
@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

@keyframes float {
  0%, 100% { transform: translateY(-8px); }
  50% { transform: translateY(8px); }
}

@keyframes ken-burns {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

@keyframes draw {
  from { stroke-dashoffset: 1800; }
  to { stroke-dashoffset: 0; }
}

@keyframes scroll-cue {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  51% { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---- v5: scroll reveal (js/reveal.js adds .is-visible) ----
   Without JS nothing is hidden: the hidden state only applies under .js.
   A one-shot animation, not a transition: once it ends it lets go of the
   element, so buttons and cards keep their own hover transitions. The
   keyframe has no `to`, so it lands on the element's own transform. */
.js .reveal:not(.is-visible) {
  opacity: 0;
}

.js .reveal.is-visible {
  animation: reveal-up var(--dur-reveal) var(--ease-flow) calc(var(--i, 0) * 80ms) backwards;
}

@keyframes reveal-up {
  from { opacity: 0; transform: translateY(24px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes flow-dash {
  to { stroke-dashoffset: -60; }
}

@keyframes ping {
  0% { opacity: 0.7; transform: scale(1); }
  80%, 100% { opacity: 0; transform: scale(1.9); }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Western digits, codes and phone numbers stay LTR inside Arabic text. */
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
}
