/* ==========================================================================
   Dráhy – animované prepojenia medzi uzlami (simoradigital.sk)
   Použitie: <div class="drahy" data-drahy> ... stĺpce .drahy__col s uzlami .drahy__node
   Uzol, z ktorého dráha vychádza, má data-id="x". Cieľ má data-from="x" (aj viac: "x y").
   Čiary a bodky kreslí assets/js/drahy.js. Bez JS zostanú viditeľné uzly bez čiar.
   ========================================================================== */

.drahy {
  --drahy-line: var(--accent);
  --drahy-dot: var(--accent-soft);
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  justify-content: space-between;
  align-items: center;
  gap: clamp(2.5rem, 7vw, 6rem);
}
.drahy__col {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: flex-start;
  gap: var(--sp-2);
  min-width: 0;
}
.drahy__label {
  font-size: var(--step--1);
  color: var(--muted-2);
  margin-bottom: var(--sp-1);
}
.drahy__node {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .45em .95em;
  border-radius: var(--r-full);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  font-size: .88rem; line-height: 1.3;
  white-space: nowrap;
  transition: opacity .35s var(--ease), border-color .25s var(--ease);
}
.drahy__node svg { width: 1.05em; height: 1.05em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.drahy__node--src { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.drahy__node--ai  { background: var(--accent-dim); border-color: rgba(148, 129, 249, .5); }
a.drahy__node { text-decoration: none; }
a.drahy__node:hover, .drahy__node.is-on { border-color: var(--accent-soft); }
a.drahy__node:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 3px; }

.drahy__svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  overflow: visible; pointer-events: none; z-index: 0;
}
.drahy__path {
  fill: none;
  stroke: var(--drahy-line); stroke-opacity: .42; stroke-width: 1.5;
  stroke-dasharray: 4 6;
  transition: stroke-opacity .25s var(--ease), opacity .6s var(--ease);
}
.drahy__dot { fill: var(--drahy-dot); transition: opacity .25s var(--ease); }

/* Postupné objavenie pri scrollovaní (len keď beží JS) */
.drahy--js .drahy__node { opacity: 0; }
.drahy--js .drahy__path, .drahy--js .drahy__dot { opacity: 0; }
.drahy--js.is-in .drahy__node { opacity: 1; transition-delay: calc(var(--i, 0) * 70ms); }
.drahy--js.is-in .drahy__path { opacity: 1; transition-delay: calc(var(--i, 0) * 50ms + 250ms); }
.drahy--js.is-in .drahy__dot { opacity: 1; transition-delay: 1s; }
/* po objavení reaguje zvýraznenie hneď, bez oneskorenia */
.drahy--js.is-done .drahy__node, .drahy--js.is-done .drahy__path, .drahy--js.is-done .drahy__dot { transition-delay: 0s; }

/* Zvýraznenie jednej trasy pri prejdení myšou */
.drahy.is-focus .drahy__node:not(.is-on) { opacity: .35; }
.drahy.is-focus .drahy__path:not(.is-on) { stroke-opacity: .08; }
.drahy.is-focus .drahy__path.is-on { stroke-opacity: .9; }
.drahy.is-focus .drahy__dot:not(.is-on) { opacity: 0; }

@media (prefers-reduced-motion: no-preference) {
  .drahy__path { animation: drahy-dash 1.4s linear infinite; }
}
@keyframes drahy-dash { to { stroke-dashoffset: -20; } }

/* Stĺpce s popisom: popisy v jednej línii hore, uzly vycentrované pod nimi */
.drahy:has(.drahy__label) { align-items: stretch; }
.drahy:has(.drahy__label) .drahy__col { justify-content: flex-start; }
.drahy__col > .drahy__label { margin-bottom: auto; }
.drahy:has(.drahy__label) .drahy__col::after { content: ""; margin-top: auto; }

/* Na mobile sa stĺpce s triedou --stack menia na riadky */
@media (max-width: 639px) {
  .drahy--stack { grid-auto-flow: row; grid-auto-columns: auto; justify-content: stretch; gap: var(--sp-6); }
  .drahy--stack .drahy__col { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; }
  .drahy--stack .drahy__col > .drahy__label { width: 100%; text-align: center; margin-bottom: 0; }
  .drahy--stack .drahy__col::after { content: none; }
}

/* Kompaktný režim na mobile: stĺpce zostanú vedľa seba, skryje sa doplnkový text a ikony */
@media (max-width: 639px) {
  .drahy--compact { gap: 1.5rem; }
  .drahy--compact .drahy__more, .drahy--compact .drahy__node svg { display: none; }
  .drahy--compact .drahy__node { font-size: .8rem; padding: .4em .75em; }
}

/* --- Použitie 1: "Jedno fotenie poslúži všetkému" ------------------------- */
.once .drahy { gap: clamp(1.5rem, 5vw, 3.5rem); }

/* --- Použitie 2: "Ako to beží u mňa" ------------------------------------- */
.system { display: grid; gap: var(--sp-6); }
.system__flow { padding: var(--sp-6) var(--sp-5); border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--border); }
.system__note { font-size: var(--step--1); color: var(--muted-2); }
@media (min-width: 640px) { .system__flow { padding: var(--sp-7) var(--sp-6); } }
