/* ─── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1e293b;
  background: #f8fafc;
  line-height: 1.6;
}
a { color: #f59e0b; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
ul { list-style: none; }

/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --sun:      #f59e0b;
  --sun-dark: #d97706;
  --sun-light:#fef3c7;
  --blue:     #0f2d5e;
  --blue-mid: #1e4080;
  --green:    #16a34a;
  --red:      #dc2626;
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-900: #0f172a;
  --radius:   10px;
  --shadow:   0 2px 8px rgba(0,0,0,.08);
}

/* ─── Container ─────────────────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ─── Header / Nav ──────────────────────────────────────────────────────────── */
.site-header {
  background: var(--blue);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.nav-inner {
  display: flex; align-items: center; gap: 24px;
  height: 60px;
}
.site-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.1rem; font-weight: 700; color: #fff;
  text-decoration: none; flex-shrink: 0;
}
.site-logo:hover { text-decoration: none; opacity: .9; }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  color: rgba(255,255,255,.85); padding: 6px 12px;
  border-radius: 6px; font-size: .92rem; font-weight: 500;
  transition: background .15s;
}
.nav-links a:hover { background: rgba(255,255,255,.1); text-decoration: none; color: #fff; }
.nav-cta { flex-shrink: 0; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px;
       border-radius: 8px; font-weight: 600; font-size: .92rem; transition: all .15s;
       cursor: pointer; border: none; text-decoration: none; }
.btn-primary { background: var(--sun); color: #fff; }
.btn-primary:hover { background: var(--sun-dark); text-decoration: none; color: #fff; }
.btn-outline { background: transparent; color: var(--sun); border: 2px solid var(--sun); }
.btn-outline:hover { background: var(--sun); color: #fff; text-decoration: none; }
.nav-burger { display: none; background: none; border: none; color: #fff; cursor: pointer; padding: 4px; }

/* ─── Hero ──────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--blue) 0%, #1e4080 60%, #2d5fa0 100%);
  color: #fff; padding: 64px 0 56px;
  text-align: center;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(245,158,11,.2); border: 1px solid rgba(245,158,11,.4);
  color: #fcd34d; padding: 4px 14px; border-radius: 20px;
  font-size: .82rem; font-weight: 600; margin-bottom: 20px;
}
.hero h1 { font-size: 2.4rem; font-weight: 800; line-height: 1.2; margin-bottom: 16px; }
.hero h1 em { font-style: normal; color: var(--sun); }
.hero p { font-size: 1.1rem; color: rgba(255,255,255,.85); max-width: 580px; margin: 0 auto 28px; }

/* ─── Search bar ────────────────────────────────────────────────────────────── */
.search-wrap { position: relative; max-width: 520px; margin: 0 auto; }
.search-wrap input {
  width: 100%; padding: 16px 56px 16px 20px;
  border-radius: 12px; border: none; font-size: 1rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  outline: none;
}
.search-wrap input:focus { box-shadow: 0 4px 20px rgba(245,158,11,.3); }
.search-wrap button {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: var(--sun); border: none; border-radius: 8px;
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff;
}
.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15);
  z-index: 200; overflow: hidden; display: none;
}
.search-results.open { display: block; }
.search-item {
  padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--gray-100);
  display: flex; justify-content: space-between; align-items: center;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--gray-50); }
.search-item .city { font-weight: 600; color: var(--gray-900); }
.search-item .dept { font-size: .82rem; color: var(--gray-600); }
.search-item .irr  { font-size: .82rem; color: var(--sun-dark); font-weight: 600; }

/* ─── Sections ──────────────────────────────────────────────────────────────── */
.section { padding: 56px 0; }
.section-alt { background: var(--gray-100); }
.section-title { font-size: 1.7rem; font-weight: 800; margin-bottom: 8px; color: var(--gray-900); }
.section-sub { color: var(--gray-600); margin-bottom: 32px; font-size: 1rem; }

/* ─── Cards ─────────────────────────────────────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
  background: #fff; border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); }

/* ─── KPI boxes ─────────────────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }
.kpi-box {
  background: #fff; border-radius: var(--radius);
  padding: 20px 24px; box-shadow: var(--shadow);
  border-left: 4px solid var(--sun);
}
.kpi-label { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-600); margin-bottom: 4px; }
.kpi-value { font-size: 1.8rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.kpi-unit  { font-size: .85rem; color: var(--gray-600); margin-top: 4px; }

/* ─── Score badge ───────────────────────────────────────────────────────────── */
.score-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 80px; height: 80px; border-radius: 50%;
  font-size: 1.8rem; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.score-excellent  { background: #16a34a; }
.score-tres-bon   { background: #65a30d; }
.score-bon        { background: #ca8a04; }
.score-moyen      { background: #ea580c; }
.score-faible     { background: #dc2626; }

/* ─── Commune page ──────────────────────────────────────────────────────────── */
.commune-hero {
  background: linear-gradient(135deg, var(--blue) 0%, #1e4080 100%);
  color: #fff; padding: 48px 0 40px;
}
.commune-hero-inner { display: flex; align-items: flex-start; gap: 28px; flex-wrap: wrap; }
.commune-hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.commune-hero .breadcrumb { font-size: .85rem; color: rgba(255,255,255,.7); margin-bottom: 12px; }
.commune-hero .breadcrumb a { color: rgba(255,255,255,.8); }
.commune-hero .subtitle { color: rgba(255,255,255,.85); font-size: 1rem; }
.hero-score-block { text-align: center; flex-shrink: 0; }
.hero-score-label { font-size: .8rem; color: rgba(255,255,255,.7); margin-top: 8px; }

/* ─── 2-col layout ──────────────────────────────────────────────────────────── */
.layout-2col { display: grid; grid-template-columns: 1fr 360px; gap: 32px; align-items: start; }
.layout-2col-eq { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }

/* ─── Sidebar cards ─────────────────────────────────────────────────────────── */
.sidebar-card {
  background: #fff; border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  border: 1px solid var(--gray-200); margin-bottom: 20px;
}
.sidebar-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 14px; color: var(--gray-900); }
.sidebar-row { display: flex; justify-content: space-between; align-items: center;
               padding: 8px 0; border-bottom: 1px solid var(--gray-100); font-size: .9rem; }
.sidebar-row:last-child { border-bottom: none; }
.sidebar-label { color: var(--gray-600); }
.sidebar-value { font-weight: 600; color: var(--gray-900); }

/* ─── Table ─────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { background: var(--gray-100); padding: 10px 14px; text-align: left; font-weight: 600;
     font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-600); }
td { padding: 10px 14px; border-bottom: 1px solid var(--gray-100); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* ─── CTA block ─────────────────────────────────────────────────────────────── */
.cta-block {
  background: linear-gradient(135deg, var(--sun) 0%, var(--sun-dark) 100%);
  color: #fff; border-radius: var(--radius); padding: 32px 40px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  flex-wrap: wrap;
}
.cta-block h3 { font-size: 1.3rem; font-weight: 800; margin-bottom: 6px; }
.cta-block p  { font-size: .95rem; opacity: .9; }
.btn-white { background: #fff; color: var(--sun-dark); font-weight: 700; }
.btn-white:hover { background: #fffbeb; text-decoration: none; color: var(--sun-dark); }

/* ─── Installateurs ─────────────────────────────────────────────────────────── */
.inst-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.inst-card {
  background: #fff; border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); border: 1px solid var(--gray-200);
}
.inst-card .inst-name { font-weight: 700; font-size: .95rem; margin-bottom: 8px; color: var(--gray-900); }
.inst-card .inst-meta { font-size: .82rem; color: var(--gray-600); line-height: 1.7; }
.inst-card .inst-tel  { margin-top: 10px; }
.inst-card .inst-tel a { font-weight: 600; color: var(--blue); }
.inst-badge { display: inline-block; font-size: .72rem; padding: 2px 8px;
              border-radius: 4px; background: var(--sun-light); color: var(--sun-dark);
              font-weight: 600; margin-bottom: 8px; }

/* ─── FAQ ───────────────────────────────────────────────────────────────────── */
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-list details {
  background: #fff; border-radius: var(--radius);
  border: 1px solid var(--gray-200); overflow: hidden;
}
.faq-list summary {
  padding: 16px 20px; font-weight: 600; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  list-style: none; user-select: none; gap: 12px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: ''; width: 20px; height: 20px; flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center/contain no-repeat;
  transition: transform .2s;
}
.faq-list details[open] summary::after { transform: rotate(180deg); }
.faq-list details[open] summary { color: var(--blue); border-bottom: 1px solid var(--gray-200); }
.faq-answer { padding: 16px 20px; color: var(--gray-700); font-size: .95rem; line-height: 1.7; }

/* ─── Alert / conseil ───────────────────────────────────────────────────────── */
.alert { padding: 14px 18px; border-radius: 8px; font-size: .92rem; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.alert-info    { background: #eff6ff; border-left: 4px solid #3b82f6; color: #1e3a8a; }
.alert-success { background: #f0fdf4; border-left: 4px solid #22c55e; color: #14532d; }
.alert-warn    { background: #fffbeb; border-left: 4px solid var(--sun); color: #78350f; }
.alert-source  { background: var(--gray-100); border-left: 4px solid var(--gray-600); color: var(--gray-700); font-size: .85rem; }

/* ─── Chart ─────────────────────────────────────────────────────────────────── */
.chart-wrap { position: relative; height: 220px; }

/* ─── Footer ────────────────────────────────────────────────────────────────── */
.site-footer { background: #0a1628; color: rgba(255,255,255,.75); padding: 48px 0 0; }
.footer-inner {}
.footer-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.footer-logo strong { color: #fff; font-size: 1rem; }
.footer-tagline { font-size: .82rem; color: rgba(255,255,255,.5); max-width: 220px; }
.footer-cols { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 32px; padding-bottom: 40px; }
.footer-col strong { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.5); margin-bottom: 14px; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col a { color: rgba(255,255,255,.7); font-size: .88rem; }
.footer-col a:hover { color: var(--sun); text-decoration: none; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 16px 0; display: flex; justify-content: space-between;
  font-size: .78rem; color: rgba(255,255,255,.35); flex-wrap: wrap; gap: 8px;
}

/* ─── Breadcrumb ────────────────────────────────────────────────────────────── */
.breadcrumb-bar { background: var(--gray-100); padding: 10px 0; font-size: .85rem; color: var(--gray-600); }
.breadcrumb-bar a { color: var(--gray-600); }
.breadcrumb-bar a:hover { color: var(--sun-dark); }
.breadcrumb-bar span { color: var(--gray-700); font-weight: 500; }
.bc-sep { margin: 0 6px; }

/* ─── Utilities ─────────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted   { color: var(--gray-600); }
.mt-4  { margin-top: 16px; }
.mt-8  { margin-top: 32px; }
.mb-4  { margin-bottom: 16px; }
.mb-8  { margin-bottom: 32px; }
.icon-sm { width: 16px; height: 16px; display: inline-block; vertical-align: middle; }
.icon-md { width: 20px; height: 20px; display: inline-block; vertical-align: middle; }

/* ─── Tag / badge ───────────────────────────────────────────────────────────── */
.tag { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .78rem; font-weight: 600; }
.tag-green  { background: #dcfce7; color: #166534; }
.tag-yellow { background: #fef3c7; color: #92400e; }
.tag-red    { background: #fee2e2; color: #991b1b; }
.tag-blue   { background: #dbeafe; color: #1e3a8a; }

/* ─── Simulateur ────────────────────────────────────────────────────────────── */
.sim-form { background: #fff; border-radius: var(--radius); padding: 28px 32px; box-shadow: var(--shadow); }
.sim-row  { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.sim-field { flex: 1; min-width: 180px; }
.sim-field label { display: block; font-size: .85rem; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.sim-field input, .sim-field select {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--gray-200);
  border-radius: 8px; font-size: .95rem; outline: none;
}
.sim-field input:focus, .sim-field select:focus { border-color: var(--sun); }
.sim-result { background: var(--sun-light); border-radius: var(--radius); padding: 24px 28px; margin-top: 20px; }
.sim-result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.sim-kpi { text-align: center; }
.sim-kpi .val { font-size: 1.6rem; font-weight: 800; color: var(--sun-dark); }
.sim-kpi .lbl { font-size: .78rem; color: var(--gray-700); margin-top: 4px; }

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .layout-2col { grid-template-columns: 1fr; }
  .card-grid-3  { grid-template-columns: repeat(2, 1fr); }
  .footer-cols  { grid-template-columns: repeat(2, 1fr); }
  .cta-block    { flex-direction: column; text-align: center; }
  .hero h1      { font-size: 1.8rem; }
}
@media (max-width: 640px) {
  .nav-links, .nav-cta { display: none; }
  .nav-burger { display: flex; }
  .nav-inner.open .nav-links { display: flex; flex-direction: column; position: absolute; top: 60px; left: 0; right: 0; background: var(--blue); padding: 12px; }
  .card-grid-3  { grid-template-columns: 1fr; }
  .layout-2col-eq { grid-template-columns: 1fr; }
  .footer-cols  { grid-template-columns: 1fr; }
  .kpi-grid     { grid-template-columns: repeat(2, 1fr); }
  .section      { padding: 36px 0; }
  .commune-hero { padding: 32px 0 28px; }
  .hero         { padding: 44px 0 36px; }
  .hero h1      { font-size: 1.5rem; }
  .commune-hero h1 { font-size: 1.5rem; }
  .sim-form     { padding: 20px; }
}
