/* =========================================
   1. CORE TOKENS
========================================= */
:root {
  --font-main: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  /* Deep Space Base */
  --bg-void: #020617;
  --bg-card-glass: rgba(30, 41, 59, 0.4);
  --bg-card-hover: rgba(30, 41, 59, 0.7);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 255, 255, 0.2);

  --radius-card: 24px;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-on-brand: #ffffff;

  --color-cyan: #06b6d4;
  --color-purple: #8b5cf6;

  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  --shell-max: 1000px;
  --gap: 24px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100vh; }

body {
  color: var(--text-main);
  font-family: var(--font-main);
  background-color: var(--bg-void);
  background-image:
    radial-gradient(ellipse at top, rgba(139, 92, 246, 0.15), transparent 50%),
    radial-gradient(ellipse at bottom, rgba(6, 182, 212, 0.15), transparent 50%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

/* =========================================
   AMBIENT LIGHT
========================================= */
.ambient-light {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none; overflow: hidden;
}
.orb {
  position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.3;
}
.orb-1 { top: -20%; left: -10%; width: 60vw; height: 60vw; background: var(--color-purple); animation: breathe 10s infinite alternate ease-in-out; }
.orb-2 { bottom: -20%; right: -10%; width: 50vw; height: 50vw; background: var(--color-cyan); animation: breathe 12s infinite alternate ease-in-out reverse; }

@keyframes breathe {
  0% { transform: scale(1); opacity: 0.3; }
  100% { transform: scale(1.1); opacity: 0.4; }
}

/* =========================================
   BACKGROUND MATH SYMBOLS
========================================= */
.math-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.math-symbol {
  position: absolute;
  font-size: clamp(1.8rem, 3.5vw, 3rem);
  color: rgba(255, 255, 255, 0.2);
  font-weight: 300;
  font-family: "Times New Roman", serif;
  animation: floatUp linear infinite;
  opacity: 0;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

@keyframes floatUp {
  0% { transform: translateY(10vh) rotate(0deg); opacity: 0; }
  10% { opacity: 0.4; }
  90% { opacity: 0.2; }
  100% { transform: translateY(-110vh) rotate(360deg); opacity: 0; }
}

.math-symbol.green { color: rgba(16, 185, 129, 0.5); text-shadow: 0 0 20px rgba(16, 185, 129, 0.3); }
.math-symbol.blue { color: rgba(59, 130, 246, 0.5); text-shadow: 0 0 20px rgba(59, 130, 246, 0.3); }
.math-symbol.rose { color: rgba(244, 63, 94, 0.5); text-shadow: 0 0 20px rgba(244, 63, 94, 0.3); }

/* =========================================
   2. PAGE LAYOUT
========================================= */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 20px;
  position: relative;
  z-index: 1;
}

.shell {
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
}

/* =========================================
   3. HEADER & HERO
========================================= */
.hero { margin-bottom: 64px; animation: fadeIn 0.8s var(--ease-smooth); }

.greeting {
  text-align: center;
  position: relative;
}

.greeting h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  margin: 0 0 16px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-on-brand);
  text-shadow: 0 0 30px rgba(255,255,255,0.15);
}

.mathos-brand {
  /* Match accueil (index.html) title style */
  display: block;
  margin-bottom: 12px;
  white-space: nowrap;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #10b981 0%, #3b82f6 50%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 40px rgba(16, 185, 129, 0.3);
}

.waving-hand {
  display: inline-block;
  animation: wave 2.5s infinite;
  transform-origin: 70% 70%;
}

@keyframes wave {
  0% { transform: rotate(0deg); }
  10% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  30% { transform: rotate(14deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
  60% { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

.greeting p.subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin: 0 auto;
  max-width: 600px;
}

/* =========================================
   4. BENTO GRID & CARDS
========================================= */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  width: 100%;
}

.card-form { display: flex; }

.data-card {
  position: relative;
  width: 100%;
  min-height: 220px;
  padding: 32px;

  display: flex; flex-direction: column; align-items: flex-start;

  background: var(--bg-card-glass);
  backdrop-filter: blur(24px) saturate(110%);
  -webkit-backdrop-filter: blur(24px) saturate(110%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);

  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: all 0.4s var(--ease-spring);
  user-select: none;
}

.data-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--theme-color), transparent);
  opacity: 0.6; transition: 0.3s; z-index: 2;
}

