/*Глобальні настройки*/
html {
    scroll-behavior: smooth;
}

:root {
    --matrix-bg: #030303;
    --matrix-green: #00ff41;
    --matrix-dark: #008f11;
    --matrix-glow: 0 0 8px rgba(0, 255, 65, 0.6), 0 0 2px rgba(0, 255, 65, 1);
    --font-primary: "IBM Plex Mono", monospace;

}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    display: grid;
    grid-template-areas: "header"
        "main"
        "footer";

    grid-template-rows: auto 1fr auto;

    font-family: var(--font-primary);
    font-weight: 400;
    font-style: normal;

    background-color: var(--matrix-bg);
    color: var(--matrix-green);

}

/*Настройки голови*/

header {

    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--matrix-dark);
    background-color: rgba(0, 0, 0, 0.5);
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lightning-icon {

    width: 32px;
    height: 32px;
    stroke: var(--matrix-green);
    filter: drop-shadow(0 0 8px rgba(0, 255, 65, 0.8));
    animation: spark 5s ease-in-out infinite;
}

@keyframes spark {

    0%,
    100% {
        stroke: var(--matrix-dark);
        filter: drop-shadow(0 0 2px var(--matrix-dark));
    }

    50% {
        stroke: #ffffff;
        filter: drop-shadow(0 0 15px var(--matrix-green));
    }
}

.site-title {
    font-weight: 700;
    text-transform: uppercase;
    text-shadow: var(--matrix-glow);
    letter-spacing: 1px;
}

.lang-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
}

.lang-btn {

    color: var(--matrix-dark);
    transition: all 0.2s ease-in-out;
    text-decoration: none;

}


.separator {
    color: var(--matrix-green);
    user-select: none;
}

/*Настройки майна*/

main {
    grid-area: main;
}

/*Секція змісту*/

.toc-section {
    margin: 2rem 0;
    padding: 1.5rem;
    border: 1px dashed var(--matrix-dark);
}

.toc-title {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--matrix-dark);
    color: var(--matrix-dark);
}

.toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toc-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toc-index {
    color: var(--matrix-dark);
    font-weight: 700;
}

.toc-link {
    color: var(--matrix-green);
    position: relative;
    transition: all 0.2s ease;
    text-decoration: none;

    &::before {
        content: ">";
        opacity: 0;
        color: #fff;
        transition: opacity 0.2s ease;
    }

}

/*Настройки секцій з інформацією*/
.theory-section {

    padding-left: 2rem;
    margin: 4rem 0;
    border-left: 2px solid var(--matrix-dark);

}


.section-header {

    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 143, 17, 0.3);
    /* Тьмяний зелений */
    padding-bottom: 0.5rem;

}

.section-title {

    font-size: 1.5rem;

}

.section-content p {

    margin-bottom: 1rem;
    line-height: 1.6;

}

.section-content h4 {
    margin-bottom: 1rem;
}

