/* =========================
   1. КОНТЕЙНЕР (СЕТКА)
   ========================= */
.category-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(320px, 470px) minmax(0, 1fr);
    align-items: center;
    gap: 24px;
    min-height: 430px;
    margin: 24px 0 20px;
    padding: 58px 52px;
    overflow: hidden;
}

.category-hero--ro {
    background:
        linear-gradient(90deg, #fff 0%, rgba(255, 255, 255, .96) 30%, rgba(255, 255, 255, .58) 48%, rgba(255, 255, 255, 0) 68%),
        url("/img/ro-bg.png") right bottom / 83% auto no-repeat;
}

.category-hero--en {
    background:
        linear-gradient(90deg, #fff 0%, rgba(255, 255, 255, .96) 30%, rgba(255, 255, 255, .58) 48%, rgba(255, 255, 255, 0) 68%),
        url("/img/en-bg.png") right bottom / 74% auto no-repeat;
}

.category-hero--ru {
    background:
        linear-gradient(90deg, #fff 0%, rgba(255, 255, 255, .96) 30%, rgba(255, 255, 255, .58) 48%, rgba(255, 255, 255, 0) 68%),
        url("/img/ru-bg.png") right bottom / 83% auto no-repeat;
}

.category-hero--math {
    background:
        linear-gradient(90deg, rgba(255, 255, 255, .92) 0%, rgba(255, 255, 255, .74) 30%, rgba(255, 255, 255, .24) 52%, rgba(255, 255, 255, 0) 68%),
        url("/img/math-bg.png") right bottom / cover no-repeat;
}

.category-hero__content {
    position: relative;
    z-index: 2;
    max-width: 470px;
    min-width: 0;
}

.category-hero__content .hero__title {
    color: #071457;
    font-size: clamp(44px, 5vw, 64px);
    line-height: 1.03;
    margin-bottom: 20px;
}

.category-hero__content .hero__text {
    color: #111a4a;
    font-size: 18px;
    line-height: 1.55;
    max-width: 440px;
}

.category-hero__content .hero__cta {
    gap: 22px;
    margin-top: 34px;
}

.category-hero__content .btn {
    min-height: 66px;
    padding: 0 30px;
    border-radius: 16px;
    font-weight: 900;
}

.category-hero__visual {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.category-hero__mascot {
    position: absolute;
    right: -8px;
    bottom: 0;
    width: min(58vw, 430px);
    object-fit: contain;
    object-position: center bottom;
    filter: drop-shadow(0 18px 22px rgba(15, 23, 42, .12));
}

.category-hero-fallback {
    padding: 40px 0;
}

.category-hero-fallback__content {
    max-width: 600px;
}

.category-section-head {
    text-align: left;
}

.category-section-head--spaced {
    margin-bottom: 24px;
}

.category-empty {
    text-align: left;
    color: var(--muted);
}

.category-filters {
    margin-bottom: 24px;
}

.category-filter-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.category-filter-row--spaced {
    margin-bottom: 16px;
}

.category-filter-label {
    font-weight: 700;
    color: var(--muted);
    align-self: center;
    margin-right: 8px;
}

.chip--active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 20px 0 24px;
    font-size: 14px;
    font-weight: 600;
}

.breadcrumb-item {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.breadcrumb-item:hover {
    color: var(--blue);
}

.breadcrumb-item.active {
    color: var(--text);
    font-weight: 700;
}

.breadcrumb-separator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    color: #94A3B8;
    font-size: 11px;
    line-height: 1;
    transform: translateY(1px);
}

.category-hero--en .category-hero__mascot {
    right: -5px;
    bottom: -13px;
    width: min(58vw, 430px);
}

.grid--categories {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding-bottom: 24px;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 40px;
}

/* Умная логика скрытия носика активной карточки при наведении на другие */
.grid--categories:has(:is(.cat, .scat):hover:not(.is-active)) :is(.cat, .scat).is-active::before,
.grid--categories:has(:is(.cat, .scat):hover:not(.is-active)) :is(.cat, .scat).is-active::after {
    opacity: 0;
}

/* =========================
   2. ГЛАВНЫЕ КАТЕГОРИИ (Белые карточки)
   ========================= */
.cat {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 30px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    z-index: 1;
}

.cat:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    border-color: var(--accent);
    z-index: 5;
}

.cat.is-active {
    border-color: #27AE60;
    box-shadow: 0 10px 25px rgba(39, 174, 96, 0.10);
}

/* Специально для главной страницы: иконки в квадратах */
/*.cat__icon-wrapper {*/
/*    width: 65px;*/
/*    height: 65px;*/
/*    margin-bottom: 20px;*/
/*    display: flex;*/
/*    align-items: center;*/
/*    justify-content: center;*/
/*    border-radius: 12px;*/

/*    overflow: hidden;*/
/*    transition: background 0.2s ease;*/
/*}*/

/* Ограничиваем саму картинку на главной */
.cat__icon-wrapper .cat__img {
    width: 65px;  /* Вот тут задай нужный размер для главной */
    height: 65px;
    object-fit: contain;
    filter: none; /* Убираем тени, если на главной они не нужны */
}



/* =========================
   3. СУБКАTEГОРИИ (Прозрачные)
   ========================= */
.scat {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    background: transparent; /* Убираем белый фон */
    border: 1px solid transparent;
    transition: transform 0.2s ease;
    z-index: 1;
}

.scat:hover {
    transform: translateY(-4px);
    z-index: 5;
}

/* =========================
   4. ИНДИКАТОРЫ (ЛИНИИ И НОСИКИ)
   ========================= */
.cat::before, .cat::after,
.scat::before, .scat::after {
    content: "";
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.cat::before, .scat::before {
    left: -1px;
    right: -1px;
    bottom: -28px;
    height: 2px;
    background: var(--accent);
    z-index: 3;
}

.cat::after, .scat::after {
    left: 50%;
    bottom: -36px;
    width: 14px;
    height: 14px;
    background: #F6F9FF; /* Цвет фона страницы */
    border-left: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    transform: translateX(-50%) rotate(-45deg);
    border-radius: 2px;
    z-index: 4;
}

:is(.cat, .scat):is(:hover, .is-active)::before,
:is(.cat, .scat):is(:hover, .is-active)::after {
    opacity: 1;
}

/* =========================
   5. ИКОНКИ И КРУЖОК (ГЛАВНОЕ)
   ========================= */
.subcat__icon-container {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    z-index: 1;
}

.subcat__icon-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    background-color: var(--accent);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: -1;
}

/* Кружок появляется при ХОВЕРЕ ИЛИ если субкатегория АКТИВНА */
.scat:is(:hover, .is-active) .subcat__icon-circle {
    opacity: 0.15;
    transform: translate(-50%, -50%) scale(1.1);
}

/* Дополнительный акцент для АКТИВНОГО кружка (чтобы отличался от ховера) */
.scat.is-active .subcat__icon-circle {
    opacity: 0.25; /* Чуть ярче активный */
    box-shadow: 0 0 0 2px var(--accent); /* Тонкий ободок */
}

.subcat__img {
    max-width: 80px;
    max-height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
    transition: transform 0.3s ease;
}

/* Анимация картинки при наведении или активе */
.scat:is(:hover, .is-active) .subcat__img {
    transform: scale(1.1) translateY(-5px);
}

.subcat__svg-wrapper svg {
    width: 42px;
    height: 42px;
    fill: #2D3954;
    transition: fill 0.3s ease;
}

.scat:is(:hover, .is-active) .subcat__svg-wrapper svg {
    fill: var(--accent);
}

/* =========================
   6. ТИПОГРАФИКА И ЦВЕТА
   ========================= */
.cat__title {
    font-size: 17px;
    font-weight: 700;
    color: #2D3954;
    margin-bottom: 4px;
    transition: color 0.2s ease;
}

:is(.cat, .scat):is(:hover, .is-active) .cat__title {
    color: var(--accent);
}

.cat__hint {
    font-size: 12px;
    color: #94A3B8;
    font-weight: 500;
}

/* Акцентные цвета */
.cat--green  { --accent: #27AE60; }
.cat--orange { --accent: #F39C12; }
.cat--pink   { --accent: #FF74B1; }
.cat--purple { --accent: #8E44AD; }
.cat--blue   { --accent: #3498DB; }

@media (max-width: 1024px) {
    .category-hero {
        grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
        min-height: 380px;
        padding: 42px 34px;
    }

    .category-hero__mascot {
        right: -12px;
        width: min(58vw, 560px);
    }

    .grid--categories {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }
}

@media (max-width: 767px) {
    .category-hero {
        grid-template-columns: 1fr;
        gap: 18px;
        min-height: 560px;
        margin: 16px 0 18px;
        padding: 34px 20px 0;
    }

    .category-hero--ro {
        background:
            linear-gradient(180deg, rgba(255, 255, 255, .94) 0%, rgba(255, 255, 255, .72) 58%, rgba(255, 255, 255, .16) 100%),
            url("/img/ro-bg.png") center / cover no-repeat;
    }

    .category-hero--ru {
        background:
            linear-gradient(180deg, rgba(255, 255, 255, .94) 0%, rgba(255, 255, 255, .72) 58%, rgba(255, 255, 255, .16) 100%),
            url("/img/ru-bg.png") center / cover no-repeat;
    }

    .category-hero--math {
        background:
            linear-gradient(180deg, rgba(255, 255, 255, .84) 0%, rgba(255, 255, 255, .48) 58%, rgba(255, 255, 255, .08) 100%),
            url("/img/math-bg.png") center / cover no-repeat;
    }

    .category-hero__content {
        text-align: center;
        max-width: none;
        bottom: 147px;
    }

    .category-hero__content .hero__title {
        font-size: 40px;
    }

    .category-hero__content .hero__text {
        margin-left: auto;
        margin-right: auto;
    }

    .category-hero__content .hero__cta {
        justify-content: center;
    }

    .category-hero__mascot {
        left: 50%;
        right: auto;
        bottom: 0;
        width: min(104vw, 430px);
        transform: translateX(-50%);
    }

    .grid--categories {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        padding-bottom: 16px;
        margin-bottom: 24px;
        border-bottom-width: 1px;
    }

    .cat {
        padding: 18px 10px;
        border-radius: 14px;
    }

    .cat__icon-wrapper .cat__img {
        width: 52px;
        height: 52px;
    }

    .cat__title {
        font-size: 15px;
        line-height: 1.25;
    }

    .cat__hint {
        font-size: 11px;
    }

    .cat::before,
    .cat::after,
    .scat::before,
    .scat::after {
        display: none;
    }
}
