/* Templates (v2) - 8 templates (bundles de KPIs) en 4 catégories + bibliothèque
   de 19 KPIs. 100 % dérivé des tokens -> compatible [data-theme] (sombre). */

/* ── Badges de catégorie ──────────────────────────────────────────────────── */
.cat-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 11px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.05em;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink-2);
}
.cat-badge .cdot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.cat-badge.overall .cdot { background: var(--ink); }
.cat-badge.awareness { background: var(--accent-soft); border-color: var(--accent-ring); color: var(--ink); }
.cat-badge.awareness .cdot { background: var(--accent); }
.cat-badge.consideration { background: rgba(59, 130, 246, 0.12); border-color: rgba(59, 130, 246, 0.32); }
.cat-badge.consideration .cdot { background: #3b82f6; }
.cat-badge.conversion { background: rgba(22, 163, 74, 0.12); border-color: rgba(22, 163, 74, 0.32); }
.cat-badge.conversion .cdot { background: #16a34a; }

/* ── Note d'injection du jeton ────────────────────────────────────────────── */
.tpl-note {
  max-width: 780px; margin: 22px auto 0; padding: 12px 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft);
  font-size: 13px; color: var(--ink-2); display: flex; gap: 10px; align-items: flex-start;
}
.tpl-note-ic { color: var(--accent); flex: none; margin-top: 1px; }
.tpl-token {
  font-family: var(--font-mono); font-size: 0.88em; white-space: nowrap;
  padding: 1px 6px; border-radius: 5px;
  background: var(--accent-soft); border: 1px solid var(--accent-ring); color: var(--ink);
}

/* ── En-tête de catégorie ─────────────────────────────────────────────────── */
.tpl-cat-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 34px 0 14px; }
.tpl-cat-head h2 { margin: 0; font-size: 22px; }
.tpl-cat-sub { color: var(--ink-3); font-size: 14px; }

/* ── Cartes de templates ──────────────────────────────────────────────────── */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.tpl-card {
  border: 1px solid var(--line); border-radius: 16px; padding: 22px;
  background: var(--bg-soft); display: flex; flex-direction: column; gap: 13px;
}
.tpl-card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; color: inherit; font: inherit;
}
.tpl-head-right { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.tpl-chevron { color: var(--ink-3); display: inline-flex; transition: transform 0.25s ease; }
.tpl-card.open .tpl-chevron { transform: rotate(90deg); color: var(--ink); }
.tpl-card-head:hover h3 { color: var(--ink); }
.tpl-card h3 { font-size: 18px; margin: 0; line-height: 1.25; transition: color 0.15s ease; }
.tpl-card-obj { color: var(--ink-2); font-size: 14px; margin: 0; line-height: 1.5; }
.tpl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kpi-chip {
  font-family: var(--font-mono); font-size: 10.5px; padding: 2px 8px; border-radius: 6px;
  border: 1px solid var(--line); color: var(--ink-2); background: transparent;
}
/* Révélation animée : astuce grid-template-rows 0fr -> 1fr (hauteur auto animable). */
.tpl-reveal { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s ease; }
.tpl-card.open .tpl-reveal { grid-template-rows: 1fr; }
.tpl-reveal-inner { overflow: hidden; min-height: 0; }
.tpl-detail {
  border-top: 1px solid var(--line); margin-top: 8px; padding-top: 14px;
  opacity: 0; transform: translateY(-4px);
  transition: opacity 0.28s ease 0.05s, transform 0.28s ease 0.05s;
}
.tpl-card.open .tpl-detail { opacity: 1; transform: none; }
.tpl-phare { background: var(--accent-soft); border: 1px solid var(--accent-ring); border-radius: 12px; padding: 12px 14px; }
.tpl-phare-k { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); }
.tpl-phare-q { font-weight: 500; margin: 5px 0 0; line-height: 1.5; }
.tpl-qhead { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); margin: 16px 0 9px; }
.tpl-qlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tpl-qitem { display: grid; grid-template-columns: 26px 1fr auto; gap: 11px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.tpl-qnum { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-family: var(--font-mono); font-size: 11px; background: var(--accent-soft); color: var(--ink); border: 1px solid var(--accent-ring); }
.tpl-qbody { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tpl-qname { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); }
.tpl-qtext { font-size: 13.5px; color: var(--ink); line-height: 1.45; }
.tpl-qitem .scale-badge { align-self: center; }
.tpl-metho-note { font-size: 13px; color: var(--ink-2); display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; }

/* ── Bibliothèque de KPIs ─────────────────────────────────────────────────── */
.kpi-lib { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.kpi-row { display: grid; grid-template-columns: 210px 1fr 120px; gap: 18px; align-items: start; padding: 14px 18px; border-top: 1px solid var(--line); }
.kpi-row:first-child { border-top: 0; }
.kpi-row:nth-child(even) { background: var(--bg-soft); }
.kpi-name { font-weight: 500; font-size: 14px; padding-top: 1px; }
.kpi-q { color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.kpi-note { display: block; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.scale-badge {
  justify-self: end; font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink-2); white-space: nowrap;
}
.scale-badge.scale { background: var(--accent-soft); border-color: var(--accent-ring); color: var(--ink); }

/* ── Bande méthodo ────────────────────────────────────────────────────────── */
.tpl-metho { border: 1px solid var(--line); border-radius: 18px; padding: 28px; background: var(--bg-soft); }
.tpl-metho-links { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 16px; }
.tpl-metho-links a { color: var(--ink); border-bottom: 1px solid var(--accent); padding-bottom: 1px; font-size: 14px; }

@media (max-width: 640px) {
  .tpl-grid { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: 1fr; gap: 7px; }
  .scale-badge { justify-self: start; }
  .tpl-qitem { grid-template-columns: 24px 1fr; }
  .tpl-qitem .scale-badge { grid-column: 2; justify-self: start; margin-top: 4px; }
}
