﻿/*
 * Category landing hierarchy
 * Uses Timator brand token + Tailwind slate palette.
 */

.categories-page {
    padding: 2rem 0 4.5rem;
    background: #fff;
}

.categories-page__heading {
    margin-bottom: 1.5rem;
}

.categories-page__heading h1 {
    margin: 0;
    color: #0f172a;
    font-size: clamp(1.6rem, 2.5vw, 2.2rem);
    font-weight: 800;
    line-height: 1.4;
}

.category-families {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.category-family {
    display: grid;
    grid-template-columns: minmax(12.5rem, 15.5rem) minmax(0, 1fr);
    gap: 1rem;
    padding: 1rem;
    border-radius: 0.75rem;
    background: #f1f5f9;
}

.category-family__parent {
    display: flex;
    min-height: 100%;
    padding: 1.1rem;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    border-radius: 0.75rem;
    background: #fff;
    text-align: center;
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        background-color 180ms ease;
}

.category-family__parent:hover,
.category-family__parent:focus-visible {
    background: #fefefe;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
}

.category-family__parent:focus-visible,
.category-node__link:focus-visible {
    outline: 2px solid var(--theme-brand-color, #1260aa);
    outline-offset: 3px;
}

.category-family__media {
    display: flex;
    width: 9rem;
    height: 9rem;
    margin-bottom: 0.9rem;
    padding: 0.9rem;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 999px;
    background: #f1f5f9;
}

.category-family__media img,
.category-node__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.category-family__fallback,
.category-node__fallback {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-weight: 800;
}

.category-family__fallback {
    font-size: 2rem;
}

.category-family__parent-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
}

.category-family__parent-name {
    color: #0f172a;
    font-size: 1rem;
    font-weight: 750;
    line-height: 1.65;
}

.category-family__parent-arrow,
.category-node__arrow {
    position: relative;
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    flex: 0 0 auto;
    border-bottom: 1.5px solid currentColor;
    border-left: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition:
        color 180ms ease,
        transform 180ms ease;
}

.category-family__parent-arrow {
    color: #94a3b8;
}

.category-family__parent:hover .category-family__parent-arrow {
    color: var(--theme-brand-color, #1260aa);
    transform: translateX(-2px) rotate(45deg);
}

.category-family__children {
    position: relative;
    min-width: 0;
    padding: 0.15rem 1.25rem 0.15rem 0;
    border-inline-start: 2px solid #cbd5e1;
}

.category-tree {
    margin: 0;
    padding: 0;
    list-style: none;
}

.category-tree--root {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.category-node {
    min-width: 0;
}

.category-node--depth-1 {
    display: flex;
    min-height: 100%;
    padding: 0.55rem;
    flex-direction: column;
    border-radius: 0.75rem;
    background: #fff;
}

.category-node__link {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.65rem;
    border-radius: 0.75rem;
    color: #1e293b;
    transition:
        color 180ms ease,
        background-color 180ms ease;
}

.category-node--depth-1 > .category-node__link {
    min-height: 4.7rem;
    padding: 0.4rem;
}

.category-node__link:hover {
    color: var(--theme-brand-color, #1260aa);
    background: #f8fafc;
}

.category-node__media {
    display: flex;
    width: 3.8rem;
    height: 3.8rem;
    padding: 0.4rem;
    align-items: center;
    justify-content: center;
    flex: 0 0 3.8rem;
    overflow: hidden;
    border-radius: 0.75rem;
    background: #f1f5f9;
}

.category-node__fallback {
    font-size: 1.15rem;
}

.category-node__name {
    min-width: 0;
    flex: 1 1 auto;
    font-size: 0.84rem;
    font-weight: 650;
    line-height: 1.65;
}

.category-node__arrow {
    margin-inline-start: auto;
    color: #cbd5e1;
}

.category-node__link:hover .category-node__arrow {
    color: var(--theme-brand-color, #1260aa);
    transform: translateX(-2px) rotate(45deg);
}

.category-tree--nested {
    display: flex;
    margin-top: 0.35rem;
    margin-inline-start: 1rem;
    padding-inline-start: 0.7rem;
    flex-direction: column;
    gap: 0.15rem;
    border-inline-start: 1px solid #e2e8f0;
}

.category-tree--nested .category-node__link {
    min-height: 2.25rem;
    padding: 0.3rem 0.5rem;
}

.category-tree--nested .category-node__name {
    font-size: 0.76rem;
    font-weight: 550;
}

.category-tree--nested .category-node__arrow {
    width: 0.42rem;
    height: 0.42rem;
}

@media (max-width: 1279.98px) {
    .category-family {
        grid-template-columns: minmax(11.5rem, 13.5rem) minmax(0, 1fr);
    }

    .category-tree--root {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .categories-page {
        padding: 1.25rem 0 3.25rem;
    }

    .categories-page__heading {
        margin-bottom: 1rem;
    }

    .categories-page__heading h1 {
        font-size: 1.4rem;
    }

    .category-families {
        gap: 0.8rem;
    }

    .category-family {
        display: block;
        padding: 0.75rem;
        border-radius: 0.75rem;
    }

    .category-family__parent {
        min-height: auto;
        padding: 0.7rem;
        flex-direction: row;
        justify-content: flex-start;
        text-align: right;
    }

    .category-family__media {
        width: 5.1rem;
        height: 5.1rem;
        margin: 0 0 0 0.8rem;
        padding: 0.5rem;
        flex: 0 0 5.1rem;
    }

    .category-family__parent-content {
        min-width: 0;
        flex: 1 1 auto;
        justify-content: flex-start;
    }

    .category-family__parent-name {
        min-width: 0;
        flex: 1 1 auto;
        font-size: 0.92rem;
    }

    .category-family__children {
        margin-top: 0.75rem;
        margin-inline-start: 1rem;
        padding: 0 0.75rem 0 0;
    }

    .category-tree--root {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .category-node--depth-1 {
        padding: 0.4rem;
        border-radius: 0.75rem;
    }

    .category-node--depth-1 > .category-node__link {
        min-height: 4rem;
        padding: 0.3rem;
    }

    .category-node__media {
        width: 3.2rem;
        height: 3.2rem;
        flex-basis: 3.2rem;
    }

    .category-node__name {
        font-size: 0.8rem;
    }

    .category-tree--nested {
        margin-inline-start: 0.8rem;
        padding-inline-start: 0.55rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .category-family__parent,
    .category-family__parent-arrow,
    .category-node__link,
    .category-node__arrow {
        transition: none;
    }

    .category-family__parent:hover {
        transform: none;
    }
}
