/* =====================================================================
 * Semtopic — blocs Courbe de visibilité, Voisins sémantiques,
 * Wikipédia & Wikidata, Archives du Web.
 * Complète styles.css (DA Nature) : mêmes jetons, mêmes cartes.
 * Réutilise .stat-tiles, .kw-read, .kw-foot, .kw-loading, .chip et
 * .mini-pos définis dans keywords.css — ne pas les redéfinir ici.
 * ===================================================================== */

/* Quatre tuiles sur une ligne. `.stat-tiles` en tient trois (keywords.css) :
   avec quatre, la dernière partait seule sur un second rang. */
.stat-tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .stat-tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Verdicts partagés (gain / perte / stable) ---------- */
.v-gain   { background: var(--c1-tint); }
.v-perte  { background: var(--c3-tint); }
.v-stable { background: var(--rail); color: var(--granit); }

/* ===================== Courbe de visibilité ===================== */
.vis-chart-wrap { position: relative; margin: 4px 0 2px; }
.vis-chart { width: 100%; height: auto; display: block; overflow: visible; }

/* Bandeaux des mises à jour Google, derrière les courbes */
.vis-chart .upd { fill: var(--c3-tint); opacity: 0.38; }
.vis-chart .upd.spam { fill: var(--pierre); opacity: 0.3; }
.vis-chart .upd:hover { opacity: 0.6; }
.vis-chart .grid { stroke: var(--rail); stroke-width: 1; }
.vis-chart .axis-lbl {
  font-family: var(--f-mono); font-size: 11px; fill: var(--granit);
}
.vis-chart .line { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
.vis-chart .line.rival { stroke-width: 1.75; stroke-dasharray: 5 4; }
.vis-chart .area { opacity: 0.12; }
.vis-chart .tip { fill: var(--sapin); r: 4; }

.vis-legend {
  display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center;
  margin-top: 10px; font-size: 13px;
}
.vis-legend .ln {
  display: inline-block; width: 22px; height: 3px; border-radius: 2px;
  margin-right: 7px; vertical-align: 2px;
}
.vis-legend .ln.rival { height: 2px; opacity: 0.85; }
.vis-legend .sw-upd {
  display: inline-block; width: 12px; height: 12px; border-radius: 3px;
  background: var(--c3-tint); margin-right: 7px; vertical-align: -2px;
}
.vis-legend .sw-upd.spam { background: var(--pierre); }
.vis-legend .dom { font-family: var(--f-mono); font-size: 12.5px; }
.vis-legend .val { color: var(--granit); }

/* Effet de chaque mise à jour */
.upd-list { display: grid; gap: 8px; margin-top: 18px; }
.upd-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center; gap: 10px 14px;
  padding: 9px 0; border-top: 1px dotted var(--pierre);
}
.upd-row:first-child { border-top: none; }
.upd-name { font-weight: 600; font-size: 14.5px; min-width: 0; }
.upd-name small {
  display: block; font-family: var(--f-mono); font-weight: 400;
  font-size: 11.5px; color: var(--granit); letter-spacing: 0.02em;
}
.upd-move { font-family: var(--f-mono); font-size: 12.5px; color: var(--granit); }
.upd-delta {
  font-family: var(--f-serif); font-size: 19px; letter-spacing: -0.02em;
  border-radius: var(--r-pill); padding: 2px 12px; white-space: nowrap;
}

/* ===================== Voisins sémantiques ===================== */
.voice-hero { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.voice-num {
  font-family: var(--f-serif); font-size: clamp(52px, 6.5vw, 80px);
  letter-spacing: -0.04em; line-height: 0.9;
}
.voice-sub { font-size: 15px; line-height: 1.35; color: #3f5446; }

.nb-list { display: grid; gap: 2px; margin-top: 4px; }
.nb-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1.5fr) minmax(0, 1fr) auto;
  align-items: center; gap: 8px 14px;
  padding: 10px 10px 10px 4px; border-radius: 12px;
}
.nb-row.is-main { background: var(--neige-2); }
.nb-rank {
  font-family: var(--f-mono); font-size: 12px; color: var(--granit);
  text-align: right;
}
.nb-dom {
  font-family: var(--f-mono); font-size: 13.5px; font-weight: 500;
  min-width: 0; overflow-wrap: anywhere;
}
.nb-row.is-main .nb-dom { font-weight: 600; }
.nb-dom small {
  display: block; font-family: var(--f-sans); font-weight: 400;
  font-size: 12px; color: var(--granit);
}
.nb-bar { height: 9px; border-radius: var(--r-pill); background: var(--rail); }
.nb-bar > span {
  display: block; height: 100%; width: 0; border-radius: var(--r-pill);
  background: var(--pierre-2);
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.nb-row.is-main .nb-bar > span { background: var(--c1); }
.nb-share {
  font-family: var(--f-mono); font-size: 13px; white-space: nowrap;
  min-width: 52px; text-align: right;
}

.nb-themes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.nb-themes .chip .n { font-family: var(--f-mono); opacity: 0.7; margin-left: 6px; }

.nb-gap { margin-top: 4px; }
.nb-gap h4, .wiki-col h4, .nb-themes-wrap h4 {
  margin: 0 0 8px; font-size: 13px; font-family: var(--f-mono);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--granit);
  font-weight: 500;
}
.nb-gap ol { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 6px; }
.nb-gap li {
  display: flex; align-items: baseline; gap: 10px; justify-content: space-between;
  font-size: 14px; border-bottom: 1px dotted var(--pierre); padding-bottom: 6px;
}
.nb-gap li:last-child { border-bottom: none; }
.nb-gap .n { font-family: var(--f-mono); font-size: 12.5px; color: var(--granit); }

