/* ══════════════════════════════════════════════════════════════════════════════
   InnoSpira — Système visuel commun de la boîte à outils · direction « Atelier »
   SOURCE UNIQUE DE VÉRITÉ. Ne pas dupliquer ces règles dans les CSS des outils.
   Lier AVANT le CSS spécifique de l'outil :
     <link rel="stylesheet" href="../shared/innospira-ui.css">
     <link rel="stylesheet" href="style.css">
   Thème CLAIR chaud · primaire orange #ffab3f · secondaire indigo (touches).
   Typo : Bricolage Grotesk (titres) / Instrument Sans (UI) / Space Mono (labels).
   Convention : tokens --panel/--line/--brand, classes BEM (.btn--primary).
   ══════════════════════════════════════════════════════════════════════════════ */

/* ═══ Tokens ══════════════════════════════════════════════════════════════════ */
:root {
  /* Canvas & surfaces — blanc chaud, net (pas de beige mou) */
  --bg:        oklch(0.972 0.008 74);   /* fond de page */
  --bg-2:      oklch(0.945 0.011 72);   /* champs, zones creuses, dropzone */
  --panel:     oklch(0.996 0.004 74);   /* header, footer, cartes */
  --panel-2:   oklch(0.955 0.010 72);   /* survols, éléments actifs */
  --line:      oklch(0.895 0.013 72);   /* bordures */
  --line-2:    oklch(0.845 0.016 70);   /* bordures marquées / champs */
  --text:      oklch(0.235 0.022 55);   /* encre chaude quasi-noire */
  --muted:     oklch(0.475 0.021 62);   /* ≥4.5:1 sur --panel (WCAG AA) */
  --muted-2:   oklch(0.595 0.018 62);

  /* Primaire — orange InnoSpira #ffab3f */
  --brand:        oklch(0.806 0.153 69);   /* = #ffab3f (aplats, boutons) */
  --brand-2:      oklch(0.850 0.140 71);   /* survol / remplissage plus clair */
  --brand-strong: oklch(0.545 0.165 46);   /* terre cuite lisible sur clair (texte accent) */
  --brand-ink:    oklch(0.255 0.052 60);   /* texte sur aplat orange */
  --brand-wash:   oklch(0.955 0.042 74);   /* teinte orange très pâle (fonds) */

  /* Secondaire joueur — indigo électrique (délice, avec parcimonie) */
  --spark:        oklch(0.560 0.180 268);
  --spark-strong: oklch(0.470 0.170 268); /* lisible sur clair */
  --spark-wash:   oklch(0.952 0.038 268);

  --danger:       oklch(0.585 0.200 27);   /* erreurs, suppression */
  --danger-wash:  oklch(0.955 0.035 27);
  --ok:           oklch(0.610 0.130 150);

  --radius:    16px;
  --radius-sm: 10px;

  --font:    'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bricolage Grotesk', 'Instrument Sans', system-ui, sans-serif;
  --mono:    'Space Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --shadow-sm: 0 1px 2px oklch(0.5 0.03 60 / 0.07);
  --shadow:    0 1px 2px oklch(0.5 0.03 60 / 0.06), 0 14px 34px -14px oklch(0.5 0.06 60 / 0.20);
  --shadow-lg: 0 2px 4px oklch(0.5 0.03 60 / 0.06), 0 30px 60px -22px oklch(0.5 0.08 55 / 0.28);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);  /* ease-out-quint */

  /* Alias rétro-compatibles — n'utilisez PAS ceux-ci dans du nouveau code.
     Ils existent le temps de la migration des anciens outils. */
  --surface:  var(--panel);
  --surface2: var(--panel-2);
  --border:   var(--line);
  --accent:   var(--brand);
  --accent2:  var(--brand);   /* accent unique orange ; l'indigo est --spark */
  --font-main: var(--font);
  --font-mono: var(--mono);
}

/* ═══ Reset & base ════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* Footer toujours en bas, même sur une page peu remplie (recherche vide…) :
     colonne flex + `.site-footer { margin-top: auto }`. Ne pas redéfinir dans
     le CSS d'un outil — c'est le comportement commun. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ═══ Header (barre de marque) ════════════════════════════════════════════════ */
.site-header {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 40px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand__mark {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--brand); flex-shrink: 0;
  box-shadow: var(--shadow-sm), inset 0 0 0 1px oklch(0.4 0.1 55 / 0.12);
  transform: rotate(-4deg);
  transition: transform .3s var(--ease);
}
.brand:hover .brand__mark { transform: rotate(3deg) scale(1.04); }
.brand__mark--sm { width: 32px; height: 32px; border-radius: 9px; }
.brand__mark svg { width: 25px; height: 25px; }
.brand__name { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -.03em; }
.brand__pill {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  border: 1px solid var(--line); background: var(--bg);
  padding: 4px 10px; border-radius: 999px; letter-spacing: 0;
}

