/* ==========================================================================
   base.css — brand tokens, surfaces, reset, typography for Ar-Rahmah VBT
   Colours and fonts come from the organisation: its brand guideline, or derived
   from its logo + description. A layout reference contributes no colour or font.
   Colour literals live ONLY in the five --c-* tokens below; everything else uses
   var() or color-mix() of them.  Check: python3 tools/palette.py lint <this css folder>
   ========================================================================== */

:root {
  /* Brand palette: 3 hues + 2 neutrals. BRAND: replace these neutral boilerplate defaults
     with the organisation's colours; `palette.py lint` fails while any hue is still a default. */
  --c-primary: #0e4a35;   /* identity: dark band, footer, next prayer (logo green, dark shade) */
  --c-secondary: #e4eee7; /* supporting light surface: prayer strip, subtle cards */
  --c-accent: #b9500c;    /* the one action colour: buttons, links, focus, Infaq */
  --c-paper: #fbf8f2;     /* warm white page background */
  --c-ink: #231e1b;       /* main text (logo brown, darkened) */

  /* Text colour on each brand colour: paper or ink, whichever `palette.py contrast` passes. */
  --on-primary: var(--c-paper);
  --on-secondary: var(--c-ink);
  --on-accent: var(--c-paper);

  /* Type: BRAND fonts (never a layout reference's fonts). Load them with MAR_FONTS_URL in functions.php. */
  --font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-arabic: "Amiri", "Noto Naskh Arabic", serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: clamp(1.375rem, 1.25rem + 0.4vw, 1.625rem);
  --fs-2xl: clamp(2rem, 1.5rem + 1.6vw, 3rem);
  --fs-3xl: clamp(2.75rem, 1.6rem + 3.6vw, 4.75rem);
  --fs-hero: clamp(2.75rem, 1.6rem + 5vw, 6rem);

  /* Space & shape */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;
  --radius: 2px;
  --radius-sm: 2px;

  /* Layout */
  --container: 75rem;
  --gutter: 1.25rem;
  --header-h: 4.75rem;
}

@media (min-width: 48rem) {
  :root { --gutter: 2rem; }
}

/* Surfaces: the only four section backgrounds. Accent is never a surface.
   Components read --bg/--fg/--muted/--line/--link/--btn-bg/--btn-fg/--focus.
   BRAND: `palette.py contrast` lists the surfaces where accent buttons pass (≥ 3:1);
   on the others, buttons, links and focus use the surface's text colour instead. */
.surface-paper {
  --bg: var(--c-paper); --fg: var(--c-ink);
  --muted: color-mix(in srgb, var(--c-ink) 68%, var(--c-paper));
  --line: color-mix(in srgb, var(--c-ink) 16%, var(--c-paper));
  --link: var(--c-accent); --btn-bg: var(--c-accent); --btn-fg: var(--on-accent); --focus: var(--c-accent);
}
.surface-primary {
  --bg: var(--c-primary); --fg: var(--on-primary);
  --muted: color-mix(in srgb, var(--on-primary) 78%, var(--c-primary));
  --line: color-mix(in srgb, var(--on-primary) 22%, var(--c-primary));
  --link: var(--on-primary); --btn-bg: var(--on-primary); --btn-fg: var(--c-primary); --focus: var(--on-primary);
}
.surface-secondary {
  --bg: var(--c-secondary); --fg: var(--on-secondary);
  --muted: color-mix(in srgb, var(--on-secondary) 78%, var(--c-secondary));
  --line: color-mix(in srgb, var(--on-secondary) 22%, var(--c-secondary));
  --link: var(--on-secondary); --btn-bg: var(--c-accent); --btn-fg: var(--on-accent); --focus: var(--c-accent);
}
.surface-ink {
  --bg: var(--c-ink); --fg: var(--c-paper);
  --muted: color-mix(in srgb, var(--c-paper) 72%, var(--c-ink));
  --line: color-mix(in srgb, var(--c-paper) 18%, var(--c-ink));
  --link: var(--c-paper); --btn-bg: var(--c-paper); --btn-fg: var(--c-ink); --focus: var(--c-paper);
}
[class*="surface-"] { background: var(--bg); color: var(--fg); }
/* Derived roles (DESIGN.md): input borders need 3:1, hover goes darker, never brighter. */
[class*="surface-"] {
  --field-line: color-mix(in srgb, var(--fg) 50%, var(--bg));
  --btn-bg-hover: color-mix(in srgb, var(--btn-bg) 85%, var(--c-ink));
}

/* Reset ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + var(--space-4)); }
body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--fs-lg);
  line-height: 1.6;
  color: var(--c-ink);
  background: var(--c-paper);
  -webkit-font-smoothing: antialiased;
}
img, picture, svg, video, iframe { display: block; max-width: 100%; }
[hidden] { display: none !important; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
p, h1, h2, h3, h4, h5, h6, li { overflow-wrap: break-word; }
ul[class], ol[class], nav ul, nav ol { list-style: none; padding: 0; }
a { color: inherit; text-underline-offset: 0.18em; }

/* Typography ------------------------------------------------------------- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; line-height: 1.1; letter-spacing: -0.02em; }
h1 { letter-spacing: -0.03em; line-height: 1.04; }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
.lead { font-size: clamp(1.125rem, 1.05rem + 0.3vw, 1.25rem); line-height: 1.6; color: var(--muted); max-width: 40rem; }

/* Long-form content (WordPress the_content() lands here) */
.prose { font-size: 1.0625rem; line-height: 1.75; max-width: 68ch; }
.prose > * + * { margin-top: var(--space-6); }
.prose h2 { margin-top: var(--space-12); }
.prose ul, .prose ol { padding-left: var(--space-6); }
.prose a { color: var(--link); font-weight: 600; }
.prose blockquote { border-left: 4px solid var(--focus, var(--c-accent)); padding-left: var(--space-6); font-size: var(--fs-xl); }

/* Accessibility ---------------------------------------------------------- */
:focus-visible { outline: 3px solid var(--focus, var(--c-accent)); outline-offset: 3px; }
.sr-only {
  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; left: var(--space-4); top: -100%; z-index: 100;
  padding: var(--space-2) var(--space-4); background: var(--c-ink); color: var(--c-paper);
  border-radius: var(--radius-sm); font-weight: 700;
}
.skip-link:focus { top: var(--space-4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
