/* Fourth Expedition — MARSWELL design system (ported from luxembourg-smart-learning) */

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

/* ──────────────────────────────────────────────────────────────────────────
   THEME TOKENS
   ────────────────────────────────────────────────────────────────────────── */
:root {
  /* Radius */
  --radius: 0.875rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-2xl: calc(var(--radius) + 8px);
  --radius-3xl: calc(var(--radius) + 12px);

  /* Core colours (oklch from source) */
  --background: oklch(0.13 0.035 268);
  --foreground: oklch(0.985 0.01 90);
  --card: oklch(0.18 0.04 268);
  --card-foreground: oklch(0.985 0.01 90);
  --popover: oklch(0.18 0.04 268);
  --popover-foreground: oklch(0.985 0.01 90);
  --primary: oklch(0.72 0.17 45);
  --primary-foreground: oklch(0.13 0.035 268);
  --secondary: oklch(0.25 0.04 268);
  --secondary-foreground: oklch(0.985 0.01 90);
  --muted: oklch(0.22 0.03 268);
  --muted-foreground: oklch(0.72 0.03 250);
  --accent: oklch(0.78 0.15 90);
  --accent-foreground: oklch(0.13 0.035 268);
  --destructive: oklch(0.7 0.2 22);
  --destructive-foreground: oklch(0.985 0.01 90);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 12%);
  --ring: oklch(0.72 0.17 45);

  /* Domain / semantic accent colours */
  --nombres: #f97316;
  --espace: #22d3ee;
  --grandeurs: #10b981;
  --problemes: #a855f7;

  /* Fonts */
  --font-sans: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Sora", "Manrope", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Motion */
  --ease-standard: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-micro: 120ms;
  --duration-standard: 200ms;
  --duration-entrance: 240ms;
  --lift-y: -2px;
  --press-scale: 0.98;
  --shadow-lift:
    0 10px 24px -12px rgba(0, 0, 0, 0.55),
    0 2px 6px -2px rgba(0, 0, 0, 0.35);

  /* Card system */
  --card-radius: 1.25rem;
  --card-bg: rgba(255, 255, 255, 0.04);
  --card-bg-elevated: rgba(255, 255, 255, 0.065);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-border-elevated: rgba(255, 255, 255, 0.12);
  --card-blur: 20px;
  --card-shadow-elevated:
    0 24px 60px -28px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

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

* {
  border-color: var(--border);
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

html {
  scroll-padding-top: 96px;
}

:target,
section[id],
[data-anchor] {
  scroll-margin-top: 96px;
}

h1, h2, h3, h4, h5, h6, .font-display {
  font-family: var(--font-display);
  font-weight: 300;
  letter-spacing: -0.025em;
  margin: 0;
}

p { margin: 0; }

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* ──────────────────────────────────────────────────────────────────────────
   TYPOGRAPHY UTILITIES
   ────────────────────────────────────────────────────────────────────────── */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-5xl { font-size: 3rem; line-height: 1; }
.text-6xl { font-size: 3.75rem; line-height: 1; }
.text-7xl { font-size: 4.5rem; line-height: 1; }

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: var(--font-mono); }

