/* --- Tokens: liegen bewusst auf .kh-lk, nicht auf :root, damit nichts
       in den Rest der Seite ausblutet. Farben haengen an den Elementor
       Global Colors, die Hexwerte sind nur Fallback. ------------------- */
.kh-lk{
  --kh-konfektion: var(--e-global-color-primary,   #B51836);  /* Konfektion – rot */
  --kh-faser:      var(--e-global-color-secondary, #8DA826);  /* Rohstoff Faser – gruen */
  --kh-farbstoffe: #93E0C5;                                   /* Farb- und Hilfsstoffe – blau */
  --kh-rohgewebe:  var(--e-global-color-accent,    #EDDE76);  /* Rohgewebe / Weberei – gelb */

  --kh-ink:        var(--e-global-color-text, #2e2e2e);
  --kh-heading:    #333333;
  --kh-muted:      #969696;
  --kh-card:       #ffffff;
  --kh-line:       #e3e3e3;
  --kh-line-soft:  #f3f3f3;
  --kh-grey-100:   #f3f3f3;
  --kh-grey-200:   #e3e3e3;
  --kh-grey-650:   #737171;

  /* Schrift: erbt von der Seite. Fuer die Design-Schriften stattdessen
     z. B. "DM Sans" bzw. "Open Sans" eintragen. */
  --kh-font-display: inherit;
  --kh-font-body: inherit;

  font-family: var(--kh-font-body);
  color: var(--kh-ink);
}
.kh-lk *{ box-sizing: border-box; }

/* Elementor-Kit stylt alle <button> global (roter Hintergrund, 10px Radius,
   Schlagschatten, 15px/30px Padding). Hier komplett zuruecksetzen; die
   Komponenten-Regeln darunter sind spezifischer und greifen danach. */
.kh-lk button,
.kh-lk button:hover,
.kh-lk button:focus,
.kh-lk button:active{
  -webkit-appearance:none; appearance:none;
  margin:0; padding:0; border:0; border-radius:0;
  background:transparent !important; background-image:none !important;
  box-shadow:none !important; text-shadow:none;
  font:inherit; color:inherit; letter-spacing:inherit; line-height:inherit;
  text-transform:none; text-decoration:none; min-height:0; min-width:0;
}

/* Elementor: das HTML-Widget ist ein Flex-Item ohne feste Breite. Ein SVG
   ohne Breitenangabe faellt sonst auf 300px zurueck und das Widget mit ihm. */
.elementor-widget-html:has(.kh-lk),
.elementor-widget-shortcode:has(.kh-lk){ width:100%; flex:1 1 100%; }
.elementor-widget-html:has(.kh-lk) .elementor-widget-container,
.elementor-widget-shortcode:has(.kh-lk) .elementor-widget-container,
.elementor-widget-shortcode:has(.kh-lk) .elementor-shortcode{ width:100%; }

/* Karte und Liste liegen in EINER Box. Desktop/Laptop: Liste als hohe
   Spalte rechts. Tablet/Mobil: Liste als breiter Streifen unter der Karte.
   Die Hoehe der Box gibt allein die Karte vor (Seitenverhaeltnis, aber nie
   niedriger als die Liste braucht); die Liste zieht sich auf dieselbe Hoehe. */
.kh-layout{ display:grid; grid-template-columns:minmax(0,1fr) 360px; gap:0; align-items:stretch;
  background:var(--kh-card); border-radius:22px; box-shadow:0 4px 4.6px rgba(0,0,0,.25); overflow:hidden; }
.kh-mapcard{ position:relative; aspect-ratio:860/360; min-height:480px; width:100%; min-width:0; overflow:hidden; }
.kh-lk .kh-map{ display:block; position:absolute; inset:0; width:100%; height:100%; }

.kh-legend{ display:flex; gap:8px; padding:0; margin:0 0 16px; list-style:none; flex-wrap:wrap; }
.kh-lk .kh-chip{ display:flex; align-items:center; gap:8px; padding:8px 14px; border-radius:999px;
  border:1px solid var(--kh-line); background:var(--kh-card) !important; font-family:var(--kh-font-body);
  font-weight:700; font-size:14px; line-height:1.5; letter-spacing:.03em; color:var(--kh-ink);
  cursor:pointer; transition:background-color .18s ease, border-color .18s ease, color .18s ease; }
.kh-lk .kh-chip:hover, .kh-lk .kh-chip:focus, .kh-lk .kh-chip:active{
  padding:8px 14px; border-radius:999px; border:1px solid var(--kh-muted);
  font-family:var(--kh-font-body); font-weight:700; font-size:14px; font-style:normal;
  line-height:1.5; letter-spacing:.03em; text-transform:none; }
.kh-lk .kh-chip[aria-pressed="true"]{ color:#fff; border-color:transparent; }
.kh-lk .kh-chip .kh-dot{ width:10px; height:10px; border-radius:50%; flex:none; }
.kh-lk .kh-chip[aria-pressed="true"] .kh-dot{ background:#fff !important; }

.kh-views{ position:absolute; top:16px; right:16px; display:flex; background:var(--kh-grey-100);
  border-radius:999px; padding:3px; z-index:4; }
.kh-lk .kh-views button{ border:0; background:none; padding:6px 14px; border-radius:999px;
  font-family:var(--kh-font-body); font-weight:700; font-size:13px; letter-spacing:.02em;
  color:var(--kh-grey-650); cursor:pointer; transition:background .15s ease, color .15s ease; }
.kh-lk .kh-views button:hover, .kh-lk .kh-views button:focus, .kh-lk .kh-views button:active{
  padding:6px 14px; border-radius:999px; border:0;
  font-family:var(--kh-font-body); font-weight:700; font-size:13px; font-style:normal;
  letter-spacing:.02em; text-transform:none; color:var(--kh-ink); }
.kh-lk .kh-views button[aria-pressed="true"]{ background:#fff !important; color:var(--kh-ink);
  box-shadow:0 1px 2px rgba(0,0,0,.15) !important; }

.kh-panel{ display:flex; flex-direction:column; height:0; min-height:100%; background:var(--kh-card);
  border-left:1px solid var(--kh-line); padding:24px; overflow:hidden; }
.kh-panel h3{ font-family:var(--kh-font-display); font-weight:700; font-size:18px; line-height:1.3;
  letter-spacing:.01em; color:var(--kh-heading); margin:0 0 4px; }
.kh-panel .kh-role{ display:flex; align-items:center; gap:8px; font-weight:700; font-size:12px;
  letter-spacing:.06em; text-transform:uppercase; color:var(--kh-ink); margin:0 0 14px; }
.kh-panel .kh-sw{ width:8px; height:8px; border-radius:50%; flex:none; }
.kh-panel .kh-role + *{ margin-top:0; }
.kh-panel p{ font-weight:400; font-size:14px; line-height:24px; letter-spacing:.02em;
  color:var(--kh-ink); margin:0 0 18px; }
.kh-nodelist{ list-style:none; margin:6px 0 0; padding:0;
  flex:1 1 auto; min-height:0; overflow-y:auto; }
.kh-nodelist li{ border:0; }
.kh-lk .kh-nodelist button{ width:100%; display:flex; align-items:center; gap:10px; padding:6px 4px;
  background:none; border:0; text-align:left; cursor:pointer; font-family:var(--kh-font-body);
  font-weight:600; font-size:14px; letter-spacing:.03em; color:var(--kh-ink);
  transition:color .15s ease, opacity .15s ease; }
.kh-lk .kh-nodelist button:hover, .kh-lk .kh-nodelist button:focus,
.kh-lk .kh-nodelist button:active, .kh-lk .kh-nodelist button[aria-current="true"]{
  padding:6px 4px; border:0; border-radius:0;
  font-family:var(--kh-font-body); font-weight:600; font-size:14px; font-style:normal;
  letter-spacing:.03em; text-transform:none; color:var(--kh-konfektion); }
.kh-lk .kh-nodelist button[data-dim="true"]{ opacity:.32; }
.kh-lk .kh-nodelist .kh-sw{ width:8px; height:8px; border-radius:50%; flex:none; }
.kh-lk .kh-nodelist .kh-cty{ flex:1 1 auto; min-width:auto; }
.kh-lk .kh-nodelist .kh-cnt{ flex:none; white-space:nowrap; text-align:right; font-weight:400; font-size:12px; color:var(--kh-muted); }

.kh-tip{ position:absolute; pointer-events:none; opacity:0; transform:translate(-50%,-100%);
  background:var(--kh-ink); color:#fff; padding:7px 11px; border-radius:8px; font-weight:600;
  font-size:12.5px; line-height:1.35; letter-spacing:.02em; white-space:nowrap;
  transition:opacity .14s ease; z-index:5; }
.kh-tip b{ display:block; font-weight:700; font-size:13.5px; }
.kh-tip .kh-r{ opacity:.72; font-weight:400; }

.kh-lk .kh-country{ fill:var(--kh-grey-100); stroke:#fff; stroke-width:.7; }
.kh-lk .kh-country.kh-on{ fill:var(--kh-grey-200); }

.kh-node{ cursor:pointer; }
.kh-node .kh-halo{ fill:none; stroke-width:1.4; opacity:0; transition:opacity .2s ease; }
.kh-node.kh-sel .kh-halo{ opacity:.5; }
.kh-node .kh-core{ stroke:#fff; stroke-width:2; }
.kh-node .kh-lbl{ font-family:var(--kh-font-body); font-weight:700; font-size:12.5px;
  letter-spacing:.02em; fill:var(--kh-ink); paint-order:stroke; stroke:var(--kh-card);
  stroke-width:3.5; stroke-linejoin:round; pointer-events:none; transition:opacity .25s ease; }
.kh-node .kh-lbl.kh-hide{ opacity:0; }
.kh-node[data-dim="true"]{ opacity:.2; }
.kh-hubring{ fill:none; stroke:var(--kh-konfektion); stroke-width:1.2; opacity:.35; }
.kh-node.kh-hub .kh-core{ stroke-width:2.5; }

.kh-flow{ fill:none; stroke-width:1.6; stroke-linecap:round; opacity:.85; transition:opacity .25s ease; }
.kh-flow.kh-dim{ opacity:.08; }
.kh-flow.kh-move{ stroke-dasharray:5 7; animation:kh-dash 2.4s linear infinite; }
@keyframes kh-dash{ to{ stroke-dashoffset:-24; } }

/* Stufenfarben zentral: Knoten, Fluesse, Punkte */
.kh-lk [data-stage="faser"]     { --kh-stage: var(--kh-faser); }
.kh-lk [data-stage="rohgewebe"] { --kh-stage: var(--kh-rohgewebe); }
.kh-lk [data-stage="farbstoffe"]{ --kh-stage: var(--kh-farbstoffe); }
.kh-lk [data-stage="konfektion"]{ --kh-stage: var(--kh-konfektion); }
.kh-lk .kh-flow{ stroke: var(--kh-stage); }
.kh-lk .kh-node .kh-core{ fill: var(--kh-stage); }
.kh-lk .kh-node .kh-halo{ stroke: var(--kh-stage); }
.kh-lk .kh-dot, .kh-lk .kh-sw{ background: var(--kh-stage); }
.kh-lk .kh-chip[aria-pressed="true"]{ background: var(--kh-stage) !important; }

.kh-lk :focus-visible{ outline:2px solid var(--kh-konfektion); outline-offset:2px; }

@media (max-width:1024px){
  .kh-layout{ grid-template-columns:1fr; }
  .kh-mapcard{ min-height:0; }
  .kh-panel{ height:auto; min-height:0; border-left:0; border-top:1px solid var(--kh-line); }
  .kh-nodelist{ overflow:visible; columns:2 320px; column-gap:32px; }
  .kh-nodelist li{ break-inside:avoid; }
}
@media (max-width:600px){
  .kh-mapcard{ aspect-ratio:auto; height:50vh; min-height:320px; }
  .kh-panel{ padding:20px; }
  .kh-nodelist{ columns:1; }
  /* Sehr schmale Handys: lange Stufen duerfen umbrechen, Woerter bleiben ganz */
  .kh-lk .kh-nodelist .kh-cnt{ flex:0 1 auto; white-space:normal; }
  .kh-lk .kh-views{ top:10px; right:10px; }
}
@media (prefers-reduced-motion: reduce){
  .kh-lk *{ transition:none !important; animation:none !important; }
}
