/* =========================================================
   Calculatrices Finances — Feuille de style globale
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=DM+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

/* ---------- Variables ---------- */
:root {
  --bg:          #f8fafc;
  --surface:     #ffffff;
  --text:        #0f172a;
  --muted:       #64748b;
  --accent:      #1e40af;
  --accent-soft: #3b82f6;
  --accent-bg:   #eff6ff;
  --accent-brd:  #bfdbfe;
  --amber:       #b45309;
  --amber-bg:    #fffbeb;
  --amber-brd:   #fde68a;
  --green:       #047857;
  --green-bg:    #f0fdf4;
  --green-brd:   #a7f3d0;
  --red:         #b91c1c;
  --red-bg:      #fef2f2;
  --border:      #e2e8f0;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --radius:      12px;
  --radius-sm:   8px;
  --font-ui:     'DM Sans', system-ui, sans-serif;
  --font-serif:  'DM Serif Display', Georgia, serif;
  --font-mono:   'JetBrains Mono', 'Courier New', monospace;
  --max-content: 780px;
  --max-wide:    1120px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }

/* ---------- Navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 0;
}
.logo {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
  letter-spacing: -.01em;
}
.logo span { color: var(--accent); }
.nav-links {
  display: flex;
  align-items: center;
  gap: .1rem;
  list-style: none;
}
.nav-links a {
  font-size: .85rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: .4rem .7rem;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--accent); background: var(--accent-bg); }
.nav-links a.active { color: var(--accent); font-weight: 600; }
.nav-links .nav-cta {
  background: var(--accent);
  color: #fff !important;
  padding: .4rem .9rem;
  border-radius: 999px;
  margin-left: .4rem;
}
.nav-links .nav-cta:hover { background: var(--accent-soft); }

/* Hamburger mobile */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
  color: var(--text);
}
@media (max-width: 768px) {
  .nav-links { display: none; flex-direction: column; align-items: flex-start; gap: .2rem; position: absolute; top: 60px; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 1rem 1.5rem; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  max-width: var(--max-wide);
  margin: 1.25rem auto 0;
  padding: 0 1.5rem;
  font-size: .8rem;
  color: var(--muted);
  display: flex;
  gap: .4rem;
  align-items: center;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { opacity: .5; }

/* ---------- Contenu centré ---------- */
.container {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.container--narrow {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Typographie ---------- */
h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.2;
  letter-spacing: -.02em;
  margin-bottom: 1rem;
}
h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: .75rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--accent-bg);
  color: var(--text);
}
h3 { font-size: 1.05rem; font-weight: 700; margin-top: 1.75rem; margin-bottom: .5rem; }
p { margin-bottom: 1rem; }
ul, ol { margin: .6rem 0 1rem 1.4rem; }
li { margin-bottom: .35rem; }
strong { font-weight: 600; }

/* ---------- Tag de catégorie ---------- */
.tag {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: .25rem .75rem;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent);
  margin-bottom: .75rem;
}

/* ---------- Page header ---------- */
.page-hero {
  padding: 3rem 1.5rem 2.5rem;
  max-width: var(--max-wide);
  margin: 0 auto;
}
.page-hero .meta {
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: .75rem;
}

/* ---------- Boîtes d'info ---------- */
.info-box {
  background: var(--accent-bg);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-size: .95rem;
}
.info-box.warning {
  background: var(--amber-bg);
  border-color: var(--amber);
}
.info-box.danger {
  background: var(--red-bg);
  border-color: var(--red);
}
.info-box.success {
  background: var(--green-bg);
  border-color: var(--green);
}

/* ---------- Card générique ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* ---------- Résultats calculatrice ---------- */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.result-card.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.result-card.highlight {
  background: var(--green-bg);
  border-color: var(--green-brd);
}
.result-label {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .7;
  margin-bottom: .35rem;
}
.result-value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.result-card.primary .result-label { opacity: .85; }

/* ---------- Formulaire calculatrice ---------- */
.calc-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.field label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .4rem;
}
.field .hint {
  font-size: .74rem;
  color: var(--muted);
  margin-top: .25rem;
}
.field input {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
  -moz-appearance: textfield;
}
.field input::-webkit-outer-spin-button,
.field input::-webkit-inner-spin-button { -webkit-appearance: none; }
.field input:focus {
  outline: none;
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
  background: var(--surface);
}
.btn-group { display: flex; gap: .75rem; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .7rem 1.4rem;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform .1s, box-shadow .15s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: white; box-shadow: 0 2px 8px rgba(30,64,175,.3); }
.btn-primary:hover { background: var(--accent-soft); box-shadow: 0 4px 12px rgba(59,130,246,.35); }
.btn-ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

