/* ==========================================================================
   mapy.one — Brand Design System
   A warm, editorial identity for a service that elevates real businesses.

   Color Philosophy:
   - NOT generic blue. NOT startup purple.
   - Warm earth tones inspired by handcrafted markets, wood storefronts,
     clay walls, copper trays — the texture of real local business.
   - Primary: Deep Oud (dark olive-brown) — authority without coldness
   - Accent: Saffron Amber — warmth, energy, distinction
   - Surface: Cream Linen — inviting, premium, never sterile
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. FONT IMPORTS
   Tajawal: clean, modern, geometric Arabic font — weights 200-900.
            Popular across Saudi websites and government portals.
   Bricolage Grotesque: distinctive display font, editorial weight contrast
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@200;300;400;500;700;800;900&family=Bricolage+Grotesque:opsz,wght@12..96,200..800&family=DM+Sans:ital,opsz,wght@0,9..40,300..700;1,9..40,300..700&display=swap');

/* --------------------------------------------------------------------------
   2. DESIGN TOKENS — CSS Custom Properties
   All values derive from these. Never hardcode colors, sizes, or motion.
   -------------------------------------------------------------------------- */
:root {
  /* — Color Palette: OKLCH for perceptual uniformity — */

  /* Primary: Deep Oud — a dark, warm olive-brown. Authority + warmth */
  --color-oud-950:  oklch(18% 0.04 65);
  --color-oud-900:  oklch(24% 0.05 68);
  --color-oud-800:  oklch(32% 0.06 70);
  --color-oud-700:  oklch(40% 0.07 72);
  --color-oud-600:  oklch(48% 0.08 74);
  --color-oud-500:  oklch(56% 0.09 76);
  --color-oud-400:  oklch(65% 0.07 78);
  --color-oud-300:  oklch(75% 0.05 80);
  --color-oud-200:  oklch(86% 0.03 82);
  --color-oud-100:  oklch(93% 0.02 84);
  --color-oud-50:   oklch(97% 0.01 86);

  /* Accent: Saffron Amber — vibrant, warm, confident */
  --color-saffron-600: oklch(62% 0.18 58);
  --color-saffron-500: oklch(72% 0.20 60);
  --color-saffron-400: oklch(80% 0.18 62);
  --color-saffron-300: oklch(87% 0.14 64);
  --color-saffron-100: oklch(96% 0.05 66);

  /* Secondary: Patina Teal — subtle, for secondary actions and badges */
  --color-patina-700:  oklch(38% 0.08 190);
  --color-patina-500:  oklch(52% 0.10 192);
  --color-patina-300:  oklch(72% 0.07 194);
  --color-patina-100:  oklch(94% 0.03 196);

  /* Neutral: Warm grays, NOT cold. Tinted toward oud hue */
  --color-stone-950: oklch(14% 0.02 70);
  --color-stone-900: oklch(20% 0.02 72);
  --color-stone-800: oklch(28% 0.02 74);
  --color-stone-700: oklch(38% 0.02 76);
  --color-stone-600: oklch(50% 0.02 78);
  --color-stone-500: oklch(60% 0.02 80);
  --color-stone-400: oklch(70% 0.015 82);
  --color-stone-300: oklch(80% 0.01 84);
  --color-stone-200: oklch(90% 0.008 86);
  --color-stone-100: oklch(95% 0.005 88);
  --color-stone-50:  oklch(98% 0.003 90);

  /* Surface: Cream Linen — not white, not gray. Warm parchment feel */
  --color-linen:        oklch(97.5% 0.008 80);
  --color-linen-dark:   oklch(94% 0.012 78);
  --color-linen-border: oklch(88% 0.015 76);

  /* — Semantic Color Assignments — */
  --brand-primary:       var(--color-oud-900);
  --brand-primary-hover: var(--color-oud-800);
  --brand-accent:        var(--color-saffron-500);
  --brand-accent-hover:  var(--color-saffron-600);
  --brand-accent-subtle: var(--color-saffron-100);
  --brand-secondary:     var(--color-patina-500);

  --bg-base:     var(--color-linen);
  --bg-surface:  #ffffff;
  --bg-muted:    var(--color-linen-dark);
  --bg-inverse:  var(--color-oud-950);

  --text-primary:   var(--color-stone-950);
  --text-secondary: var(--color-stone-700);
  --text-muted:     var(--color-stone-500);
  --text-inverse:   oklch(97% 0.005 80);
  --text-accent:    var(--color-saffron-600);

  --border-default: var(--color-linen-border);
  --border-muted:   var(--color-stone-200);
  --border-accent:  var(--color-saffron-400);

  /* — Typography — */
  --font-arabic:  'Tajawal', 'Noto Kufi Arabic', 'Arial Unicode MS', sans-serif;
  --font-display: 'Bricolage Grotesque', 'DM Sans', system-ui, sans-serif;
  --font-body:    'DM Sans', 'Bricolage Grotesque', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  /* — Type Scale — Major Third (1.25) from 16px base — */
  --text-xs:   0.64rem;   /* 10.2px */
  --text-sm:   0.8rem;    /* 12.8px */
  --text-base: 1rem;      /* 16px */
  --text-lg:   1.25rem;   /* 20px */
  --text-xl:   1.563rem;  /* 25px */
  --text-2xl:  1.953rem;  /* 31.25px */
  --text-3xl:  2.441rem;  /* 39px */
  --text-4xl:  3.052rem;  /* 48.8px */
  --text-5xl:  3.815rem;  /* 61px */
  --text-6xl:  4.768rem;  /* 76.3px */
  --text-hero: clamp(3rem, 6vw + 1rem, 5.5rem);

  /* — Font Weights — */
  --weight-light:    300;
  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;
  --weight-black:    800;

  /* — Spacing (8px base grid) — */
  --space-1:  0.25rem;   /* 4px */
  --space-2:  0.5rem;    /* 8px */
  --space-3:  0.75rem;   /* 12px */
  --space-4:  1rem;      /* 16px */
  --space-5:  1.25rem;   /* 20px */
  --space-6:  1.5rem;    /* 24px */
  --space-8:  2rem;      /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */
  --space-16: 4rem;      /* 64px */
  --space-20: 5rem;      /* 80px */
  --space-24: 6rem;      /* 96px */
  --space-32: 8rem;      /* 128px */

  /* — Border Radius — Strategy: generous on cards, pill on tags, none on inputs — */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-2xl:  32px;
  --radius-pill: 9999px;

  /* — Shadows — 3-layer system: ambient + direct + accent — */
  --shadow-sm:  0 1px 2px oklch(0% 0 0 / 0.04), 0 1px 6px oklch(0% 0 0 / 0.06);
  --shadow-md:  0 4px 8px oklch(0% 0 0 / 0.06), 0 2px 24px oklch(0% 0 0 / 0.08);
  --shadow-lg:  0 8px 16px oklch(0% 0 0 / 0.08), 0 4px 48px oklch(0% 0 0 / 0.12);
  --shadow-xl:  0 16px 32px oklch(0% 0 0 / 0.10), 0 8px 64px oklch(0% 0 0 / 0.14);
  --shadow-accent: 0 8px 24px color-mix(in oklch, var(--brand-accent) 30%, transparent);

  /* — Motion Tokens — */
  --duration-instant: 80ms;
  --duration-fast:    150ms;
  --duration-normal:  250ms;
  --duration-slow:    400ms;
  --duration-stagger: 60ms;

  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: linear(0, 0.009, 0.037 2.7%, 0.153 6.2%, 0.776 18.6%, 1.001, 1.142 30%, 1.181, 1.153 36%, 0.998 53%, 0.977, 0.975 59.5%, 1.006 72.2%, 1);

  /* — Layout — */
  --container-sm:  640px;
  --container-md:  768px;
  --container-lg:  1024px;
  --container-xl:  1280px;
  --container-2xl: 1400px;

  /* — Z-index Stack — */
  --z-base:    0;
  --z-raised:  10;
  --z-overlay: 100;
  --z-modal:   200;
  --z-top:     999;
}

