/* ============================================================
   BUTTON·LAB — style.css
   Thème sombre premium, cartes glassmorphism, grille responsive
   ============================================================ */
:root {
  --bg: #0a0b0d;
  --bg2: #101216;
  --card: rgba(20, 23, 28, 0.72);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8edf2;
  --dim: #a9b4c2;
  --faint: #5f6b7c;
  --red: #e60018;
  --red2: #ff3b4a;
  --blue: #0057d9;
  --cyan: #38bdf8;
  --green: #10b981;
  --amber: #f59e0b;
  --radius: 18px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background:
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(230, 0, 18, 0.07), transparent),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(230, 0, 18, 0.4); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 11, 13, 0.8);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 24px;
}
.brand { font-weight: 800; letter-spacing: 0.14em; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 12px var(--red); animation: dot-pulse 2.4s ease-in-out infinite; }
.accent { color: var(--red); }
.nav-links { display: flex; gap: 6px; margin-left: auto; }
.nav-links a {
  color: var(--dim); text-decoration: none; font-size: 0.82rem; font-weight: 600;
  padding: 8px 14px; border-radius: 10px; transition: all 0.2s;
}
.nav-links a:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
@keyframes dot-pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.4 } }

/* ---------- Hero ---------- */
.hero { max-width: 1200px; margin: 0 auto; padding: 72px 24px 48px; text-align: center; }
.hero-badge {
  display: inline-block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.18em;
  color: var(--dim); background: var(--bg2); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 999px; margin-bottom: 22px;
}
h1 { font-size: clamp(2.2rem, 6vw, 4rem); font-weight: 800; line-height: 1.05; letter-spacing: -0.03em; }
.accent2 { color: var(--cyan); }
.hero-sub { color: var(--dim); max-width: 560px; margin: 20px auto 30px; font-size: 1rem; line-height: 1.6; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- Sections ---------- */
.section { max-width: 1200px; margin: 0 auto; padding: 56px 24px; }
.section-title { font-size: 1.6rem; font-weight: 800; display: flex; align-items: center; gap: 14px; letter-spacing: -0.02em; }
.num {
  font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; font-weight: 700;
  color: var(--red); background: rgba(230,0,18,0.1); border: 1px solid rgba(230,0,18,0.3);
  padding: 4px 10px; border-radius: 8px;
}
.section-desc { color: var(--dim); font-size: 0.9rem; margin: 8px 0 26px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

/* ---------- Cartes ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex; flex-direction: column; gap: 16px;
  backdrop-filter: blur(10px);
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(230,0,18,0.06), transparent);
  pointer-events: none;
}
.card:hover { border-color: rgba(230, 0, 18, 0.35); transform: translateY(-3px); box-shadow: 0 16px 40px -12px rgba(0,0,0,0.7); }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.card-name { font-size: 0.86rem; font-weight: 700; }
.card-tag { font-family: 'JetBrains Mono', monospace; font-size: 0.62rem; color: var(--faint); background: rgba(255,255,255,0.04); border: 1px solid var(--border); padding: 3px 8px; border-radius: 6px; }
.card-stage {
  min-height: 96px;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse 100% 100% at 50% 50%, rgba(255,255,255,0.02), transparent);
  border-radius: 12px;
  border: 1px dashed rgba(255,255,255,0.06);
  padding: 14px;
  position: relative;
}
.card-stage .hint { position: absolute; top: 8px; left: 10px; font-size: 0.58rem; color: var(--faint); letter-spacing: 0.1em; }
.card-code {
  display: flex; align-items: center; gap: 8px;
  background: #0d0e11; border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; cursor: pointer; transition: border-color 0.2s;
  font-family: 'JetBrains Mono', monospace; font-size: 0.66rem; color: var(--faint);
}
.card-code:hover { border-color: rgba(230,0,18,0.4); color: var(--dim); }
.card-code .ext { margin-left: auto; color: var(--red); font-weight: 700; }

/* ---------- Les boutons : BASE (forme + lift) ---------- */
.btn { /* forme de base : rectangle arrondi */
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 28px;
  font-family: 'Inter', sans-serif; font-weight: 700; font-size: 0.85rem;
  color: #fff; cursor: pointer; user-select: none;
  border: none; position: relative; overflow: hidden;
  background: #1e242e;
  border-radius: 12px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s, background 0.25s, color 0.25s, border-color 0.25s, filter 0.3s;
  will-change: transform;
}
.btn:hover { transform: translateY(-3px); }
.btn:active { transform: translateY(0) scale(0.96); }

/* Variantes de FORME (classe .shape-*) */
.shape-pill { border-radius: 999px; padding: 13px 34px; }
.shape-square { border-radius: 6px; }
.shape-oval { border-radius: 50%; width: 78px; height: 78px; padding: 0; font-size: 0.72rem; }
.shape-diamond { clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); padding: 0; width: 84px; height: 84px; }
.shape-diamond span { transform: rotate(45deg); }
.shape-triangle { clip-path: polygon(50% 6%, 95% 94%, 5% 94%); padding: 0; width: 90px; height: 84px; font-size: 0.62rem; padding-top: 30px; }
.shape-hex { clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%); padding: 13px 36px; }
.shape-arrow-right { border-radius: 12px; padding-right: 40px; }
.shape-arrow-right::after { content: '→'; position: absolute; right: 20px; font-size: 1rem; opacity: 0; transition: opacity 0.2s, transform 0.25s; }
.shape-arrow-right:hover::after { opacity: 1; transform: translateX(3px); }

