/* =========================
   Sakinah – base.css
   Purpose: CSS variables, color tokens, resets, typography.
   Notes:
   - Keep color tokens abstract; actual palette can be swapped later.
   - Uses logical properties to support RTL/LTR.
   - Respects prefers-reduced-motion.
========================= */

:root {
  color-scheme: light;
  /* Typography */
  --font-base: "IBM Plex Sans Arabic", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-heading: "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-size-xs: clamp(0.8rem, 0.74rem + 0.2vw, 0.9rem);
  --font-size-sm: clamp(0.9rem, 0.82rem + 0.3vw, 1rem);
  --font-size-md: clamp(1rem, 0.96rem + 0.35vw, 1.12rem);
  --font-size-lg: clamp(1.2rem, 1.08rem + 0.6vw, 1.6rem);
  --font-size-xl: clamp(1.8rem, 1.4rem + 1.7vw, 2.8rem);
  /* Palette tokens (can be re-mapped later from your color sheets) */
  /* mapped via colors.css */
  --bg: var(--canvas);
  --surface: var(--paper);
  --surface-alt: color-mix(in srgb, var(--paper) 80%, transparent);
  --ink: #2b2622;
  --ink-soft: #5f574f;
  --muted: #827a70;
  /* Accent family (terracotta) */
  --accent: var(--brand-500);
  --accent-strong: var(--brand-600);
  --accent-soft: var(--brand-100);
  /* Semantic (placeholders;
  will remap when you confirm palette) */
  --success-600: #1e9b52;
  --warning-600: #f0a300;
  --info-600: #0c8da0;
  --danger-600: #bb2d2b;
  --border: var(--gray-200);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  /* Radii & shadows */
  --r-sm: 16px;
  --r: 24px;
  --r-lg: 32px;
  --r-pill: 999px;
  --sh-sm: 0 4px 20px -2px rgba(40, 45, 30, 0.08);
  --sh-md: 0 12px 30px -4px rgba(40, 45, 30, 0.1);
  --sh-lg: 0 20px 40px -6px rgba(40, 45, 30, 0.12);
  --container-max: 1140px;
  --transition: 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Reset + base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font-base);
  background: var(--bg);
  color: var(--ink);
  scroll-behavior: smooth;
}

/* Pattern layer */



body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-size: var(--font-size-md);
  line-height: 1.65;
  display: flex;
  flex-direction: column;
  position: relative;
  /* REQUIRED */
}

/* Pattern ABOVE background gradient */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url('../assets/pattern.png') center/500px repeat;
  opacity: 0.08;
  pointer-events: none;
  z-index: -1;
}

/* Gradient layer BELOW the pattern */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg,
      var(--brand-50) 0%,
      var(--brand-50) 40%,
      var(--brand-100) 100%);
  z-index: -2;
}

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

/* Accessibility helpers */
.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-sm);
}

/* Typography scale */
h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  color: var(--ink);
  margin-block: 0 .75rem;
}

h1 {
  font-size: var(--font-size-xl);
  line-height: 1.1;
}

h2 {
  font-size: clamp(1.6rem, 1.3rem + 1vw, 2.2rem);
}

h3 {
  font-size: var(--font-size-lg);
}

h4 {
  font-size: clamp(1.05rem, .96rem + .2vw, 1.2rem);
}

p {
  color: var(--ink-soft);
  margin-block: 0 1rem;
}

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