/* --------------------------------------------------------------------------
   3. RESET & BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-base);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

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

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

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

/* --------------------------------------------------------------------------
   4. TYPOGRAPHY UTILITIES
   -------------------------------------------------------------------------- */

/* Display headings — use Bricolage Grotesque for dramatic hierarchy */
.type-hero {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: var(--weight-black);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.type-display {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.type-heading-1 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.type-heading-2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.type-heading-3 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.type-body-lg {
  font-size: var(--text-lg);
  line-height: 1.65;
  font-weight: var(--weight-regular);
  text-wrap: pretty;
}

.type-body {
  font-size: var(--text-base);
  line-height: 1.6;
  font-weight: var(--weight-regular);
  text-wrap: pretty;
}

.type-caption {
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-muted);
}

/* Arabic variants — Cairo renders with clean geometric Arabic forms */
[dir="rtl"] .type-hero,
[dir="rtl"] .type-display,
[dir="rtl"] .type-heading-1,
[dir="rtl"] .type-heading-2,
[dir="rtl"] .type-heading-3 {
  font-family: var(--font-arabic);
  letter-spacing: 0; /* Arabic doesn't use tracking */
}

/* --------------------------------------------------------------------------
   5. LAYOUT UTILITIES
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

@media (min-width: 768px) {
  .container { padding-inline: var(--space-8); }
}

@media (min-width: 1024px) {
  .container { padding-inline: var(--space-12); }
}

.container-narrow {
  max-width: var(--container-md);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.section {
  padding-block: var(--space-20);
}

@media (min-width: 768px) {
  .section { padding-block: var(--space-32); }
}

/* --------------------------------------------------------------------------
   6. BUTTON COMPONENTS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: 1;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-in-out),
    border-color var(--duration-fast) var(--ease-in-out),
    color var(--duration-fast) var(--ease-in-out);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  overflow: hidden;
  min-height: 44px; /* WCAG 2.5.8 touch target */
  min-width: 44px;
}