/* Variantes COULEUR */
.bg-red { background: linear-gradient(135deg, #e60018, #a30012); box-shadow: 0 6px 20px -6px rgba(230, 0, 18, 0.55); }
.bg-red:hover { box-shadow: 0 10px 32px -6px rgba(230, 0, 18, 0.8); }
.bg-blue { background: linear-gradient(135deg, #0057d9, #003a92); box-shadow: 0 6px 20px -6px rgba(0, 87, 217, 0.55); }
.bg-blue:hover { box-shadow: 0 10px 32px -6px rgba(0, 87, 217, 0.85); }
.bg-green { background: linear-gradient(135deg, #10b981, #0b7a54); box-shadow: 0 6px 20px -6px rgba(16, 185, 129, 0.55); }
.bg-green:hover { box-shadow: 0 10px 32px -6px rgba(16, 185, 129, 0.8); }
.bg-amber { background: linear-gradient(135deg, #f59e0b, #b45309); box-shadow: 0 6px 20px -6px rgba(245, 158, 11, 0.55); }
.bg-amber:hover { box-shadow: 0 10px 32px -6px rgba(245, 158, 11, 0.85); }
.bg-dark { background: #14171c; border: 1px solid rgba(255,255,255,0.12); }
.bg-dark:hover { border-color: rgba(255,255,255,0.35); }
.outline { background: transparent; border: 2px solid rgba(255,255,255,0.15); color: #e8edf2; }
.outline:hover { border-color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.04); }
.ghost { background: transparent; border: 1px solid var(--border); color: var(--dim); }
.ghost:hover { color: #fff; border-color: rgba(255,255,255,0.3); }
.sm { padding: 8px 16px; font-size: 0.75rem; border-radius: 9px; }

/* Variantes TAILLE */
.size-lg { padding: 17px 44px; font-size: 1rem; border-radius: 14px; }
.size-xs { padding: 6px 12px; font-size: 0.68rem; border-radius: 7px; }
.size-full { width: 100%; }

/* ---------- Animations de CONTENU ---------- */
/* 1. shake */
.anim-shake { animation: none; }
.card:hover .anim-shake { animation: shake 0.5s ease; }
@keyframes shake { 0%,100% { transform: translateX(0) } 20% { transform: translateX(-6px) rotate(-2deg) } 40% { transform: translateX(6px) rotate(2deg) } 60% { transform: translateX(-4px) } 80% { transform: translateX(4px) } }

/* 2. wobble (rotation douce) */
.anim-wobble { animation: none; }
.card:hover .anim-wobble { animation: wobble 0.9s ease infinite; }
@keyframes wobble { 0%,100% { transform: rotate(0) } 25% { transform: rotate(-4deg) } 75% { transform: rotate(4deg) } }

/* 3. pulse fort (scale) sans hover */
.anim-pulse-strong { animation: pulseStrong 1.6s ease-in-out infinite; }
@keyframes pulseStrong { 0%,100% { transform: scale(1) } 50% { transform: scale(1.08) } }

/* 4. glow respire (box-shadow) — permanent */
.anim-glow { animation: glowBreath 2.6s ease-in-out infinite; }
@keyframes glowBreath {
  0%,100% { box-shadow: 0 0 8px -2px rgba(230,0,18,0.4); }
  50% { box-shadow: 0 0 26px -2px rgba(230,0,18,0.85); }
}

/* 5. shine balayage au survol (CSS pur) */
.anim-shine { position: relative; overflow: hidden; }
.anim-shine::after {
  content: ''; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(115deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: skewX(-22deg); transition: left 0.55s cubic-bezier(0.16,1,0.3,1);
}
.card:hover .anim-shine::after { left: 140%; }

/* 6. shine AUTO (sweep périodique sans hover) */
.anim-autoshine { position: relative; overflow: hidden; }
.anim-autoshine::after {
  content: ''; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(115deg, transparent, rgba(255,255,255,0.3), transparent);
  transform: skewX(-22deg);
  animation: autoSweep 5.2s ease-in-out 0.8s infinite;
}
@keyframes autoSweep { 0% { left: -120% } 14% { left: 140% } 100% { left: 140% } }

/* 7. dégradé qui fluide (living gradient) */
.anim-flow {
  background-size: 200% auto;
  animation: flowMove 3.8s linear infinite;
}
@keyframes flowMove { from { background-position: 0% center } to { background-position: 200% center } }

/* 8. float (flottement doux) */
.anim-float { animation: floatY 3s ease-in-out infinite; }
@keyframes floatY { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-7px) } }

/* 9. néon (halo cyan qui pulse) */
.anim-neon { animation: neonPulse 2.2s ease-in-out infinite; }
@keyframes neonPulse {
  0%,100% { box-shadow: 0 0 6px rgba(56,189,248,0.3), 0 0 16px rgba(56,189,248,0.15); }
  50% { box-shadow: 0 0 14px rgba(56,189,248,0.7), 0 0 34px rgba(56,189,248,0.35); }
}

/* 10. ripple au clic (ondes) */
.anim-ripple { position: relative; overflow: hidden; }
.anim-ripple:active::before {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,0.5); transform: translate(-50%,-50%);
  animation: ripple 0.7s ease-out forwards;
}
@keyframes ripple { to { width: 400px; height: 400px; opacity: 0 } }

/* 11. border qui tourne (rotating border) */
.anim-rotborder { position: relative; overflow: hidden; }
.anim-rotborder::before {
  content: ''; position: absolute; inset: -50%;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(230,0,18,0.9) 60deg, transparent 120deg, transparent 200deg, rgba(56,189,248,0.9) 260deg, transparent 320deg);
  animation: rotateBorder 3.5s linear infinite;
}
.anim-rotborder > * { position: relative; z-index: 1; background: #14171c; border-radius: inherit; padding: 13px 28px; }
@keyframes rotateBorder { to { transform: rotate(360deg) } }

/* 12. gradient qui tourne (hue) */
.anim-hue { animation: hueSpin 4s linear infinite; }
@keyframes hueSpin { to { filter: hue-rotate(360deg) } }

/* 13. text glitch */
.anim-glitch { position: relative; }
.card:hover .anim-glitch { animation: glitch 0.4s steps(2) 2; }
@keyframes glitch {
  0% { text-shadow: 2px 0 var(--red), -2px 0 var(--cyan); transform: translateX(-1px); }
  50% { text-shadow: -2px 0 var(--red), 2px 0 var(--cyan); transform: translateX(1px); }
  100% { text-shadow: none; }
}

/* 14. elastic (rebond overshoot) */
.anim-elastic { animation: none; }
.card:hover .anim-elastic { animation: elastic 0.8s cubic-bezier(0.68, -0.6, 0.32, 1.6); }
@keyframes elastic { 0% { transform: scale(1) } 40% { transform: scale(1.15) } 70% { transform: scale(0.94) } 100% { transform: scale(1) } }

/* 15. slide-in icône */
.anim-slideicon { position: relative; padding-left: 18px; }
.anim-slideicon .ico { position: absolute; left: 14px; opacity: 0; transform: translateX(-14px); transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1); font-size: 1rem; }
.card:hover .anim-slideicon .ico { opacity: 1; transform: translateX(0); }

/* ---------- Toggles & switches ---------- */
.toggle-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }

/* switch classique */
.switch { position: relative; width: 54px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #232833; border-radius: 999px; transition: 0.3s;
}
.slider::before {
  content: ''; position: absolute; width: 20px; height: 20px; left: 4px; top: 4px;
  background: #9aa7b5; border-radius: 50%; transition: 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.switch input:checked + .slider { background: linear-gradient(135deg, #e60018, #a30012); }
.switch input:checked + .slider::before { transform: translateX(26px); background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }

/* switch glowy */
.switch-glow .slider { box-shadow: inset 0 0 8px rgba(0,0,0,0.5); }
.switch-glow input:checked + .slider { box-shadow: 0 0 18px rgba(230,0,18,0.7), inset 0 0 8px rgba(230,0,18,0.4); }

/* toggle bouton poussoir */
.toggle-push { position: relative; width: 84px; height: 34px; }
.toggle-push input { opacity: 0; width: 0; height: 0; }
.tp-track {
  position: absolute; inset: 0; border-radius: 10px; cursor: pointer;
  background: #1a1e24; border: 1px solid var(--border);
  transition: 0.25s; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em;
  display: flex; align-items: center; justify-content: center; color: var(--faint);
}
.toggle-push input:checked + .tp-track { background: linear-gradient(135deg, #e60018, #a30012); color: #fff; box-shadow: 0 0 16px rgba(230,0,18,0.5); }

/* ---------- Overlay ---------- */
.overlay {
  display: none;
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 20px;
}
.overlay.show { display: flex; }
.overlay-panel {
  width: min(720px, 100%);
  background: #0d0e11; border: 1px solid var(--border); border-radius: 16px;
  animation: popIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
.overlay-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.overlay-foot { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); }
.code-block {
  max-height: 60vh; overflow: auto;
  padding: 18px;
  font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; line-height: 1.7;
  color: #c9d4e0; white-space: pre-wrap;
  background: transparent;
}
.code-block::-webkit-scrollbar { width: 8px; }
.code-block::-webkit-scrollbar-thumb { background: #2a2f38; border-radius: 4px; }
.mono { font-family: 'JetBrains Mono', monospace; }
.small { font-size: 0.68rem; color: var(--faint); }
#ov-status { margin-left: auto; color: var(--green); }

/* ---------- Footer ---------- */
.footer {
  max-width: 1200px; margin: 0 auto; padding: 40px 24px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  border-top: 1px solid var(--border);
  color: var(--faint); font-size: 0.78rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .section { padding: 40px 16px; }
  .hero { padding: 48px 16px 32px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}