/* ===================== Wikipédia & Wikidata ===================== */
.wiki-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px 32px; margin-top: 4px;
}
.wiki-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.wiki-facts { margin: 0; display: grid; gap: 7px; }
.wiki-facts > div {
  display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 4px 14px;
  border-bottom: 1px dotted var(--pierre); padding-bottom: 7px;
}
.wiki-facts > div:last-child { border-bottom: none; }
.wiki-facts dt {
  font-family: var(--f-mono); font-size: 12px; color: var(--granit);
  letter-spacing: 0.02em;
}
.wiki-facts dd { margin: 0; font-size: 14.5px; }

.wiki-cats { display: flex; flex-wrap: wrap; gap: 7px; }
.wiki-cats .chip { background: var(--c2-tint); }
.wiki-cats .chip .n { font-family: var(--f-mono); opacity: 0.7; margin-left: 6px; }

.wiki-cites { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; }
.wiki-cites li { font-size: 14px; display: flex; gap: 8px; align-items: baseline; }
.wiki-cites .lang {
  font-family: var(--f-mono); font-size: 10.5px; color: var(--granit);
  border: 1px solid var(--pierre); border-radius: 4px; padding: 0 4px;
  flex-shrink: 0; text-transform: uppercase;
}
.wiki-links { display: flex; flex-wrap: wrap; gap: 8px; }
.wiki-links a {
  font-family: var(--f-mono); font-size: 12px; text-decoration: none;
  border: 1px solid var(--pierre); border-radius: var(--r-pill);
  padding: 4px 12px; color: var(--granit);
}
.wiki-links a:hover { border-color: var(--sapin); color: var(--sapin); }

