/* Directions Section */
.directions {
    padding: 115px 0;
    background-color: var(--background-color);
    overflow: hidden;
}



.directions__title {
    margin: 0;
    text-align: center;
    font-size: var(--section-title);
    line-height: 1.1;
    font-weight: 700;
    color: var(--text-color);
}

.direction__desc {
    margin: 16px auto 100px;
    text-align: center;
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-color);
    opacity: 0.85;
    max-width: 820px;
}

.directions__map-wrapper {
    position: relative;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

/* Aspect ratio to perfectly match 1000x400 SVG */
.directions__map {
    position: relative;
    width: 100%;
    aspect-ratio: 1200 / 400; /* Fixed to match viewBox 1200x400 */
}

.directions__lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.directions__path {
    stroke: var(--text-color);
    stroke-width: 4;
    stroke-dasharray: 12 12;
    fill: none;
    opacity: 0.15;
}

[data-theme="dark"] .directions__path {
    opacity: 0.3;
}

.directions__flow {
    stroke: var(--primary-color);
    stroke-width: 4;
    /* pathLength=1000, dash segment 150, gap 1000 total cycle length = 1150 */
    stroke-dasharray: 150 1000;
    stroke-dashoffset: 1150;
    fill: none;
    filter: url(#glow);
    opacity: 0.15; /* Subtler background energy */
    stroke-linecap: round;
    animation: dashFlowAnim 4s linear infinite;
}

.directions__flow--2 {
    animation-delay: -1.5s;
}

@keyframes dashFlowAnim {
    0% {
        stroke-dashoffset: 1150; /* Start just before the path */
    }
    100% {
        stroke-dashoffset: 0;    /* End just after the path (Full cycle of 1150) */
    }
}

.directions__flow-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    filter: blur(0.5px); /* Soft focus for tech look */
}

.directions__node {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translate(-50%, -50%);
    z-index: 10;
}

/* Узлы стоят на изломах ломаной, координаты те же, что в viewBox 1200x400.
   Высоты чередуются: 120 и 280 — отсюда и зигзаг. */
/* Golang: x=180, y=120 → left=15%, top=30% */
.directions__node--golang {
    left: 15%;
    top: 30%;
}

/* JavaScript: x=480, y=280 → left=40%, top=70% */
.directions__node--js {
    left: 40%;
    top: 70%;
}

/* AI: x=780, y=120 → left=65%, top=30% */
.directions__node--ai {
    left: 65%;
    top: 30%;
}

/* Стажировка: x=1020, y=280 → left=85%, top=70% */
.directions__node--internship {
    left: 85%;
    top: 70%;
}

/* Подпись точки сведения — вниз-вправо от кружка: узел сидит на нижнем
   изломе, и подпись уходит от линии, а не на неё */
.directions__node--internship .directions__node-content--bottom {
    top: 40px;
    left: 10px;
    white-space: nowrap;
}

.directions__node-dot {
    width: 24px;
    height: 24px;
    background-color: var(--primary-color);
    border-radius: 50%;
    position: relative;
    z-index: 2;
    box-shadow: 0 0 0 6px var(--background-color);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Hover Interaction: Dot pulse */
.directions__node:hover .directions__node-dot {
    transform: scale(1.4);
    box-shadow: 0 0 0 6px var(--background-color), 0 0 25px var(--primary-color);
    background-color: #0000ff;
}

/* Special larger glowing dot for the convergence "Специализация" node */
.directions__node-dot--internship {
    width: 32px;
    height: 32px;
    background-color: var(--primary-color);
    box-shadow: 0 0 0 6px var(--background-color), 0 0 20px var(--primary-color);
    animation: nodePulse 2s ease-in-out infinite;
}

@keyframes nodePulse {
    0%, 100% { box-shadow: 0 0 0 6px var(--background-color), 0 0 15px var(--primary-color); }
    50%       { box-shadow: 0 0 0 8px var(--background-color), 0 0 30px var(--primary-color); }
}

.directions__node-content {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.directions__node-content--top {
    bottom: 34px;
}

.directions__node-content--bottom {
    top: 34px;
}

/* Content movement on hover */
.directions__node:hover .directions__node-content--top {
    transform: translateY(-8px);
}

.directions__node:hover .directions__node-content--bottom {
    transform: translateY(8px);
}

.directions__node-title {
    font-size: 22px;
    /* Своя line-height, а не наследованная от body: подпись позиционирована
       абсолютно и выходит за контент-бокс секции, поэтому её высота не должна
       зависеть от общего --body-s-lh. 1.1 воспроизводит прежнюю фактическую
       высоту строки (24px при 22px шрифта = 1.09) — иначе двухстрочная
       подпись вырастает и её срезает overflow: hidden. */
    line-height: 1.1;
    font-weight: 700;
    color: var(--text-color);
    text-shadow: 0 4px 8px var(--background-color);
    transition: color 0.3s ease;
}

.directions__node:hover .directions__node-title {
    color: var(--primary-color);
}

/* Container for SVG icons */
/* Два знака одним этапом: Python и JavaScript через плюс. */
.directions__icon-pair {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

/* Внутри пары коробка сжимается по знаку: её 90px — это поля вокруг одиночного
   логотипа, а два таких блока рядом разносили бы знаки на шестьдесят пикселей
   пустоты. Расстояние задаёт gap самой пары. */
.directions__icon-pair .directions__icon-box {
    width: auto;
    height: auto;
}

.directions__icon-plus {
    font-size: 30px;
    font-weight: 300;
    line-height: 1;
    color: var(--primary-color);
    opacity: .5;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.directions__node:hover .directions__icon-plus {
    opacity: 1;
    transform: scale(1.2);
}

.directions__icon-box {
    width: 90px;
    height: 90px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.directions__node:hover .directions__icon-box {
    transform: scale(1.15) rotate(-3deg);
    color: #0000ee;
    filter: drop-shadow(0 15px 25px rgba(0, 0, 255, 0.2));
}


.directions__icon-box svg {
    width: 100%;
    height: 100%;
}

.directions__icon-go {
    width: 100%;
    height: 80px;
}

.directions__icon-js,
.directions__icon-py {
    width: 60px;
    height: 60px;
}

.directions__icon-ai {
    width: 60px;
    height: 60px;
}

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 1024px) {
    .directions__node-title {
        font-size: 18px;
    }

    .directions__icon-box {
        width: 70px;
        height: 70px;
    }

    .directions__node-content--top {
        bottom: 28px;
    }

    .directions__node-content--bottom {
        top: 28px;
    }
}

/* Единый мобильный ритм: общий отступ сверху до 900px, как у #results и #roadmap.
   Снизу отступ больше: подпись нижнего узла (Artificial Intelligence)
   позиционирована абсолютно и выходит за контент-бокс, а .directions
   с overflow: hidden её обрезает. Худший случай — полоса 769–900px: там
   подпись ещё 22px (13px включается только с 768px), поэтому вылет
   максимальный. Замерено: при 100px снизу на 769px подпись всё ещё
   выходила на 15px. 128px закрывает всю полосу 360–900 с запасом. */
@media (max-width: 900px) {
    .directions {
        padding: var(--section-pad-y-mobile) 0 128px;
    }
}

/* Пропорциональное уменьшение на планшетах — схема остаётся такой же */
@media (max-width: 768px) {
    .direction__desc {
        font-size: 15px;
        margin-bottom: 70px;
    }

    .directions__node-title {
        font-size: 13px;
    }

    .directions__icon-box {
        width: 50px;
        height: 50px;
    }

    .directions__icon-go {
        height: 44px;
    }

    .directions__icon-js,
    .directions__icon-py,
    .directions__icon-ai {
        width: 40px;
        height: 40px;
    }

    .directions__icon-pair {
        gap: 10px;
    }

    .directions__icon-plus {
        font-size: 22px;
    }


    .directions__node-content--top {
        bottom: 20px;
    }

    .directions__node-content--bottom {
        top: 20px;
    }

    .directions__node-dot {
        width: 16px;
        height: 16px;
    }

    .directions__node-dot--internship {
        width: 22px;
        height: 22px;
    }
}

/* Малые мобильные */
@media (max-width: 480px) {
    .direction__desc {
        font-size: 14px;
        margin-bottom: 100px;
    }

    .directions__node-title {
        font-size: 10px;
    }

    .directions__icon-box {
        width: 36px;
        height: 36px;
    }

    .directions__icon-go {
        height: 30px;
    }

    .directions__icon-js,
    .directions__icon-py,
    .directions__icon-ai {
        width: 28px;
        height: 28px;
    }

    .directions__icon-pair {
        gap: 7px;
    }

    .directions__icon-plus {
        font-size: 16px;
    }


    .directions__node-content--top {
        bottom: 14px;
    }

    .directions__node-content--bottom {
        top: 14px;
    }

    .directions__node-dot {
        width: 12px;
        height: 12px;
    }

    .directions__node-dot--internship {
        width: 18px;
        height: 18px;
    }
}