.notes-list {

    list-style: none;
    /* Відключаємо стандартні крапки браузера */
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ol-list {
    margin-left: 4rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.note-item {

    font-style: italic;
    padding-left: 2rem;
    /* Місце для нашого кастомного маркера */
    line-height: 1.5;

}

.alarm {
    margin: 4rem 0;
    padding: 2rem;
    border: 1px solid var(--matrix-dark);
    /* Створюємо ледь помітний смугастий фон, як на попереджувальних стрічках */
    background: repeating-linear-gradient(45deg,
            rgba(0, 20, 0, 0.4),
            rgba(0, 20, 0, 0.4) 10px,
            rgba(0, 40, 0, 0.4) 10px,
            rgba(0, 40, 0, 0.4) 20px);
}

footer {

    grid-area: footer;

    p {
        color: var(--color-text-secondary);
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
        text-align: center;
    }

}

/*Мобільна адаптація*/

@media (hover: hover) {

    .lang-btn:hover,
    .lang-btn.active {
        color: var(--matrix-green);
        text-shadow: var(--matrix-glow);
    }

    .toc-link:hover {

        color: #fff;
        text-shadow: var(--matrix-glow);

        &::before {
            opacity: 1;
        }

    }

    .table tbody tr {
        transition: all 0.2s ease;
    }
    
    .table tbody tr:hover {
        background-color: rgba(0, 255, 65, 0.1); /* Легке підсвічування фону */
        color: #fff;
        text-shadow: var(--matrix-glow);
    }

    /*ІНТЕРАКТИВНИЙ ЗАКОН ОМА*/

    .om-cell:hover {

        border-color: var(--matrix-green);
        background-color: rgba(0, 255, 65, 0.2);
        text-shadow: var(--matrix-glow);
        box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
        color: #fff;
    }

}

.toc-link:active,
.lang-btn:active {
    color: var(--matrix-green);
    background-color: rgba(0, 255, 65, 0.2);
    /* Легке підсвічування фону при тапі */
}

/* Адаптація для екранів менше 768px (Планшети та телефони) */
@media (max-width: 768px) {

    /* Зменшуємо зовнішні відступи */
    main {
        min-width: 0;
        padding: 1rem;
        gap: 1rem;
    }

    /* Перебудовуємо шапку: назва сайту зверху, перемикач мов знизу */
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }

    /* Зменшуємо шрифти для мобілок, щоб текст не випадав */
    .site-title {
        font-size: 1.2rem;
    }

    .section-title {
        font-size: 1.2rem;
    }

    /* Зменшуємо відступи всередині секцій */
    .theory-section,
    .alarm {
        margin: 2rem 0;
        padding: 1rem;
    }

    /*ІНТЕРАКТИВНИЙ ЗАКОН ОМА*/

    .om-interactive {
        flex-direction: column;
        padding: 1rem;
    }

    .om-screen {
        width: 100%;
        text-align: center;
        font-size: 1.2rem;
    }

    .om-cell:active {
        background-color: rgba(0, 255, 65, 0.4);
    }
}

/* --- ТАБЛИЦЯ ДАНИХ --- */
.table-wrapper {
    width: 100%;
    overflow-x: auto; /* Рятує мобільну верстку від поломки */
    margin-top: 1.5rem;
    border: 1px solid var(--matrix-dark);
}

.table {
   width: 100%;
    border-collapse: collapse; /* Злипаємо рамки клітинок */
    text-align: left;
    white-space: nowrap; /* Забороняємо тексту падати на новий рядок */
}

.table th, 
.table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 143, 17, 0.3); /* Тьмяний розділювач */
}

/* Шапка таблиці */
.table th {
    text-shadow: var(--matrix-glow);
    font-weight: 700;
}

/*ІНТЕРАКТИВНИЙ ТРИКУТНИК ОМА*/

.om-interactive {

    display: flex;
    gap: 2rem;
    align-items: center;
    margin-top: 1.5rem;
    padding: 2rem;
    border: 1px dashed var(--matrix-dark);
    background-color: rgba(0, 20, 0, 0.2);

}

.om-triangle {

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;

}

.om-bottom-row {

    display: flex;
    gap: 5px;

}

.om-cell {

    width: 70px;
    height: 70px;

    display: flex;
    justify-content: center;
    align-items: center;

    font-size: 2rem;
    font-weight: 700;
    color: var(--matrix-dark);

    border: 2px solid var(--matrix-dark);

    cursor: pointer;

    transition: all 0.2s ease;
    user-select: none;


}

.om-screen {

    flex-grow: 1;
    padding: 1.5rem;

    border: 1px solid var(--matrix-green);

    box-shadow: inset 0 0 15px rgba(0, 255, 65, 0.1);

    font-size: 1.5rem;
    min-height: 80px;

    display: flex;
    align-items: center;

}

#om-formula {

    margin: 0;
    text-shadow: var(--matrix-glow);
}