/* ==========================================================================
   ClimScore — Design System v3
   Premium climate risk scoring platform for French real estate.
   Inspired by Stripe's clarity, Linear's elegance, Vercel's whitespace.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
ul, ol { list-style: none; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; }

::selection {
  background: rgba(29, 78, 216, 0.15);
  color: #0F172A;
}

/* --------------------------------------------------------------------------
   2. Design Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Backgrounds */
  --color-bg: #FFFFFF;
  --color-bg-subtle: #F8FAFC;
  --color-bg-muted: #F1F5F9;
  --color-bg-dark: #0F172A;
  --color-bg-dark-subtle: #1E293B;

  /* Text */
  --color-text: #0F172A;
  --color-text-secondary: #475569;
  --color-text-muted: #94A3B8;
  --color-text-inverse: #FFFFFF;

  /* Brand */
  --color-primary: #1D4ED8;
  --color-primary-hover: #1E40AF;
  --color-primary-light: #DBEAFE;
  --color-primary-50: #EFF6FF;
  --color-accent: #059669;
  --color-accent-hover: #047857;
  --color-accent-light: #D1FAE5;

  /* Borders */
  --color-border: #E2E8F0;
  --color-border-subtle: #F1F5F9;

  /* Semantic */
  --color-info: #2563EB;
  --color-info-bg: #EFF6FF;
  --color-success: #059669;
  --color-success-bg: #D1FAE5;
  --color-warning: #D97706;
  --color-warning-bg: #FFFBEB;
  --color-error: #DC2626;
  --color-error-bg: #FEF2F2;

  /* Unified risk palette (A-F, replaces 3 inconsistent systems) */
  --risk-a: #15803D;
  --risk-a-bg: #DCFCE7;
  --risk-b: #65A30D;
  --risk-b-bg: #ECFCCB;
  --risk-c: #CA8A04;
  --risk-c-bg: #FEF9C3;
  --risk-d: #EA580C;
  --risk-d-bg: #FFEDD5;
  --risk-e: #DC2626;
  --risk-e-bg: #FEE2E2;
  --risk-f: #991B1B;
  --risk-f-bg: #FEE2E2;

  /* Score gradient (component scores 0-10) */
  --color-score-0: #15803D;
  --color-score-1: #65A30D;
  --color-score-2: #CA8A04;
  --color-score-3: #EA580C;
  --color-score-4: #DC2626;
  --color-score-5: #991B1B;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.07), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
  --shadow-glow-blue: 0 0 40px rgba(29, 78, 216, 0.12);
  --shadow-glow-green: 0 0 40px rgba(5, 150, 105, 0.12);
  --shadow-ring: 0 0 0 3px rgba(29, 78, 216, 0.15);

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Transitions */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
}

/* --------------------------------------------------------------------------
   3. Base Typography
   -------------------------------------------------------------------------- */
body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--color-text);
  line-height: 1.2;
}
h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
h2 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
h3 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
}
h4 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
}
p {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
}
p:last-child { margin-bottom: 0; }

.overline {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}
.lead {
  font-size: 1.25rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
}
small, .text-sm { font-size: 0.875rem; }

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}
.container-narrow {
  max-width: 768px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.section {
  padding: 5rem 0;
}
.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 3rem;
}
.section-header h2 {
  margin-bottom: 0.75rem;
}
.section-header p {
  font-size: 1.0625rem;
  color: var(--color-text-secondary);
}

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