/* ═══ Sélecteur d'outils (header, à droite) ═══════════════════════════════════
   Base : <details>/<summary> — fonctionne au clavier et SANS JS. `innospira-ui.js`
   n'ajoute que la fermeture au clic extérieur et à Échap.
   L'icône mosaïque 2×2 = le glyphe de la boîte à outils (même signe qu'au footer). */
.toolnav { position: relative; margin-left: auto; }
.toolnav__btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg); color: var(--text);
  font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer;
  list-style: none;
  transition: border-color .15s ease, background .15s ease, transform .12s var(--ease);
}
.toolnav__btn::-webkit-details-marker { display: none; }
.toolnav__btn:hover { border-color: var(--line-2); background: var(--panel-2); }
.toolnav[open] .toolnav__btn { background: var(--panel-2); border-color: var(--line-2); }

.toolnav__grid {
  display: grid; grid-template-columns: repeat(2, 5px); grid-template-rows: repeat(2, 5px);
  gap: 3px; flex-shrink: 0;
}
.toolnav__grid i { width: 5px; height: 5px; border-radius: 1.5px; background: var(--brand-strong); transition: transform .3s var(--ease); }
.toolnav__btn:hover .toolnav__grid i:nth-child(1) { transform: translate(-1.5px, -1.5px); }
.toolnav__btn:hover .toolnav__grid i:nth-child(2) { transform: translate( 1.5px, -1.5px); }
.toolnav__btn:hover .toolnav__grid i:nth-child(3) { transform: translate(-1.5px,  1.5px); }
.toolnav__btn:hover .toolnav__grid i:nth-child(4) { transform: translate( 1.5px,  1.5px); }

.toolnav__chev { width: 9px; height: 9px; flex-shrink: 0; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-2px) rotate(45deg); transition: transform .25s var(--ease); }
.toolnav[open] .toolnav__chev { transform: translateY(1px) rotate(225deg); }

.toolnav__panel {
  position: absolute; top: calc(100% + 9px); right: 0; z-index: 90;
  min-width: 232px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: toolnav-in .18s var(--ease);
}
@keyframes toolnav-in { from { opacity: 0; transform: translateY(-6px); } }

.toolnav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  text-decoration: none; color: var(--text); font-size: 14px; font-weight: 500;
  transition: background .14s ease;
}
.toolnav__item:hover { background: var(--panel-2); }
.toolnav__item .toolnav__ico {
  display: grid; place-items: center; width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 8px; background: var(--brand-wash); border: 1px solid var(--line);
  color: var(--brand-strong);
}
.toolnav__ico svg { width: 15px; height: 15px; }
/* Outil courant : marqué, non cliquable */
.toolnav__item.is-current { background: var(--brand-wash); font-weight: 700; cursor: default; }
.toolnav__item.is-current::after { content: "✓"; margin-left: auto; color: var(--brand-strong); font-weight: 700; }
.toolnav__item.is-current .toolnav__ico { background: var(--panel); }

.toolnav__sep { height: 1px; margin: 5px 8px; background: var(--line); }
.toolnav__all {
  display: block; padding: 8px 10px; border-radius: 9px;
  font-family: var(--mono); font-size: 12.5px; color: var(--muted);
  text-decoration: none; transition: background .14s ease, color .14s ease;
}
.toolnav__all:hover { background: var(--panel-2); color: var(--brand-strong); }

/* Lien simple en header (page d'accueil : pas de sélecteur, on est déjà sur la liste) */
.header-link {
  margin-left: auto; font-size: 14px; font-weight: 600; color: var(--muted);
  text-decoration: none; transition: color .15s ease;
}
.header-link:hover { color: var(--brand-strong); }

@media (max-width: 620px) {
  .toolnav__btn { padding: 8px 12px; }
  .toolnav__label { display: none; }   /* icône + chevron seuls, la barre reste lisible */
}

