/* =========================================================================
   amalgame.me — feuille de style principale
   Variables thématiques (light par défaut, override via [data-theme="dark"])
   ========================================================================= */

:root {
  --cream:    #F7F4EE;
  --ink:      #1A1A2E;
  --rust:     #3B82F6;
  --cyan:     #06B6D4;
  --green:    #10B981;
  --amber:    #F59E0B;
  --rose:     #EC4899;
  --violet:   #8B5CF6;

  /* Sémantiques (light) */
  --bg-page:        #F7F4EE;
  --bg-card:        #FFFFFF;
  --bg-elevated:    #FFFFFF;
  --bg-deep:        #1A1A2E;
  --bg-subtle:      #F0EBE0;
  --fg-primary:     #1A1A2E;
  --fg-secondary:   #2D2D44;
  --fg-muted:       #6B7280;
  --fg-on-deep:     #F7F4EE;
  --rule:           #E5E1D8;
  --rule-strong:    #C7C0B0;
  --code-bg:        #1A1A2E;
  --code-fg:        #F7F4EE;
  --link:           #1A1A2E;
  --link-hover:     #C76A2D;
  --shadow-sm:      0 1px 2px rgba(26,26,46,0.04), 0 1px 3px rgba(26,26,46,0.06);
  --shadow-md:      0 4px 6px rgba(26,26,46,0.05), 0 2px 4px rgba(26,26,46,0.06);
  --shadow-lg:      0 10px 15px rgba(26,26,46,0.08), 0 4px 6px rgba(26,26,46,0.05);
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;
  --radius-pill:    999px;
  --transition:     0.18s ease;
}

:root[data-theme="dark"] {
  --bg-page:        #0F0F1A;
  --bg-card:        #16162A;
  --bg-elevated:    #1A1A2E;
  --bg-deep:        #08080F;
  --bg-subtle:      #14142A;
  --fg-primary:     #F7F4EE;
  --fg-secondary:   #D1D5DB;
  --fg-muted:       #9CA3AF;
  --fg-on-deep:     #F7F4EE;
  --rule:           #2A2A3E;
  --rule-strong:    #3A3A52;
  --code-bg:        #08080F;
  --code-fg:        #F7F4EE;
  --link:           #F7F4EE;
  --link-hover:     #F59E0B;
  --shadow-sm:      0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:      0 4px 6px rgba(0,0,0,0.35);
  --shadow-lg:      0 10px 15px rgba(0,0,0,0.4);
}

/* =========================================================================
   Reset léger
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img, svg { max-width: 100%; height: auto; vertical-align: middle; }
button { font: inherit; color: inherit; cursor: pointer; }
ul { padding: 0; }

/* =========================================================================
   Base
   ========================================================================= */

html {
  scroll-behavior: smooth;
}
body {
  background: var(--bg-page);
  color: var(--fg-primary);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition), color var(--transition);
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition);
}
a:hover { color: var(--link-hover); }

h1, h2, h3, h4, h5, h6 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg-primary);
  margin: 0 0 0.5em;
  line-height: 1.15;
}
h1 { font-size: clamp(2rem, 4.5vw, 3.5rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }
h4 { font-size: 1.125rem; }

p { color: var(--fg-secondary); margin: 0 0 1em; }
.lead { font-size: 1.2rem; color: var(--fg-muted); max-width: 640px; }

code, pre, kbd, samp {
  font-family: 'JetBrains Mono', 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 0.92em;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (min-width: 768px) {
  .container { padding: 0 40px; }
}

.section {
  padding: 64px 0;
}
@media (min-width: 768px) {
  .section { padding: 96px 0; }
}

/* =========================================================================
   Logo (variantes light/dark — toggle par data-theme)
   ========================================================================= */

.logo { display: inline-block; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: inline-block; }

/* =========================================================================
   Nav
   ========================================================================= */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 244, 238, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--rule);
}
:root[data-theme="dark"] .site-nav {
  background: rgba(15, 15, 26, 0.85);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 24px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--fg-primary);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.nav-brand:hover { color: var(--fg-primary); }
.nav-logo { width: 28px; height: 28px; }
.nav-brand-text { line-height: 1; }

.nav-collapsible {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}
.nav-links {
  list-style: none;
  margin: 0;
  display: flex;
  gap: 28px;
  align-items: center;
}
.nav-links a {
  text-decoration: none;
  color: var(--fg-primary);
  font-size: 0.95rem;
  font-weight: 500;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--amber);
}
.nav-links .nav-github { font-weight: 500; }

.nav-tools { display: flex; align-items: center; gap: 12px; }
.theme-toggle {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 14px;
  color: var(--fg-primary);
  transition: background var(--transition), border-color var(--transition);
  line-height: 1;
}
.theme-toggle:hover { background: var(--bg-card); border-color: var(--rule-strong); }
.theme-icon-light { display: inline; }
.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: inline; }

.lang-switch {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--bg-card);
  color: var(--fg-primary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule);
  text-decoration: none;
}
.lang-switch:hover { background: var(--bg-subtle); color: var(--fg-primary); }

