/* ================================================================
   ALGEBRIX — Design System
   main.css : variables, reset, nav, footer, composants partagés
================================================================ */

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  /* Palette bleue */
  --c-deep:    #07111f;
  --c-navy:    #0f2040;
  --c-main:    #1a3a6b;
  --c-mid:     #2558b0;
  --c-light:   #3d7de4;
  --c-glow:    #5b9cf6;
  --c-accent:  #e8f1ff;
  --c-accent2: #dbeafe;

  /* Neutres */
  --c-white:   #ffffff;
  --c-bg:      #f7f9fd;
  --c-bg2:     #eef3fc;
  --c-border:  rgba(37, 88, 176, 0.12);
  --c-text:    #6b7a99;
  --c-text2:   #4a5568;

  /* Status */
  --c-green:   #16a34a;
  --c-green-bg:#f0fdf4;
  --c-red:     #dc2626;
  --c-red-bg:  #fef2f2;
  --c-orange:  #d97706;
  --c-orange-bg:#fffbeb;
  --c-purple:  #7c3aed;
  --c-purple-bg:#f5f3ff;
  --c-gold:    #b45309;
  --c-gold-bg: #fffbeb;

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

  /* Section padding */
  --section-y: 5rem;
  --section-x: 5vw;

  /* Radius */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-2xl: 28px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(7,17,31,.06), 0 1px 2px rgba(7,17,31,.04);
  --shadow-md:  0 4px 16px rgba(37,88,176,.08), 0 1px 4px rgba(7,17,31,.05);
  --shadow-lg:  0 12px 40px rgba(37,88,176,.12), 0 2px 8px rgba(7,17,31,.06);
  --shadow-xl:  0 24px 64px rgba(37,88,176,.16), 0 4px 16px rgba(7,17,31,.08);
  --shadow-btn: 0 4px 20px rgba(37,88,176,.28);
  --shadow-btn-h: 0 8px 28px rgba(37,88,176,.40);

  /* Typography */
  --font-heading: 'Syne', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'DM Mono', monospace;

  /* Nav height */
  --nav-h: 64px;

  /* Transitions */
  --t-fast: .15s ease;
  --t-base: .25s ease;
  --t-slow: .4s ease;
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
}
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--c-white);
  color: var(--c-deep);
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, video { display: block; max-width: 100%; }
svg { display: inline-block; max-width: 100%; vertical-align: middle; }
button, input, select, textarea {
  font: inherit;
  border: none;
  background: none;
  outline: none;
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ── TYPOGRAPHY SCALE ───────────────────────────────────────── */
.text-xs   { font-size: .75rem; }
.text-sm   { font-size: .875rem; }
.text-base { font-size: 1rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }

/* ── NOISE OVERLAY ──────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 9999;
  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)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none; opacity: .35;
}

/* ── NAVBAR ─────────────────────────────────────────────────── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--section-x);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--c-border);
  animation: fadeDown .5s ease both;
}

.nav-logo {
  font-family: var(--font-heading);
  font-weight: 800; font-size: 1.35rem;
  letter-spacing: -.025em;
  color: var(--c-deep);
  display: flex; align-items: center; gap: .4rem;
  flex-shrink: 0;
}
.nav-logo .logo-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-mid);
  color: var(--c-white);
  border-radius: var(--r-sm);
  width: 30px; height: 30px;
  font-size: 1.1rem;
}
.nav-logo-img {
  height: 24px;
  width: auto;
  display: block;
  object-fit: contain;
}

.nav-links {
  display: flex; align-items: center; gap: 1.75rem;
}
.nav-links a {
  font-size: .875rem; font-weight: 500;
  color: var(--c-text);
  transition: color var(--t-fast);
  position: relative;
}
.nav-links a:hover,
.nav-links a.active { color: var(--c-mid); }
.nav-links a.active::after {
  content: '';
  position: absolute; left: 0; bottom: -.3rem; right: 0;
  height: 2px; background: var(--c-mid); border-radius: 2px;
}

.nav-right {
  display: flex; align-items: center; gap: .5rem;
}
.nav-actions {
  display: flex; align-items: center; gap: .5rem;
}

/* Hamburger (mobile) */
.nav-hamburger {
  display: none;
  flex-direction: column; gap: 5px;
  cursor: pointer; padding: var(--sp-2);
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
}
.nav-hamburger:hover { background: var(--c-accent); }
.nav-hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--c-deep); border-radius: 2px;
  transition: transform var(--t-base), opacity var(--t-base);
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu */
.nav-mobile {
  display: none;
  position: fixed; top: var(--nav-h); left: 0; right: 0;
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  padding: var(--sp-6) var(--section-x);
  z-index: 199;
  animation: fadeDown .25s ease;
}
.nav-mobile.open { display: block; }
.nav-mobile .nav-links {
  flex-direction: column; align-items: flex-start;
  gap: var(--sp-4);
}
.nav-mobile .nav-links a {
  font-size: 1rem;
}
.nav-mobile .nav-actions {
  flex-direction: column; align-items: flex-start;
  margin-top: var(--sp-6); padding-top: var(--sp-6);
  border-top: 1px solid var(--c-border);
}

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--font-body);
  font-weight: 600; border-radius: var(--r-md);
  cursor: pointer; transition: all var(--t-fast);
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Sizes */
.btn-sm  { font-size: .8rem;  padding: .35rem .85rem; }
.btn-md  { font-size: .875rem; padding: .5rem 1.1rem; }
.btn-lg  { font-size: 1rem;   padding: .75rem 1.75rem; box-shadow: var(--shadow-btn); }
.btn-xl  { font-size: 1.05rem; padding: .9rem 2rem;  box-shadow: var(--shadow-btn); }

