/* ===== DESIGN SYSTEM – White/Gloomy Premium Aesthetic ===== */
/* Inspired by shaygansoft.com – airy, melancholic, intentional */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* ===== COLORS – White/Gloomy Palette ===== */
  --color-bg-base: #F8F8FC;
  --color-bg-surface: #FFFFFF;
  --color-bg-card: rgba(255, 255, 255, 0.6);
  --color-bg-card-hover: rgba(255, 255, 255, 0.9);
  --color-accent-primary: #6A5ACD;
  --color-accent-secondary: #8B7FBF;
  --color-accent-gradient: linear-gradient(135deg, #6A5ACD 0%, #8B7FBF 100%);
  --color-accent-glow: rgba(106, 90, 205, 0.15);
  --color-text-primary: #1A1A2E;
  --color-text-secondary: #4A4A5A;
  --color-text-muted: #9A9AAC;
  --color-border-subtle: rgba(0, 0, 0, 0.06);
  --color-border-glow: rgba(106, 90, 205, 0.2);

  /* ===== TYPOGRAPHY ===== */
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-persian: 'Shabnam', 'Tahoma', sans-serif;

  /* ===== SCALE ===== */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.75rem;
  --text-5xl: 3.75rem;
  --text-6xl: 5rem;

  /* ===== SPACING ===== */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* ===== EFFECTS ===== */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --shadow-glow: 0 0 30px rgba(106, 90, 205, 0.2);
  --shadow-glow-strong: 0 0 50px rgba(106, 90, 205, 0.3);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.04);
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== GLOBAL BASE STYLES ===== */
html {
  scroll-behavior: smooth;
  font-size: 16px;
  height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 0;
  font-family: var(--font-persian);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.7;
  color: var(--color-text-primary);
  background: var(--color-bg-base);
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  opacity: 0;
  animation: fadeIn 0.4s ease 0.1s forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* Noise overlay for gloomy texture */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

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

::selection {
  background: var(--color-accent-primary);
  color: white;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.02);
}

::-webkit-scrollbar-thumb {
  background: var(--color-accent-primary);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent-secondary);
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  margin: 0 0 var(--space-4) 0;
}

/* Keep Persian font for RTL content */
[lang="fa"] h1, [lang="fa"] h2, [lang="fa"] h3, [lang="fa"] h4,
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4 {
  font-family: var(--font-persian);
  letter-spacing: 0;
}

h1 { font-size: clamp(2rem, 5vw, 3.75rem); }
h2 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }
h4 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
  margin: 0 0 var(--space-4) 0;
  line-height: 1.7;
}

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

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

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

/* ===== UTILITY CLASSES ===== */
.text-gradient {
  background: var(--color-accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-divider {
  height: 1px;
  max-width: 800px;
  margin: 0 auto;
  background: linear-gradient(to right, transparent, var(--color-border-subtle), transparent);
}

/* ===== SCROLL ANIMATIONS ===== */
[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

[data-animate="fade-left"] {
  transform: translateX(-24px);
}

[data-animate="fade-left"].is-visible {
  transform: translateX(0);
}

[data-animate="fade-right"] {
  transform: translateX(24px);
}

[data-animate="fade-right"].is-visible {
  transform: translateX(0);
}

[data-animate="scale"] {
  transform: scale(0.95);
}

[data-animate="scale"].is-visible {
  transform: scale(1);
}

/* ===== FOCUS STATES ===== */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--color-accent-primary);
  outline-offset: 3px;
}

/* ===== DARK MODE – Navy/Teal palette matching RD reference ===== */
html[data-theme="dark"] {
  --color-bg-base: #0d0d1a;
  --color-bg-surface: #1a1a2e;
  --color-bg-card: rgba(255, 255, 255, 0.04);
  --color-bg-card-hover: rgba(255, 255, 255, 0.08);
  --color-accent-primary: #aecece;
  --color-accent-secondary: #00c8c0;
  --color-accent-gradient: linear-gradient(135deg, #00645f 0%, #128088 100%);
  --color-accent-glow: rgba(0, 131, 163, 0.35);
  --color-text-primary: #f0f0f0;
  --color-text-secondary: #b0b8c8;
  --color-text-muted: #6b7280;
  --color-border-subtle: rgba(255, 255, 255, 0.07);
  --color-border-glow: rgba(0, 200, 200, 0.22);
  --shadow-glow: 0 0 30px rgba(0, 131, 163, 0.25);
  --shadow-glow-strong: 0 0 50px rgba(0, 131, 163, 0.4);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* Smooth theme transition */
html {
  transition: background-color 0.4s ease, color 0.3s ease;
}
