/* =====================================================================
   QU CORE — Base styles + utilities + shared keyframes
   Non-destructif : uniquement classes préfixées .qu-* et règles génériques safe.
   ===================================================================== */

/* ---------- Subtle modern reset (n'écrase pas les règles locales) ---------- */
.qu-scope *,
.qu-scope *::before,
.qu-scope *::after { box-sizing: border-box; }

/* Smooth scroll global, safe */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Body readability defaults — applies only where not overridden */
body {
  line-height: var(--qu-lh-normal, 1.55);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Long-text blocks (paragraphs, list items in nav/menus) get more breathing room */
p, li {
  line-height: var(--qu-lh-normal, 1.55);
}

/* Selection */
::selection { background: var(--qu-accent); color: #fff; }
::-moz-selection { background: var(--qu-accent); color: #fff; }

/* Focus ring accessible, n'apparaît que sur :focus-visible */
.qu-scope :focus-visible,
:where(button, a, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--qu-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Shared keyframes ---------- */

@keyframes qu-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes qu-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes qu-fade-down {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes qu-scale-in {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes qu-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}
@keyframes qu-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .55; }
}
@keyframes qu-pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,92,0,.45); }
  50%      { box-shadow: 0 0 0 8px rgba(255,92,0,0); }
}
@keyframes qu-spin {
  to { transform: rotate(360deg); }
}
@keyframes qu-spark-drift {
  0%   { transform: translate(0, 0) scale(1); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translate(var(--dx, 30px), var(--dy, -40px)) scale(0); opacity: 0; }
}

/* ---------- Utility classes (préfixe qu- pour éviter collisions) ---------- */

.qu-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.qu-noise {
  position: relative;
  isolation: isolate;
}
.qu-noise::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .7 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
  z-index: 0;
}

/* Metal/brushed surface (for premium CTA) */
.qu-metal-surface {
  background:
    linear-gradient(180deg, rgba(255,255,255,.08) 0%, transparent 50%, rgba(0,0,0,.15) 100%),
    linear-gradient(92deg, #2a2a2a 0%, #3a3a3a 40%, #2e2e2e 80%, #1f1f1f 100%);
  position: relative;
  overflow: hidden;
}
.qu-metal-surface::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -40%;
  width: 30%;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,.25) 50%, transparent 100%);
  transform: skewX(-20deg);
  transition: left 800ms var(--qu-ease);
  pointer-events: none;
}
.qu-metal-surface:hover::before { left: 140%; }

/* Grain noise for hero/premium sections */
.qu-grain::before {
  content: '';
  position: absolute;
  inset: -1px;
  pointer-events: none;
  opacity: .08;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3'/></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>");
}

.qu-center { display: flex; align-items: center; justify-content: center; }
.qu-hidden { display: none !important; }

/* Safe responsive container */
.qu-container {
  width: 100%;
  max-width: var(--qu-container);
  margin-inline: auto;
  padding-inline: var(--qu-s-4);
}
@media (min-width: 768px) {
  .qu-container { padding-inline: var(--qu-s-6); }
}

/* Skeleton shimmer (loading) */
.qu-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--qu-bg-3);
  border-radius: var(--qu-r-sm);
}
.qu-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.04), transparent);
  animation: qu-shimmer 1.4s infinite;
}

/* Spinner */
.qu-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--qu-line-2);
  border-top-color: var(--qu-accent);
  border-radius: 50%;
  animation: qu-spin .8s linear infinite;
}
.qu-spinner--lg { width: 32px; height: 32px; border-width: 3px; }
