/* =============================================================
   Web'up Design System — Foundations
   Terminal CRT — c'est la seule direction du projet.
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Major+Mono+Display&display=swap');

/* -------------------------------------------------------------
   BASE — tokens that don't depend on direction
   ------------------------------------------------------------- */

:root {
  /* —— Typographie —— */
  /* --font-display retiré : aucun italique / calligraphique sur ce projet. */
  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
  --font-retro: 'Major Mono Display', 'JetBrains Mono', monospace;

  /* Tailles */
  --fs-12: 0.75rem;
  --fs-14: 0.875rem;
  --fs-16: 1rem;
  --fs-18: 1.125rem;
  --fs-20: 1.25rem;
  --fs-24: 1.5rem;
  --fs-32: 2rem;
  --fs-40: 2.5rem;
  --fs-56: 3.5rem;
  --fs-72: 4.5rem;
  --fs-96: 6rem;

  /* Line heights */
  --lh-tight: 1.05;
  --lh-snug: 1.2;
  --lh-base: 1.5;
  --lh-loose: 1.7;

  /* Letter spacing */
  --ls-tight: -0.03em;
  --ls-snug: -0.015em;
  --ls-base: 0;
  --ls-wide: 0.04em;
  --ls-wider: 0.14em; /* labels mono ALL CAPS */

  /* —— Spacing (4px scale) —— */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;

  /* —— Radii —— */
  --radius-sm: 4px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;
  --radius-pill: 999px;

  /* —— Motion —— */
  --ease-out-quart: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 120ms;
  --dur-base: 240ms;
  --dur-slow: 480ms;
  --dur-ambient: 8s;

  /* —— Layout —— */
  --container-max: 1200px;
  --container-pad: clamp(1rem, 4vw, 2rem);
  --grid-cols: 12;
  --grid-gap: var(--space-5);
}

/* -------------------------------------------------------------
   THEME — Terminal CRT  (seule direction du projet)
   ------------------------------------------------------------- */

:root {
  /* —— Brand spine (from the logo) —— */
  --brand-light: #4FA3E0;  /* sky blue — logo's lighter arc */
  --brand-deep:  #2C5DAF;  /* royal blue — logo's darker arc */
  --brand-ink:   #1B2436;  /* near-black logo wordmark color */

  /* —— Surfaces (base) — almost-black with the faintest blue cast —— */
  --bg-deep:   #02080F;
  --bg-elev:   #06101E;
  --bg-elev-2: #0A1A30;

  /* —— Glass surfaces (cyan-tinted) —— */
  --surface:        rgba(78, 214, 255, 0.03);
  --surface-glass:  rgba(78, 214, 255, 0.05);
  --surface-elev:   rgba(78, 214, 255, 0.08);

  /* —— Foreground —— */
  --fg-1: #DCF4FF;
  --fg-2: rgba(220, 244, 255, 0.7);
  --fg-3: rgba(220, 244, 255, 0.48);
  --fg-4: rgba(220, 244, 255, 0.3);

  /* —— Borders —— */
  --border-1:      rgba(78, 214, 255, 0.12);
  --border-2:      rgba(78, 214, 255, 0.24);
  --border-strong: rgba(78, 214, 255, 0.42);

  /* —— Accents —— */
  --accent:    #4ED6FF;   /* electric cyan — le signal CRT (CTA principal) */
  --accent-2:  #2C72D6;   /* brand deep blue — accents, états chauds */
  --accent-3:  #FFB155;   /* warm amber — alerts, soleil var */
  --accent-4:  #6D5BFF;   /* indigo — gradients ponctuels */
  --accent-5:  #FFD166;   /* gold — sparkle / stars */

  /* —— Sémantique —— */
  --success: var(--accent);
  --warning: var(--accent-3);
  --danger:  #ff4d6d;
  --info:    var(--accent);

  /* —— Glow / shadow (halos colorés, jamais du noir pur) —— */
  --glow-accent:   rgba(78, 214, 255, 0.5);
  --glow-accent-2: rgba(44, 114, 214, 0.4);
  --glow-accent-3: rgba(255, 177, 85, 0.35);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 16px 40px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--border-1);
  --shadow-lg: 0 24px 60px -16px rgba(0, 0, 0, 0.85), 0 0 80px -20px var(--glow-accent);

  /* —— Backgrounds décoratifs (orbes ambiantes) —— */
  --orb-1: radial-gradient(circle at 20% 10%, rgba(78, 214, 255, 0.2), transparent 55%);
  --orb-2: radial-gradient(circle at 85% 85%, rgba(44, 114, 214, 0.18), transparent 60%);
  --orb-3: radial-gradient(circle at 50% 50%, rgba(255, 177, 85, 0.06), transparent 70%);

  /* —— Grille horizon —— */
  --horizon-color: rgba(78, 214, 255, 0.28);

  /* —— Scanlines CRT — overlay 4% cyan sur tout le body —— */
  --scanline-opacity: 0.04;
}

/* =============================================================
   ELEMENTS — semantic resets & defaults
   ============================================================= */

* {
  box-sizing: border-box;
}

html {
  background: var(--bg-deep);
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-16);
  line-height: var(--lh-base);
  color: var(--fg-1);
  background: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* —— Headings ——
   Headlines en Space Grotesk gras tight — JAMAIS d'italique, JAMAIS d'ALL CAPS, JAMAIS de calligraphique. */
