﻿/* ============================================
   DEVSTARTER KIT — Style Global
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition-slow), color var(--transition-slow);
  overflow-x: hidden;
}

/* --- Sélection --- */
::selection {
  background: var(--primary);
  color: white;
}

/* --- Scrollbar personnalisée --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* --- Typographie --- */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 5vw, var(--text-5xl)); }
h2 { font-size: clamp(1.5rem, 3vw, var(--text-4xl)); }
h3 { font-size: clamp(1.25rem, 2.5vw, var(--text-3xl)); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p { color: var(--text-muted); line-height: 1.7; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--primary-dark); }

code, pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

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

ul, ol { list-style: none; }

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* --- Layout containers --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container--narrow { max-width: 800px; }
.container--wide   { max-width: 1400px; }

/* --- Grid système --- */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* --- Flex utilitaires --- */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.flex-col    { flex-direction: column; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.showcase-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.showcase-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.editorial-badge {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* --- Sections --- */
.section {
  padding: var(--space-24) 0;
}
.section--sm {
  padding: var(--space-16) 0;
}

/* --- Titres de section --- */
.section-header {
  text-align: center;
  margin-bottom: var(--space-16);
}
.section-header .eyebrow {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: var(--space-3);
}
.section-header h2 {
  margin-bottom: var(--space-4);
}
.section-header p {
  max-width: 560px;
  margin: 0 auto;
  font-size: var(--text-lg);
}

/* --- Boutons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all var(--transition-normal);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn--primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: white;
}

.btn--secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.btn--secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn--ghost {
  background: transparent;
  color: var(--primary);
  padding: var(--space-2) var(--space-4);
}
.btn--ghost:hover {
  background: rgba(108,99,255,.1);
  color: var(--primary);
}

.btn--sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

.btn--lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

.btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-md);
}

/* --- Badge / Tag --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .04em;
}

.badge--primary    { background: rgba(108,99,255,.12); color: var(--primary); }
.badge--secondary  { background: rgba(15,204,206,.12); color: var(--secondary); }
.badge--accent     { background: rgba(255,101,132,.12); color: var(--accent); }
.badge--success    { background: rgba(16,185,129,.12); color: #10B981; }
.badge--warning    { background: rgba(245,158,11,.12); color: #F59E0B; }
.badge--beginner   { background: rgba(16,185,129,.12); color: #10B981; }
.badge--intermediate { background: rgba(245,158,11,.12); color: #F59E0B; }
.badge--advanced   { background: rgba(239,68,68,.12); color: #EF4444; }

/* --- Cards base --- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.card__body { padding: var(--space-6); }
.card__header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
}
.card__footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
}

/* --- Glassmorphism --- */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
}

/* --- Gradient text --- */
.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* --- Divider --- */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-8) 0;
}

/* --- Loading spinner --- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* --- Page loader --- */
#page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  transition: opacity .4s, visibility .4s;
}
#page-loader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-logo {
  font-size: var(--text-2xl);
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: pulse 1.5s ease infinite;
}

/* --- Toast notifications --- */
#toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  pointer-events: all;
  animation: toast-in .35s cubic-bezier(.34,1.56,.64,1) both;
  min-width: 220px;
}

.toast.removing {
  animation: toast-out .3s ease both;
}

.toast--success { border-left: 3px solid #10B981; }
.toast--error   { border-left: 3px solid #EF4444; }
.toast--info    { border-left: 3px solid var(--primary); }

.toast__icon { font-size: var(--text-lg); }
.toast__msg  { flex: 1; color: var(--text); }

/* --- Scroll to top --- */
#scroll-top {
  position: fixed;
  bottom: var(--space-6);
  left: var(--space-6);
  width: 44px;
  height: 44px;
  background: var(--gradient-primary);
  color: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  opacity: 0;
  visibility: hidden;
  z-index: var(--z-sticky);
  font-size: var(--text-lg);
}
#scroll-top.visible {
  opacity: 1;
  visibility: visible;
}
#scroll-top:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* --- Code block --- */
.code-block {
  position: relative;
  background: var(--bg-code);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: var(--space-4) 0;
}

.code-block pre {
  padding: var(--space-6);
  overflow-x: auto;
  font-size: var(--text-sm);
  line-height: 1.7;
  color: #CDD6F4;
}

.code-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  background: rgba(255,255,255,.05);
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.code-block__lang {
  font-size: var(--text-xs);
  color: rgba(255,255,255,.5);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.7);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  transition: all var(--transition-fast);
  border: 1px solid rgba(255,255,255,.1);
}
.copy-btn:hover {
  background: rgba(255,255,255,.15);
  color: white;
}
.copy-btn.copied {
  background: rgba(16,185,129,.2);
  color: #10B981;
  border-color: rgba(16,185,129,.3);
}

/* --- Search bar --- */
.search-bar {
  position: relative;
  width: 100%;
  max-width: 500px;
}
.search-bar input {
  width: 100%;
  padding: var(--space-3) var(--space-5) var(--space-3) 2.75rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text);
  font-size: var(--text-sm);
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-xs);
}
.search-bar input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(108,99,255,.12);
}
.search-bar__icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-bar input::placeholder { color: var(--text-light); }

/* --- Filter chips --- */
.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.filter-chip {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  letter-spacing: .03em;
}
.filter-chip:hover,
.filter-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* --- Preview container --- */
.preview-container {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  margin-bottom: var(--space-4);
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.preview-label {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-light);
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px;
  width: fit-content;
}
.tab-btn {
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  cursor: pointer;
}
.tab-btn.active,
.tab-btn:hover {
  background: var(--primary);
  color: white;
}

/* --- Accordion --- */
.accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-3);
}
.accordion-header {
  padding: var(--space-4) var(--space-5);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background var(--transition-fast);
  background: var(--bg-card);
}
.accordion-header:hover { background: var(--bg); }
.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
}
.accordion-body.open { max-height: 999px; }
.accordion-content { padding: var(--space-5); }

/* --- Utilitaires --- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm     { font-size: var(--text-sm); }
.text-muted  { color: var(--text-muted); }
.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }
.hidden  { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* --- No results --- */
.no-results {
  text-align: center;
  padding: var(--space-16);
  color: var(--text-muted);
}
.no-results svg {
  margin: 0 auto var(--space-4);
  opacity: .4;
}
