/* Système de design partagé par toutes les pages du site.
   Chaque page ajoute ensuite son propre <style> pour ce qui lui est spécifique. */

/* TOKENS */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f1f2f0;
  --text: #17181a;
  --text-2: #33353a;
  --muted: #5f6166;
  --faint: #8d9096;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);
  --accent: #1c3c6e;
  --accent-contrast: #ffffff;
  --brand: #1a9455;
  --brand-soft: rgba(26, 148, 85, 0.1);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --radius: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1113;
    --surface: #17191c;
    --surface-2: #1e2125;
    --text: #ececea;
    --text-2: #cfd1d4;
    --muted: #9a9ea5;
    --faint: #75797f;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.18);
    --accent: #9dbcf0;
    --accent-contrast: #0f1113;
    --brand: #3ecf8e;
    --brand-soft: rgba(62, 207, 142, 0.12);
    --warn: #f0a35e;
    --warn-soft: rgba(240, 163, 94, 0.12);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1113;
  --surface: #17191c;
  --surface-2: #1e2125;
  --text: #ececea;
  --text-2: #cfd1d4;
  --muted: #9a9ea5;
  --faint: #75797f;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);
  --accent: #9dbcf0;
  --accent-contrast: #0f1113;
  --brand: #3ecf8e;
  --brand-soft: rgba(62, 207, 142, 0.12);
  --warn: #f0a35e;
  --warn-soft: rgba(240, 163, 94, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

/* ANIMATIONS */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

.i {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.i-fill {
  fill: currentColor;
  stroke: none;
}

/* NAV */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 2rem;
  height: 64px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo img {
  height: 28px;
  display: block;
}

.nav-links {
  display: flex;
  gap: 1.75rem;
  align-items: center;
}

.nav-links a {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
}

.nav-pill {
  color: var(--text) !important;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px !important;
  border: 1px solid var(--border-strong);
  transition: background 0.2s ease !important;
}

.nav-pill:hover {
  background: var(--surface);
}

/* HERO (sous-pages) */
.hero {
  padding: 4.5rem 2rem 1.5rem;
}

.hero-content {
  max-width: 896px;
  margin: 0 auto;
  animation: fadeInUp 0.7s var(--ease) backwards;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 1.25rem;
  font-size: 13px;
  color: var(--faint);
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumb a:hover {
  color: var(--text);
}

h1 {
  font-size: 44px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.035em;
  margin-bottom: 1rem;
  color: var(--text);
}

.hero-desc {
  font-size: 18px;
  line-height: 1.65;
  letter-spacing: -0.01em;
  color: var(--muted);
  max-width: 640px;
}

/* SECTIONS */
.section {
  max-width: 960px;
  margin: 0 auto;
  padding: 3.5rem 2rem;
}

.section.hidden {
  opacity: 0;
  transform: translateY(12px);
}

.section.visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.section-label {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 1.75rem;
  color: var(--text);
}

.section-intro {
  font-size: 16px;
  color: var(--muted);
  max-width: 680px;
  margin: -0.75rem 0 2rem;
  line-height: 1.7;
}

/* CARTES (composant générique et alias des anciennes variantes) */
.cards-grid,
.cartes-grid,
.donnees-grid,
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.card,
.carte-item,
.donnee-item,
.plan-item {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, box-shadow 0.3s ease;
}

a.card:hover,
[onclick].card:hover,
.carte-item:hover,
.donnee-item:hover,
.plan-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.card-icon,
.carte-icon,
.donnee-icon,
.plan-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: var(--surface-2);
  color: var(--text);
  overflow: hidden;
  flex-shrink: 0;
}

.card-icon img,
.carte-icon img,
.donnee-icon img,
.plan-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card h3,
.carte-item h3,
.donnee-item h3,
.plan-item h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}

.card p,
.carte-item p,
.donnee-item p,
.plan-item p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
}

