/* =====================================================================
 * Semtopic — blocs Massifs (carte thématique), Sentiers croisés
 * (cannibalisation), Balise (marque), Boussole (intentions),
 * Empreinte (signature lexicale), Territoire (carte)
 * Complète styles.css (DA Nature) : mêmes jetons, mêmes cartes.
 * ===================================================================== */

.result-duo {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px;
  align-items: start;
}

/* ---------- Chargement ---------- */
.kw-loading {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0;
  font-size: 15px; color: var(--granit); padding: 8px 0 4px;
}
.kw-loading small {
  flex-basis: 100%; padding-left: 22px;
  font-family: var(--f-mono); font-size: 12px; color: var(--placeholder);
}

.sample-note {
  margin: 8px 0 0; font-family: var(--f-mono); font-size: 13px; color: var(--granit);
}

.kw-read {
  margin: 0; font-size: 15px; line-height: 1.5; color: #3f5446; text-wrap: pretty;
}
.kw-foot {
  margin: 14px 0 0; font-family: var(--f-mono); font-size: 12px; color: var(--granit);
  line-height: 1.5;
}
.mini-pos {
  flex-shrink: 0;
  font-family: var(--f-mono); font-size: 12px; font-weight: 600; color: var(--sapin);
  background: var(--rail); border-radius: var(--r-pill); padding: 1px 8px;
}