/* Variants */
.btn-primary {
  background: var(--c-mid); color: var(--c-white);
}
.btn-primary:hover:not(:disabled) {
  background: var(--c-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-btn-h);
}

.btn-secondary {
  background: var(--c-accent); color: var(--c-mid);
  border: 1.5px solid var(--c-border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--c-accent2);
  border-color: rgba(37,88,176,.25);
}

.btn-ghost {
  color: var(--c-mid);
}
.btn-ghost:hover:not(:disabled) { background: var(--c-accent); }

.btn-outline {
  color: var(--c-mid);
  border: 1.5px solid rgba(37,88,176,.3);
}
.btn-outline:hover:not(:disabled) {
  border-color: var(--c-mid);
  background: var(--c-accent);
}

/* ── BADGE / TAG ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .75rem; font-weight: 600;
  padding: .3rem .8rem;
  border-radius: var(--r-full);
}
.badge-blue   { background: var(--c-accent); color: var(--c-mid); border: 1px solid rgba(37,88,176,.2); }
.badge-green  { background: var(--c-green-bg); color: var(--c-green); }
.badge-orange { background: var(--c-orange-bg); color: var(--c-orange); }
.badge-red    { background: var(--c-red-bg); color: var(--c-red); }
.badge-purple { background: var(--c-purple-bg); color: var(--c-purple); }
.badge-gold   { background: var(--c-gold-bg); color: var(--c-gold); border: 1px solid #fde68a; }

/* ── SECTION BASE ───────────────────────────────────────────── */
.section {
  padding: var(--section-y) var(--section-x);
}
.section-alt { background: var(--c-bg); }

.section-eyebrow {
  font-size: .75rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--c-mid); margin-bottom: .75rem;
}
.section-title {
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800; letter-spacing: -.025em;
  color: var(--c-deep); line-height: 1.15;
  margin-bottom: .9rem;
}
.section-sub {
  font-size: 1rem; line-height: 1.7;
  color: var(--c-text); font-weight: 400;
  max-width: 520px;
}

/* ── CARD ────────────────────────────────────────────────────── */
.card {
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
  position: relative; overflow: hidden;
}
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(37,88,176,.22);
}
.card-top-accent::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--c-mid), var(--c-light));
  transform: scaleX(0); transform-origin: left;
  transition: transform .3s ease;
}
.card-top-accent:hover::before { transform: scaleX(1); }

/* Card icon */
.card-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  margin-bottom: var(--sp-5);
}
.card-icon-light { background: var(--c-accent); }
.card-icon-dark  { background: var(--c-deep); }
.card-icon-mid   { background: var(--c-mid); }

