/* ==========================================================================
   ThermoCalc — Design System, Typographie Mathématique & Feuille de style
   ========================================================================== */

:root {
  --bg-page: #f6f8fc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-accent-soft: #eff6ff;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --brand: #1d4ed8;
  --brand-hover: #1e40af;
  --brand-light: #93c5fd;

  --accent-emerald: #059669;
  --accent-rose: #e11d48;

  --border-color: #e2e8f0;
  --border-strong: #cbd5e1;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04), 0 1px 3px 0 rgba(15, 23, 42, 0.03);
  --shadow-md: 0 8px 20px -4px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.04);

  --container-max: 1200px;
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --font-math: "STIX Two Text", "Cambria Math", "Times New Roman", Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  background:
    radial-gradient(ellipse 90% 380px at 50% -60px, rgba(37, 99, 235, 0.065), transparent 70%),
    var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---------- En-tête et Navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
}

.header-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0.72rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.12rem;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.brand-logo:hover {
  text-decoration: none;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.28);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.92rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.header-nav a {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.35rem 0.78rem;
  border-radius: 999px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.header-nav a:hover {
  color: var(--brand);
  background: var(--bg-subtle);
  text-decoration: none;
}

.header-nav a.active {
  color: var(--brand);
  background: var(--bg-accent-soft);
  font-weight: 600;
}

/* ---------- Conteneur principal & Intro ---------- */

.main-container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  flex: 1;
}

.breadcrumb {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.page-intro {
  margin-bottom: 1.15rem;
}

.page-intro h1 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.5rem, 2.6vw, 2.05rem);
  line-height: 1.22;
  letter-spacing: -0.025em;
}

.page-intro p {
  margin: 0;
  color: var(--text-secondary);
  max-width: 74ch;
  line-height: 1.62;
}

.usage-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  background: var(--bg-surface);
  border: 1px solid #dbeafe;
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--shadow-sm);
  font-size: 0.89rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.usage-banner-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-accent-soft);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.08rem;
}

.usage-banner strong {
  color: var(--text-primary);
}

/* ---------- Page d'accueil : Hero, Guide 3 étapes, Filtres & Cartes ---------- */

.hero-directory {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand);
  background: var(--bg-accent-soft);
  border: 1px solid #dbeafe;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.9rem;
}

.hero-directory h1 {
  margin: 0 0 0.55rem;
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  line-height: 1.18;
  letter-spacing: -0.03em;
}

.hero-lead {
  margin: 0 0 1.35rem;
  color: var(--text-secondary);
  max-width: 70ch;
  font-size: 1.02rem;
  line-height: 1.65;
}

.how-it-works {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.4rem;
  padding: 0.9rem 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.how-step {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.how-step strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.86rem;
  margin-bottom: 0.1rem;
}

.how-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.08rem;
}

.filter-controls {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.search-input-wrap {
  position: relative;
  max-width: 560px;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 0.96rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-subtle);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  padding: 0.38rem 0.88rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.tag-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.25rem;
}

.tool-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.15rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-light);
}

.tool-card[hidden] {
  display: none;
}

.tool-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.tool-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-accent-soft);
  border: 1px solid #dbeafe;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tool-category {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand);
  background: var(--bg-accent-soft);
  padding: 0.24rem 0.62rem;
  border-radius: var(--radius-sm);
}

.tool-card h2 {
  margin: 0 0 0.55rem;
  font-size: 1.16rem;
  line-height: 1.32;
  letter-spacing: -0.015em;
}

.tool-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.93rem;
  line-height: 1.6;
}

.tool-ideal {
  margin-top: 0.8rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--border-color);
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.48;
}

.tool-ideal strong {
  color: var(--text-primary);
}

.tool-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

.tool-pill {
  font-size: 0.77rem;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 0.18rem 0.52rem;
  border-radius: var(--radius-sm);
}

.tool-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.68rem 1rem;
  background: var(--brand);
  color: #ffffff;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.15s ease;
}

.tool-cta:hover {
  background: var(--brand-hover);
  text-decoration: none;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
}

/* ---------- Layout 2 colonnes des simulateurs ---------- */