/* ---------- Balise (part de marque) ---------- */
.brand-card { display: flex; flex-direction: column; }
.brand-card #brandBody { display: flex; flex-direction: column; gap: 16px; }
.brand-hero { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.brand-num {
  font-family: var(--f-serif); font-size: clamp(56px, 7vw, 88px);
  letter-spacing: -0.04em; line-height: 0.9;
}
.brand-sub { font-size: 15px; line-height: 1.35; color: #3f5446; }

.split-bar {
  height: 14px; border-radius: var(--r-pill); background: var(--c1-tint);
  overflow: hidden;
}
.split-brand {
  display: block; height: 100%; width: 0; background: var(--sapin);
  border-radius: var(--r-pill) 0 0 var(--r-pill);
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.split-legend {
  display: flex; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap;
  font-size: 14px; color: var(--granit);
}
.split-legend b { color: var(--sapin); font-family: var(--f-mono); font-weight: 600; }
.split-legend .sw {
  display: inline-block; width: 12px; height: 12px; border-radius: 3px;
  margin-right: 8px; vertical-align: -1px;
}
.sw-brand { background: var(--sapin); }
.sw-generic { background: var(--c1-tint); }

.brand-lists {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  border-top: var(--hair) dashed var(--pierre-2); padding-top: 16px;
}
.brand-lists h4 {
  margin: 0 0 8px; font-family: var(--f-mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--granit);
}
.brand-lists ol, .geo-tip ul { list-style: none; margin: 0; padding: 0; }
.brand-lists li, .geo-tip li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: 14px; padding: 4px 0; min-width: 0;
}

/* ---------- Boussole (intentions) ---------- */
.intent-row {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 0; border-top: var(--hair) dashed var(--pierre-2);
  animation: popIn 0.4s both; animation-delay: calc(var(--i, 0) * 40ms);
}
.intent-row:first-child { border-top: 0; padding-top: 0; }
.intent-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.intent-name { font-size: 17px; font-weight: 700; }
.intent-name small {
  display: block; font-size: 13px; font-weight: 400; color: var(--granit);
}
.intent-share { font-family: var(--f-serif); font-size: 22px; white-space: nowrap; }
.intent-bar { height: 10px; border-radius: var(--r-pill); background: var(--rail); overflow: hidden; }
.intent-bar > span {
  display: block; height: 100%; width: 0; border-radius: var(--r-pill);
  transition: width 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.intent-info  { background: var(--c2); }
.intent-comm  { background: var(--c3); }
.intent-trans { background: var(--c1); }
.intent-nav   { background: var(--c5); }
.intent-local { background: var(--c4); }
.intent-meta { font-family: var(--f-mono); font-size: 12px; color: var(--granit); }

/* ---------- Territoire (carte) ---------- */
.geo-grid {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, 1fr);
  gap: 32px; align-items: start;
}
.geo-map-wrap { position: relative; }
.geo-map { display: block; width: 100%; height: auto; overflow: visible; }
.geo-map .dep {
  fill: var(--neige-2); stroke: var(--pierre-2); stroke-width: 1;
  stroke-linejoin: round;
}
.geo-map .dep.has { fill: var(--c1-tint); }
.geo-map-wrap.empty .geo-map { opacity: 0.55; }

.geo-map .dot {
  stroke: var(--neige); stroke-width: 1.6; cursor: pointer;
  transition: stroke 0.15s ease, stroke-width 0.15s ease;
}
.geo-map .dot:focus { outline: none; }
.geo-map .dot.hl, .geo-map .dot:focus-visible { stroke: var(--sapin); stroke-width: 3.5; }

/* Densité = qualité de la meilleure position */
.gt1 { fill: var(--sapin); background: var(--sapin); }
.gt2 { fill: var(--c1); background: var(--c1); }
.gt3 { fill: oklch(0.76 0.08 145); background: oklch(0.76 0.08 145); }
.gt4 { fill: var(--pierre-2); background: var(--pierre-2); }
.geo-map .dot.gt1 { fill-opacity: 0.92; }
.geo-map .dot.gt2 { fill-opacity: 0.88; }
.geo-map .dot.gt3 { fill-opacity: 0.85; }
.geo-map .dot.gt4 { fill-opacity: 0.8; }

.geo-empty {
  position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%);
  width: min(360px, 86%); margin: 0; text-align: center;
  background: var(--neige); border: var(--hair) solid var(--pierre);
  border-radius: var(--r-card-sm); padding: 16px 20px;
  font-size: 15px; line-height: 1.45; color: var(--sapin);
}

.geo-tip {
  position: absolute; z-index: 5; width: max-content; max-width: min(320px, 90%);
  background: var(--neige); border: var(--hair) solid var(--sapin);
  border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 16px 30px -18px rgba(29, 51, 39, 0.55);
  font-size: 14px; pointer-events: none;
}
.geo-tip .muted { font-size: 13px; }
.geo-tip .tip-meta {
  display: block; margin: 4px 0 6px;
  font-family: var(--f-mono); font-size: 12px; color: var(--granit);
}
.geo-tip ul { border-top: 1px dashed var(--pierre); padding-top: 4px; }

.geo-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.geo-stats, .stat-tiles {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
}
.stat-tiles-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.geo-stats > div, .stat-tiles > div {
  background: var(--neige-2); border-radius: 16px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.geo-stats b, .stat-tiles b {
  font-family: var(--f-serif); font-weight: 400; font-size: 28px; line-height: 1.05;
}
.geo-stats span, .stat-tiles span { font-size: 13px; color: var(--granit); line-height: 1.3; }

.geo-legend {
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center;
  font-size: 13px; color: var(--granit);
}
.geo-legend span { display: inline-flex; align-items: center; gap: 6px; }
.geo-legend .lg-title {
  flex-basis: 100%; font-family: var(--f-mono); font-size: 12px;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.geo-legend .lg-size { flex-basis: 100%; font-size: 12px; }
.dot-sw {
  display: inline-block; flex-shrink: 0; width: 12px; height: 12px; border-radius: 50%;
}

.geo-list { list-style: none; margin: 0; padding: 0; }
.geo-list li {
  display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto;
  align-items: center; gap: 10px;
  padding: 8px 0; border-top: 1px dashed var(--pierre);
  font-size: 15px; cursor: default;
}
.geo-list li:first-child { border-top: 0; }
.geo-list li:hover .geo-city { text-decoration: underline; text-underline-offset: 3px; }
.geo-city { font-weight: 600; }
.geo-city small { font-family: var(--f-mono); font-size: 12px; font-weight: 400; color: var(--granit); }
.geo-n { font-family: var(--f-mono); font-size: 13px; color: var(--granit); }

/* ---------- Barre de progression du relevé ---------- */
.kw-busy .kw-table, .kw-busy .kw-legend, .kw-busy .tabs { display: none; }

.kw-progress { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 2px; }
.kwp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.kwp-label { font-size: 16px; font-weight: 600; }
.kwp-time {
  font-family: var(--f-mono); font-size: 13px; color: var(--granit);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.kwp-rail { height: 10px; border-radius: var(--r-pill); background: var(--rail); overflow: hidden; }
.kwp-fill {
  display: block; height: 100%; width: 0; background: var(--c1);
  border-radius: var(--r-pill); transition: width 0.3s linear;
}
.kwp-hint { margin: 0; font-size: 14px; color: var(--granit); line-height: 1.45; text-wrap: pretty; }

/* Au-delà de la durée estimée, la barre cesse d'être une jauge : elle pulse
   pour signaler que ça travaille encore, sans prétendre mesurer quoi que ce soit. */
.kwp-rail.is-overrun .kwp-fill { animation: kwpPulse 1.4s ease-in-out infinite; }
@keyframes kwpPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .kwp-rail.is-overrun .kwp-fill { animation: none; opacity: 0.7; }
}

/* Bouton d'action glissé dans une ligne de texte */
.btn-inline {
  padding: 4px 14px; font-size: 13px; margin-left: 4px;
  vertical-align: baseline;
}

/* ---------- Pastilles partagées ---------- */
.chip {
  display: inline-flex; align-items: center;
  font-family: var(--f-mono); font-size: 12px; font-weight: 500;
  padding: 3px 12px; border-radius: var(--r-pill);
  background: var(--rail); color: var(--sapin); white-space: nowrap;
}
.chip-plain { background: transparent; border: 1px solid var(--pierre); color: var(--granit); }
.chip.v-haut   { background: var(--c1-tint); }
.chip.v-solide { background: var(--c2-tint); }
.chip.v-moyen  { background: var(--c3-tint); }
.chip.v-bas    { background: var(--rail); color: var(--granit); }

/* ---------- Massifs (carte thématique) ---------- */
#mapBody, #cannibalBody, #signatureBody {
  display: flex; flex-direction: column; gap: 16px;
}
.massifs {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
}
.massif-focus .kw-url, .canni-urls .kw-url {
  display: inline; max-width: none; overflow: visible;
  white-space: normal; overflow-wrap: anywhere;
}
.massif {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--neige-2); border-radius: var(--r-card-sm); padding: 18px 20px;
  animation: popIn 0.4s both; animation-delay: calc(var(--i, 0) * 40ms);
}
.massif.is-other { background: transparent; border: var(--hair) dashed var(--pierre); }
.massif-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; }
.massif-rank { font-family: var(--f-serif); font-size: 24px; line-height: 1; }
.massif-id { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.massif-label { margin: 0; font-family: var(--f-serif); font-weight: 400; font-size: 21px; line-height: 1.15; }
.massif-meta { font-family: var(--f-mono); font-size: 12px; color: var(--granit); line-height: 1.45; }
.massif-alt { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.alt-num { font-family: var(--f-serif); font-size: 34px; line-height: 0.95; }
.alt-lbl {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--granit);
}
.massif-gauge { height: 8px; border-radius: var(--r-pill); background: var(--rail); overflow: hidden; }
.massif-gauge .fill {
  display: block; height: 100%; width: 0; border-radius: var(--r-pill);
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.massif-foot { display: flex; flex-wrap: wrap; gap: 8px; }
.massif-kws { list-style: none; margin: 0; padding: 0; }
.massif-kws li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: 14px; padding: 4px 0; border-top: 1px dashed var(--pierre); min-width: 0;
}
.massif-kws li:first-child { border-top: 0; }
.massif-focus { margin: 0; font-size: 13px; color: var(--granit); line-height: 1.45; }

/* ---------- Sentiers croisés (cannibalisation) ---------- */
.canni-clear { display: flex; align-items: flex-start; gap: 14px; }
.canni-ok {
  flex-shrink: 0; width: 34px; height: 30px; background: var(--c1-tint);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.canni-legend {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  font-family: var(--f-mono); font-size: 12px; color: var(--granit);
}
.canni-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sev-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sev-sw.sev-haute { background: var(--c3); }
.sev-sw.sev-moyenne { background: var(--c4); }
.sev-sw.sev-faible { background: var(--pierre-2); }

.canni-list { display: flex; flex-direction: column; gap: 12px; }
.canni-case {
  border-left: 3px solid var(--pierre-2); padding: 2px 0 2px 16px;
  animation: popIn 0.4s both; animation-delay: calc(var(--i, 0) * 30ms);
}
.canni-case.sev-haute { border-left-color: var(--c3); }
.canni-case.sev-moyenne { border-left-color: var(--c4); }
.canni-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; flex-wrap: wrap;
}
.canni-label { font-size: 17px; font-weight: 700; min-width: 0; }
.canni-tags { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.canni-case.sev-haute .sev-chip { background: var(--c3-tint); }
.canni-case.sev-moyenne .sev-chip { background: var(--c4-tint); }
.canni-vol { font-family: var(--f-mono); font-size: 12px; color: var(--granit); }
.canni-variants { margin: 4px 0 0; font-size: 13px; color: var(--granit); line-height: 1.45; }
.canni-urls { list-style: none; margin: 8px 0 0; padding: 0; }
.canni-urls li {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px;
  align-items: baseline; padding: 3px 0;
}
.canni-kw { grid-column: 2; font-size: 13px; color: var(--granit); }

/* ---------- Empreinte (signature lexicale) ---------- */
.sig-grid {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr);
  gap: 32px; align-items: start;
}
.sig-cloud-wrap { display: flex; flex-direction: column; gap: 16px; }
.sig-cloud { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: baseline; }
.sig-term {
  display: inline-block; padding: 4px 12px; border-radius: var(--r-pill);
  line-height: 1.25; color: var(--sapin);
  animation: popIn 0.4s both;
}
.sig-term.st1 { background: var(--c1-tint); }
.sig-term.st2 { background: var(--c2-tint); }
.sig-term.st3 { background: var(--c3-tint); }
.sig-term.st4 { background: var(--rail); color: var(--granit); }
.sig-term.carrier {
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px;
  font-weight: 600;
}
.dot-sw.st1 { background: var(--c1-tint); }
.dot-sw.st2 { background: var(--c2-tint); }
.dot-sw.st3 { background: var(--c3-tint); }
.dot-sw.st4 { background: var(--rail); }
.sig-legend {
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center;
  font-size: 13px; color: var(--granit);
}
.sig-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sig-legend .lg-title {
  flex-basis: 100%; font-family: var(--f-mono); font-size: 12px;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.sig-legend .lg-size { flex-basis: 100%; font-size: 12px; display: block; }
.carrier-mark {
  font-weight: 600; color: var(--sapin);
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 2px;
}

.sig-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.quals h4 {
  margin: 0 0 8px; font-family: var(--f-mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--granit);
}
.qual-row {
  display: flex; flex-direction: column; gap: 5px;
  padding: 10px 0; border-top: 1px dashed var(--pierre);
  animation: popIn 0.4s both; animation-delay: calc(var(--i, 0) * 40ms);
}
.qual-row:first-of-type { border-top: 0; }
.qual-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.qual-name { font-size: 15px; font-weight: 600; }
.qual-name small { display: block; font-size: 12px; font-weight: 400; color: var(--granit); }
.qual-share { font-family: var(--f-serif); font-size: 19px; white-space: nowrap; }
.qual-bar { height: 8px; border-radius: var(--r-pill); background: var(--rail); overflow: hidden; }
.qual-bar > span {
  display: block; height: 100%; width: 0; background: var(--c1); border-radius: var(--r-pill);
  transition: width 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.qual-terms { font-family: var(--f-mono); font-size: 12px; color: var(--granit); line-height: 1.5; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .result-duo { grid-template-columns: minmax(0, 1fr); }
  .geo-grid, .sig-grid { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 720px) {
  .brand-lists { grid-template-columns: 1fr; }
  .geo-stats b, .stat-tiles b { font-size: 22px; }
  .geo-stats > div, .stat-tiles > div { padding: 10px; }
  .brand-num { font-size: 56px; }
  .massifs { grid-template-columns: 1fr; }
  .massif { padding: 16px; }
  .alt-num { font-size: 28px; }
  .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Relance du relevé (échec Haloscan sur un très gros domaine) */
.kw-retry { padding: 8px 0 4px; }
