/* ==========================================================================
   moncontrat-energie.fr — feuille de style unique
   Mobile d'abord. Les couleurs et tailles se changent dans :root.
   ========================================================================== */

:root {
  /* Couleurs */
  --color-primary: #0b3a6f;        /* bleu profond */
  --color-primary-dark: #082a52;
  --color-primary-soft: #e8eff8;   /* fond des sections alternées */
  --color-accent: #b8420c;         /* bouton d'appel (contraste 5,4:1 sur blanc) */
  --color-accent-dark: #933408;
  --color-bg: #f7f9fc;
  --color-surface: #ffffff;
  --color-text: #14213d;
  --color-text-muted: #45526b;     /* contraste 7,6:1 sur blanc */
  --color-border: #d3dce8;
  --color-focus: #ffbf47;
  --color-on-primary: #ffffff;
  --color-on-accent: #ffffff;

  /* Typographie : pile système, aucune police téléchargée */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;

  /* Dimensions */
  --radius: 14px;
  --radius-sm: 8px;
  --container: 68rem;
  --gutter: 1rem;
  --callbar-h: 3.75rem;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 4px 16px rgba(20, 33, 61, .06);
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  /* place pour la barre d'appel fixe sur mobile */
  padding-bottom: var(--callbar-h);
}

img, svg { display: block; max-width: 100%; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; color: var(--color-primary-dark); }
h1 { font-size: clamp(1.8rem, 6vw, 2.75rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.4rem, 4.5vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

a { color: var(--color-primary); text-underline-offset: .15em; }
a:hover { color: var(--color-primary-dark); }

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: .5rem; top: -3rem;
  z-index: 100;
  padding: .5rem 1rem;
  background: var(--color-primary-dark);
  color: var(--color-on-primary);
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: .5rem; color: var(--color-on-primary); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 3rem;
  padding: .7rem 1.4rem;
  border: 2px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.btn svg { width: 1.25em; height: 1.25em; flex: none; }

.btn-call {
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: 1.15rem;
}
.btn-call:hover { background: var(--color-accent-dark); color: var(--color-on-accent); }

.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
}
.btn-primary:hover { background: var(--color-primary-dark); color: var(--color-on-primary); }

.btn-outline {
  background: var(--color-surface);
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-outline:hover { background: var(--color-primary-soft); }

/* ---------- Header ---------- */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}
.site-logo { display: inline-flex; }
.site-logo img { width: 190px; height: auto; }

.header-phone {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;
}
.header-phone svg { width: 1.2rem; height: 1.2rem; }
.header-phone .phone-number { display: none; }

/* ---------- Sections ---------- */
.section { padding: 3rem 0; }
.section-alt { background: var(--color-primary-soft); }
.section-intro { max-width: 40rem; color: var(--color-text-muted); }

.hero {
  padding: 3rem 0 3.5rem;
  background: var(--color-surface);
  text-align: center;
}
.hero .lead {
  max-width: 36rem;
  margin: 0 auto 1.75rem;
  font-size: 1.15rem;
  color: var(--color-text-muted);
}
.hero-note {
  margin: 1rem 0 0;
  font-size: .95rem;
  color: var(--color-text-muted);
}

/* Étapes */
.steps {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  counter-reset: step;
}
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.step { counter-increment: step; position: relative; }
.step-icon {
  display: grid;
  place-items: center;
  width: 3rem; height: 3rem;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.step-icon svg { width: 1.5rem; height: 1.5rem; }
.step h3::before {
  content: counter(step) ". ";
  color: var(--color-accent);
}
.step p { margin: 0; color: var(--color-text-muted); }

/* Cartes "Nos sujets" (masquées tant que les pages n'existent pas) */
.topics {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}
.topic-card { display: block; text-decoration: none; color: inherit; height: 100%; }
.topic-card:hover { border-color: var(--color-primary); }

/* Transparence */
.info-box {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  max-width: 48rem;
}
.info-box svg { flex: none; width: 1.75rem; height: 1.75rem; color: var(--color-primary); margin-top: .15rem; }
.info-box p:last-child { margin-bottom: 0; }

/* Bloc d'appel final */
.cta-final {
  background: var(--color-primary);
  color: var(--color-on-primary);
  text-align: center;
}
.cta-final h2 { color: var(--color-on-primary); }
.cta-final p { color: #dbe6f3; }
.cta-final .phone-big {
  display: block;
  margin: .25rem 0 1.25rem;
  font-size: clamp(1.6rem, 7vw, 2.25rem);
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--color-on-primary);
}

.call-meta { font-size: .9rem; margin-top: 1rem; }

/* ---------- Pages de contenu (légal, 404) ---------- */
.page { padding: 2.5rem 0 3.5rem; }
.prose { max-width: 46rem; overflow-wrap: break-word; }
.prose h2 { margin-top: 2.25rem; font-size: 1.4rem; }
.prose h3 { margin-top: 1.5rem; }
.prose ul { padding-left: 1.25rem; }
.prose li { margin-bottom: .35rem; }
.updated { color: var(--color-text-muted); font-size: .95rem; }

.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; background: var(--color-surface); }
th, td { border: 1px solid var(--color-border); padding: .55rem .7rem; text-align: left; vertical-align: top; }
th { background: var(--color-primary-soft); }

/* Bloc préférences cookies */
.consent-panel { margin: 1.5rem 0 2rem; }
.consent-panel h2 { margin-top: 0; }
.consent-status {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--color-primary-soft);
  font-weight: 600;
}
.consent-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-primary-dark);
  color: #dbe6f3;
  padding: 2.5rem 0 2rem;
  font-size: .95rem;
}
.site-footer a { color: var(--color-on-primary); }
.footer-links {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
}
.footer-links a { display: inline-block; padding: .25rem 0; }
.footer-legal p { margin-bottom: .75rem; }
.footer-legal p:last-child { margin-bottom: 0; }