.btn:focus-visible {
  outline: 3px solid var(--brand-accent);
  outline-offset: 2px;
}

.btn:active {
  transform: scale(0.97);
}

/* Primary button */
.btn-primary {
  background-color: var(--brand-primary);
  color: var(--text-inverse);
  border-color: var(--brand-primary);
}

.btn-primary:hover {
  background-color: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Accent button — the hero CTA */
.btn-accent {
  background-color: var(--brand-accent);
  color: var(--color-oud-950);
  border-color: var(--brand-accent);
  font-weight: var(--weight-bold);
}

.btn-accent:hover {
  background-color: var(--brand-accent-hover);
  border-color: var(--brand-accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-accent);
}

/* Ghost button */
.btn-ghost {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-ghost:hover {
  background-color: var(--bg-muted);
  border-color: var(--border-muted);
}

/* Outline accent */
.btn-outline {
  background-color: transparent;
  color: var(--brand-accent);
  border-color: var(--brand-accent);
}

.btn-outline:hover {
  background-color: var(--brand-accent-subtle);
}

/* Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  min-height: 36px;
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
  min-height: 52px;
  border-radius: var(--radius-lg);
}

.btn-xl {
  padding: var(--space-5) var(--space-10);
  font-size: var(--text-xl);
  min-height: 60px;
  border-radius: var(--radius-xl);
}

/* Full width */
.btn-block {
  width: 100%;
}

/* --------------------------------------------------------------------------
   7. CARD COMPONENTS
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--duration-normal) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out),
    border-color var(--duration-fast) var(--ease-in-out);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-linen-border);
}

.card-warm {
  background: var(--bg-muted);
  border-color: transparent;
}

.card-accent {
  background: var(--brand-accent-subtle);
  border-color: var(--border-accent);
}

.card-dark {
  background: var(--bg-inverse);
  color: var(--text-inverse);
  border-color: transparent;
}

/* Pattern card — used in generated site previews */
.card-pattern {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  position: relative;
  overflow: hidden;
}

.card-pattern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--brand-accent),
    var(--brand-secondary)
  );
}

