/* ==========================================================================
   RENDEMENT AUTO — DESIGN CANONIQUE OFFICIEL
   Référence stricte : Rendement Auto — Écrans.html
   8 Écrans Canoniques (4 Desktop + 4 Mobile 390px)
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background: #F3F5F8;
  font-family: 'Instrument Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #16181D;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  background: #F3F5F8;
}

a {
  color: #0B4F42;
  text-decoration: none;
  transition: color .16s ease;
}

a:hover {
  color: #062B24;
}

.num {
  font-variant-numeric: tabular-nums;
}

/* Animations canoniques */
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(47,192,160,.6); }
  70% { box-shadow: 0 0 0 7px rgba(47,192,160,0); }
  100% { box-shadow: 0 0 0 0 rgba(47,192,160,0); }
}

@keyframes barRise {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

@keyframes barGrow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes slideup {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

.pulse {
  animation: ping 2.4s cubic-bezier(.2,0,0,1) infinite;
}

.bar {
  animation: barRise .8s cubic-bezier(.2,0,0,1) both;
  transform-origin: bottom;
}

.bar-horiz {
  animation: barGrow .7s cubic-bezier(.2,0,0,1) both;
  transform-origin: left;
}

/* Micro-interactions & focus */
:focus-visible {
  outline: 2px solid #0E7C66;
  outline-offset: 3px;
}

a, button, select, input {
  transition: background-color .16s ease, color .16s ease, box-shadow .2s ease, transform .16s cubic-bezier(.2,0,0,1);
}

a[href]:hover, button:hover {
  transform: translateY(-1px);
}

a[href]:active, button:active {
  transform: translateY(0);
}

/* Cartes & survols */
article {
  animation: rise .65s cubic-bezier(.2,0,0,1) both;
  transition: transform .22s cubic-bezier(.2,0,0,1), box-shadow .22s ease;
}

article:hover {
  transform: translateY(-6px);
  box-shadow: 0 2px 6px rgba(20,30,48,.06), 0 30px 52px -26px rgba(20,30,48,.34) !important;
}

article > div:first-child img, article > div:first-child svg {
  transition: transform .4s cubic-bezier(.2,0,0,1);
}

article:hover > div:first-child img, article:hover > div:first-child svg {
  transform: scale(1.06);
}

/* Range input slider styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #E8ECF1;
  outline: none;
  cursor: pointer;
  margin: 12px 0 6px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #0E7C66;
  border: 4px solid #FFFFFF;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(14,124,102,.4);
  transition: transform .15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #0E7C66;
  border: 4px solid #FFFFFF;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(14,124,102,.4);
}

/* Segmented bar for simulator */
.ra-segmented-bar {
  display: flex;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: #E8ECF1;
}

/* Terms & accordions in methodology */
.term {
  border-bottom: 1.5px dotted #0E7C66;
  cursor: help;
}

.chev {
  transition: transform .2s ease;
}

details[open] .chev {
  transform: rotate(180deg);
}

/* Card utility */
.card {
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 1px 2px rgba(20,30,48,.05), 0 16px 32px -20px rgba(20,30,48,.22);
}

/* ==========================================================================
   SYSTÈME RESPONSIVE CANONIQUE (DESKTOP & MOBILE 390px)
   ========================================================================== */

/* Conteneurs de page */
.ra-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
  box-sizing: border-box;
}

.ra-container-lg {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
  box-sizing: border-box;
}

.ra-page-wrap {
  min-height: 100%;
  background: #F3F5F8;
  padding-bottom: 80px;
}

/* Header */
.ra-header {
  background: rgba(243,245,248,.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(185,194,206,.45);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

.ra-header-inner {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.ra-brand-text {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.025em;
  color: #16181D;
  white-space: nowrap;
}

.ra-nav-capsule {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #E8ECF1;
  padding: 4px;
  border-radius: 999px;
}

.ra-nav-link {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  text-decoration: none;
  color: #5B6069;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.ra-nav-link.active {
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(20,30,48,.08);
  color: #16181D;
  font-weight: 600;
}

.ra-city-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border: 0;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(20,30,48,.06);
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #16181D;
  cursor: pointer;
  white-space: nowrap;
}

.ra-header-cta {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 22px;
  background: #0E7C66;
  color: #FFFFFF;
  border-radius: 999px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 4px 12px -2px rgba(14,124,102,.45);
  white-space: nowrap;
}

.ra-menu-btn {
  display: none;
}

/* Tiroir / menu mobile */
.ra-mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 43, 36, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 250;
  display: flex;
  flex-direction: column;
  padding: 16px;
  animation: fade .18s ease-out;
}

.ra-mobile-menu-card {
  background: #FFFFFF;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 20px 48px -12px rgba(20,30,48,.4);
  animation: rise .22s cubic-bezier(.2,0,0,1);
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 50px;
}

.ra-mobile-menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  color: #16181D;
  background: #F3F5F8;
}

.ra-mobile-menu-link.active {
  background: #D9F0E9;
  color: #0B4F42;
}

/* Hero */
.ra-hero-wrap {
  background: #062B24;
  background-image: radial-gradient(ellipse 60% 80% at 85% 10%, rgba(47,192,160,.22), transparent 60%);
  width: 100%;
}

.ra-hero-inner {
  padding: 64px 0 76px;
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  align-items: center;
}

.ra-hero-title {
  margin: 0 0 16px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 52px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: #FFFFFF;
}

.ra-hero-lead {
  margin: 0;
  font-size: 19px;
  line-height: 1.5;
  color: #B7D6CC;
  max-width: 52ch;
}

.ra-hero-card {
  flex: 1 1 320px;
  min-width: 0;
  background: #FFFFFF;
  border-radius: 24px;
  padding: 26px;
  box-shadow: 0 1px 2px rgba(20,30,48,.04), 0 20px 40px -20px rgba(20,30,48,.20);
}

/* Grille 3 étapes "Comment ça marche" */
.ra-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-bottom: 44px;
  margin-top: -36px;
  position: relative;
}