/* ═══ Boutons ═════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--text);
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14.5px;
  box-shadow: var(--shadow-sm);
  transition: transform .12s var(--ease), background .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn:hover { border-color: var(--muted-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn--primary {
  background: var(--brand); border-color: transparent; color: var(--brand-ink); font-weight: 700;
  box-shadow: 0 1px 2px oklch(0.5 0.1 55 / .2), 0 10px 22px -8px oklch(0.806 0.153 69 / .5);
}
.btn--primary:hover { background: var(--brand-2); border-color: transparent; }
.btn--ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn--ghost:hover { background: var(--panel-2); border-color: transparent; }
.btn--lg { padding: 15px 24px; font-size: 16px; border-radius: 12px; }
.btn--block, .btn--lg.btn--block { width: 100%; }

/* ═══ Hero (accroche de landing) ══════════════════════════════════════════════ */
.hero { position: relative; max-width: 780px; margin: 0 auto; padding: 8vh 24px 4vh; text-align: center; overflow: hidden; }
.hero::before { /* texture pointillée très discrète */
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(oklch(0.6 0.04 60 / 0.14) 1.3px, transparent 1.4px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, #000 0%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, #000 0%, transparent 75%);
}
.hero > * { position: relative; z-index: 1; }
.hero__title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 4.2rem); line-height: 1.0; margin: 0 0 20px;
  letter-spacing: -.035em; text-wrap: balance;
}
.hero__accent { position: relative; white-space: nowrap; color: var(--brand-strong); }
.hero__accent::after { /* soulignage « marqueur » tracé main, indigo */
  content: ""; position: absolute; left: -1%; right: -1%; bottom: -.14em; height: .34em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14' preserveAspectRatio='none'%3E%3Cpath d='M4 9 Q 46 2 96 7 T 196 6' stroke='%235a52e0' fill='none' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}
.hero__sub { color: var(--muted); font-size: 18px; line-height: 1.55; margin: 0 auto 26px; max-width: 560px; text-wrap: pretty; }
.hero__checks {
  list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px;
  padding: 0; margin: 0; font-family: var(--mono); font-size: 13px; color: var(--muted);
}
.hero__checks li { display: inline-flex; align-items: center; gap: 7px; }
.hero__checks li::before { /* puce « étincelle » orange */
  content: ""; width: 15px; height: 15px; flex-shrink: 0; background: var(--brand);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1 L14 10 L23 12 L14 14 L12 23 L10 14 L1 12 L10 10 Z' fill='black'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1 L14 10 L23 12 L14 14 L12 23 L10 14 L1 12 L10 10 Z' fill='black'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* Variante compacte — accueil : le hero ne doit pas repousser la grille d'outils */
.hero--compact { padding: 5vh 24px 2.5vh; max-width: 720px; }
.hero--compact .hero__title { font-size: clamp(2rem, 4.6vw, 3.1rem); margin-bottom: 14px; }
.hero--compact .hero__sub { font-size: 16.5px; margin-bottom: 20px; }

/* ═══ En-tête d'outil (compact) ═══════════════════════════════════════════════
   Remplace le hero sur les PAGES OUTIL : l'outil doit être visible tout de suite.
   Le hero (plein format) reste réservé à la page d'accueil de la boîte à outils. */
.tool-head { max-width: 1100px; margin: 0 auto; padding: 26px 24px 0; text-align: center; }
.tool-head__title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(1.45rem, 3.2vw, 2rem); line-height: 1.12;
  letter-spacing: -.035em; margin: 0; text-wrap: balance;
}
.tool-head__accent { color: var(--brand-strong); }
.tool-head__sub {
  color: var(--muted); font-size: 15px; line-height: 1.5;
  margin: 8px auto 0; max-width: 620px; text-wrap: pretty;
}
@media (max-width: 720px) {
  .tool-head { padding: 20px 20px 0; }
  .tool-head__sub { font-size: 14px; }
}

/* ═══ Carte / panel générique ════════════════════════════════════════════════ */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; text-align: left;
  box-shadow: var(--shadow);
}

/* ═══ FAQ (accordéon <details>) ══════════════════════════════════════════════ */
.faq { max-width: 760px; margin: 0 auto; padding: 4vh 24px 6vh; }
.faq__h { font-family: var(--display); font-weight: 800; font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: -.02em; margin: 0 0 22px; }
.faq__list { display: flex; flex-direction: column; gap: 12px; }
.faq__item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm); }
.faq__item summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 20px; font-weight: 600; font-size: 15.5px; color: var(--text);
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__plus { font-family: var(--mono); color: var(--brand-strong); font-size: 22px; line-height: 1; transition: transform .25s var(--ease); flex-shrink: 0; }
.faq__item[open] .faq__plus { transform: rotate(135deg); }
.faq__a { padding: 0 20px 20px; color: var(--muted); font-size: 15px; line-height: 1.6; }