.data-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 20%), rgba(255, 255, 255, 0.15), transparent 50%);
  transform: scale(0.8); transition: opacity 0.6s, transform 0.6s; z-index: 1;
}
.data-card.is-rippling::after { opacity: 1; transform: scale(1.2); }

/* HOVER STATES */
.data-card:hover, .data-card:focus-visible {
  transform: translateY(-10px) scale(1.01);
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
  box-shadow: 0 24px 48px -12px rgba(0,0,0,0.6);
}
.data-card:hover::before { height: 2px; opacity: 1; box-shadow: 0 0 25px var(--theme-color); }

/* Active State */
.data-card.is-active {
  border-color: var(--theme-color);
  box-shadow: 0 0 40px var(--theme-color-glow) inset;
}

/* =========================================
   5. CARD CONTENT (Updated for Emojis)
========================================= */
.card-icon-box {
  width: 64px; height: 64px; /* Un peu plus grand pour les emojis */
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 18px;
  display: grid; place-items: center;
  /* On retire la couleur forcée pour laisser l'emoji en 3D */
  /* color: var(--theme-color); */
  margin-bottom: 24px;
  transition: 0.3s var(--ease-smooth);
  overflow: hidden;
  z-index: 2;
}

/* Style spécifique pour la taille de l'emoji */
.emoji-icon {
  font-size: 36px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* Icon Hover Animation */
.data-card:hover .card-icon-box,
.data-card.is-active .card-icon-box {
  background: var(--theme-color);
  /* color: #fff; */ /* Inutile pour les emojis */
  border-color: transparent;
  box-shadow: 0 8px 24px var(--theme-color-glow);
  transform: scale(1.1) rotate(-5deg); /* Rotation un peu plus prononcée */
}

.card-content { z-index: 2; }
.card-content h3 {
  font-size: 2rem; font-weight: 800; margin: 0 0 8px; color: #fff;
  letter-spacing: -0.02em;
}
.card-content p {
  font-size: 1rem; color: var(--text-muted); margin: 0; font-weight: 500;
}

/* Arrow */
.card-action {
  margin-top: auto; width: 100%; display: flex; justify-content: flex-end; z-index: 2;
}
.card-arrow {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--border-subtle);
  display: grid; place-items: center;
  color: var(--text-muted); opacity: 0.6;
  transition: 0.3s var(--ease-spring);
}
.data-card:hover .card-arrow {
  border-color: var(--theme-color); color: var(--theme-color);
  opacity: 1; transform: translateX(8px); background: rgba(255,255,255,0.05);
}
.data-card.is-active .card-arrow {
  background: var(--theme-color); border-color: var(--theme-color); color: #fff; opacity: 1;
}

/* =========================================
   6. MOBILE RESPONSIVE
========================================= */
@media (max-width: 768px) {
  .page { padding: 40px 16px; }
  .bento-grid { grid-template-columns: 1fr; gap: 16px; }

  .greeting h1 { font-size: 2.5rem; }
  .mathos-brand { font-size: 1.75rem; }

  .data-card {
    min-height: auto;
    flex-direction: row;
    align-items: center;
    padding: 24px;
    gap: 20px;
  }

  .card-icon-box { margin-bottom: 0; width: 52px; height: 52px; flex-shrink: 0; }
  .emoji-icon { font-size: 30px; }

  .card-content h3 { font-size: 1.5rem; margin-bottom: 4px; }
  .card-content p { font-size: 0.9rem; }

  .card-action { width: auto; margin-left: auto; }
  .card-arrow { width: 40px; height: 40px; border-width: 1px; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
