/* ==========================================================================
   NEXUS SCIENTIFIC CLUB — DESIGN SYSTEM & GLOBAL STYLES
   Badji Mokhtar University, Annaba, Algeria
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@500;600;700;800&family=Cairo:wght@400;600;700;800&display=swap');

:root,
[data-theme="dark"] {
  --color-scheme: dark;

  /* Dark palette — refined charcoal, not pitch black */
  --bg-primary: #0A0D14;
  --bg-secondary: #0F1219;
  --bg-card: #13161F;
  --bg-card-hover: #181C28;
  --bg-surface: #1A1F2E;
  --bg-input: #0D1018;
  --bg-elevated: #171B27;

  /* Borders — restrained, no glow */
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-glow: rgba(123, 129, 255, 0.25);

  /* Typography — crisp readable hierarchy */
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-tertiary: #64748B;
  --text-inverse: #0A0D14;

  /* Accent Colors — slightly muted, no neon */
  --accent-primary: #7B81FF;
  --accent-primary-rgb: 123, 129, 255;
  --accent-cyan: #56C4D6;
  --accent-cyan-rgb: 86, 196, 214;
  --accent-blue: #6B9EF7;
  --accent-blue-rgb: 107, 158, 247;
  --accent-purple: #9B8AFA;
  --accent-purple-rgb: 155, 138, 250;

  /* Status Colors — readable, not flashy */
  --status-open: #3CC68A;
  --status-open-bg: rgba(60, 198, 138, 0.1);
  --status-upcoming: #60A5FA;
  --status-upcoming-bg: rgba(96, 165, 250, 0.1);
  --status-planned: #E5A54B;
  --status-planned-bg: rgba(229, 165, 75, 0.1);
  --status-completed: #6B7280;
  --status-completed-bg: rgba(107, 114, 128, 0.12);
  --status-danger: #EF4444;
  --status-danger-bg: rgba(239, 68, 68, 0.1);

  /* Gradients — following official NEXUS logo rising arrow */
  --grad-nexus: linear-gradient(135deg, #5B5EED 0%, #7B81FF 50%, #969AFF 100%);
  --grad-card: linear-gradient(180deg, rgba(19, 22, 31, 0.9) 0%, rgba(13, 16, 24, 0.95) 100%);
  --grad-glow: radial-gradient(circle at 50% 0%, rgba(123, 129, 255, 0.08) 0%, transparent 65%);
  --grad-dark-overlay: linear-gradient(180deg, rgba(10, 13, 20, 0) 0%, #0A0D14 100%);

  /* Header & Backdrop */
  --header-bg: rgba(10, 13, 20, 0.8);
  --header-bg-scrolled: rgba(10, 13, 20, 0.92);
  --header-border: rgba(255, 255, 255, 0.08);
  --shadow-header: 0 8px 30px -8px rgba(0, 0, 0, 0.5);
  --shadow-header-scrolled: 0 12px 40px -8px rgba(0, 0, 0, 0.6);

  /* Shadows — deep but not exaggerated */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-cyan: 0 0 20px rgba(86, 196, 214, 0.12);
  --shadow-purple: 0 0 20px rgba(155, 138, 250, 0.14);

  /* Typography */
  --font-heading: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  --font-arabic: 'Cairo', 'Inter', sans-serif;

  /* Spacing & Layout */
  --container-max: 1200px;
  --container-wide: 1400px;
  --header-height: 54px;
  --sandbox-banner-height: 38px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Spacing scale (introduced UX-1; adopted as components are migrated) */
  --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-7: 2rem;     /* 32px  */
  --space-8: 2.5rem;   /* 40px  */
  --space-9: 3.5rem;   /* 56px  */
  --space-10: 4.5rem;  /* 72px  */

  /* Z-index scale (introduced UX-1; hardcoded values migrate as components are touched) */
  --z-header: 900;
  --z-mobile-nav: 950;
  --z-dropdown: 1000;
  --z-modal: 2000;
  --z-toast: 2100;

  /* Accent tints for content categories (icons, tags, callouts) */
  --accent-tint-violet-rgb: 155, 138, 250;   /* == --accent-purple */
  --accent-tint-green-rgb: 60, 198, 138;     /* == --status-open   */
  --accent-tint-sky-rgb: 56, 189, 248;       /* sky / tools        */
  --accent-tint-amber-rgb: 251, 191, 36;     /* community          */
  --accent-tint-pink-rgb: 244, 114, 182;     /* showcase           */
  --accent-neon-rgb: 0, 240, 255;            /* interactive neon highlights */

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-env="production"] {
  --sandbox-banner-height: 0px;
}

/* ==========================================================================
   PROPER LIGHT MODE — REFINED SLATE & LOGO COLOR PALETTE
   ========================================================================== */
[data-theme="light"] {
  --color-scheme: light;

  /* Clean surfaces — crisp warm whites */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FFFFFF;
  --bg-surface: #F1F5F9;
  --bg-input: #FFFFFF;
  --bg-elevated: #FFFFFF;

  /* Borders & Corners — noticeably darker, defined, crisp (never faint #E2E8F0) */
  --border-subtle: #CBD5E1;
  --border-medium: #94A3B8;
  --border-glow: rgba(91, 94, 237, 0.25);

  /* Typography — deep slate ink (crisp high contrast, WCAG AAA) */
  --text-primary: #0F172A;
  --text-secondary: #1E293B;
  --text-tertiary: #334155;
  --text-inverse: #FFFFFF;

  /* Accent Colors — matching official NEXUS logo */
  --accent-primary: #5B5EED;
  --accent-primary-rgb: 91, 94, 237;
  --accent-cyan: #0284C7;
  --accent-cyan-rgb: 2, 132, 199;
  --accent-blue: #2563EB;
  --accent-blue-rgb: 37, 99, 235;
  --accent-purple: #7C3AED;
  --accent-purple-rgb: 124, 58, 237;

  /* Status Colors */
  --status-open: #059669;
  --status-open-bg: rgba(5, 150, 105, 0.1);
  --status-upcoming: #2563EB;
  --status-upcoming-bg: rgba(37, 99, 235, 0.1);
  --status-planned: #D97706;
  --status-planned-bg: rgba(217, 119, 6, 0.1);
  --status-completed: #475569;
  --status-completed-bg: rgba(71, 85, 105, 0.1);
  --status-danger: #DC2626;
  --status-danger-bg: rgba(220, 38, 38, 0.1);

  /* Gradients — following the rising arrow in official NEXUS logo */
  --grad-nexus: linear-gradient(135deg, #4338CA 0%, #5B5EED 50%, #7B81FF 100%);
  --grad-card: linear-gradient(180deg, #FFFFFF 0%, #FAFAFA 100%);
  --grad-glow: radial-gradient(circle at 50% 0%, rgba(91, 94, 237, 0.06) 0%, transparent 60%);
  --grad-dark-overlay: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #FFFFFF 100%);

  /* Header & Backdrop — elegant frosted glass with visible darker grey border */
  --header-bg: rgba(255, 255, 255, 0.92);
  --header-bg-scrolled: rgba(255, 255, 255, 0.98);
  --header-border: #CBD5E1;
  --shadow-header: 0 4px 20px -4px rgba(0, 0, 0, 0.08);
  --shadow-header-scrolled: 0 8px 28px -4px rgba(0, 0, 0, 0.12);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-cyan: 0 0 16px rgba(2, 132, 199, 0.12);
  --shadow-purple: 0 0 16px rgba(91, 94, 237, 0.15);
}

/* Smooth Theme Transitions */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color 0.24s ease, border-color 0.24s ease, color 0.24s ease, fill 0.24s ease, stroke 0.24s ease, box-shadow 0.24s ease !important;
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

body[dir="rtl"] {
  font-family: var(--font-arabic);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 0.95rem; }

p {
  color: var(--text-secondary);
  font-size: 1rem;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

img, svg {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Layout Containers */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.container-wide {
  width: 100%;
  max-width: var(--container-wide);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Page entrance motion lives in css/page-transition.css (fade + 8px slide,
   shared with native view transitions). Keeping it in one place prevents the
   content from being animated twice on browsers that support view transitions. */
.main-content {
  flex: 1 0 auto;
  padding-top: calc(var(--header-height) + var(--sandbox-banner-height) + 18px);
}

/* Section Spacing */
.section {
  padding: 5rem 0;
  position: relative;
}

.section-hero {
  padding: 4rem 0 5rem;
  position: relative;
  overflow: hidden;
}

.section-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 3.5rem;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-primary);
  background: rgba(var(--accent-primary-rgb), 0.06);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.15);
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  margin-bottom: 1rem;
}

.section-tag::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-primary);
  flex-shrink: 0;
}

.section-title {
  margin-bottom: 1rem;
}

.section-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

/* Gradient Text */
.text-gradient {
  background: var(--grad-nexus);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* Grid Utilities */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

/* Selection */
::selection {
  background: rgba(var(--accent-primary-rgb), 0.2);
  color: var(--text-primary);
}

/* Accessibility */
.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;
}

:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
}

