/* ============================================================
   MARSA ALEKHWA — Base Styles
   Reset, typography, global element styling
   ============================================================ */

@layer base {

  /* ── Modern Reset ─────────────────────────────── */
  *,
  *::before,
  *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    color-scheme: dark;
    scrollbar-color: var(--color-navy-700) var(--color-navy-900);
    scrollbar-width: thin;
  }

  body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-block-size: 100dvh;
    /* Safe area insets for notched phones */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  /* ── Touch Optimizations ──────────────────────── */
  a, button, [role="button"], input, select, textarea, summary {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  /* RTL body */
  [dir="rtl"] body,
  [lang="ar"] body,
  [lang="ku"] body {
    font-family: var(--font-arabic);
  }

  /* ── Typography ────────────────────────────────── */
  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-text-heading);
    line-height: 1.2;
    text-wrap: balance;
    font-weight: 700;
  }

  [dir="rtl"] h1,
  [dir="rtl"] h2,
  [dir="rtl"] h3,
  [dir="rtl"] h4,
  [dir="rtl"] h5,
  [dir="rtl"] h6 {
    font-family: var(--font-arabic-heading);
    font-weight: 700;
  }

  h1 { font-size: var(--text-hero); }
  h2 { font-size: var(--text-4xl); }
  h3 { font-size: var(--text-2xl); }
  h4 { font-size: var(--text-xl); }
  h5 { font-size: var(--text-lg); }
  h6 { font-size: var(--text-base); }

  p {
    text-wrap: pretty;
    max-inline-size: 72ch;
  }

  a {
    color: var(--color-accent);
    text-decoration: none;
    transition: var(--transition-color);
  }

  a:hover:not(:disabled) {
    color: var(--color-accent-hover);
  }

  /* ── Focus Management ─────────────────────────── */
  :focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
  }

  /* ── Lists ─────────────────────────────────────── */
  ul, ol {
    list-style: none;
  }

  /* ── Images & Media ────────────────────────────── */
  img, picture, video, canvas, svg {
    display: block;
    max-inline-size: 100%;
    block-size: auto;
  }

  img {
    font-style: italic; /* alt text styling */
  }

  /* ── Form Elements ─────────────────────────────── */
  input, button, textarea, select {
    font: inherit;
    color: inherit;
  }

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

  /* ── Selection ─────────────────────────────────── */
  ::selection {
    background-color: var(--color-gold-400);
    color: var(--color-navy-950);
  }

  /* ── Reduced Motion ────────────────────────────── */
  @property --animation-reduced {
    syntax: "*";
    inherits: false;
    initial-value: none;
  }

  @media (prefers-reduced-motion: reduce) {
    html {
      scroll-behavior: auto;
    }

    * {
      animation: var(--animation-reduced) !important;
      transition-duration: 0.01ms !important;
    }
  }

  /* ── Utility: Screen Reader Only ───────────────── */
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
  }
}