/* ===================== Archives du Web ===================== */
.wb-timeline {
  display: grid; gap: 20px; margin-top: 4px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.wb-snap {
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
  border: var(--hair) solid var(--pierre); border-radius: var(--r-card-sm);
  background: var(--neige); padding: 14px;
}
.wb-snap.has-shift { border-color: var(--c3); }
.wb-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.wb-when { font-family: var(--f-serif); font-size: 17px; letter-spacing: -0.01em; }
.wb-date { font-family: var(--f-mono); font-size: 11.5px; color: var(--granit); }

.wb-actions { margin: 4px 0 2px; }

/* Aperçu : la page archivée elle-même, réduite. Aucun service de capture
   d'écran, donc aucun coût — l'Internet Archive sert déjà la page. Il s'ouvre
   au clic (cf. insights.js) : l'archive renvoie parfois du vide, et quatre
   cadres blancs feraient passer un bloc juste pour un bloc cassé. */
.wb-frame {
  position: relative; overflow: hidden; border-radius: 10px;
  background: var(--rail); border: 1px solid var(--pierre);
  aspect-ratio: 4 / 3;
  /* Sert d'unité de référence à l'échelle de l'aperçu, juste en dessous. */
  container-type: inline-size;
}
.wb-frame.is-idle {
  display: flex; align-items: center; justify-content: center;
  background: var(--neige-2);
}
.wb-show {
  font-family: var(--f-sans); font-size: 13px; font-weight: 600;
  color: var(--sapin); background: var(--neige);
  border: var(--hair) solid var(--pierre); border-radius: var(--r-pill);
  padding: 9px 18px; cursor: pointer; min-height: 44px;
}
.wb-show:hover { border-color: var(--sapin); background: #fff; }
/* Une page de 1280 px rendue dans une vignette de quelques centaines. L'échelle
   se calcule en CSS (`100cqw` = largeur de la vignette) et non en JavaScript :
   elle suit alors toute seule le redimensionnement de la fenêtre et le passage
   en colonne unique, sans observateur à tenir à jour. Le `scale` fixe sert de
   repli aux navigateurs sans unités de conteneur. */
.wb-frame iframe {
  position: absolute; top: 0; left: 0;
  width: 1280px; height: 960px;
  transform: scale(0.25);
  transform-origin: 0 0; border: 0; background: #fff;
  pointer-events: none;                 /* l'aperçu ne capte pas le défilement */
}
/* `/ 1280px` et non `/ 1280` : diviser une longueur par un nombre donne une
   longueur, que `scale()` refuse ; la diviser par une longueur donne le ratio
   sans unité attendu. Le `@supports` teste la déclaration entière, seule façon
   de vérifier que le navigateur accepte bien ce calcul. */
@supports (transform: scale(calc(100cqw / 1280px))) {
  .wb-frame iframe { transform: scale(calc(100cqw / 1280px)); }
}
.wb-frame .wb-open {
  position: absolute; inset: auto 8px 8px auto;
  font-family: var(--f-mono); font-size: 11px; text-decoration: none;
  background: var(--sapin); color: var(--neige);
  border-radius: var(--r-pill); padding: 4px 10px;
}
.wb-frame .wb-open:hover { background: var(--sapin-hover); color: var(--neige); }
.wb-frame.is-empty {
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 16px; background: var(--neige-2);
}
.wb-frame.is-empty p {
  margin: 0 0 30px; font-size: 12.5px; color: var(--granit); line-height: 1.4;
}

.wb-title { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.35; }
.wb-h1 { margin: 0; font-size: 12.5px; color: var(--granit); line-height: 1.4; }
.wb-terms { display: flex; flex-wrap: wrap; gap: 5px; }
.wb-terms span {
  font-family: var(--f-mono); font-size: 11px; background: var(--rail);
  border-radius: var(--r-pill); padding: 2px 8px;
}
.wb-shift {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--sapin);
  background: var(--c3-tint); border-radius: var(--r-pill); padding: 3px 11px;
  align-self: flex-start;
}

/* ===================== Mobile ===================== */
@media (max-width: 900px) {
  .wiki-grid { grid-template-columns: 1fr; }
  .wiki-facts > div { grid-template-columns: 120px minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .upd-row { grid-template-columns: minmax(0, 1fr) auto; }
  .upd-move { grid-column: 1 / -1; }
  .nb-row { grid-template-columns: 20px minmax(0, 1fr) auto; }
  .nb-bar { grid-column: 2 / -1; }
  .wb-timeline { grid-template-columns: 1fr; }
}

/* ===================== Profil de liens ===================== */
.lp-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px 32px; margin-top: 4px;
}
.lp-top h4, .lp-themes h4 {
  margin: 0 0 8px; font-size: 13px; font-family: var(--f-mono);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--granit);
  font-weight: 500;
}
.lp-top ol {
  margin: 0; padding-left: 0; list-style: none; counter-reset: lp;
  display: grid; gap: 4px;
}
.lp-top li {
  display: flex; align-items: baseline; gap: 10px; counter-increment: lp;
  border-bottom: 1px dotted var(--pierre); padding-bottom: 5px; font-size: 14px;
}
.lp-top li:last-child { border-bottom: none; }
.lp-top li::before {
  content: counter(lp); font-family: var(--f-mono); font-size: 11.5px;
  color: var(--granit); min-width: 16px; text-align: right; flex-shrink: 0;
}
.lp-dom { font-family: var(--f-mono); font-size: 13.5px; flex: 1; min-width: 0; }
.lp-go { text-decoration: none; color: var(--granit); font-size: 12px; flex-shrink: 0; }
.lp-go:hover { color: var(--sapin); }