h1, .h1 {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(var(--fs-40), 7vw, var(--fs-96));
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  margin: 0 0 var(--space-5);
  color: var(--fg-1);
  text-wrap: balance;
}

h2, .h2 {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(var(--fs-32), 5vw, var(--fs-72));
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  margin: 0 0 var(--space-5);
  color: var(--fg-1);
  text-wrap: balance;
}

/* Emphasis in headlines: NO italic. Accent color instead. */
h1 em, .h1 em,
h2 em, .h2 em,
h3 em, .h3 em {
  font-style: normal;
  color: var(--accent);
  font-weight: inherit;
}

/* Safety net: ban italic globally. Anywhere <em> or <i> appears,
   we use color weight, never slant. */
em, i, cite, address {
  font-style: normal;
}

h3, .h3 {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--fs-24);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-snug);
  margin: 0 0 var(--space-3);
  color: var(--fg-1);
  text-wrap: pretty;
}

h4, .h4 {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--fs-18);
  line-height: var(--lh-snug);
  margin: 0 0 var(--space-2);
  color: var(--fg-1);
}

/* Direction B (CRT) garde les mêmes titres Space Grotesk — c'est la palette qui change,
   pas la typographie. (L'ancienne règle qui forcçait Major Mono Display ALL CAPS
   est volontairement retirée — trop agressive, peu lisible.) */

/* —— Body, paragraph —— */
p {
  margin: 0 0 var(--space-4);
  color: var(--fg-2);
  text-wrap: pretty;
  max-width: 65ch;
}

a {
  color: var(--accent-2);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out-quart);
}
a:hover { color: var(--accent); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* —— Eyebrow (small label above titles) —— */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--ls-wider);
  color: var(--accent);
  margin: 0 0 var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.eyebrow::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

/* —— Code / mono —— */
code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  padding: 2px 6px;
  background: var(--surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-sm);
  color: var(--accent);
}

pre {
  padding: var(--space-5);
  background: var(--bg-elev);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-md);
  overflow-x: auto;
  line-height: var(--lh-snug);
}

pre code {
  padding: 0;
  background: transparent;
  border: none;
  color: var(--fg-1);
}

/* —— Big stat / metric —— */
.metric {
  font-family: var(--font-retro);
  font-size: clamp(var(--fs-56), 9vw, var(--fs-96));
  line-height: 1;
  letter-spacing: var(--ls-snug);
  color: var(--fg-1);
  font-variant-numeric: tabular-nums;
}

.metric-label {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  text-transform: uppercase;
  letter-spacing: var(--ls-wider);
  color: var(--fg-3);
}

/* —— Mono label (technical tag) —— */
.mono-tag {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: var(--ls-wide);
  color: var(--accent);
  padding: 4px 10px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-pill);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

/* =============================================================
   UTILITIES — glass card, buttons, etc.
   ============================================================= */

.glass {
  background: var(--surface-glass);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

/* Spec line — petit reflet en haut du panel */
.glass::before {
  content: '';
  position: absolute;
  top: 0; left: 12px; right: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.32), transparent);
  pointer-events: none;
}

/* —— Stage backgrounds (orbs + grid) —— */
.stage {
  position: relative;
  background: var(--bg-deep);
  overflow: hidden;
  isolation: isolate;
}

.stage::before,
.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.stage::before {
  background: var(--orb-1), var(--orb-2), var(--orb-3);
}

.stage::after {
  background-image:
    linear-gradient(to right, var(--border-1) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border-1) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  opacity: 0.5;
}

.stage > * { position: relative; z-index: 1; }

/* —— Scanlines (Direction B) —— */
.stage::after,
.scanlines::after { }

body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(78, 214, 255, var(--scanline-opacity)) 2px,
    rgba(78, 214, 255, var(--scanline-opacity)) 3px
  );
  mix-blend-mode: screen;
}

/* —— Buttons —— */
.btn {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--fs-16);
  line-height: 1;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: all var(--dur-base) var(--ease-out-quart);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-deep);
  box-shadow: 0 0 0 1px var(--accent), 0 0 32px -4px var(--glow-accent);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent);
  filter: brightness(1.1);
  box-shadow: 0 0 0 1px var(--accent), 0 0 48px -4px var(--glow-accent);
  transform: translateY(-1px);
}

.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  background: var(--surface-glass);
  color: var(--fg-1);
  border-color: var(--border-2);
  backdrop-filter: blur(12px);
}

.btn-secondary:hover {
  background: var(--surface-elev);
  border-color: var(--border-strong);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-1);
  padding: 10px 12px;
}

.btn-ghost:hover { color: var(--accent); background: var(--surface); }

/* —— Inputs —— */
.field {
  font-family: var(--font-sans);
  font-size: var(--fs-16);
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-md);
  color: var(--fg-1);
  transition: border-color var(--dur-fast) var(--ease-out-quart),
              box-shadow var(--dur-fast) var(--ease-out-quart);
  font-feature-settings: "ss01";
}

.field::placeholder { color: var(--fg-4); }

.field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow-accent);
}

/* =============================================================
   ANIMATIONS — ambient
   ============================================================= */

@keyframes orb-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(2%, -2%) scale(1.04); }
}

@keyframes cursor-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.cursor::after {
  content: '▮';
  margin-left: 4px;
  color: var(--accent);
  animation: cursor-blink 1s steps(1) infinite;
}

@keyframes scroll-x {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* —— Reduced motion —— */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