/* ---------- Formule ---------- */
.formula-block {
  background: #0f172a;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: .85rem;
  line-height: 2;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.5rem 0;
}
.formula-block .hl { color: #93c5fd; font-weight: 600; }

/* ---------- Tableau ---------- */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th {
  background: var(--text);
  color: white;
  padding: .65rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
tbody td { padding: .6rem 1rem; border-bottom: 1px solid var(--border); }
tbody tr:nth-child(even) td { background: var(--bg); }
tbody tr:hover td { background: var(--accent-bg); }

/* ---------- Highlight card ---------- */
.highlight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}
.highlight-card strong { color: var(--accent); }

/* ---------- FAQ Accordion ---------- */
.faq-list { margin: 1rem 0; }
details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: .6rem;
  background: var(--surface);
  overflow: hidden;
}
details + details { }
summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: .95rem;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: '+';
  font-size: 1.2rem;
  font-weight: 300;
  color: var(--accent);
  flex-shrink: 0;
  transition: transform .2s;
}
details[open] > summary::after { content: '−'; }
details[open] > summary { color: var(--accent); border-bottom: 1px solid var(--border); }
.faq-answer { padding: 1rem 1.25rem; font-size: .95rem; color: var(--muted); line-height: 1.7; }
.faq-answer p { margin-bottom: .5rem; }
.faq-answer p:last-child { margin-bottom: 0; }

/* ---------- Articles liés ---------- */
.related-articles {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding-top: 2rem;
}
.related-articles h3 {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-top: 0;
  margin-bottom: 1rem;
}
.related-articles a {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .95rem;
  color: var(--text);
  text-decoration: none;
  padding: .65rem 0;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  transition: color .15s;
}
.related-articles a::before { content: '→'; color: var(--accent); }
.related-articles a:hover { color: var(--accent); }

/* ---------- Grille de blog ---------- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}
.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.blog-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.blog-card .tag { margin-bottom: .5rem; }
.blog-card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 .6rem;
  border: none;
  padding: 0;
  color: var(--text);
}
.blog-card p { font-size: .875rem; color: var(--muted); flex: 1; margin: 0; }
.blog-card .card-meta { font-size: .75rem; color: var(--muted); margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--border); }
.blog-card .read-more { font-size: .82rem; font-weight: 600; color: var(--accent); margin-top: .5rem; display: inline-block; }
.blog-card.coming-soon { opacity: .45; cursor: default; pointer-events: none; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 2.5rem 1.5rem;
  margin-top: 4rem;
}
.footer-inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
  align-items: flex-start;
}
.footer-brand .logo { font-size: 1.1rem; margin-bottom: .5rem; display: inline-block; }
.footer-brand p { font-size: .82rem; color: var(--muted); max-width: 260px; line-height: 1.6; }
.footer-links h4 { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: .75rem; }
.footer-links ul { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: .35rem; }
.footer-links a { font-size: .85rem; color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom {
  max-width: var(--max-wide);
  margin: 2rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: space-between;
  align-items: center;
  font-size: .78rem;
  color: var(--muted);
}
.footer-bottom a { color: var(--muted); text-decoration: none; }
.footer-bottom a:hover { color: var(--accent); }

/* ---------- Disclaimer ---------- */
.disclaimer {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 1rem;
  padding: .75rem 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ---------- Séparateur de section ---------- */
.section { padding: 3rem 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-header { margin-bottom: 1.5rem; }
.section-header h2 { font-size: 1.5rem; border: none; padding: 0; }
.section-header p { color: var(--muted); font-size: .95rem; margin: 0; }

/* ---------- Canvas chart ---------- */
.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
}
.chart-legend {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: .8rem;
  margin-bottom: .75rem;
  padding: 0 .5rem;
}
.chart-legend span { display: flex; align-items: center; gap: .35rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ---------- Utilitaires ---------- */
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0 !important; }
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.fw-600 { font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.75rem; }
  .footer-inner { flex-direction: column; gap: 1.5rem; }
}
@media (max-width: 400px) {
  .form-grid { grid-template-columns: 1fr; }
}
