.all-tags-page {
    background: #f8fafc;
}

.tags-hero,
.tag-card,
.category-card,
.tags-empty-state {
    border-radius: var(--ui-radius);
}

.tags-hero {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.06);
}

.tags-back-link {
    display: inline-block;
    margin-bottom: 0.75rem;
    color: #475569;
    text-decoration: none;
    font-weight: 600;
}

.tags-back-link:hover {
    color: #0f172a;
}

.tags-title {
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 700;
    color: #0f172a;
}

.tags-subtitle {
    max-width: 1000px;
    color: #64748b;
    font-size: 1rem;
}

.sort-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.72rem 1rem;
    border-radius: var(--ui-radius);
    background: #fff;
    border: 1px solid color-mix(in srgb, var(--primary-color) 18%, white);
    color: color-mix(in srgb, var(--secondary-color) 78%, black);
    font-weight: 600;
    text-decoration: none;
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        box-shadow 0.18s ease;
}

.sort-chip:hover {
    background: color-mix(in srgb, var(--primary-color) 8%, white);
    border-color: color-mix(in srgb, var(--primary-color) 32%, white);
    color: var(--primary-color);
    box-shadow: 0 10px 24px -18px
        color-mix(in srgb, var(--primary-color) 28%, rgba(15, 23, 42, 0.18));
}

.sort-chip.is-active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 12px 26px -18px
        color-mix(in srgb, var(--primary-color) 45%, rgba(15, 23, 42, 0.2));
}

.tag-card,
.category-card {
    display: block;
    padding: 1.1rem 1.15rem;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 0.35rem 1rem rgba(15, 23, 42, 0.08);
    cursor: pointer;
    transition:
        transform 0.22s ease,
        box-shadow 0.22s ease,
        border-color 0.22s ease,
        background-color 0.22s ease;
}

.tag-card:hover,
.category-card:hover {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--primary-color) 42%, white);
    box-shadow: 0 0.85rem 1.6rem rgba(15, 23, 42, 0.13);
    color: inherit;
}

.tag-card:hover .tag-card-label,
.category-card:hover .category-card-label {
    color: var(--primary-color);
}

.tag-card-media,
.category-card-media {
    width: 56px;
    height: 56px;
    border-radius: calc(var(--ui-radius) - 6px);
    overflow: hidden;
    background: #f8fafc;
    flex-shrink: 0;
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.tag-card-media-image,
.category-card-media-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tag-card-media-placeholder,
.category-card-media-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: color-mix(in srgb, var(--primary-color) 65%, #475569);
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--primary-color) 8%, white),
        #f8fafc
    );
    font-size: 1.15rem;
}

.tag-card-label,
.category-card-label {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    word-break: break-word;
}

.tag-card-description,
.category-card-description {
    margin-top: 0.35rem;
    color: #64748b;
    line-height: 1.55;
    font-size: 0.95rem;
}

.tag-card-meta,
.category-card-meta {
    margin-top: 0.4rem;
    color: #64748b;
    font-size: 0.95rem;
}

.category-card-meta-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.32rem 0.65rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary-color) 10%, white);
    color: color-mix(in srgb, var(--primary-color) 72%, #475569);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
}

.tag-inline,
.category-inline {
    display: inline-flex;
    align-items: center;
    color: color-mix(in srgb, var(--primary-color) 70%, #64748b);
    flex-shrink: 0;
    line-height: 1;
    transition:
        color 0.22s ease,
        transform 0.22s ease;
    align-self: center;
}

.tag-card:hover .tag-inline,
.category-card:hover .category-inline {
    color: var(--primary-color);
    transform: translateX(2px);
}

.tag-inline .tag-icon,
.category-inline .category-icon {
    width: 0.95rem;
    height: 0.95rem;
    display: inline-block;
    vertical-align: middle;
    color: currentColor;
}

.tags-empty-state {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 10px 24px -16px rgba(15, 23, 42, 0.12);
}

@media (max-width: 991.98px) {
    .tags-sort-group {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .all-tags-page {
        padding-top: 1.25rem;
    }

    .tags-hero {
        margin-bottom: 1rem;
    }

    .tags-title {
        font-size: 2.3rem;
    }

    .tag-card-media,
    .category-card-media {
        width: 48px;
        height: 48px;
    }
}