/* Barre de filtres */
.ra-filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-bottom: 22px;
}

/* Barre de résultats */
.ra-results-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
}

/* Grille de cartes véhicules */
.ra-vehicle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  width: 100%;
}

/* Fiche véhicule : Galerie */
.ra-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-top: 16px;
}

.ra-gallery-main {
  grid-column: span 2;
  aspect-ratio: 3 / 2;
  background: #E8ECF1;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.ra-gallery-side {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* Fiche véhicule : Titre et CTA */
.ra-detail-header {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: flex-end;
  padding: 28px 0 24px;
}

.ra-detail-title {
  margin: 0 0 8px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* Fiche véhicule : Grille des 4 KPIs */
.ra-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
}

.ra-kpi-card {
  background: #FFFFFF;
  border: 1px solid #DCE2EA;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(20,30,48,.04);
}

.ra-kpi-val {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* Fiche véhicule : Waterfall */
.ra-waterfall-desktop {
  display: block;
}

.ra-waterfall-mobile {
  display: none;
}

/* Fiche véhicule : Scénarios */
.ra-scenarios-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ra-scenarios-cards {
  display: none;
}

/* Fiche véhicule : Hypothèses */
.ra-hypotheses-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 32px;
}

/* Simulateur */
.ra-sim-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

.ra-charges-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
}

/* Méthodologie */
.ra-methodo-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: flex-start;
}

.ra-methodo-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 24px 28px;
  margin-bottom: 36px;
}

.ra-methodo-chips {
  display: none;
}

/* Dock bas mobile sticky */
.ra-mobile-dock {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -8px 24px rgba(20, 30, 48, 0.12);
  padding: 12px 20px max(14px, env(safe-area-inset-bottom));
  z-index: 100;
  align-items: center;
  gap: 14px;
}

/* ==========================================================================
   BREAKPOINTS MÉDIA QUERIES
   ========================================================================== */

/* Tablette (<= 1024px) */
@media (max-width: 1024px) {
  .ra-vehicle-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 18px !important;
  }
}