/* ── REVEAL ANIMATION (IntersectionObserver) ─────────────────── */
.reveal {
  opacity: 0; transform: translateY(24px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ── FOOTER ─────────────────────────────────────────────────── */
.footer {
  background: var(--c-deep);
  padding: var(--sp-16) var(--section-x) var(--sp-8);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--sp-12);
  margin-bottom: var(--sp-12);
  padding-bottom: var(--sp-10);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.footer-brand .nav-logo { color: var(--c-white); }
.footer-brand p {
  font-size: .85rem; line-height: 1.65;
  color: rgba(255,255,255,.45);
  margin-top: var(--sp-4); max-width: 200px;
}
.footer-col h4 {
  font-family: var(--font-heading);
  font-size: .8rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--c-white); margin-bottom: var(--sp-5);
}
.footer-col ul {
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.footer-col a {
  font-size: .85rem;
  color: rgba(255,255,255,.45);
  transition: color var(--t-fast);
}
.footer-col a:hover { color: var(--c-white); }
.footer-bottom {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--sp-4);
  font-size: .8rem; color: rgba(255,255,255,.35);
}

/* ── FORMS ──────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.form-label {
  font-size: .875rem; font-weight: 600;
  color: var(--c-deep);
}
.form-input {
  padding: .65rem var(--sp-4);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: .9rem; color: var(--c-deep);
  background: var(--c-white);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-input:focus {
  border-color: var(--c-mid);
  box-shadow: 0 0 0 3px rgba(37,88,176,.12);
}
.form-input::placeholder { color: var(--c-text); }
.form-error {
  font-size: .8rem; color: var(--c-red); margin-top: .15rem;
}

/* ── AVATAR ─────────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  background: var(--c-mid);
  color: var(--c-white);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-weight: 700;
  flex-shrink: 0;
}
.avatar-sm  { width: 32px; height: 32px; font-size: .8rem; }
.avatar-md  { width: 40px; height: 40px; font-size: .95rem; }
.avatar-lg  { width: 56px; height: 56px; font-size: 1.2rem; }

/* ── PROGRESS BAR ───────────────────────────────────────────── */
.progress-track {
  background: var(--c-bg2);
  border-radius: var(--r-full); overflow: hidden;
  height: 6px;
}
.progress-fill {
  height: 100%; border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--c-mid), var(--c-light));
  transition: width .5s ease;
}

/* ── BREADCRUMB ─────────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: .8rem; color: var(--c-text);
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--c-text); transition: color var(--t-fast); }
.breadcrumb a:hover { color: var(--c-mid); }
.breadcrumb-sep { opacity: .4; }

/* ── ANIMATIONS ─────────────────────────────────────────────── */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.04); opacity: .85; }
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* Utility animation classes */
.anim-fade-down { animation: fadeDown .5s ease both; }
.anim-fade-up   { animation: fadeUp .6s ease both; }
.anim-delay-1   { animation-delay: .1s; }
.anim-delay-2   { animation-delay: .2s; }
.anim-delay-3   { animation-delay: .3s; }
.anim-delay-4   { animation-delay: .4s; }
.anim-delay-5   { animation-delay: .5s; }

/* ── MATH FLOATS (decorative) ──────────────────────────────── */
.math-float {
  position: absolute;
  font-family: var(--font-heading); font-weight: 800;
  color: rgba(37,88,176,.055);
  pointer-events: none; user-select: none;
  line-height: 1;
}

/* ── GRID UTILITIES ─────────────────────────────────────────── */
.grid-auto-fill { display: grid; gap: var(--sp-6); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root {
    --section-y: 3.5rem;
    --section-x: 5vw;
  }
  .navbar .nav-links   { display: none; }
  .navbar .nav-actions { display: none; }
  .navbar .nav-right   { gap: .25rem; }
  .nav-hamburger { display: flex; }
  .nav-mobile .nav-links  { display: flex; }
  .nav-mobile .nav-actions { display: flex; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }

  /* Logo: cacher l'image sur mobile, garder uniquement le texte */
  .nav-logo { font-size: 1.15rem; gap: .3rem; }
  .nav-logo-img { display: none; }
}

@media (max-width: 480px) {
  .nav-actions .btn-ghost { display: none; }
  .footer-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
}