/* --------------------------------------------------------------------------
   8. INPUT COMPONENTS
   -------------------------------------------------------------------------- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.input-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

.input {
  width: 100%;
  padding: var(--space-4);
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-md);
  outline: none;
  transition:
    border-color var(--duration-fast) var(--ease-in-out),
    box-shadow var(--duration-fast) var(--ease-in-out);
  min-height: 44px;
}

.input::placeholder {
  color: var(--text-muted);
}

.input:hover {
  border-color: var(--color-stone-300);
}

.input:focus {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand-accent) 20%, transparent);
}

/* Hero input — large URL input */
.input-hero {
  font-size: var(--text-lg);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  min-height: 60px;
  border-width: 2px;
}

.input-hero:focus {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--brand-accent) 15%, transparent);
}

/* Combo input — input + button row */
.input-combo {
  display: flex;
  gap: 0;
  background: var(--bg-surface);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: border-color var(--duration-fast) var(--ease-in-out), box-shadow var(--duration-fast);
}

.input-combo:focus-within {
  border-color: var(--brand-accent);
  box-shadow: var(--shadow-lg), 0 0 0 3px color-mix(in oklch, var(--brand-accent) 20%, transparent);
}

.input-combo .input {
  border: none;
  border-radius: 0;
  box-shadow: none;
  flex: 1;
  min-width: 0;
}

.input-combo .input:focus {
  box-shadow: none;
  border-color: transparent;
}

.input-combo .btn {
  border-radius: 0;
  border: none;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   9. BADGE COMPONENTS
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  line-height: 1.5;
}

.badge-accent {
  background: var(--brand-accent-subtle);
  color: var(--color-oud-800);
}

.badge-primary {
  background: color-mix(in oklch, var(--brand-primary) 12%, transparent);
  color: var(--brand-primary);
}

.badge-teal {
  background: var(--color-patina-100);
  color: var(--color-patina-700);
}

.badge-neutral {
  background: var(--color-stone-100);
  color: var(--color-stone-700);
}

/* --------------------------------------------------------------------------
   10. STAR RATING
   -------------------------------------------------------------------------- */
.stars {
  display: inline-flex;
  gap: 2px;
  color: var(--brand-accent);
  font-size: var(--text-base);
}

/* --------------------------------------------------------------------------
   11. QUOTE / REVIEW BLOCK
   -------------------------------------------------------------------------- */
.quote-block {
  position: relative;
  padding: var(--space-6);
  padding-top: var(--space-10);
  background: var(--bg-muted);
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--brand-accent);
}

[dir="rtl"] .quote-block {
  border-left: none;
  border-right: 3px solid var(--brand-accent);
}

.quote-block::before {
  content: '\201C';
  position: absolute;
  top: var(--space-3);
  left: var(--space-6);
  font-family: var(--font-display);
  font-size: 3rem;
  line-height: 1;
  color: var(--brand-accent);
  font-weight: var(--weight-black);
}

[dir="rtl"] .quote-block::before {
  content: '\201D';
  left: auto;
  right: var(--space-6);
}

.quote-text {
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.65;
}

.quote-author {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   12. SECTION HEADER
   -------------------------------------------------------------------------- */
.section-header {
  text-align: center;
  max-width: 640px;
  margin-inline: auto;
  margin-bottom: var(--space-16);
}

.section-eyebrow {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-accent);
  margin-bottom: var(--space-4);
}

