/**
 * Footer Component
 * Gradient background from background to accent (inverted)
 */

.footer {
    width: 100%;
    background: linear-gradient(to bottom, var(--color-background), var(--color-accent)); /* Inverted gradient: from background to accent */
    padding: 0;
    margin: 0;
    margin-bottom: 0;
    color: var(--color-content);
    position: relative;
}

.footer__container {
    width: 100%;
    margin: 0 auto;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: 12px; /* свои 12px между колонками */
    row-gap: 24px;
    padding: 60px 12px 0 12px; /* Убрали padding-bottom, полоска будет в самом низу */
    overflow-x: visible; /* чтобы .footer__bottom на 100vw не обрезался */
    overflow-y: hidden;
}

@media (min-width: 769px) and (max-width: 1024px) {
    .footer__container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .footer__bottom {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* Footer Sections */
.footer__section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Inside и outside — одинаковый стиль: отступ 50% колонки, ссылки в ряд с gap 40px */
.footer__section--inside,
.footer__section--outside {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 40px;
}

.footer__section--inside {
    grid-column: 1 / span 4; /* ещё на колонку левее */
    padding-left: calc((100% - 3 * var(--grid-gap)) / 8); /* 50% колонки при span 4 */
}

.footer__section--outside {
    grid-column: 8 / span 5;
    padding-left: calc((100% - 4 * var(--grid-gap)) / 10); /* 50% колонки при span 5 */
}

/* Footer Label */
.footer__label {
    font-family: var(--font-body);
    font-size: 14px; /* body-4-desktop - always desktop size */
    font-weight: 300;
    line-height: var(--line-height-body-4-desktop); /* 120% */
    color: var(--color-content-a40);
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer__arrow {
    display: inline-block;
    font-size: 14px; /* body-4-desktop - always desktop size */
}

/* Footer Links */
.footer__links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--grid-gap);
}

/* Ссылки в ряд с отступом 40px */
.footer__section--inside .footer__links,
.footer__section--outside .footer__links {
    display: flex;
    flex-direction: row;
    gap: 40px;
}

.footer__links-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer__link {
    font-family: var(--font-body);
    font-size: 16px; /* body-3-desktop - always desktop size */
    font-weight: 300;
    line-height: var(--line-height-body-3-desktop); /* 120% */
    color: var(--color-content);
    text-decoration: none;
    transition: color 0.5s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer__link:hover {
    color: var(--color-subaccent);
    transition: color 0s ease;
}

.footer__link--download {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer__download-icon {
    flex-shrink: 0;
    /* currentColor — наследует --color-content, при hover — --color-subaccent */
}

/* Footer Bottom - счётчик прибит к левому краю (12px), "creating" к правому (12px) */
.footer__bottom {
    grid-column: 1 / -1; /* на всю ширину сетки */
    width: 100vw;
    margin-left: calc(50% - 50vw);
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 40px;
    margin-top: 40px;
    padding-bottom: 0;
    margin-bottom: 12px; /* Отступ до полоски */
    padding-left: 12px;
    padding-right: 12px;
}

/* Счетчик времени - слева */
.footer__bottom-counter {
    font-family: var(--font-body);
    font-size: 16px; /* body-3-desktop - always desktop size */
    font-weight: 300;
    line-height: var(--line-height-body-3-desktop); /* 120% */
    color: var(--color-solid-light);
    text-align: left;
    min-width: 300px; /* Фиксированная минимальная ширина, чтобы строка не прыгала */
    white-space: nowrap;
}

/* Текст справа — прибит к правому краю с отступом 12px */
.footer__bottom-text {
    flex: 0 0 auto;
    font-family: var(--font-body);
    font-size: 16px; /* body-3-desktop - always desktop size */
    font-weight: 300;
    line-height: var(--line-height-body-3-desktop); /* 120% */
    color: var(--color-solid-light);
    text-align: right;
}

.footer__label:hover {
    color: var(--color-content);
}

/* Progress Indicator - полоска в самом низу, заканчивает сайт */
.footer__progress {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-top: 0; /* Расстояние задано через margin-bottom у footer__bottom */
    margin-bottom: 0;
    padding-bottom: 0;
    position: relative;
    z-index: 1;
}

.footer__progress-bar {
    width: 100%;
    height: 4px;
    background-color: var(--color-solid-dark); /* Правая часть - оставшееся время (черный) */
    position: relative;
    overflow: hidden;
    margin-bottom: 0;
    padding-bottom: 0;
}

.footer__progress-fill {
    height: 100%;
    background-color: var(--color-solid-light); /* Левая часть - прошедшее время (magenta/pink) */
    position: absolute;
    left: 0;
    top: 0;
    transition: width 0.1s linear;
    will-change: width;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .footer__container {
        grid-template-columns: repeat(6, 1fr);
        gap: 12px;
        padding: 40px 12px 0 12px; /* Убрали padding-bottom на мобильных */
    }
    
    .footer__section--inside {
        grid-column: 1 / span 6;
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 12px;
        padding-left: 0;
    }
    
    .footer__section--inside .footer__label {
        grid-column: 1 / span 2;
        padding-left: 40px; /* Выравнивание с первой колонкой ссылок */
    }
    
    .footer__section--inside .footer__links {
        grid-column: 1 / span 6;
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 12px;
    }
    
    .footer__section--inside .footer__links-column:first-child {
        grid-column: 1 / span 2;
        padding-left: 40px; /* Отступ для первой колонки */
    }
    
    .footer__section--inside .footer__links-column:last-child {
        grid-column: 4 / span 3; /* Вторая колонка начинается с 4-й колонки */
    }
    
    .footer__section--outside {
        grid-column: 1 / span 6;
        margin-top: 40px;
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 12px;
        padding-left: 0;
    }
    
    .footer__section--outside .footer__label {
        grid-column: 1 / span 2;
        padding-left: 40px; /* Выравнивание с первой колонкой ссылок */
    }
    
    .footer__section--outside .footer__links {
        grid-column: 1 / span 6;
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 12px;
    }
    
    .footer__section--outside .footer__links-column:first-child {
        grid-column: 1 / span 2;
        padding-left: 40px; /* Отступ для первой колонки */
    }
    
    .footer__section--outside .footer__links-column:last-child {
        grid-column: 4 / span 3; /* Вторая колонка начинается с 4-й колонки */
    }
    
    .footer__bottom {
        grid-column: 1 / -1;
        width: 100vw;
        margin-left: calc(50% - 50vw);
        box-sizing: border-box;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-top: 24px;
        margin-top: 24px;
        padding-bottom: 0;
        margin-bottom: 12px; /* Отступ под блоком до полоски */
        padding-left: 12px;
        padding-right: 12px;
    }

    .footer__bottom-counter {
        /* Always use desktop typography size */
        font-size: 16px; /* body-3-desktop */
        line-height: var(--line-height-body-3-desktop); /* 120% */
        text-align: left;
        min-width: 200px; /* Фиксированная минимальная ширина на мобильных */
        white-space: nowrap;
    }
    
    .footer__bottom-text {
        /* Always use desktop typography size */
        flex: 0 0 auto;
        font-size: 16px; /* body-3-desktop */
        line-height: var(--line-height-body-3-desktop); /* 120% */
        text-align: right;
    }
    
    .footer__progress {
        margin-top: 0; /* На мобильных gap = 12px, поэтому margin-top = 0 дает итоговое расстояние 12px */
    }
}
