/* Chasseurs d'appart' — feuille de style
   Palette : marine #1F3A5F, sarcelle #2A7F9E, ambre #C8841A, fond #F3F4F6, cartes blanches. */

:root {
  --marine: #1F3A5F;
  --marine-dark: #172c48;
  --sarcelle: #2A7F9E;
  --sarcelle-dark: #216880;
  --sarcelle-soft: #e4f0f5;
  --ambre: #C8841A;
  --ambre-soft: #fbf1e2;
  --fond: #F3F4F6;
  --carte: #ffffff;
  --texte: #1f2937;
  --texte-2: #4b5563;
  --texte-3: #6b7280;
  --ligne: #d9dde3;
  --erreur: #b3261e;
  --erreur-soft: #fbe9e7;
  --rayon: 10px;
  --ombre: 0 1px 2px rgba(31, 58, 95, 0.06), 0 4px 14px rgba(31, 58, 95, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--texte);
  background: var(--fond);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1; }
a { color: var(--sarcelle); }
a:hover { color: var(--sarcelle-dark); }
h1, h2, h3 { color: var(--marine); line-height: 1.25; margin: 0 0 0.5rem; font-weight: 650; }
h1 { font-size: 1.9rem; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75rem; }
ul, ol { margin: 0 0 0.75rem; padding-left: 1.25rem; }
li { margin-bottom: 0.25rem; }
strong { font-weight: 650; }
.muted { color: var(--texte-3); }
.small { font-size: 0.875rem; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--marine); color: #fff; padding: 8px 12px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* En-tête */
.site-header { background: var(--marine); color: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 9px; background: rgba(255, 255, 255, 0.12); color: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 1.1rem; }
.brand-sub { font-size: 0.8rem; color: rgba(255, 255, 255, 0.72); letter-spacing: 0.02em; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { color: rgba(255, 255, 255, 0.85); text-decoration: none; padding: 8px 12px; border-radius: 6px; font-weight: 500; font-size: 0.95rem; }
.site-nav a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.site-nav a.active { background: rgba(255, 255, 255, 0.16); color: #fff; }

/* Pied de page */
.site-footer { margin-top: 48px; padding: 24px 0 28px; border-top: 1px solid var(--ligne); color: var(--texte-3); font-size: 0.875rem; }
.site-footer p { margin: 0 0 4px; }
.footer-note { font-size: 0.8rem; }

/* Sections */
.hero { padding: 36px 0 20px; }
.hero-compact { padding-bottom: 12px; }
.lead { font-size: 1.05rem; color: var(--texte-2); max-width: 720px; margin-bottom: 0; }

.card { background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 24px; margin-bottom: 20px; }
.card-flat { box-shadow: none; border: 1px solid var(--ligne); }
.grid { display: grid; gap: 16px 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Formulaire */
.form-card { padding: 8px 28px 24px; }
fieldset { border: 0; padding: 20px 0 8px; margin: 0; border-top: 1px solid var(--ligne); }
fieldset:first-of-type { border-top: 0; }
legend { padding: 0; font-weight: 650; color: var(--marine); font-size: 1rem; margin-bottom: 8px; padding-top: 20px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .field .label { font-weight: 550; font-size: 0.925rem; color: var(--texte); }
.unit { color: var(--texte-3); font-weight: 400; font-size: 0.85rem; }
.field small { color: var(--texte-3); font-size: 0.8rem; line-height: 1.4; }
input[type="number"], select {
  font: inherit; font-size: 0.975rem; color: var(--texte); background: #fff;
  border: 1px solid #c4c9d1; border-radius: 7px; padding: 9px 11px; width: 100%; min-height: 42px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input[type="number"]::placeholder { color: #9aa1ab; }
input:focus, select:focus { outline: none; border-color: var(--sarcelle); box-shadow: 0 0 0 3px rgba(42, 127, 158, 0.18); }
input:invalid:not(:placeholder-shown):not(:focus) { border-color: var(--erreur); }
select { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.choice-row { display: flex; gap: 8px; }
.choice { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #c4c9d1; border-radius: 7px; padding: 8px 14px; min-height: 42px; cursor: pointer; font-weight: 500; flex: 1; }
.choice:has(input:checked) { border-color: var(--sarcelle); background: var(--sarcelle-soft); color: var(--sarcelle-dark); }
.choice input { accent-color: var(--sarcelle); margin: 0; }

.advanced { border-top: 1px solid var(--ligne); padding: 16px 0 4px; }
.advanced summary { cursor: pointer; font-weight: 650; color: var(--marine); list-style: none; display: flex; align-items: center; gap: 8px; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--sarcelle); border-bottom: 2px solid var(--sarcelle); transform: rotate(-45deg); transition: transform 0.15s; margin-left: 2px; }
.advanced[open] summary::before { transform: rotate(45deg); }
.advanced .grid { margin-top: 16px; }
.advanced p { margin-top: 12px; }

.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 20px; margin-top: 8px; border-top: 1px solid var(--ligne); }
.form-actions p { margin: 0; flex-basis: 100%; }

.btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 600; font-size: 0.975rem;
  padding: 11px 22px; border-radius: 7px; border: 1px solid transparent; cursor: pointer; text-decoration: none; min-height: 44px; transition: background 0.12s, color 0.12s; }
.btn-primary { background: var(--sarcelle); color: #fff; }
.btn-primary:hover { background: var(--sarcelle-dark); color: #fff; }
.btn-ghost { background: transparent; color: var(--marine); border-color: #c4c9d1; }
.btn-ghost:hover { background: #fff; border-color: var(--marine); }
.btn:focus-visible { outline: 3px solid rgba(42, 127, 158, 0.35); outline-offset: 2px; }

.alert { border-radius: var(--rayon); padding: 16px 20px; margin-bottom: 20px; }
.alert ul { margin: 6px 0 0; }
.alert-error { background: var(--erreur-soft); border: 1px solid #efb3ad; color: #7a1a14; }

.info-strip .card { margin-bottom: 0; padding: 18px 20px; }
.info-strip h3 { font-size: 0.95rem; margin-bottom: 4px; }
.info-strip p { margin: 0; color: var(--texte-2); font-size: 0.925rem; }

/* Résultat */
.result-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.result-main { border-top: 4px solid var(--ambre); }
.result-label { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; font-weight: 650; color: var(--texte-3); margin-bottom: 4px; }
.result-price { font-size: 2.8rem; font-weight: 750; color: var(--marine); letter-spacing: -0.02em; line-height: 1.1; margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.result-range { font-size: 1rem; margin-bottom: 20px; }
.kpi-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--fond); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi-value { font-size: 1.25rem; font-weight: 700; color: var(--marine); font-variant-numeric: tabular-nums; }
.kpi-value.up { color: var(--ambre); }
.kpi-value.down { color: var(--sarcelle); }
.kpi-label { font-size: 0.8rem; color: var(--texte-3); line-height: 1.3; }
.bar-compare { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.bar-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 110px; align-items: center; gap: 10px; font-size: 0.875rem; }
.bar-name { color: var(--texte-2); }
.bar { background: var(--fond); border-radius: 4px; height: 14px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--sarcelle); border-radius: 4px; }
.bar-fill.accent { background: var(--ambre); }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--texte-2); }

.result-side h2 { font-size: 1.05rem; }
.result-side h3 { font-size: 0.95rem; margin-top: 16px; }
.recap { margin: 0 0 8px; display: grid; gap: 0; }
.recap > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid #eceef1; font-size: 0.9rem; }
.recap > div:last-child { border-bottom: 0; }
.recap dt { color: var(--texte-3); margin: 0; }
.recap dd { margin: 0; font-weight: 550; text-align: right; }

.tech { margin-top: 20px; padding: 14px 20px; }
.tech summary { cursor: pointer; color: var(--texte-2); font-size: 0.9rem; font-weight: 550; }
.table-compact { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 0.85rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.table-compact th { text-align: left; font-weight: 500; color: var(--texte-3); padding: 4px 8px 4px 0; width: 40%; }
.table-compact td { padding: 4px 0; }
.table-compact tr { border-bottom: 1px solid #eceef1; }

/* À propos */
.kpi-cards { margin-bottom: 20px; }
.kpi-card { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; margin-bottom: 0; }
.kpi-card .kpi-value { font-size: 1.45rem; }
.about-grid .card { margin-bottom: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; background: var(--sarcelle-soft); color: var(--sarcelle-dark); border-radius: 999px; padding: 3px 10px; font-size: 0.8rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.chip-alt { background: var(--ambre-soft); color: #8a5a0f; }
.table-wrap { overflow-x: auto; margin: 12px 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th { text-align: left; color: var(--texte-3); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 2px solid var(--ligne); }
tbody td { padding: 8px 10px; border-bottom: 1px solid #eceef1; white-space: nowrap; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.highlight td { background: var(--ambre-soft); font-weight: 600; }

/* Erreur */
.error-card { text-align: center; padding: 48px 24px; margin-top: 40px; }
.error-code { font-size: 3rem; font-weight: 750; color: var(--ambre); margin: 0; line-height: 1; }
.error-card h1 { font-size: 1.4rem; margin: 8px 0 20px; }

/* Responsive */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  h1 { font-size: 1.5rem; }
  .hero { padding-top: 24px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-card { padding: 4px 18px 20px; }
  .card { padding: 18px; }
  .kpi-row { grid-template-columns: 1fr; }
  .result-price { font-size: 2.2rem; }
  .bar-row { grid-template-columns: 90px minmax(0, 1fr) 90px; }
  .header-inner { justify-content: center; text-align: center; }
  .site-nav { width: 100%; justify-content: center; }
  .btn { width: 100%; }
  .form-actions { flex-direction: column; align-items: stretch; }
}