/* Tablette portrait (<= 960px) */
@media (max-width: 960px) {
  .ra-nav-capsule {
    display: none !important;
  }
  .ra-menu-btn {
    display: flex !important;
  }
  .ra-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }
  .ra-methodo-layout {
    flex-direction: column !important;
  }
  .ra-methodo-sidebar {
    position: static !important;
    width: 100% !important;
  }
  .ra-methodo-chips {
    display: flex !important;
  }
  .ra-sim-layout {
    flex-direction: column !important;
  }
  .ra-sim-layout > * {
    width: 100% !important;
    flex: none !important;
  }
}

/* Mobile (<= 768px) */
@media (max-width: 768px) {
  .ra-container, .ra-container-lg {
    padding: 0 16px !important;
  }

  .ra-page-wrap {
    padding-bottom: 96px !important; /* Laisse l'espace au dock collant */
  }

  .ra-header-inner {
    height: 60px !important;
    padding: 0 16px !important;
  }

  .ra-header-cta {
    display: none !important;
  }

  .ra-city-btn {
    height: 38px !important;
    padding: 0 12px !important;
    font-size: 13px !important;
  }

  /* Hero mobile */
  .ra-hero-inner {
    padding: 24px 0 32px !important;
    gap: 20px !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .ra-hero-title {
    font-size: 28px !important;
    line-height: 1.12 !important;
    letter-spacing: -0.025em !important;
    margin-bottom: 10px !important;
  }

  .ra-hero-lead {
    font-size: 15px !important;
    line-height: 1.45 !important;
  }

  .ra-hero-card {
    flex: none !important;
    width: 100% !important;
    border-radius: 20px !important;
    padding: 18px !important;
  }

  /* Comment ça marche mobile */
  .ra-steps-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    margin-top: 14px !important;
    padding-bottom: 22px !important;
  }

  /* Ruban défilant de filtres horizontal */
  .ra-filters-bar {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -16px 14px !important;
    padding: 4px 16px 8px !important;
    gap: 8px !important;
  }

  .ra-filters-bar::-webkit-scrollbar {
    display: none;
  }

  .ra-filters-bar > * {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  /* Cartes véhicules 1 colonne mobile */
  .ra-vehicle-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .card {
    border-radius: 22px !important;
  }

  /* Fiche véhicule mobile */
  .ra-gallery-grid {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
    padding-top: 8px !important;
  }

  .ra-gallery-side {
    display: none !important;
  }

  .ra-gallery-main {
    grid-column: span 1 !important;
    aspect-ratio: 16 / 10 !important;
    border-radius: 20px !important;
  }

  .ra-detail-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 14px !important;
    padding: 18px 0 16px !important;
  }

  .ra-detail-title {
    font-size: 24px !important;
    line-height: 1.15 !important;
  }

  /* Bascule Waterfall vertical -> horizontal sur mobile */
  .ra-waterfall-desktop {
    display: none !important;
  }

  .ra-waterfall-mobile {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }

  /* Scénarios en cartes sur mobile */
  .ra-scenarios-table-wrap {
    display: none !important;
  }

  .ra-scenarios-cards {
    display: flex !important;
    gap: 8px !important;
  }

  .ra-hypotheses-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /* Simulateur mobile */
  .ra-charges-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Méthodologie mobile */
  .ra-methodo-summary {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 16px 18px !important;
    margin-bottom: 20px !important;
  }

  .ra-summary-arrow {
    display: none !important;
  }

  .ra-methodo-chips {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -16px 14px !important;
    padding: 4px 16px !important;
  }

  .ra-methodo-chips::-webkit-scrollbar {
    display: none;
  }

  .ra-methodo-chips > * {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  /* Dock bas mobile sticky actif */
  .ra-mobile-dock {
    display: flex !important;
  }
}

/* Petit écran mobile (<= 390px) */
@media (max-width: 390px) {
  .ra-kpi-val {
    font-size: 24px !important;
  }
  .ra-kpi-card {
    padding: 12px 10px !important;
  }
  .ra-brand-text {
    font-size: 17px !important;
  }
}

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