/* ============================================
   DPE par Ville — Design System
   Based on cout-employe.fr, adapted with green accent
   ============================================ */

/* --- CSS Variables --- */
:root {
  /* Primary — Green (energy/ecology) */
  --green-50: #ecfdf5;
  --green-100: #d1fae5;
  --green-200: #a7f3d0;
  --green-300: #6ee7b7;
  --green-400: #34d399;
  --green-500: #10b981;
  --green-600: #059669;
  --green-700: #047857;
  --green-800: #065f46;
  --green-900: #064e3b;

  /* Neutral */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Accent blue for links */
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;

  /* DPE Colors */
  --dpe-a: #319834;
  --dpe-b: #33cc33;
  --dpe-c: #cbfc34;
  --dpe-d: #fbea01;
  --dpe-e: #fbab34;
  --dpe-f: #eb6734;
  --dpe-g: #d7221f;

  /* Semantic */
  --primary: var(--green-600);
  --primary-light: var(--green-50);
  --primary-dark: var(--green-800);
  --text: var(--gray-800);
  --text-light: var(--gray-500);
  --text-dark: var(--gray-900);
  --bg: #ffffff;
  --bg-alt: var(--gray-50);
  --border: var(--gray-200);
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --transition: 150ms ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue-600); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--blue-700); text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
  color: var(--text-dark);
  line-height: 1.25;
  font-weight: 700;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.35rem; }

/* --- Layout --- */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.content-section {
  max-width: 1140px;
  margin: 0 auto;
  padding: 3.5rem 1.25rem;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  text-align: center;
  margin-bottom: 2rem;
}

.section-title h2 {
  margin-bottom: .5rem;
}

.section-title p {
  color: var(--text-light);
  max-width: 640px;
  margin: 0 auto;
}

/* --- Header --- */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: .625rem;
  text-decoration: none;
  color: var(--text-dark);
  font-weight: 700;
  font-size: 1.15rem;
}

.logo:hover { text-decoration: none; color: var(--text-dark); }

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: .85rem;
  letter-spacing: -.5px;
}

.main-nav { display: flex; gap: 1.5rem; align-items: center; }
.main-nav a {
  color: var(--text);
  font-size: .925rem;
  font-weight: 500;
  text-decoration: none;
  padding: .25rem 0;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.main-nav a:hover,
.main-nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  text-decoration: none;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .5rem;
  color: var(--text);
}

.menu-toggle svg { width: 24px; height: 24px; }

/* --- Hero --- */
.hero {
  background: linear-gradient(135deg, var(--green-900) 0%, var(--green-700) 100%);
  color: #fff;
  text-align: center;
  padding: 4rem 1.25rem;
}

.hero h1 {
  color: #fff;
  font-size: 2.5rem;
  margin-bottom: 1rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.hero p {
  font-size: 1.2rem;
  opacity: .9;
  max-width: 640px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.hero-search {
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: 1rem 1.25rem;
  padding-right: 3.5rem;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  box-shadow: var(--shadow-lg);
  outline: none;
}

.hero-search input::placeholder { color: var(--gray-400); }

.hero-search button {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.hero-search button:hover { background: var(--green-700); }
.hero-search button svg { width: 20px; height: 20px; }

/* --- Cards --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  background: var(--green-100);
  color: var(--green-700);
}

.card h3 { margin-bottom: .5rem; }
.card p { color: var(--text-light); font-size: .95rem; }

/* --- Tables --- */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .925rem;
}

thead { background: var(--gray-50); }

th {
  text-align: left;
  padding: .875rem 1rem;
  font-weight: 600;
  color: var(--text-dark);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

th:hover { color: var(--primary); }
th .sort-icon { margin-left: .25rem; font-size: .75rem; opacity: .4; }
th.sorted .sort-icon { opacity: 1; color: var(--primary); }

td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
}

tbody tr:hover { background: var(--green-50); }
tbody tr:last-child td { border-bottom: none; }

/* --- DPE Badge --- */
.dpe-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-weight: 700;
  color: #fff;
  font-size: .85rem;
}

.dpe-badge.dpe-a { background: var(--dpe-a); }
.dpe-badge.dpe-b { background: var(--dpe-b); }
.dpe-badge.dpe-c { background: var(--dpe-c); color: var(--gray-800); }
.dpe-badge.dpe-d { background: var(--dpe-d); color: var(--gray-800); }
.dpe-badge.dpe-e { background: var(--dpe-e); }
.dpe-badge.dpe-f { background: var(--dpe-f); }
.dpe-badge.dpe-g { background: var(--dpe-g); }

/* DPE Scale (visual bar chart) */
.dpe-scale {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: 480px;
}

.dpe-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.dpe-bar-label {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: .8rem;
  flex-shrink: 0;
}

.dpe-bar-fill {
  height: 28px;
  border-radius: 4px;
  min-width: 24px;
  display: flex;
  align-items: center;
  padding: 0 .5rem;
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
}

.dpe-bar-value {
  color: var(--text-light);
  font-size: .85rem;
  font-weight: 600;
  min-width: 40px;
}

/* --- Stats Row --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  text-align: center;
  padding: 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.stat-label {
  font-size: .875rem;
  color: var(--text-light);
  margin-top: .25rem;
}

/* --- FAQ --- */
.faq-list { max-width: 780px; margin: 0 auto; }

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: .75rem;
  overflow: hidden;
  background: var(--bg);
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
}