.link-arrow,
.card-arrow,
.carte-arrow,
.donnee-arrow,
.plan-arrow,
.article-arrow {
  display: inline-flex;
  text-decoration: none;
  align-items: center;
  gap: 6px;
  margin-top: 1.25rem;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.link-arrow .i,
.card-arrow .i,
.carte-arrow .i,
.donnee-arrow .i,
.plan-arrow .i,
.article-arrow .i {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.i-arrow {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

a:hover .i-arrow,
[onclick]:hover .i-arrow {
  transform: translateX(3px);
}

.badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

/* BOUTONS */
.btn-primary,
.btn-secondary,
.cta-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.btn-primary,
.cta-link {
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
}

.btn-primary:hover,
.cta-link:hover {
  opacity: 0.85;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: var(--surface);
  border-color: var(--text);
}

/* PROSE (articles et pages de plans) */
.article-content,
.article {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem 2rem 4rem;
  font-size: 17px;
  color: var(--text-2);
  display: flow-root;
}

.article-content h2,
.article h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
  color: var(--text);
  margin: 2.75rem 0 1rem;
}

.article-content h2:first-child,
.article h2:first-child {
  margin-top: 0.5rem;
}

.article-content h3,
.article h3 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 2rem 0 0.5rem;
}

.article-content p,
.article p {
  line-height: 1.75;
  margin-bottom: 1.25rem;
}

.article-content ul,
.article ul,
.article-content ol,
.article ol {
  margin: 0.5rem 0 1.5rem 1.25rem;
}

.article-content li,
.article li {
  line-height: 1.75;
  margin-bottom: 0.4rem;
}

.article-content strong,
.article strong {
  color: var(--text);
  font-weight: 600;
}

.article-content a:not(.cta-link),
.article a:not(.cta-link) {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease;
}

.article-content a:not(.cta-link):hover,
.article a:not(.cta-link):hover {
  text-decoration-color: currentColor;
}

.clearfix {
  clear: both;
}

.source-note {
  font-size: 14px;
  color: var(--muted);
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.source-note a {
  color: var(--text);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.callout,
.highlight-section,
.line-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin: 2rem 0;
}

.highlight-section h3,
.line-section h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0;
}

.highlight-section p:last-child,
.line-section p:last-child {
  margin-bottom: 0;
}

/* MODALE (cartes en iframe et images agrandies) */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  flex-direction: column;
  background: var(--bg);
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  color: var(--text);
  line-height: 1;
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: var(--surface);
}

.modal-body {
  flex: 1;
  position: relative;
}

.modal-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--bg);
  z-index: 1;
  transition: opacity 0.3s ease;
}

.modal-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-loader p {
  font-size: 14px;
  color: var(--muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.modal-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.modal-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 340px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 10px;
  padding: 10px 14px;
}

.modal-warning .i {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

/* FOOTER */
footer {
  border-top: 1px solid var(--border);
  padding: 3rem 2rem;
  margin-top: 2rem;
}

.footer-inner {
  max-width: 896px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-brand p {
  font-size: 13px;
  color: var(--muted);
}

.footer-brand p a {
  color: inherit;
}

.footer-brand strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.social-row {
  display: flex;
  gap: 8px;
}

.social-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border: 1px solid var(--border);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.social-icon:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.social-icon .i {
  width: 18px;
  height: 18px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .nav-links {
    gap: 1rem;
  }

  h1 {
    font-size: 34px;
  }

  .hero-desc {
    font-size: 16px;
  }
}

@media (max-width: 600px) {
  nav {
    padding: 0 16px;
  }

  .nav-links {
    min-width: 0;
    gap: 0.85rem;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav-links a {
    font-size: 13px;
    white-space: nowrap;
  }

  .nav-pill {
    display: none;
  }

  .hero {
    padding: 3rem 16px 1rem;
  }

  h1 {
    font-size: 28px;
  }

  .section {
    padding: 2.5rem 16px;
  }

  .section-label {
    font-size: 22px;
  }

  .cards-grid,
  .cartes-grid,
  .donnees-grid,
  .plans-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .article-content,
  .article {
    padding: 1rem 16px 3rem;
    font-size: 16px;
  }

  .article-content h2,
  .article h2 {
    font-size: 22px;
  }

  footer {
    padding: 2.5rem 16px;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }

  .section.hidden {
    opacity: 1;
    transform: none;
  }
}
