/* ============================================
   IREMA — TIC & IA pour l'impact social
   Design system: soft dark blue + blue accents
   Light mode: soft ash backgrounds
   Dark mode: deep soft blues
   ============================================ */

:root {
  /* Light mode (default) */
  --bg-body: #e9ecef;           /* soft ash – less eye strain */
  --bg-surface: #f8f9fa;
  --bg-card: #ffffff;
  --bg-nav: rgba(30, 58, 95, 0.92);
  --bg-hero-overlay: linear-gradient(135deg, rgba(15, 30, 55, 0.85), rgba(30, 58, 95, 0.7));

  --text-primary: #1a2332;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --text-on-dark: #f1f5f9;

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: #dbeafe;
  --primary-dark: #1e3a5f;
  --primary-soft: #2a4a75;

  --border: #d1d5db;
  --border-soft: #e2e8f0;
  --shadow: 0 4px 20px rgba(30, 58, 95, 0.08);
  --shadow-lg: 0 12px 40px rgba(30, 58, 95, 0.12);

  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.25s ease;
}

/* Dark mode — texte bien blanc pour le contraste */
[data-theme="dark"] {
  --bg-body: #0f172a;
  --bg-surface: #1e293b;
  --bg-card: #1e293b;
  --bg-nav: rgba(15, 23, 42, 0.95);
  --bg-hero-overlay: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 58, 95, 0.75));

  --text-primary: #ffffff;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-on-dark: #ffffff;

  --accent: #60a5fa;
  --accent-hover: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.2);
  --primary-dark: #1e3a5f;
  --primary-soft: #334155;

  --border: #334155;
  --border-soft: #1e293b;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] strong {
  color: #ffffff;
}

[data-theme="dark"] .text-secondary {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .lead {
  color: #e2e8f0;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  transition: background-color var(--transition), color var(--transition);
  line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
}

.display-4, .display-5, .display-6 {
  letter-spacing: -0.02em;
}

.lead {
  color: var(--text-secondary);
}

.text-secondary {
  color: var(--text-secondary) !important;
}

.kicker {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.grad {
  background: linear-gradient(90deg, var(--accent), #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Navbar */
#mainNav {
  background: var(--bg-nav) !important;
  backdrop-filter: blur(12px);
  transition: background var(--transition), box-shadow var(--transition);
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

#mainNav.scrolled {
  box-shadow: var(--shadow);
}

.navbar-brand {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: #fff !important;
}

.navbar-brand i {
  color: var(--accent);
}

.nav-link {
  color: rgba(255, 255, 255, 0.85) !important;
  font-weight: 400;
  font-size: 0.95rem;
  transition: color var(--transition);
  position: relative;
  padding-bottom: 0.35rem !important;
}

.nav-link:hover {
  color: #fff !important;
}

.nav-link.active {
  color: #fff !important;
  font-weight: 500;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

/* Theme toggle */
.theme-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  font-size: 1.1rem;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: inline-block;
}

[data-theme="light"] .theme-toggle .icon-moon,
:root:not([data-theme]) .theme-toggle .icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun,
:root:not([data-theme]) .theme-toggle .icon-sun {
  display: inline-block;
}

/* Hero */
#hero {
  min-height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.overlay {
  position: absolute;
  inset: 0;
  background: var(--bg-hero-overlay);
  z-index: 1;
}

#hero .container {
  z-index: 2;
}

#hero h1 {
  color: #fff;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

#hero .lead {
  color: rgba(255, 255, 255, 0.85);
}

/* Buttons */
.btn-primary {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.5rem;
  transition: all var(--transition);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
}

.btn-outline-light {
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: all var(--transition);
}

.btn-outline-primary {
  color: var(--accent);
  border-color: var(--accent);
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.btn-outline-primary:hover {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Sections */
.section-pad {
  padding: 5rem 0;
}

/* Cards */
.card-dark,
.card-surface {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.card-dark:hover,
.card-surface:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

/* Pricing / Solutions cards */
.price {
  position: relative;
  overflow: hidden;
}

.price.featured {
  border: 2px solid var(--accent);
}

.price .badge {
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* Gallery */
.gallery-item {
  aspect-ratio: 4/3;
  position: relative;
  overflow: hidden;
}

.gallery-item img {
  transition: transform 0.4s ease;
}

.gallery-item:hover img {
  transform: scale(1.06);
}

.gallery-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.5), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.gallery-item:hover::after {
  opacity: 1;
}

/* Team */
.avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent-soft);
}

.avatar-sm {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

/* Quotes */
.quote {
  position: relative;
}

.quote::before {
  content: '"';
  font-size: 4rem;
  line-height: 1;
  color: var(--accent);
  opacity: 0.25;
  position: absolute;
  top: 0.5rem;
  left: 1rem;
  font-family: Georgia, serif;
}

/* Forms */
.form-control-dark,
.form-select-dark {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control-dark:focus,
.form-select-dark:focus {
  background-color: var(--bg-surface);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-control-dark::placeholder {
  color: var(--text-muted);
}

.form-label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

/* Contact info */
.contact-list li {
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.contact-list i {
  color: var(--accent);
  font-size: 1.15rem;
}

/* Footer */
footer {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-top: 1px solid var(--border) !important;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  z-index: 1000;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  box-shadow: var(--shadow);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Stats / Impact numbers */
.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

/* Charts */
.chart-wrap {
  position: relative;
  width: 100%;
  max-height: 260px;
  height: 240px;
}

.chart-wrap-tall {
  max-height: 280px;
  height: 260px;
}

.impact-kpis strong {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Utility */
.bg-surface {
  background-color: var(--bg-surface) !important;
}

.border-soft {
  border-color: var(--border) !important;
}

/* Inner page hero */
.page-hero {
  padding: 8rem 0 3.5rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.page-hero h1 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Home preview cards */
.preview-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.preview-card .preview-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.preview-card .preview-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.preview-card .preview-body p {
  flex: 1;
}

/* 404 page */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.error-code {
  font-size: clamp(6rem, 15vw, 10rem);
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Responsive tweaks */
@media (max-width: 768px) {
  .section-pad {
    padding: 3.5rem 0;
  }

  #hero h1 {
    font-size: 2rem;
  }
}