.faq-question:hover { color: var(--primary); }

.faq-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin-left: 1rem;
  transition: transform .2s ease;
  color: var(--gray-400);
}

.faq-item.open .faq-icon { transform: rotate(180deg); }

.faq-answer {
  display: none;
  padding: 0 1.25rem 1rem;
  color: var(--text-light);
  line-height: 1.7;
  font-size: .95rem;
}

.faq-item.open .faq-answer { display: block; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  font-size: .95rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--green-700);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background: var(--green-50);
  color: var(--green-700);
}

.btn-white {
  background: #fff;
  color: var(--primary);
}

.btn-white:hover {
  background: var(--green-50);
  color: var(--green-700);
}

/* --- Sticky CTA --- */
.sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 10px rgba(0,0,0,.08);
  padding: .75rem 1.25rem;
  z-index: 90;
  display: none;
}

.sticky-cta.visible { display: block; }

.sticky-cta-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.sticky-cta-text {
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-dark);
}

/* --- Footer --- */
.site-footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 3rem 1.25rem 1.5rem;
}

.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-brand p {
  font-size: .9rem;
  line-height: 1.7;
  margin-top: .75rem;
}

.footer-col h4 {
  color: #fff;
  font-size: .95rem;
  margin-bottom: .75rem;
}

.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: .5rem; }
.footer-col a {
  color: var(--gray-400);
  font-size: .875rem;
  text-decoration: none;
}
.footer-col a:hover { color: #fff; text-decoration: none; }

.footer-bottom {
  border-top: 1px solid var(--gray-700);
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .8rem;
}

.footer-bottom a { color: var(--gray-400); }
.footer-bottom a:hover { color: #fff; }

/* --- Breadcrumb --- */
.breadcrumb {
  padding: .75rem 0;
  font-size: .85rem;
  color: var(--text-light);
}

.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { margin: 0 .4rem; }

/* --- Guide / Prose --- */
.prose { max-width: 780px; margin: 0 auto; }
.prose h2 { margin: 2.5rem 0 1rem; }
.prose h3 { margin: 2rem 0 .75rem; }
.prose p { margin-bottom: 1rem; color: var(--text); line-height: 1.8; }
.prose ul, .prose ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.prose li { margin-bottom: .5rem; line-height: 1.7; }
.prose strong { color: var(--text-dark); }

.info-box {
  background: var(--green-50);
  border-left: 4px solid var(--primary);
  padding: 1.25rem 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0;
}

.info-box p { margin-bottom: 0; }

/* --- Mobile Nav --- */
.mobile-nav {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 99;
  padding: 1.5rem 1.25rem;
  flex-direction: column;
  gap: .5rem;
  border-top: 1px solid var(--border);
}

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

.mobile-nav a {
  display: block;
  padding: .875rem 0;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--gray-100);
}

.mobile-nav a:hover { color: var(--primary); text-decoration: none; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .main-nav { display: none; }
  .menu-toggle { display: block; }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.4rem; }

  .hero { padding: 2.5rem 1.25rem; }
  .hero h1 { font-size: 1.85rem; }
  .hero p { font-size: 1.05rem; }

  .content-section { padding: 2.5rem 1.25rem; }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    gap: .5rem;
    text-align: center;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .sticky-cta-text { font-size: .85rem; }
  .sticky-cta .btn { font-size: .85rem; padding: .625rem 1rem; }

  .card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stats-row {
    grid-template-columns: 1fr;
  }
}

/* --- Utilities --- */
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