.tracking-tight { letter-spacing: -0.025em; }
.tracking-wide { letter-spacing: 0.025em; }
.leading-none { line-height: 1; }
.leading-tight { line-height: 1.25; }
.leading-relaxed { line-height: 1.625; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-muted { color: var(--muted-foreground); }
.text-destructive { color: var(--destructive); }
.text-gradient {
  background: linear-gradient(90deg, #f97316 0%, #fbbf24 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ──────────────────────────────────────────────────────────────────────────
   LAYOUT UTILITIES
   ────────────────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.mx-auto { margin-left: auto; margin-right: auto; }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.block { display: block; }
.inline-block { display: inline-block; }
.hidden { display: none; }

.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.flex-none { flex: none; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-10 { gap: 2.5rem; }
.gap-12 { gap: 3rem; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.inset-0 { inset: 0; }
.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

.overflow-hidden { overflow: hidden; }
.overflow-visible { overflow: visible; }
.overflow-x-hidden { overflow-x: hidden; }

.min-h-screen { min-height: 100vh; }
.min-h-svh { min-height: 100svh; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-7xl { max-width: 80rem; }

/* ──────────────────────────────────────────────────────────────────────────
   SPACING UTILITIES
   ────────────────────────────────────────────────────────────────────────── */
.m-0 { margin: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
.mt-16 { margin-top: 4rem; }
.mt-20 { margin-top: 5rem; }
.mt-24 { margin-top: 6rem; }
.mt-32 { margin-top: 8rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mb-12 { margin-bottom: 3rem; }
.mb-16 { margin-bottom: 4rem; }
.mb-20 { margin-bottom: 5rem; }

.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

.p-0 { padding: 0; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-10 { padding: 2.5rem; }
.p-12 { padding: 3rem; }

.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }
.py-24 { padding-top: 6rem; padding-bottom: 6rem; }
.py-32 { padding-top: 8rem; padding-bottom: 8rem; }

.pt-20 { padding-top: 5rem; }
.pt-24 { padding-top: 6rem; }
.pt-28 { padding-top: 7rem; }
.pt-32 { padding-top: 8rem; }
.pb-16 { padding-bottom: 4rem; }
.pb-20 { padding-bottom: 5rem; }
.pb-24 { padding-bottom: 6rem; }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-3xl { border-radius: var(--radius-3xl); }
.rounded-full { border-radius: 9999px; }

/* ──────────────────────────────────────────────────────────────────────────
   SURFACES / CARDS
   ────────────────────────────────────────────────────────────────────────── */
.card-flat {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
}

.card-elevated {
  background: var(--card-bg-elevated);
  border: 1px solid var(--card-border-elevated);
  border-radius: var(--card-radius);
  backdrop-filter: blur(var(--card-blur)) saturate(1.3);
  box-shadow: var(--card-shadow-elevated);
}

.glass {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
}

.glass-strong {
  background: var(--card-bg-elevated);
  border: 1px solid var(--card-border-elevated);
  border-radius: var(--card-radius);
  backdrop-filter: blur(var(--card-blur)) saturate(1.3);
  box-shadow: var(--card-shadow-elevated);
}

.glass-pill {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(36px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.2),
    0 30px 80px -20px rgba(0, 0, 0, 0.5);
}

/* ──────────────────────────────────────────────────────────────────────────
   BUTTONS
   ────────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.25rem;
  cursor: pointer;
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--primary-foreground);
  transition:
    transform var(--duration-micro) var(--ease-standard),
    box-shadow var(--duration-micro) var(--ease-standard),
    opacity var(--duration-micro) var(--ease-standard),
    background-color var(--duration-micro) var(--ease-standard),
    border-color var(--duration-micro) var(--ease-standard);
  will-change: transform;
}

.btn:hover:not(:disabled) {
  transform: translateY(var(--lift-y));
  box-shadow: var(--shadow-lift);
}

.btn:active:not(:disabled) {
  transform: scale(var(--press-scale));
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--foreground);
}

.btn-ghost {
  background: transparent;
  color: var(--foreground);
}

.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.75rem; }
.btn-lg { padding: 0.875rem 2rem; font-size: 1rem; }
.btn-icon { padding: 0.5rem; }

/* ──────────────────────────────────────────────────────────────────────────
   FORM ELEMENTS
   ────────────────────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--input);
  background: var(--input);
  color: var(--foreground);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--duration-micro), box-shadow var(--duration-micro);
}

.input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px var(--ring);
}

.input::placeholder {
  color: var(--muted-foreground);
}

/* ──────────────────────────────────────────────────────────────────────────
   ATMOSPHERES & EFFECTS
   ────────────────────────────────────────────────────────────────────────── */
.grid-dots {
  background-image: radial-gradient(rgba(249, 115, 22, 0.22) 1px, transparent 1px);
  background-size: 24px 24px;
}

.starfield {
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.6) 50%, transparent 50%),
    radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,0.5) 50%, transparent 50%),
    radial-gradient(1px 1px at 45% 85%, rgba(255,255,255,0.7) 50%, transparent 50%),
    radial-gradient(1px 1px at 85% 20%, rgba(255,255,255,0.4) 50%, transparent 50%),
    radial-gradient(1px 1px at 10% 70%, rgba(255,255,255,0.5) 50%, transparent 50%);
  background-size: 600px 600px;
}

.atmosphere-rust {
  background:
    radial-gradient(ellipse 80% 50% at 50% 110%, rgba(249, 115, 22, 0.35), transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 0%, rgba(251, 191, 36, 0.18), transparent 60%),
    linear-gradient(180deg, oklch(0.16 0.04 280) 0%, oklch(0.13 0.035 268) 100%);
}

.atmosphere-dawn {
  background:
    radial-gradient(ellipse 90% 60% at 50% 100%, rgba(244, 114, 182, 0.18), transparent 65%),
    radial-gradient(ellipse 70% 40% at 20% 10%, rgba(167, 139, 250, 0.14), transparent 60%),
    linear-gradient(180deg, oklch(0.14 0.05 290) 0%, oklch(0.13 0.035 268) 100%);
}

.atmosphere-orbit {
  background:
    radial-gradient(circle 600px at 50% 100%, rgba(96, 165, 250, 0.12), transparent 60%),
    radial-gradient(circle 800px at 80% 20%, rgba(249, 115, 22, 0.1), transparent 60%),
    linear-gradient(180deg, oklch(0.11 0.04 268) 0%, oklch(0.13 0.035 268) 100%);
}

.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ──────────────────────────────────────────────────────────────────────────
   ANIMATIONS
   ────────────────────────────────────────────────────────────────────────── */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.5; filter: blur(60px); }
  50% { opacity: 0.85; filter: blur(90px); }
}

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

@keyframes drift {
  0%, 100% { transform: translate3d(0,0,0) scale(1); }
  50% { transform: translate3d(0,-8px,0) scale(1.02); }
}

@keyframes page-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes holo-spin {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes holo-sheen {
  0% { transform: translateX(-120%) skewX(-20deg); }
  100% { transform: translateX(220%) skewX(-20deg); }
}

.animate-float { animation: float 6s ease-in-out infinite; }
.animate-pulse-glow { animation: pulse-glow 5s ease-in-out infinite; }
.animate-drift { animation: drift 9s ease-in-out infinite; }
.animate-in-up { animation: slide-up 0.8s var(--ease-out-expo) both; }
.page-enter { animation: page-enter var(--duration-standard) var(--ease-standard) both; }

.holo-border {
  background: linear-gradient(120deg, #f97316, #fde047, #22d3ee, #a855f7, #ec4899, #f97316);
  background-size: 200% 200%;
  animation: holo-spin 4s linear infinite;
}

.holo-sheen {
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.55) 50%, transparent 70%);
  animation: holo-sheen 2.8s ease-in-out infinite;
}

.holo-frame {
  position: relative;
}
.holo-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 1rem;
  padding: 2px;
  background: linear-gradient(120deg, #22d3ee, #8b5cf6, #ec4899, #22d3ee);
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: holo-spin 6s linear infinite;
  pointer-events: none;
}

/* ──────────────────────────────────────────────────────────────────────────
   INTERACTIVE FEEL
   ────────────────────────────────────────────────────────────────────────── */
button:not([data-no-motion]),
[role="button"]:not([data-no-motion]),
a.btn:not([data-no-motion]),
.interactive:not([data-no-motion]),
.glass:not([data-no-motion]),
.glass-strong:not([data-no-motion]),
.card-flat:not([data-no-motion]),
.card-elevated:not([data-no-motion]) {
  transition:
    transform var(--duration-micro) var(--ease-standard),
    box-shadow var(--duration-micro) var(--ease-standard),
    opacity var(--duration-micro) var(--ease-standard),
    background-color var(--duration-micro) var(--ease-standard),
    border-color var(--duration-micro) var(--ease-standard),
    color var(--duration-micro) var(--ease-standard);
  will-change: transform;
}

button:not([disabled]):not([data-no-motion]):hover,
[role="button"]:not([aria-disabled="true"]):not([data-no-motion]):hover,
a.btn:not([data-no-motion]):hover,
.interactive:not([data-no-motion]):hover,
.glass:not([data-no-motion]):hover,
.glass-strong:not([data-no-motion]):hover,
.card-flat:not([data-no-motion]):hover,
.card-elevated:not([data-no-motion]):hover {
  transform: translateY(var(--lift-y));
  box-shadow: var(--shadow-lift);
}

button:not([disabled]):not([data-no-motion]):active,
[role="button"]:not([aria-disabled="true"]):not([data-no-motion]):active,
a.btn:not([data-no-motion]):active,
.interactive:not([data-no-motion]):active {
  transform: scale(var(--press-scale));
  transition-duration: 80ms;
}

/* ──────────────────────────────────────────────────────────────────────────
   REDUCED MOTION
   ────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-property: opacity, color, background-color, border-color !important;
    transition-duration: var(--duration-micro) !important;
    scroll-behavior: auto !important;
  }

  .page-enter {
    animation: none;
    opacity: 1;
  }

  button:not([data-no-motion]):hover,
  [role="button"]:not([data-no-motion]):hover,
  a.btn:not([data-no-motion]):hover,
  .interactive:not([data-no-motion]):hover,
  .glass:not([data-no-motion]):hover,
  .glass-strong:not([data-no-motion]):hover,
  .card-flat:not([data-no-motion]):hover,
  .card-elevated:not([data-no-motion]):hover,
  button:not([data-no-motion]):active,
  [role="button"]:not([data-no-motion]):active,
  a.btn:not([data-no-motion]):active,
  .interactive:not([data-no-motion]):active {
    transform: none !important;
    box-shadow: none !important;
  }
}