.calc-layout {
  display: grid;
  grid-template-columns: minmax(320px, 445px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.45rem;
  box-shadow: var(--shadow-sm);
}

.results-column {
  position: sticky;
  top: 4.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.unit-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.unit-select-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.unit-select {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

/* ---------- Groupes & Contrôles Curseur + Champ Numérique ---------- */

.field-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  color: var(--brand);
  margin: 1.35rem 0 0.85rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-color);
}

.field-section-title.is-first {
  margin-top: 0;
}

.field-group {
  margin-bottom: 1.05rem;
}

.field-group:last-of-type {
  margin-bottom: 0;
}

.field-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.field-label {
  font-size: 0.89rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.25rem;
  line-height: 1.45;
}

.field-warning {
  margin-top: 0.45rem;
  padding: 0.48rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid #fcd34d;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.8rem;
  line-height: 1.45;
}

.field-warning[hidden] {
  display: none;
}

.number-unit-wrap {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  overflow: hidden;
  flex-shrink: 0;
}

.number-unit-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.15);
}

.field-number {
  width: 90px;
  border: none;
  padding: 0.32rem 0.48rem;
  font-size: 0.9rem;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
  color: var(--text-primary);
  background: transparent;
}

.field-number:focus {
  outline: none;
}

.field-unit {
  padding: 0.32rem 0.52rem;
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border-left: 1px solid var(--border-color);
  white-space: nowrap;
}

.field-range {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  margin: 0.25rem 0 0;
  height: 20px;
}

.field-range:focus {
  outline: none;
}

.field-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
}

.field-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 17px;
  height: 17px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: var(--brand);
  border: 2.5px solid #ffffff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.28);
  transition: transform 0.12s ease, background-color 0.12s ease;
}

.field-range:hover::-webkit-slider-thumb,
.field-range:focus-visible::-webkit-slider-thumb {
  transform: scale(1.1);
  background: var(--brand-hover);
}

.field-range:focus-visible::-webkit-slider-runnable-track {
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.16);
}

.field-range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
}

.field-range::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--brand);
  border: 2.5px solid #ffffff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.28);
  transition: transform 0.12s ease, background-color 0.12s ease;
}

.field-range:hover::-moz-range-thumb,
.field-range:focus-visible::-moz-range-thumb {
  transform: scale(1.1);
  background: var(--brand-hover);
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.preset-btn {
  font-size: 0.76rem;
  font-family: inherit;
  padding: 0.24rem 0.58rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.14s ease;
}

.preset-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--bg-accent-soft);
}

/* ---------- Barre d'actions (Partage, Impression, Reset) ---------- */

.actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.58rem 0.95rem;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--brand);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--brand-hover);
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-ghost:hover {
  color: var(--accent-rose);
  border-color: var(--accent-rose);
}

.copy-feedback {
  width: 100%;
  font-size: 0.82rem;
  color: var(--accent-emerald);
  font-weight: 600;
  min-height: 1.2rem;
}

/* ---------- Cartes KPI Résultats ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.85rem;
}

.kpi-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem;
}

.kpi-card.kpi-highlight {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border-color: #bfdbfe;
}

.kpi-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.035em;
  color: var(--text-secondary);
  margin-bottom: 0.28rem;
}

.kpi-value {
  font-size: 1.45rem;
  font-weight: 800;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-card.kpi-highlight .kpi-value {
  color: var(--brand);
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 0.25rem;
  line-height: 1.38;
}

/* ---------- Conteneur Graphique ---------- */

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 315px;
  margin-top: 1.15rem;
}

.chart-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.9rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  text-align: center;
  padding: 1rem;
}

/* ---------- Emplacements de monétisation (Zéro CLS) ---------- */