/* Mobile menu */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  flex-direction: column;
  gap: 4px;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--fg-primary);
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 880px) {
  .nav-toggle { display: flex; }
  .nav-collapsible {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-top: 12px;
    gap: 18px;
    padding-bottom: 12px;
  }
  .nav-collapsible.open { display: flex; }
  .nav-inner { flex-wrap: wrap; }
  .nav-links { flex-direction: column; align-items: flex-start; gap: 14px; width: 100%; }
  .nav-tools { width: 100%; justify-content: flex-start; }
}

/* =========================================================================
   Hero
   ========================================================================= */

.hero {
  padding: 64px 0 48px;
}
@media (min-width: 768px) {
  .hero { padding: 96px 0 80px; }
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 56px;
  align-items: center;
}
@media (min-width: 1024px) {
  .hero-grid { grid-template-columns: 1.15fr 1fr; gap: 72px; }
}

.version-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(245, 158, 11, 0.3);
  text-decoration: none;
}
.version-badge:hover { background: rgba(245, 158, 11, 0.18); color: var(--amber); }
.version-badge .dot { width: 6px; height: 6px; background: var(--amber); border-radius: 50%; }

.hero h1 { margin-bottom: 20px; }
.hero h1 .h-amber { color: var(--amber); }
.hero .lead { font-size: 1.25rem; max-width: 580px; margin-bottom: 32px; }

.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 36px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  border: 1px solid var(--fg-primary);
  background: transparent;
  color: var(--fg-primary);
  transition: transform 0.08s ease, box-shadow var(--transition), background var(--transition), color var(--transition);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); color: var(--fg-primary); }
.btn-primary {
  background: var(--fg-primary);
  color: var(--bg-page);
}
.btn-primary:hover { background: var(--fg-primary); color: var(--bg-page); }
.btn-ghost { background: transparent; }

.install-snippet {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  max-width: 580px;
  word-break: break-all;
}
.install-snippet::before {
  content: '$';
  color: var(--amber);
  font-weight: 700;
  flex-shrink: 0;
}
.install-snippet code { color: inherit; }
.install-snippet button {
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(247,244,238,0.2);
  color: rgba(247,244,238,0.7);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  transition: background var(--transition), color var(--transition);
}
.install-snippet button:hover {
  background: rgba(247,244,238,0.1);
  color: var(--code-fg);
}

/* Hero code preview */
.hero-code {
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  line-height: 1.7;
  overflow-x: auto;
  box-shadow: var(--shadow-lg);
}
.hero-code .kw  { color: #C792EA; }
.hero-code .ty  { color: #82AAFF; }
.hero-code .str { color: #F78C6C; }
.hero-code .com { color: #6B7280; font-style: italic; }
.hero-code .fn  { color: #F59E0B; }
.hero-code .num { color: #C3E88D; }

/* =========================================================================
   Features
   ========================================================================= */

.features {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 48px;
}
@media (min-width: 768px) {
  .features { grid-template-columns: repeat(3, 1fr); }
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--rule-strong);
}
.feature-card .feature-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  margin-bottom: 16px;
}
.feature-card h3 { font-size: 1.15rem; margin-bottom: 8px; }
.feature-card p { font-size: 0.95rem; color: var(--fg-muted); margin: 0; }

/* =========================================================================
   Footer
   ========================================================================= */

.site-footer {
  background: var(--bg-subtle);
  border-top: 1px solid var(--rule);
  margin-top: 96px;
  padding: 56px 0 0;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}
@media (min-width: 768px) {
  .footer-inner { grid-template-columns: 1.2fr 2fr; }
}
.footer-brand {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.footer-logo { width: 36px; height: 36px; }
.footer-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--fg-primary);
}
.footer-tagline { color: var(--fg-muted); font-size: 0.95rem; }
.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.footer-col h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  font-weight: 600;
  margin-bottom: 12px;
}
.footer-col ul { list-style: none; margin: 0; }
.footer-col li { margin: 8px 0; }
.footer-col a {
  text-decoration: none;
  color: var(--fg-primary);
  font-size: 0.95rem;
}
.footer-col a:hover { color: var(--amber); }

.footer-bottom {
  border-top: 1px solid var(--rule);
  margin-top: 48px;
  padding: 20px 0;
}
.footer-bottom-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--fg-muted);
}
.footer-version a {
  color: var(--amber);
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}
.footer-version a:hover { text-decoration: underline; }

/* =========================================================================
   Cookie consent
   ========================================================================= */

.cookie-consent {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  z-index: 100;
  background: var(--bg-elevated);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 18px 22px;
  max-width: 520px;
  margin-left: auto;
}
.cookie-consent-message {
  margin: 0 0 14px;
  font-size: 0.92rem;
  color: var(--fg-secondary);
}
.cookie-consent-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.cookie-consent .btn { padding: 8px 14px; font-size: 13px; }

/* =========================================================================
   404
   ========================================================================= */

.error-page {
  text-align: center;
  padding: 120px 0;
}
.error-page h1 { font-size: 4rem; margin-bottom: 16px; }
.error-page p { font-size: 1.1rem; color: var(--fg-muted); margin-bottom: 32px; }

/* =========================================================================
   Utilities
   ========================================================================= */

.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mt-0 { margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