/* ═══ Footer ══════════════════════════════════════════════════════════════════ */
.site-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 40px; margin-top: auto;   /* margin-top:auto → toujours collé en bas */
  background: var(--panel); border-top: 1px solid var(--line);
  color: var(--muted); font-size: 14px;
}
.site-footer__tag { font-family: var(--mono); font-size: 12px; color: var(--muted-2); }
.site-footer__nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Liens tertiaires du footer (partenaires…) : restent en texte simple */
.site-footer__nav a:not(.footer-btn), .site-footer a:not(.footer-btn) {
  color: var(--muted); text-decoration: none; transition: color .15s ease;
}
.site-footer__nav a:not(.footer-btn):hover, .site-footer a:not(.footer-btn):hover { color: var(--brand-strong); }

/* ── Boutons de retour (pilules) ────────────────────────────────────────────── */
.footer-btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 15px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg);
  color: var(--text); text-decoration: none;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: transform .18s var(--ease), background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.footer-btn:hover {
  transform: translateY(-2px);
  border-color: var(--line-2);
  box-shadow: var(--shadow-sm);
}
/* Retour à la boîte à outils : destination la plus utile depuis un outil */
.footer-btn--tools { background: var(--brand-wash); }
.footer-btn--tools:hover { background: var(--brand-wash); border-color: var(--brand); }

/* Icône = la mosaïque 2×2 de l'accueil ; les tuiles s'écartent au survol */
.footer-btn__grid {
  display: grid; grid-template-columns: repeat(2, 5px); grid-template-rows: repeat(2, 5px);
  gap: 3px; flex-shrink: 0;
}
.footer-btn__grid i {
  width: 5px; height: 5px; border-radius: 1.5px; background: var(--brand-strong);
  transition: transform .3s var(--ease);
}
.footer-btn:hover .footer-btn__grid i:nth-child(1) { transform: translate(-1.5px, -1.5px); }
.footer-btn:hover .footer-btn__grid i:nth-child(2) { transform: translate( 1.5px, -1.5px); }
.footer-btn:hover .footer-btn__grid i:nth-child(3) { transform: translate(-1.5px,  1.5px); }
.footer-btn:hover .footer-btn__grid i:nth-child(4) { transform: translate( 1.5px,  1.5px); }

/* Étincelle de marque (même signe que le logo, les puces et le toast) */
.footer-btn__spark {
  width: 14px; height: 14px; flex-shrink: 0; background: var(--brand);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1 L14 10 L23 12 L14 14 L12 23 L10 14 L1 12 L10 10 Z' fill='black'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1 L14 10 L23 12 L14 14 L12 23 L10 14 L1 12 L10 10 Z' fill='black'/%3E%3C/svg%3E") center/contain no-repeat;
}
.footer-btn__ext { color: var(--muted-2); font-size: 13px; }

/* ═══ Toast ═══════════════════════════════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px);
  opacity: 0; pointer-events: none;
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--text); color: oklch(0.97 0.01 75);
  padding: 13px 20px; border-radius: 12px; font-size: 14.5px; font-weight: 500; z-index: 120;
  transition: opacity .2s, transform .2s var(--ease); box-shadow: var(--shadow-lg);
}
.toast::before { /* étincelle orange */
  content: ""; width: 16px; height: 16px; flex-shrink: 0; background: var(--brand);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1 L14 10 L23 12 L14 14 L12 23 L10 14 L1 12 L10 10 Z' fill='black'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1 L14 10 L23 12 L14 14 L12 23 L10 14 L1 12 L10 10 Z' fill='black'/%3E%3C/svg%3E") center/contain no-repeat;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast--err { background: var(--danger); color: oklch(0.98 0.02 25); }
.toast--err::before { background: oklch(0.98 0.02 25); }

/* ═══ Overlay & spinner ═══════════════════════════════════════════════════════ */
.overlay {
  position: fixed; inset: 0; background: oklch(0.35 0.03 60 / .38); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.overlay__box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 36px; text-align: center; box-shadow: var(--shadow-lg); }
.spinner {
  width: 38px; height: 38px; border: 3px solid var(--line-2); border-top-color: var(--brand);
  border-radius: 50%; margin: 0 auto; animation: ispin .8s linear infinite;
}
@keyframes ispin { to { transform: rotate(360deg); } }

/* ═══ Accessibilité : mouvement réduit ═══════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

/* ═══ Responsive commun (chrome) ══════════════════════════════════════════════ */
@media (max-width: 720px) {
  .site-header { padding: 16px 20px; }
  .site-footer { padding: 16px 20px; flex-direction: column; align-items: flex-start; gap: 12px; }
}