.ad-slot {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ad-slot-contextual {
  min-height: 118px;
  border-left: 4px solid var(--accent-emerald);
}

.ad-slot-banner {
  min-height: 96px;
  margin-top: 2rem;
  background: var(--bg-subtle);
  align-items: center;
  text-align: center;
}

.ad-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.affiliate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.affiliate-copy strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.affiliate-copy span {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.affiliate-link {
  display: inline-flex;
  align-items: center;
  padding: 0.48rem 0.9rem;
  background: var(--accent-emerald);
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
}

.affiliate-link:hover {
  background: #047857;
  text-decoration: none;
}

/* ---------- Bloc pédagogique scientifique & Typographie Mathématique ---------- */

.science-section {
  margin-top: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.science-section h2 {
  margin: 0 0 0.45rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.science-lead {
  margin: 0 0 1.4rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 74ch;
  line-height: 1.65;
}

.science-section h3 {
  margin: 1.65rem 0 0.65rem;
  font-size: 1.04rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
  margin: 0.75rem 0 1.35rem;
}

.formula-item {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-left: 3.5px solid var(--brand);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
}

.formula-item.formula-wide {
  grid-column: 1 / -1;
}

.formula-name {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  color: var(--text-muted);
  margin-bottom: 0.48rem;
}

.math-expr {
  font-family: var(--font-math);
  font-size: 1.14rem;
  line-height: 1.75;
  color: var(--text-primary);
  white-space: nowrap;
}

.math-expr var {
  font-style: italic;
  font-family: var(--font-math);
}

.math-expr sub,
.math-expr sup {
  font-size: 0.72em;
  line-height: 0;
}

.math-op {
  padding: 0 0.22rem;
  color: var(--text-secondary);
}

.math-fn {
  font-style: normal;
  font-family: var(--font-math);
}

.math-note {
  margin-top: 0.42rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.math-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 0.24rem;
  font-size: 0.92em;
  line-height: 1.22;
}

.math-num {
  padding: 0 0.32rem 0.16rem;
  border-bottom: 1.5px solid var(--text-primary);
}

.math-den {
  padding: 0.16rem 0.32rem 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin: 0.75rem 0 1.25rem;
}

.vars-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.vars-table th,
.vars-table td {
  text-align: left;
  padding: 0.62rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.vars-table tbody tr:last-child td {
  border-bottom: none;
}

.vars-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.vars-table th {
  background: var(--bg-subtle);
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.vars-table td:first-child {
  font-family: var(--font-math);
  font-size: 1.03rem;
  color: var(--text-primary);
  white-space: nowrap;
}

.vars-table td:first-child var {
  font-style: italic;
}

.example-box {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border: 1px solid #dbeafe;
  border-radius: var(--radius-md);
  padding: 1.15rem 1.3rem;
  font-size: 0.93rem;
  line-height: 1.65;
  color: var(--text-primary);
}

.example-title {
  margin: 0;
  color: var(--text-primary);
}

.example-steps {
  margin: 0.65rem 0 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  color: var(--text-secondary);
}

.example-steps strong {
  color: var(--text-primary);
}

.limits-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.93rem;
  line-height: 1.65;
}

.limits-list li {
  margin-bottom: 0.5rem;
}

.limits-list li:last-child {
  margin-bottom: 0;
}

/* ---------- Pied de page ---------- */

.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 1.25rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ---------- En-tête réservé à l'impression ---------- */

.print-only-header {
  display: none;
}

/* ---------- Responsive Mobile ---------- */

@media (max-width: 920px) {
  .calc-layout {
    grid-template-columns: 1fr;
  }

  .results-column {
    position: static;
  }

  .chart-wrapper {
    height: 270px;
  }

  .how-it-works {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .hero-directory,
  .panel,
  .science-section {
    padding: 1.1rem;
  }

  .formula-grid {
    grid-template-columns: 1fr;
  }

  .field-number {
    width: 84px;
  }
}

/* ---------- Export PDF / Impression propre ---------- */

@media print {
  @page {
    margin: 14mm;
    size: A4 portrait;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 10.5pt;
  }

  .site-header,
  .breadcrumb,
  .actions-bar,
  .preset-row,
  .field-range,
  .unit-bar,
  .ad-slot,
  .site-footer {
    display: none !important;
  }

  .print-only-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 2px solid #0f172a;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    font-size: 9.5pt;
    color: #334155;
  }

  .main-container {
    padding: 0;
    max-width: 100%;
  }

  .usage-banner {
    background: #f8fafc !important;
    box-shadow: none;
    margin-bottom: 0.85rem;
  }

  .calc-layout {
    display: block;
  }

  .panel,
  .science-section {
    box-shadow: none;
    border: 1px solid #cbd5e1;
    margin-bottom: 1rem;
  }

  .kpi-grid,
  .formula-item,
  .example-box {
    break-inside: avoid;
  }

  .math-num {
    border-bottom-color: #000000;
  }

  .results-column {
    position: static;
  }

  .field-section-title {
    margin: 0.75rem 0 0.35rem;
    font-size: 8.5pt;
  }

  .field-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.22rem 0;
    border-bottom: 1px dotted #cbd5e1;
    margin-bottom: 0.2rem;
  }

  .field-top {
    width: 100%;
    margin-bottom: 0;
  }

  .field-hint {
    display: none;
  }

  .number-unit-wrap {
    border: none;
  }

  .field-unit {
    background: transparent;
    border: none;
  }

  .chart-wrapper {
    height: 240px;
    break-inside: avoid;
  }

  .chart-wrapper canvas {
    max-width: 100% !important;
  }

  .kpi-card {
    background: #f8fafc !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