/* --------------------------------------------------------------------------
   5. Navigation
   -------------------------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 72px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.nav.scrolled {
  border-bottom-color: var(--color-border);
  box-shadow: var(--shadow-xs);
}
.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  transition: opacity 0.2s;
}
.nav-logo:hover { opacity: 0.85; }
.logo-icon svg {
  display: block;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.logo-text {
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.025em;
}
.logo-text strong {
  font-weight: 800;
  background: linear-gradient(135deg, #1D4ED8 0%, #3B82F6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
/* On dark backgrounds (footer, hero) */
.footer .logo-text,
.footer .logo-text strong { color: #fff; }

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-link {
  color: var(--color-text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color 0.2s;
  position: relative;
  padding: 0.25rem 0;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  border-radius: 1px;
  transition: width 0.25s ease;
}
.nav-link:hover { color: var(--color-text); }
.nav-link:hover::after { width: 100%; }

/* Mobile hamburger — CSS-only checkbox hack */
.nav-toggle-input { display: none; }
.nav-toggle {
  display: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 10;
  position: relative;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  background: var(--color-text);
  height: 2px;
  width: 22px;
  border-radius: 2px;
  position: relative;
  transition: all 0.3s ease;
}
.nav-toggle span::before,
.nav-toggle span::after {
  content: '';
  position: absolute;
}
.nav-toggle span::before { top: -7px; }
.nav-toggle span::after { top: 7px; }

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-weight: 600;
  font-size: 0.9375rem;
  border-radius: var(--radius-full);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1.5;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
  color: var(--color-text-inverse);
}

.btn-accent {
  background: var(--color-accent);
  color: var(--color-text-inverse);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}
.btn-accent:hover {
  background: var(--color-accent-hover);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  color: var(--color-text-inverse);
}

.btn-outline {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-outline:hover {
  background: var(--color-bg-subtle);
  border-color: var(--color-text-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}
.btn-ghost:hover {
  background: var(--color-bg-muted);
  color: var(--color-text);
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: 1.0625rem;
}
.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
}
.btn-icon {
  padding: 0.5rem;
  border-radius: var(--radius-md);
}

/* --------------------------------------------------------------------------
   7. Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all 0.2s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: transparent;
}
.card-elevated {
  box-shadow: var(--shadow-sm);
  border-color: transparent;
}
.card-elevated:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.card-dark {
  background: var(--color-bg-dark);
  border-color: transparent;
  color: var(--color-text-inverse);
}

/* --------------------------------------------------------------------------
   8. Badges
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-score-0 { background: #DCFCE7; color: #166534; }
.badge-score-1 { background: #ECFCCB; color: #3F6212; }
.badge-score-2 { background: #FEF9C3; color: #854D0E; }
.badge-score-3 { background: #FFEDD5; color: #9A3412; }
.badge-score-4 { background: #FEE2E2; color: #991B1B; }
.badge-score-5 { background: #FECACA; color: #7F1D1D; }

/* Legacy label-based badges */
.badge-tres-faible { background: #DCFCE7; color: #166534; }
.badge-faible { background: #ECFCCB; color: #3F6212; }
.badge-modere { background: #FEF9C3; color: #854D0E; }
.badge-eleve { background: #FFEDD5; color: #9A3412; }
.badge-tres-eleve { background: #FEE2E2; color: #991B1B; }
.badge-critique { background: #FECACA; color: #7F1D1D; }

/* --------------------------------------------------------------------------
   9. Score Gauge
   -------------------------------------------------------------------------- */
.gauge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
.gauge-track {
  stroke: #E2E8F0;
}
.gauge-progress {
  transition: stroke-dashoffset 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.gauge-value {
  font-size: 2.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.gauge-label {
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

/* Legacy class for animated arc */
.score-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  animation: gaugeEntrance 0.8s ease-out both;
}
.gauge-arc {
  transition: stroke-dashoffset 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --------------------------------------------------------------------------
   9b. DPE-style Classification Scale (A-F)
   -------------------------------------------------------------------------- */
.classe-scale {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 1.5rem 0 0.75rem;
}
.classe-item {
  width: 52px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.125rem;
  color: white;
  border-radius: 8px;
  opacity: 0.3;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
}
.classe-item.classe-active {
  opacity: 1;
  transform: scale(1.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  border: 2.5px solid white;
  z-index: 1;
}
.classe-item.classe-active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid currentColor;
}
.classe-a { background: #1B5E20; }
.classe-a.classe-active::after { border-top-color: #1B5E20; }
.classe-b { background: #4CAF50; }
.classe-b.classe-active::after { border-top-color: #4CAF50; }
.classe-c { background: #FFC107; color: #333; }
.classe-c.classe-active::after { border-top-color: #FFC107; }
.classe-d { background: #FF9800; }
.classe-d.classe-active::after { border-top-color: #FF9800; }
.classe-e { background: #F44336; }
.classe-e.classe-active::after { border-top-color: #F44336; }
.classe-f { background: #B71C1C; }
.classe-f.classe-active::after { border-top-color: #B71C1C; }

@keyframes gaugeAnimation {
  from { stroke-dashoffset: var(--circumference); }
  to { stroke-dashoffset: var(--target-offset); }
}

/* Gauge entrance animation */
@keyframes gaugeEntrance {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* --------------------------------------------------------------------------
   10. Risk Cards
   -------------------------------------------------------------------------- */
.risk-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.2s ease;
}
.risk-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.risk-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.risk-card-code {
  background: var(--color-bg-muted);
  color: var(--color-primary);
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}
.risk-card-name {
  font-weight: 600;
  font-size: 0.9375rem;
  flex: 1;
  color: var(--color-text);
}
.risk-card-score {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.risk-card-bar {
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-bg-muted);
  overflow: hidden;
}
.risk-card-bar-fill,
.risk-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s ease-out;
}
/* Legacy bar wrapper */
.risk-bar {
  height: 6px;
  background: var(--color-bg-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.risk-card-detail {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0;
}
.risk-card-label {
  font-weight: 600;
  font-size: 0.8125rem;
  flex-shrink: 0;
}
.risk-card-footer {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

/* --------------------------------------------------------------------------
   11. Hero
   -------------------------------------------------------------------------- */
.hero {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0F172A 100%);
  min-height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  padding: 5rem 1.5rem 2rem;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(37, 99, 235, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(16, 185, 129, 0.08) 0%, transparent 50%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
}
.hero h1 {
  color: var(--color-text-inverse);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  margin-bottom: 0.75rem;
  max-width: 700px;
}
.hero-subtitle {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
  max-width: 560px;
  margin: 0 auto 1.5rem;
}

/* --------------------------------------------------------------------------
   12. Search Box
   -------------------------------------------------------------------------- */
.search-box {
  position: relative;
  max-width: 780px;
  margin: 0 auto;
  z-index: 100;
}
.search-box-inner {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-xl);
  padding: 0.5rem;
  box-shadow: var(--shadow-xl), 0 0 60px rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: box-shadow 0.2s, border-color 0.2s;
  gap: 0.375rem;
}
.search-box-inner:focus-within {
  box-shadow: var(--shadow-xl), 0 0 0 4px rgba(37, 99, 235, 0.2);
  border-color: var(--color-primary);
}
.search-icon {
  display: flex;
  align-items: center;
  padding-left: 1.25rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.search-input {
  flex: 1;
  padding: 0.875rem 0.75rem;
  border: none;
  font-size: 0.9375rem;
  outline: none;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-sans);
  min-width: 0;
}
.search-input::placeholder { color: var(--color-text-muted); }
.search-btn {
  padding: 0.875rem 1.75rem;
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border: none;
  border-radius: calc(var(--radius-xl) - 4px);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: var(--font-sans);
  flex-shrink: 0;
}
.search-btn:hover {
  background: var(--color-accent-hover);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Geolocation button */
.geoloc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: var(--color-bg-muted, #F1F5F9);
  border: 1px solid var(--color-border, #E2E8F0);
  border-radius: 50%;
  color: var(--color-text-secondary, #475569);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.geoloc-btn:hover {
  background: var(--color-primary-light, #DBEAFE);
  color: var(--color-primary, #2563EB);
  border-color: var(--color-primary, #2563EB);
}
.geoloc-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}
.geoloc-btn .spin {
  animation: spin 1s linear infinite;
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  z-index: 9999;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #E2E8F0;
  padding: 0.25rem 0;
  display: none;
  isolation: isolate;
}
.autocomplete-dropdown:not(:empty) {
  display: block;
}
.autocomplete-dropdown .autocomplete-item {
  display: flex;
  flex-direction: column;
  padding: 0.625rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid #F1F5F9;
}
.autocomplete-dropdown .autocomplete-item:hover {
  background: #F8FAFC;
}
.autocomplete-dropdown .autocomplete-item:last-child {
  border-bottom: none;
}
.autocomplete-dropdown .autocomplete-item strong {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0F172A;
  line-height: 1.4;
}
.autocomplete-dropdown .autocomplete-item span {
  font-size: 0.8125rem;
  color: #94A3B8;
  margin-top: 2px;
  line-height: 1.3;
}

/* --------------------------------------------------------------------------
   13. Trust Pills
   -------------------------------------------------------------------------- */
.trust-row {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 0;
}
/* Hide elements below search box when autocomplete is open */
.search-box:has(.autocomplete-dropdown:not(:empty)) ~ .trust-row,
.search-box:has(.autocomplete-dropdown:not(:empty)) ~ .hero-stats {
  visibility: hidden;
}
.trust-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
  font-weight: 500;
}
.trust-item svg { opacity: 0.8; flex-shrink: 0; }

/* --------------------------------------------------------------------------
   14. Stats Grid
   -------------------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  text-align: center;
}
.stat-item {
  padding: 1.5rem;
}
.stat-number {
  display: block;
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.5rem;
}
.stat-label {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   15. Steps
   -------------------------------------------------------------------------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  position: relative;
}
.step {
  text-align: center;
  position: relative;
  padding: 1.5rem;
}
.step-number {
  display: inline-flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 1.25rem;
  font-weight: 700;
  border-radius: 50%;
  margin: 0 auto 1rem;
}
.step::after {
  content: '';
  position: absolute;
  top: calc(1.5rem + 24px);
  left: calc(50% + 32px);
  width: calc(100% - 64px);
  height: 2px;
  background: var(--color-border);
}
.step:last-child::after { display: none; }
.step h3 { margin-bottom: 0.5rem; font-size: 1.125rem; }
.step p { font-size: 0.9375rem; color: var(--color-text-secondary); line-height: 1.6; }

/* Legacy step cards */
.step-card {
  text-align: center;
  position: relative;
  z-index: 1;
  padding: 1.5rem;
}
.steps-connector { position: relative; }
.steps-connector::before {
  content: '';
  position: absolute;
  top: 26px;
  left: 16%;
  right: 16%;
  height: 2px;
  background: linear-gradient(90deg, var(--color-border) 0%, var(--color-primary) 50%, var(--color-border) 100%);
  opacity: 0.4;
}

/* --------------------------------------------------------------------------
   16. Feature / Risk Preview Cards
   -------------------------------------------------------------------------- */
.feature-card {
  text-align: center;
  padding: 2rem 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  transition: all 0.2s ease;
}
.feature-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: transparent;
}
.feature-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #EFF6FF, #DBEAFE);
}
.feature-card h3 { margin-bottom: 0.5rem; font-size: 1.125rem; }
.feature-card p { font-size: 0.9375rem; color: var(--color-text-secondary); line-height: 1.6; }

.risk-preview-card {
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  text-align: center;
  transition: all 0.2s ease;
}
.risk-preview-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.risk-preview-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 1.5rem;
}
.risk-preview-card h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}
.risk-preview-card p {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   17. FAQ
   -------------------------------------------------------------------------- */
.faq-list {
  max-width: 720px;
  margin: 0 auto;
}
details.faq-item {
  border-bottom: 1px solid var(--color-border);
  padding: 1.25rem 0;
}
.faq-item summary {
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  list-style: none;
  transition: color 0.2s;
}
.faq-item summary:hover { color: var(--color-primary); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
  width: 24px;
  text-align: center;
  line-height: 1;
}
.faq-item[open] summary::after {
  content: '\2212';
}
.faq-answer {
  padding-top: 0.75rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
  font-size: 0.9375rem;
}

/* --------------------------------------------------------------------------
   18. CTA Banner
   -------------------------------------------------------------------------- */
.cta-banner {
  background: linear-gradient(135deg, var(--color-primary) 0%, #1D4ED8 60%, #1E40AF 100%);
  border-radius: var(--radius-xl);
  padding: 4rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}
.cta-banner h2 {
  color: var(--color-text-inverse);
  margin-bottom: 0.75rem;
  font-size: 1.75rem;
  position: relative;
}
.cta-banner p {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 1.5rem;
  font-size: 1.0625rem;
  position: relative;
}

/* --------------------------------------------------------------------------
   19. Footer
   -------------------------------------------------------------------------- */
.footer {
  background: var(--color-bg-dark);
  color: var(--color-text-muted);
  padding: 4rem 0 2rem;
  margin-top: auto;
  font-size: 0.9rem;
  position: relative;
}
.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--color-primary), var(--color-accent), transparent);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
}
.footer-brand p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  max-width: 280px;
  line-height: 1.65;
  margin-top: 1rem;
}
.footer-heading {
  color: var(--color-text-inverse);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}
.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.footer-links li { margin-bottom: 0; }
.footer-links a {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--color-text-inverse); }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 0;
  padding-top: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.6875rem;
  color: #475569;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* --------------------------------------------------------------------------
   20. Tables
   -------------------------------------------------------------------------- */
.table-responsive { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
th {
  background: var(--color-bg-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--color-text-secondary);
  padding: 0.75rem 1rem;
  text-align: left;
}
td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border-subtle);
}
tr:hover td { background: var(--color-bg-subtle); }

/* --------------------------------------------------------------------------
   21. Breadcrumbs
   -------------------------------------------------------------------------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  padding: 1rem 0;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--color-text-secondary);
  font-weight: 500;
  transition: color 0.2s;
}
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb-separator,
.breadcrumb .sep {
  color: var(--color-text-muted);
}
.breadcrumb-current {
  color: var(--color-text);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   22. Disclaimer
   -------------------------------------------------------------------------- */
.disclaimer {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-left: 4px solid var(--color-warning);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin: 2rem 0;
  font-size: 0.8125rem;
  color: #78350F;
  line-height: 1.65;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.disclaimer-icon { flex-shrink: 0; margin-top: 2px; }
.disclaimer-content { flex: 1; }
.disclaimer strong {
  color: #92400E;
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   23. HTMX Indicators
   -------------------------------------------------------------------------- */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator { display: inline-block; }

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

/* --------------------------------------------------------------------------
   24. Animations
   -------------------------------------------------------------------------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.fade-in-up { animation: fadeInUp 0.6s ease-out both; }
.fade-in-up-delay-1 { animation-delay: 0.1s; }
.fade-in-up-delay-2 { animation-delay: 0.2s; }
.fade-in-up-delay-3 { animation-delay: 0.3s; }
.animate-in { animation: fadeInUp 0.5s ease both; }

/* --------------------------------------------------------------------------
   25. Utility Classes
   -------------------------------------------------------------------------- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mx-auto { margin-inline: auto; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-7 { margin-top: 1.75rem; }
.mt-8 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-7 { margin-bottom: 1.75rem; }
.mb-8 { margin-bottom: 2rem; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

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

/* --------------------------------------------------------------------------
   26. prefers-reduced-motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   27. Responsive — 1024px
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .step::after { display: none; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --------------------------------------------------------------------------
   28. Responsive — 768px
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }

  .container { padding-inline: 1rem; }
  .section { padding: 3rem 0; }

  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }

  /* Hero adjustments */
  .hero { min-height: auto; padding: 4rem 1rem 3rem; }
  .hero h1 { font-size: clamp(1.75rem, 6vw, 2.25rem); }
  .hero-subtitle { font-size: 1rem; }

  /* Search box stacking */
  .search-box-inner {
    flex-direction: row;
    flex-wrap: wrap;
    border-radius: var(--radius-lg);
    padding: 0.25rem;
  }
  .search-input {
    flex: 1 1 0;
    min-width: 0;
  }
  .geoloc-btn {
    flex-shrink: 0;
  }
  .search-btn {
    border-radius: calc(var(--radius-lg) - 4px);
    width: 100%;
    padding: 1rem;
    flex-basis: 100%;
  }
  .search-icon { display: none; }

  .trust-row { gap: 1rem; }

  /* Mobile nav */
  .nav-toggle { display: block; }
  .nav-menu {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 1rem 1.5rem 1.5rem;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
  }
  .nav-menu .nav-links {
    flex-direction: column;
    width: 100%;
    gap: 0;
  }
  .nav-menu .nav-link {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border-subtle);
    width: 100%;
  }
  .nav-menu .nav-link::after { display: none; }
  .nav-menu .btn {
    margin-top: 1rem;
    width: 100%;
    justify-content: center;
  }
  .nav-toggle-input:checked ~ .nav-menu { display: flex; }
  .nav-toggle-input:checked ~ .nav-toggle span { background: transparent; }
  .nav-toggle-input:checked ~ .nav-toggle span::before { top: 0; transform: rotate(45deg); }
  .nav-toggle-input:checked ~ .nav-toggle span::after { top: 0; transform: rotate(-45deg); }

  /* Steps connector */
  .steps-connector::before { display: none; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .footer-bottom { flex-direction: column; text-align: center; }
}

/* --------------------------------------------------------------------------
   29. Responsive — 640px
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-number { font-size: 2rem; }
  .stat-item { padding: 1rem 0.5rem; }

  .step::after { display: none; }
}

/* --------------------------------------------------------------------------
   30. MapLibre Map Sections
   -------------------------------------------------------------------------- */
.score-map-section {
  margin-bottom: 2rem;
}
.score-map-card {
  background: var(--color-bg, #fff);
  border: 1px solid var(--color-border, #E2E8F0);
  border-radius: var(--radius-xl, 16px);
  overflow: hidden;
  box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0,0,0,0.1));
}
.score-map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border-subtle, #F1F5F9);
}
.score-map-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text, #0F172A);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.score-map-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
}
#score-map {
  width: 100%;
  height: 450px;
}
.score-map-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--color-border-subtle, #F1F5F9);
  font-size: 0.8125rem;
  color: var(--color-text-muted, #94A3B8);
}
.score-map-footer a {
  color: var(--color-primary, #2563EB);
  text-decoration: none;
  font-weight: 500;
}
#actu-map {
  width: 100%;
  height: 520px;
}
.maplibregl-popup-content {
  border-radius: 10px !important;
  padding: 14px 16px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18) !important;
  font-family: var(--font-sans, Inter, sans-serif) !important;
  min-width: 200px;
}
.maplibregl-popup-close-button {
  font-size: 18px !important;
  padding: 4px 8px !important;
  color: #94A3B8 !important;
}
@media (max-width: 768px) {
  #score-map { height: 320px; }
  #actu-map { height: 380px; }
}

/* --------------------------------------------------------------------------
   Premium content gating
   -------------------------------------------------------------------------- */
.premium-gate {
  position: relative;
  overflow: hidden;
}
.premium-gate-content {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
}
.premium-gate-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.85) 30%, rgba(255,255,255,0.95) 100%);
  z-index: 2;
  padding: 2rem;
  text-align: center;
}
.premium-gate-icon {
  width: 48px;
  height: 48px;
  background: var(--color-primary-50, #EFF6FF);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.premium-gate-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}
.premium-gate-text {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  margin-bottom: 1.25rem;
  max-width: 400px;
}
.premium-gate-price {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.75rem;
}
@media (max-width: 768px) {
  .premium-gate-overlay {
    padding: 1.25rem;
  }
  .premium-gate-title {
    font-size: 1.125rem;
  }
  .premium-gate-text {
    font-size: 0.875rem;
  }
}
