/*
Theme Name: Soft Aurora
Theme URI: https://lylamarketing.com
Author: Lyla Marketing
Author URI: https://lylamarketing.com
Description: Independent, section-based WordPress theme for Lyla Marketing (Lyla / ليلا). Bilingual EN/AR, RTL-ready, no page builder. Design system: Soft Aurora.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: soft-aurora
Tags: custom-menu, custom-logo, translation-ready, rtl-language-support
*/

/* ============================================================
   1. FONTS — self-hosted variable fonts (weights 400–700)
   Place files in: assets/fonts/
   - montserrat-var.woff2  (EN, latin)
   - alexandria-var.woff2  (AR, arabic + latin)
   Preload is handled later in inc/assets.php.
   ============================================================ */

@font-face {
  font-family: 'Montserrat';
  src: url('assets/fonts/montserrat-var.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Alexandria';
  src: url('assets/fonts/alexandria-var.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   2. DESIGN TOKENS — verbatim from design doc §11 (source of truth)
   Only change: lang selector broadened to [lang^='ar'] so
   regional locales (ar-SA, ar-AE, …) are covered too.
   ============================================================ */

:root {
  --bg: #FBF9FD;
  --bg-raised: #FFFFFF;
  --bg-raised-2: #F3EEF9;
  --bg-dark: #1E1033;
  --ink: #1E1033;
  --ink-muted: #6B6178;
  --ink-on-dark: #FBF9FD;
  --ink-muted-on-dark: #BFB3D1;
  --border: #E6DEF0;
  --border-strong: #CFC2E0;
  --primary: #6C3FA8;
  --primary-deep: #2A1450;
  --primary-soft: #B79BE0;
  --primary-tint: #EDE6F7;
  --primary-ink: #FFFFFF;
  --secondary: #F0813A;
  --secondary-ink: #1E1033;
  --gradient-brand: linear-gradient(135deg, #6C3FA8 0%, #F0813A 100%);
  --gradient-soft: linear-gradient(135deg, rgba(108, 63, 168, 0.14), rgba(240, 129, 58, 0.14));
  --gradient-aurora:
    radial-gradient(60% 50% at 20% 30%, rgba(108, 63, 168, 0.75), transparent 70%),
    radial-gradient(50% 45% at 80% 70%, rgba(240, 129, 58, 0.45), transparent 70%),
    radial-gradient(70% 60% at 50% 100%, rgba(42, 20, 80, 0.9), transparent 70%);
  --radius-sm: 10px;
  --radius-md: 20px;
  --radius-lg: 32px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(42, 20, 80, 0.04), 0 8px 24px rgba(42, 20, 80, 0.05);
  --shadow-card-hover: 0 2px 4px rgba(42, 20, 80, 0.06), 0 16px 40px rgba(108, 63, 168, 0.14);
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: 'Montserrat', sans-serif;
  --font-body: 'Montserrat', sans-serif;
  --fw-display: 600;
}

html[lang^='ar'] {
  --font-display: 'Alexandria', sans-serif;
  --font-body: 'Alexandria', sans-serif;
  --fw-display: 700;
}

/* RTL: gradient flips so "night" (purple) always starts
   from the reading-start side. Never reverse purple→orange. */
html[dir='rtl'] {
  --gradient-brand: linear-gradient(225deg, #6C3FA8 0%, #F0813A 100%);
  --gradient-soft: linear-gradient(225deg, rgba(108, 63, 168, 0.14), rgba(240, 129, 58, 0.14));
}

/* ============================================================
   3. EXTENDED TOKENS — tables §3/§4/§6/§7/§8 tokenized.
   No new values: every number below exists in the doc.
   Mobile-first base; tablet ≥768px and desktop ≥1024px below.
   Breakpoints cannot be CSS vars in media queries: 768 / 1024.
   ============================================================ */

:root {
  /* Spacing (§4) — mobile scale */
  --nav-pad-block: 18px;
  --nav-pad-inline: 16px;
  --stage-pad-top: 48px;
  --stage-pad-inline: 16px;
  --stage-pad-bottom: 80px;
  --container-max: 1200px;
  --section-gap: 48px;
  --eyebrow-gap: 16px;
  --h1-gap: 24px;
  --lede-gap: 36px;
  --row-gap: 16px;
  --badge-gap: 10px;
  --card-pad: 24px;
  --card-pad-lg: 24px;
  --grid-gap: 24px;
  --icon-badge-gap: 20px;
  --h3-gap: 10px;
  --card-p-gap: 20px;
  --panel-pad: 24px;
  --panel-col-gap: 24px;
  --stat-gap: 32px;
  --stat-row-mt: 28px;
  --divider-h: 1px;
  --divider-gap: 28px;
  --field-gap: 20px;
  --label-gap: 8px;
  --input-pad-block: 14px;
  --input-pad-inline: 16px;
  --btn-pad-block: 15px;
  --btn-pad-inline: 32px;
  --badge-pad-block: 6px;
  --badge-pad-inline: 14px;

  /* Type scale (§3) — sizes identical for EN/AR */
  --fs-h1: clamp(36px, 5.5vw, 64px);
  --fs-h2: clamp(26px, 3.4vw, 38px);
  --fs-h3: clamp(18px, 2vw, 21px);
  --fs-lede: clamp(16px, 1.7vw, 19px);
  --fs-body: 16px;
  --fs-caption: 13px;
  --fs-label: 13.5px;
  --fs-btn: 15px;
  --fs-eyebrow: 12.5px;

  /* Per-role weights — fixes §3 vs §11 conflict (AR H3 = 600) */
  --fw-h1: 600;
  --fw-h2: 600;
  --fw-h3: 600;
  --fw-body: 400;
  --fw-caption: 400;
  --fw-label: 500;
  --fw-btn: 600;
  --fw-eyebrow: 600;

  /* Per-role line heights — EN values (§3) */
  --lh-h1: 1.1;
  --lh-h2: 1.2;
  --lh-h3: 1.3;
  --lh-lede: 1.7;
  --lh-body: 1.7;
  --lh-caption: 1.5;
  --lh-label: 1.4;
  --lh-btn: 1;
  --lh-eyebrow: 1.2;

  /* Icons (§6) */
  --icon-badge-box: 48px;
  --icon-badge-glyph: 22px;
  --icon-tile-box: 72px;
  --icon-tile-glyph: 28px;
  --icon-stroke: 1.75;

  /* Motion (§8) — aurora 24s sits inside the doc's 18–30s range */
  --dur-hover: 0.3s;
  --dur-reveal: 0.7s;
  --dur-flip: 0.6s;
  --dur-aurora: 24s;
  --reveal-shift: 16px;
  --hover-lift: -2px;
  --press-scale: 0.97;

  /* Effects (§7) — blob blur reduced on mobile for GPU perf */
  --glow-card: 0 0 40px rgba(108, 63, 168, 0.12);
  --blob-blur: 48px;
  --focus-width: 2px;
  --focus-offset: 3px;
  --focus-offset-input: 2px;

  /* Logo — settings-driven defaults (not from doc; user feature).
     Real values are injected via wp_add_inline_style, never <style> in PHP. */
  --logo-w-desktop: 160px;
  --logo-w-mobile: 120px;
  --logo-w: var(--logo-w-mobile);
}

/* AR typography overrides (§3): heavier H1/H2, taller line heights.
   H3 stays 600. No letter-spacing / uppercase / italic for Arabic. */
html[lang^='ar'] {
  --fw-h1: 700;
  --fw-h2: 700;
  --lh-h1: 1.35;
  --lh-h2: 1.4;
  --lh-h3: 1.5;
  --lh-lede: 1.9;
  --lh-body: 1.9;
  --lh-caption: 1.7;
  --lh-label: 1.6;
  --lh-btn: 1.2;
  --lh-eyebrow: 1.4;
}

/* Tablet ≥768px — composed only from existing doc values */
@media (min-width: 768px) {
  :root {
    --nav-pad-inline: 24px;
    --stage-pad-inline: 24px;
    --stage-pad-top: 80px;
    --stage-pad-bottom: 96px;
    --section-gap: 80px;
    --card-pad: 32px;
    --card-pad-lg: 40px;
    --panel-pad: 40px;
    --panel-col-gap: 40px;
    --blob-blur: 80px;
    --logo-w: var(--logo-w-desktop);
  }
}

/* Desktop ≥1024px — exact doc §4 values */
@media (min-width: 1024px) {
  :root {
    --nav-pad-inline: 32px;
    --stage-pad-inline: 32px;
    --stage-pad-top: 80px;
    --stage-pad-bottom: 120px;
    --section-gap: 96px;
    --panel-pad: 48px;
  }
}

/* ============================================================
   4. BASE / RESET — minimal. No blanket border-radius rule:
   roundness is applied per component with radius tokens.
   ============================================================ */

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

* {
  margin: 0;
}

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

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

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

button {
  cursor: pointer;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* Only classed lists are reset (nav, grids); content lists keep markers */
ul[class],
ol[class] {
  list-style: none;
  padding: 0;
}

/* ============================================================
   5. TYPOGRAPHY — body = muted ink, headings = ink (§2).
   Low specificity via :where() so sections can override easily.
   ============================================================ */

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--ink-muted);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-body);
  line-height: var(--lh-body);
}

:where(h1, h2, h3, h4, h5, h6) {
  font-family: var(--font-display);
  color: var(--ink);
}

h1 {
  font-size: var(--fs-h1);
  font-weight: var(--fw-h1);
  line-height: var(--lh-h1);
}

h2 {
  font-size: var(--fs-h2);
  font-weight: var(--fw-h2);
  line-height: var(--lh-h2);
}

/* h4–h6 are not defined in the doc → nearest token (H3 scale) */
h3,
h4,
h5,
h6 {
  font-size: var(--fs-h3);
  font-weight: var(--fw-h3);
  line-height: var(--lh-h3);
}

:where(a) {
  color: var(--primary);
  text-decoration: none;
}

:where(a):hover {
  color: var(--primary-deep);
  text-decoration: underline;
}

.sa-lede {
  font-size: var(--fs-lede);
  line-height: var(--lh-lede);
}

.sa-caption {
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

/* Eyebrow text styles only; its gradient dash is a component (later file) */
.sa-eyebrow {
  font-size: var(--fs-eyebrow);
  font-weight: var(--fw-eyebrow);
  line-height: var(--lh-eyebrow);
  color: var(--primary);
}

/* EN-only rules (§3): tracking on H1, uppercase eyebrow */
html:not([lang^='ar']) h1 {
  letter-spacing: -0.01em;
}

html:not([lang^='ar']) .sa-eyebrow {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* AR emphasis: never italic — use weight instead (§3) */
html[lang^='ar'] :where(em, i) {
  font-style: normal;
  font-weight: 600;
}

/* ============================================================
   6. LAYOUT PRIMITIVES — logical properties only, RTL-safe
   ============================================================ */

.sa-container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--stage-pad-inline);
}

.sa-stage {
  padding-block: var(--stage-pad-top) var(--stage-pad-bottom);
}

.sa-section + .sa-section {
  margin-block-start: var(--section-gap);
}

/* Dark surface helper (hero, footer, dark bands) */
.sa-on-dark {
  background-color: var(--bg-dark);
  color: var(--ink-muted-on-dark);
}

.sa-on-dark :where(h1, h2, h3, h4, h5, h6) {
  color: var(--ink-on-dark);
}

/* ============================================================
   7. ACCESSIBILITY & UTILITIES
   ============================================================ */

:focus-visible {
  outline: var(--focus-width) solid var(--primary);
  outline-offset: var(--focus-offset);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline-offset: var(--focus-offset-input);
}

.sa-on-dark :focus-visible {
  outline-color: var(--primary-soft);
}

::selection {
  background-color: var(--primary-tint);
  color: var(--ink);
}

.sa-screen-reader-text {
  border: 0;
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  word-wrap: normal !important;
}

.sa-skip-link {
  position: absolute;
  inset-inline-start: 16px;
  top: -100%;
  z-index: 100000;
  padding: var(--input-pad-block) var(--input-pad-inline);
  background-color: var(--bg-raised);
  color: var(--ink);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
}

.sa-skip-link:focus-visible {
  top: 16px;
}

/* Scroll reveal — SAFE BY DEFAULT:
   content is visible without JS and under reduced motion.
   core/reveal.js adds .sa-armed ONLY when motion is allowed,
   then .sa-in on intersection. Vertical shift → no RTL mirroring needed. */
.sa-reveal.sa-armed {
  opacity: 0;
  transform: translateY(var(--reveal-shift));
}

.sa-reveal.sa-armed.sa-in {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity var(--dur-reveal) var(--ease-soft),
    transform var(--dur-reveal) var(--ease-soft);
}


.sa-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 18px;
    overflow: hidden;
}

.sa-flag img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}


/* ============================================================
   8. REDUCED MOTION — verbatim from doc §11 + smooth-scroll off
   ============================================================ */

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

  html {
    scroll-behavior: auto;
  }
}
/* ============================================================
   9. STICKY-HEADER INTEGRATION — anchor offset + brand scrollbar
   --sa-header-h is measured by core/nav.js; token fallback before JS.
   ============================================================ */

.sa-section,
#sa-main {
	scroll-margin-block-start: calc(var(--sa-header-h, var(--stage-pad-top)) + var(--row-gap));
}

html {
	scrollbar-color: var(--primary-soft) var(--bg);
	scrollbar-width: thin;
}
::-webkit-scrollbar { width: var(--badge-gap); height: var(--badge-gap); }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
	background: var(--primary-soft);
	border-radius: var(--radius-pill);
	border: var(--focus-width) solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); }