/* --------------------------------------------------------------------------
   13. GRID SYSTEMS
   -------------------------------------------------------------------------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* --------------------------------------------------------------------------
   14. NAVIGATION
   -------------------------------------------------------------------------- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) 0;
  gap: var(--space-6);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-black);
  color: var(--brand-primary);
  text-decoration: none;
  letter-spacing: -0.04em;
}

.nav-brand .dot {
  color: var(--brand-accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* --------------------------------------------------------------------------
   15. STEP / HOW IT WORKS
   -------------------------------------------------------------------------- */
.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--brand-accent-subtle);
  color: var(--brand-accent);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-black);
  flex-shrink: 0;
  border: 2px solid var(--border-accent);
  transition: all var(--duration-normal) var(--ease-out);
}

.step:hover .step-number {
  background: var(--brand-accent);
  color: var(--color-oud-950);
  transform: scale(1.05);
}

/* --------------------------------------------------------------------------
   16. LANGUAGE TOGGLE
   -------------------------------------------------------------------------- */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--bg-muted);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}

.lang-btn {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  color: var(--text-muted);
  min-height: 28px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lang-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  font-weight: var(--weight-bold);
}

/* --------------------------------------------------------------------------
   17. DECORATIVE / ATMOSPHERE
   -------------------------------------------------------------------------- */

/* Subtle noise grain overlay for premium texture */
.grain-overlay {
  position: relative;
}

.grain-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.03;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 128px;
  border-radius: inherit;
  z-index: var(--z-raised);
}

/* Radial glow — for hero sections */
.glow-saffron {
  position: relative;
}

.glow-saffron::before {
  content: '';
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 60%;
  background: radial-gradient(
    ellipse at center,
    color-mix(in oklch, var(--brand-accent) 18%, transparent) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

/* Divider with pattern */
.divider-ornament {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--text-muted);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.divider-ornament::before,
.divider-ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-default);
}

/* --------------------------------------------------------------------------
   18. UTILITIES
   -------------------------------------------------------------------------- */
.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;
}

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

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-accent    { color: var(--text-accent); }
.text-inverse   { color: var(--text-inverse); }

.font-arabic { font-family: var(--font-arabic); }
.font-display { font-family: var(--font-display); }

.mt-auto { margin-top: auto; }
.hidden { display: none; }
.flex  { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* --------------------------------------------------------------------------
   19. RTL OVERRIDES
   Arabic layout should feel native — right-to-left, Arabic font, no tracking
   -------------------------------------------------------------------------- */
[dir="rtl"] {
  font-family: var(--font-arabic);
}

[dir="rtl"] .section-header {
  direction: rtl;
}

[dir="rtl"] .nav {
  flex-direction: row-reverse;
}

[dir="rtl"] .nav-actions {
  flex-direction: row-reverse;
}

[dir="rtl"] .input-combo {
  flex-direction: row-reverse;
}

[dir="rtl"] .input-combo .btn {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

[dir="rtl"] .step-number {
  font-family: var(--font-arabic);
}

/* --------------------------------------------------------------------------
   20. REDUCED MOTION
   Respect user preferences. Animation is enhancement, not requirement.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   21. SCROLL ANIMATIONS (no-preference users only)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .fade-up {
    opacity: 0;
    transform: translateY(24px);
    transition:
      opacity var(--duration-slow) var(--ease-out),
      transform var(--duration-slow) var(--ease-out);
  }

  .fade-up.visible {
    opacity: 1;
    transform: translateY(0);
  }

  .fade-up:nth-child(2) { transition-delay: calc(1 * var(--duration-stagger)); }
  .fade-up:nth-child(3) { transition-delay: calc(2 * var(--duration-stagger)); }
  .fade-up:nth-child(4) { transition-delay: calc(3 * var(--duration-stagger)); }
  .fade-up:nth-child(5) { transition-delay: calc(4 * var(--duration-stagger)); }
  .fade-up:nth-child(6) { transition-delay: calc(5 * var(--duration-stagger)); }

  .card:hover .step-number {
    animation: none;
  }
}