/* ---------- Barre d'appel mobile ---------- */
.call-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  height: var(--callbar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  box-shadow: 0 -2px 10px rgba(20, 33, 61, .2);
}
.call-bar:hover, .call-bar:focus { color: var(--color-on-accent); background: var(--color-accent-dark); }
.call-bar svg { width: 1.3rem; height: 1.3rem; }
.call-bar:focus-visible { outline-offset: -5px; }

/* ---------- Bannière de consentement ---------- */
.consent-banner {
  position: fixed;
  left: 0; right: 0;
  bottom: var(--callbar-h);   /* au-dessus de la barre d'appel : le numéro reste utilisable */
  z-index: 50;
  padding: 0 .5rem .5rem;
}
.consent-banner[hidden] { display: none; }
.consent-banner-inner {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1rem 1.1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(20, 33, 61, .18);
  font-size: .95rem;
}
.consent-banner h2 { font-size: 1.05rem; margin: 0 0 .35rem; }
.consent-banner p { margin: 0 0 .75rem; color: var(--color-text-muted); }
.consent-banner .consent-actions { margin-top: 0; }
/* Les deux boutons ont exactement le même style */
.btn-consent {
  flex: 1 1 8rem;
  min-height: 2.75rem;
  padding: .55rem 1.2rem;
  background: var(--color-primary);
  color: var(--color-on-primary);
}
.btn-consent:hover { background: var(--color-primary-dark); color: var(--color-on-primary); }

/* ---------- Tablette et plus ---------- */
@media (min-width: 40rem) {
  :root { --gutter: 1.5rem; }
  .steps, .topics { grid-template-columns: repeat(3, 1fr); }
  .topics { grid-template-columns: repeat(2, 1fr); }
  .header-phone .phone-number { display: inline; }
  .header-phone .phone-label { display: none; }
}

@media (min-width: 48rem) {
  body { padding-bottom: 0; }
  .call-bar { display: none; }
  .consent-banner { bottom: 0; padding: 0 1rem 1rem; }
  .consent-banner-inner { display: flex; gap: 1.5rem; align-items: center; }
  .consent-banner-text { flex: 1; }
  .consent-banner p { margin-bottom: 0; }
  .consent-banner .consent-actions { flex: none; flex-wrap: nowrap; }
  .hero { padding: 4.5rem 0 5rem; }
  .section { padding: 4rem 0; }
  .topics { grid-template-columns: repeat(4, 1fr); }
  .header-phone {
    padding: .5rem 1rem;
    border: 2px solid var(--color-primary);
    border-radius: 999px;
  }
}

/* ---------- Voile "site en construction" (temporaire) ----------
   Affiché par défaut ; main.js ajoute .veil-off sur <html> en staging et en local. */
.construction-veil { display: none; }
html:not(.veil-off) body.under-construction { padding-bottom: 0; }
html:not(.veil-off) body.under-construction > :not(.construction-veil) { display: none !important; }
html:not(.veil-off) .construction-veil {
  --hazard: repeating-linear-gradient(-45deg, #ffbf47 0 18px, #14213d 18px 36px);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--color-bg);
  /* quadrillage léger façon plan d'architecte */
  background-image:
    linear-gradient(rgba(11, 58, 111, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 58, 111, .06) 1px, transparent 1px);
  background-size: 32px 32px;
  text-align: center;
}
.construction-veil::before,
.construction-veil::after {
  content: "";
  flex: none;
  height: 14px;
  background: var(--hazard);
}
.construction-veil::after { order: 99; }
.construction-veil-top {
  display: flex;
  justify-content: center;
  padding: 1.5rem var(--gutter) 0;
}
.construction-veil-top img { width: 190px; height: auto; }
.construction-veil-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem var(--gutter) 2rem;
}
.construction-veil-illu { width: min(100%, 360px); height: auto; margin-bottom: 1.5rem; }
.construction-veil-badge {
  display: inline-block;
  margin: 0 0 1rem;
  padding: .35rem .9rem;
  border: 2px solid #14213d;
  border-radius: 999px;
  background: #ffbf47;
  color: #14213d;
  font-size: .85rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.construction-veil-title {
  max-width: 22ch;
  margin: 0 0 .75rem;
  font-size: clamp(1.75rem, 6vw, 2.6rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.01em;
  color: var(--color-primary-dark);
  text-wrap: balance;
}
.construction-veil-text {
  max-width: 34rem;
  text-wrap: balance;
  margin: 0;
  font-size: 1.1rem;
  color: var(--color-text-muted);
}
.construction-veil-foot {
  margin: 0;
  padding: 0 var(--gutter) 1rem;
  font-size: .85rem;
  color: var(--color-text-muted);
}

@media print {
  .call-bar, .consent-banner, .skip-link { display: none !important; }
  body { padding: 0; background: #fff; }
}