.lp-themes { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.lp-theme-head {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 14px; margin-bottom: 4px;
}
.lp-share { font-family: var(--f-mono); font-size: 13px; }
.lp-bar { height: 9px; border-radius: var(--r-pill); background: var(--rail); }
.lp-bar > span {
  display: block; height: 100%; width: 0; border-radius: var(--r-pill);
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Avertissement « profil atypique » : au conditionnel, jamais une accusation —
   d'où le ton visuel d'une note, pas d'une erreur. */
.lp-alert {
  margin: 0; padding: 14px 16px; border-radius: var(--r-card-sm);
  background: var(--c3-tint); border: var(--hair) solid var(--c3);
  font-size: 14.5px; line-height: 1.5; color: var(--sapin);
}
.lp-alert::before { content: "⚠️ "; }

/* Audit complet : sections Ancres et Pages sous la synthèse. */
.lp-section { margin-top: 22px; padding-top: 18px; border-top: var(--hair) solid var(--pierre); }
.lp-sub { margin: 0 0 6px; font-family: var(--f-serif); font-size: 18px; font-weight: 400; }
.lp-grid-1 { grid-template-columns: 1fr; margin-top: 18px; }
.lp-n { font-family: var(--f-mono); font-size: 12px; color: var(--granit); flex-shrink: 0; }
.lp-list { min-width: 0; }
.lp-list h4 {
  margin: 0 0 8px; font-size: 13px; font-family: var(--f-mono);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--granit); font-weight: 500;
}
.lp-list ol { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 6px; }
.lp-list li {
  display: flex; align-items: baseline; gap: 10px; font-size: 14px;
  border-bottom: 1px dotted var(--pierre); padding-bottom: 6px;
}
.lp-list li > :first-child { flex: 1; min-width: 0; }
.lp-list li:last-child { border-bottom: none; }
.lp-list a { color: inherit; text-decoration: none; font-family: var(--f-mono); font-size: 13px; }
.lp-list a:hover { color: var(--sapin); text-decoration: underline; }
.lp-list .n { font-family: var(--f-mono); font-size: 12.5px; color: var(--granit); flex-shrink: 0; }
.lp-kind {
  flex-shrink: 0; font-size: 11.5px; padding: 1px 8px; border-radius: var(--r-pill);
  background: var(--rail); color: var(--granit); max-width: 40%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lp-kind.k-topic { background: var(--c1-tint); color: var(--sapin); }
.lp-kind.k-spam { background: var(--c3-tint); color: var(--sapin); }

@media (max-width: 900px) {
  .lp-grid { grid-template-columns: 1fr; }
}

/* ===================== Entités citées (analyse approfondie) ===================== */
.ent-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  margin: 6px 0 4px;
}
.ent-actions .btn { min-height: 44px; }
.ent-actions .muted { font-family: var(--f-mono); font-size: 13px; color: var(--granit); }

.ent-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px;
  font-size: 13px; color: var(--granit); margin: 0;
}
.ent-legend .mono { font-family: var(--f-mono); }
.ent-sw {
  display: inline-block; width: 12px; height: 12px; border-radius: 3px;
  background: var(--c3-tint); margin-right: 3px;
}

.ent-groups {
  display: grid; gap: 18px 24px; margin-top: 4px;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
}
.ent-group h4 {
  margin: 0 0 8px; font-family: var(--f-mono); font-size: 12px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--granit);
}
.ent-group h4 .muted { opacity: 0.7; margin-left: 4px; }
.ent-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* Une entité : nom en Figtree, nombre de pages en mono. Teinte Ocre quand elle
   manque aux requêtes — c'est l'information du bloc, pas une alerte. */
.ent {
  display: inline-flex; align-items: baseline; gap: 7px; max-width: 100%;
  padding: 5px 12px; border-radius: var(--r-pill);
  background: var(--rail); color: var(--sapin); text-decoration: none;
  font-size: 14px; line-height: 1.3;
  transition: background 0.15s ease;
}
.ent:hover { background: var(--pierre); }
.ent.is-gap { background: var(--c3-tint); }
.ent.is-gap:hover { background: var(--c3); }
.ent-name { overflow-wrap: anywhere; }
.ent-p { font-family: var(--f-mono); font-size: 11.5px; color: var(--granit); white-space: nowrap; }
.ent-alias { font-family: var(--f-mono); font-size: 11.5px; color: var(--granit); }


/* ===================== Visibilité dans les IA ===================== */
.card.ai .lp-list { margin-top: 18px; }
.ai-q { padding: 14px 0; border-bottom: 1px dotted var(--pierre); }
.ai-q:last-child { border-bottom: none; }
.ai-q-text { margin: 0; font-size: 15px; line-height: 1.5; }
.ai-q-basis { margin: 4px 0 0; font-family: var(--f-mono); font-size: 12px; color: var(--granit); }
.ai-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ai-stat {
  font-size: 12.5px; padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--rail); color: var(--granit);
}
.ai-stat b { color: var(--sapin); font-weight: 600; }
.ai-stat.is-cited { background: var(--c1-tint); }
.ai-stat.is-named { background: var(--c3-tint); }
.ai-details { margin-top: 10px; }
.ai-details summary { cursor: pointer; font-size: 13.5px; color: var(--sapin); }
.ai-ans { margin-top: 12px; padding-left: 12px; border-left: 2px solid var(--pierre); min-width: 0; }
.ai-ans h5 { margin: 0 0 4px; font-size: 13px; font-family: var(--f-mono); font-weight: 500; color: var(--granit); }
.ai-ans p { margin: 0 0 6px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.ai-flag {
  font-family: var(--f-sans, inherit); font-size: 11.5px; padding: 1px 7px;
  border-radius: var(--r-pill); background: var(--c1-tint); color: var(--sapin);
}
.ai-flag.soft { background: var(--c3-tint); }
.ai-srcs { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; }
.ai-src {
  font-family: var(--f-mono); font-size: 11.5px; padding: 1px 7px; border-radius: var(--r-pill);
  background: var(--rail); color: var(--granit); text-decoration: none; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-src.is-target { background: var(--c1-tint); color: var(--sapin); font-weight: 600; }
.ai-queries { font-size: 12.5px !important; color: var(--granit); }
