/* ==========================================================================
   Textoreo – Styles globaux (version finale – février 2026)
   Menu mobile corrigé + dropdowns qui s'ouvrent bien en dessous
   ========================================================================== */

:root {
  --bg:        #f9fafb;
  --card:      #ffffff;
  --text:      #111827;
  --muted:     #6b7280;
  --accent:    #6366f1;
  --border:    #e5e7eb;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  background-image: 
    radial-gradient(70% 50% at 80% 0%, rgba(99,102,241,0.12) 0%, transparent 60%),
    url('/images/bg-grid.svg');
  background-repeat: no-repeat, repeat;
  background-size: auto, 28px 28px;
  background-attachment: fixed, scroll;
}

/* Conteneur */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: -9999px;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
  z-index: 9999;
  background: #111827;
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
}

/* ==========================================================================
   Topbar
   ========================================================================== */
.topbar {
  position: sticky;
  top: 8px;
  z-index: 100;
  margin: 0 16px 40px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(229,231,235,0.7);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px) saturate(180%);
  overflow: visible !important;
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  flex-wrap: wrap;
  overflow: visible;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
}

.brand:hover { background: rgba(99,102,241,0.08); border-radius: 6px; }

.brand img { height: 24px; }

/* ==========================================================================
   Navigation
   ========================================================================== */
.nav-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Tous les items de nav */
.nav-btn,
.nav-dropdown > button.nav-btn,
.topbar-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  height: 36px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #4b5563;
  text-decoration: none;
  background: transparent;
  border: none;
  transition: all 0.18s ease;
  cursor: pointer;
  white-space: nowrap;
}

.nav-btn:hover,
.nav-dropdown > button.nav-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.topbar-action {
  background: white;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.topbar-action:hover {
  border-color: #c7d2fe;
  box-shadow: 0 3px 10px rgba(99,102,241,0.15);
}

.dark-mode-toggle {
  font-size: 16px;
  padding: 0 12px !important;
}

.dark-mode-toggle .dark-icon,
.dark-mode-toggle .light-icon {
  line-height: 1;
}

/* Accueil spécial */
.nav-btn--home {
  background: #fef3c7;
  color: #78350f;
}
.nav-btn--home:hover { background: #fde68a; }
.nav-btn--home[aria-current="page"] {
  background: #f59e0b;
  color: white;
}

/* ==========================================================================
   DROPDOWN – ouvre bien en dessous
   ========================================================================== */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown > button.nav-btn {
  min-width: 130px;
  justify-content: center;
}

.nav-dropdown__menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  max-width: 380px;
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0,0,0,0.08);
  padding: 8px 4px;
  margin-top: 4px;
  z-index: 9999;
}

.nav-dropdown__menu.active {
  display: block;
}

.nav-dropdown__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: #4b5563;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.925rem;
}

.nav-dropdown__link:hover {
  background: #f3f4f6;
  color: #111827;
}

.nav-dropdown__link[aria-current="page"] {
  background: var(--accent);
  color: white;
}

/* ==========================================================================
   Bouton MENU MOBILE – rendu propre et cohérent
   ========================================================================== */
.menu-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: 38px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.18s ease;
}

.menu-toggle:hover {
  background: #e5e7eb;
  color: #111827;
}

.menu-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.3);
}

/* ==========================================================================
   Mobile
   ========================================================================== */
@media (max-width: 840px) {
  .topbar {
    position: static;
    margin: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
    background: white;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .nav-main {
    display: none;
    flex-direction: column;
    width: 100%;
    padding: 12px 0;
    background: white;
    gap: 4px;
  }

  .nav-main.open {
    display: flex;
  }

  .nav-main > * {
    width: 100%;
    justify-content: flex-start;
    height: auto;
  }

  .nav-btn,
  .nav-dropdown > button.nav-btn,
  .topbar-action {
    padding: 12px 16px;
    height: auto;
  }

  .nav-dropdown__menu {
    position: static;
    box-shadow: none;
    border: none;
    margin: 6px 0;
    padding: 8px 0 8px 52px;
    background: rgba(243,244,246,0.6);
    border-radius: 8px;
  }

  .nav-dropdown__menu.active {
    display: block;
  }
}

@media (max-width: 480px) {
  .container { padding: 0 12px; }
  .topbar__inner { padding: 10px 12px; }
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
  width: 100%;
  margin: 4rem 0 2rem;
  padding: 2rem 1rem 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  color: #6b7280;
  border-top: 1px solid var(--border);
  background: #f8f9fa;
}

footer p { margin: 0.4em 0; }

.footer-links a {
  color: #4b5563;
  text-decoration: none;
  margin: 0 0.5em;
}

.footer-links a:hover { color: var(--accent); text-decoration: underline; }

/* Dark Mode */
[data-theme="dark"] {
  --bg:        #0f172a;
  --card:      #1e293b;
  --text:      #f1f5f9;
  --muted:     #a5b4c4;
  --accent:    #818cf8;
  --border:    #334155;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
}

[data-theme="dark"] body {
  background-color: var(--bg);
  color: var(--text);
  background-image: none;
}

[data-theme="dark"] .topbar {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(51, 65, 85, 0.8);
}

[data-theme="dark"] .brand__text {
  color: #f1f5f9;
}

[data-theme="dark"] .nav-btn {
  color: #cbd5e1;
}

[data-theme="dark"] .nav-btn:hover {
  background: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .nav-btn--home {
  background: #422006;
  color: #fef3c7;
}

[data-theme="dark"] .nav-btn--home:hover {
  background: #592d0d;
}

[data-theme="dark"] .nav-dropdown__menu {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .nav-dropdown__link {
  color: #cbd5e1;
}

[data-theme="dark"] .nav-dropdown__link:hover {
  background: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .nav-dropdown__icon {
  background: #334155;
}

[data-theme="dark"] .card {
  background: var(--card);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="dark"] .card .name {
  color: #f1f5f9;
}

[data-theme="dark"] .card .d {
  color: #a5b4c4;
}

[data-theme="dark"] .menu-toggle {
  background: #334155;
  color: #cbd5e1;
}

[data-theme="dark"] .nav-main.open {
  background: #1e293b;
}

[data-theme="dark"] .topbar-action {
  background: #334155;
  border-color: #475569;
  color: #cbd5e1;
}

[data-theme="dark"] .hero h1 {
  color: #f1f5f9;
}

[data-theme="dark"] .hero p.lead {
  color: #a5b4c4;
}

[data-theme="dark"] .section  {
  color: #f1f5f9;
}

[data-theme="dark"] .section p.sub {
  color: #a5b4c4;
}

[data-theme="dark"] footer {
  color: #64748b;
  border-color: #334155;
}

/* Confidentialité & Pages de contenu */
[data-theme="dark"] .page-header h1 {
  background: linear-gradient(135deg, #f1f5f9 0%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="dark"] .page-header p {
  color: #cbd5e1;
}

[data-theme="dark"] .section h2,
[data-theme="dark"] .section h3 {
  color: #f1f5f9;
}

[data-theme="dark"] .section p {
  color: #cbd5e1;
}

[data-theme="dark"] .section li {
  color: #cbd5e1;
}

[data-theme="dark"] .section a {
  color: #818cf8;
}

[data-theme="dark"] .card {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .card h3 {
  color: #f1f5f9;
}

[data-theme="dark"] .card li {
  color: #cbd5e1;
}

[data-theme="dark"] .info-bar {
  background: linear-gradient(135deg, #422006 0%, #592d0d 100%);
  border-color: #b45309;
}

[data-theme="dark"] .info-bar p {
  color: #fef3c7;
}

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