

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

html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--c-text);

  background: var(--c-bg);

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

img, picture, video, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--c-brand-darker);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease-out);
}
a:hover { color: var(--c-brand); }
/* Accessibilité RGAA AA : focus visible clavier seulement.
   Utiliser :focus-visible pour ne pas afficher d'outline au clic souris.
   Règle centralisée ici (source unique) - ne pas dupliquer "outline: none" ailleurs. */
:focus:not(:focus-visible) {
  outline: none;
}
:focus-visible {
  outline: 3px solid var(--c-border-focus);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--letter-tight);
  color: var(--c-text);
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { margin: 0 0 var(--sp-4); }

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--sp-4);
  background: var(--c-brand);
  color: var(--c-text-on-brand);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  z-index: var(--z-toast);
  font-weight: var(--fw-medium);
  transition: top var(--t-base) var(--ease-out);
}
.skip-link:focus {
  top: var(--sp-4);
  color: var(--c-text-on-brand);
}

.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;
}

/* Icône "quitte le site" (lien vers un autre nom de domaine) - décorative,
   toujours accompagnée d'un texte accessible (visible ou .sr-only) sur le lien */
.icon-external {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.3em;
  vertical-align: -0.1em;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--sp-4);
}
@media (min-width: 768px) {
  .container { padding: 0 var(--sp-6); }
}
.card,
.property-card,
.dash-card {
  background: var(--c-card-bg);
  border-radius: var(--r-lg);
  border: var(--border-thin) solid var(--c-card-border);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-base) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out),
              border-color var(--t-base) var(--ease-out);
  overflow: hidden;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-6);
}
@media (min-width: 768px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}
.dash-card {
  padding: var(--sp-6);
}
.dash-card.full { grid-column: 1 / -1; }
.dash-card h2 {
  font-size: var(--fs-lg);
  margin-bottom: var(--sp-4);
}
.dash-card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* Simple padded blocks (DRY for .legal-block, .legal-box in legal pages and fiche) */
.legal-block,
.legal-box,
.qsn-map__hours {
  background: var(--c-bg-subtle);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
}

.legal-page {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-4);
}
.legal-page h1 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--sp-8);
}
.legal-content h2 {
  font-size: var(--fs-lg);
  margin-top: var(--sp-8);
  margin-bottom: var(--sp-3);
}
.legal-content p { color: var(--c-text-secondary); line-height: var(--lh-relaxed); }

/* Common title bar / accent line (DRY for hero titles in estimation, plan-du-site, etc.) */
.title-bar {
  width: 64px;
  height: 4px;
  background: var(--c-accent);
  border-radius: var(--r-full);
  margin-bottom: var(--sp-4);
}

/* Common accent underline / filet doré (DRY for h3 in estimation, plan cards, confirm, prix, etc.) */
.estimation-option h3::after,
.plan-card__titre::after,
.est-confirm__titre::after,
.est-resultat-prix__median::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  margin: var(--sp-3) auto 0;
  background: var(--c-accent);
  border-radius: var(--r-full);
}

/* Common energy/DPE scale (DRY between recherche and estimation) */
.energy-scale {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  background: var(--c-bg-subtle);
  border: var(--border-thin) solid var(--c-input-border);
  border-radius: var(--r-md);
}
.energy-letter {
  width: 40px;
  height: 40px;
  border: var(--border-thick) solid transparent;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: #fff;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out);
}
.energy-letter:hover { opacity: 0.8; }
.energy-letter.is-active {
  opacity: 1;
  border-color: var(--c-text);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

/* Common small uppercase labels / badges (DRY for qsn-label, legal-header__label, estimation-banner-note, cartes badges, etc.) */
.badge,
.qsn-label,
.legal-header__label,
.estimation-banner-note {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--letter-wide);
  text-transform: uppercase;
}

/* Pages d'erreur (403 / 404 / 500 / 503) */
.error-page {
  min-height: calc(100vh - var(--header-h-lg) - 320px);
  display: flex;
  align-items: center;
  padding: var(--sp-20) 0;
}
.error-page__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-16);
}
.error-page__visual {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-8);
}
.error-page__code {
  font-family: var(--font-display);
  font-size: clamp(6rem, 14vw, 10rem);
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: var(--letter-tight);
  color: var(--c-brand);
  opacity: 0.12;
  user-select: none;
}
.error-page__divider {
  width: 2px;
  height: clamp(80px, 12vw, 140px);
  background: var(--c-border-strong);
  border-radius: var(--r-full);
}
.error-page__content { flex: 1; min-width: 0; }
.error-page__title {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: var(--fw-semibold);
  color: var(--c-text);
  line-height: var(--lh-tight);
  letter-spacing: var(--letter-tight);
  margin-bottom: var(--sp-4);
}
.error-page__lead {
  font-size: var(--fs-md);
  color: var(--c-text-secondary);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--sp-8);
}
.error-page__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-10);
}
.error-page__actions .btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.error-page__suggestions-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--letter-wide);
  margin-bottom: var(--sp-3);
}
.error-page__suggestions ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-6);
}
.error-page__suggestions ul li::before { content: "→ "; color: var(--c-accent); font-weight: var(--fw-semibold); }
.error-page__suggestions a { color: var(--c-text-secondary); font-size: var(--fs-sm); }
.error-page__suggestions a:hover { color: var(--c-brand); }
@media (max-width: 640px) {
  .error-page__inner { flex-direction: column; text-align: center; gap: var(--sp-8); }
  .error-page__visual { flex-direction: column; gap: var(--sp-4); }
  .error-page__divider { width: clamp(60px, 30vw, 120px); height: 2px; }
  .error-page__actions { justify-content: center; }
  .error-page__suggestions ul { justify-content: center; }
}
