/* ==========================================================================
   Hkeeli — Reset, typography, and direction-agnostic defaults.
   Rule of the house: no physical properties (left/right/margin-left) in any
   stylesheet. Logical properties only, so RTL mirrors for free.
   ========================================================================== */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* Anything a link or a script can scroll to has to clear the sticky nav, or it
   lands with its first line hidden behind it. Set on the targets rather than as
   scroll-padding on a scroll container: `body` carries its own overflow here, so
   which element actually scrolls isn't guaranteed, and scroll-margin works on
   hash jumps and scrollIntoView() alike. */
main [id] {
  scroll-margin-block-start: calc(var(--nav-h) + var(--space-5));
}

body {
  background: var(--sand-light);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--sea-deep);
}

p {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

/* Visible, on-brand focus for keyboard users only. */
:focus-visible {
  outline: 3px solid var(--citrus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Arabic script
   Always renders RTL regardless of the page's UI language — lesson content is
   trilingual and must read correctly in both site languages.
   -------------------------------------------------------------------------- */
.arabic {
  font-family: var(--font-arabic);
  font-weight: 700;
  direction: rtl;
  unicode-bidi: isolate;
  line-height: 1.35;
}

/* Transliteration is Latin text and must stay LTR even inside an RTL page. */
.translit {
  direction: ltr;
  unicode-bidi: isolate;
  font-weight: 700;
  font-size: var(--step--1);
  color: var(--olive);
  letter-spacing: 0.02em;
}

/* English lesson content needs the same isolation as transliteration. Without
   it, an Arabic page renders "How are you?" as "?How are you" — the trailing
   punctuation belongs to the surrounding RTL run, not to the sentence. The
   feedback detail is in the list because it mixes all three scripts in one
   line. */
.phrase-en,
.match-en,
.card-en,
.option-en,
.order-en,
.reply-en,
.builder-en,
.feedback-detail {
  direction: ltr;
  unicode-bidi: isolate;
}

/* Arabic UI copy gets the display Arabic face when the site is in Arabic. */
[lang='ar'] h1,
[lang='ar'] h2,
[lang='ar'] h3,
[lang='ar'] h4 {
  font-family: var(--font-arabic);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.25;
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  inset-block-start: -100px;
  inset-inline-start: var(--space-4);
  z-index: var(--z-toast);
  background: var(--sea-deep);
  color: var(--on-dark);
  padding: var(--space-3) var(--space-5);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-weight: 700;
}

.skip-link:focus {
  inset-block-start: 0;
}

[hidden] {
  display: none !important;
}

.stack > * + * {
  margin-block-start: var(--space-4);
}

.center-text {
  text-align: center;
}
