/* ===== Category details (on top of posts.css + questions.css) ===== */

/* ----- Header: logo, name, description, stats, Telegram group ----- */
.cat-hero {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px 24px;
    margin-bottom: 20px;
    padding: 26px 28px;
    overflow: hidden;
    border: 1px solid var(--pl-border);
    border-radius: 22px;
    background:
        radial-gradient(circle at 92% 10%, color-mix(in srgb, var(--pl-accent) 16%, transparent) 0, transparent 40%),
        linear-gradient(135deg, color-mix(in srgb, var(--pl-accent) 7%, var(--pl-surface)), var(--pl-surface));
}

.cat-hero-logo {
    flex: none;
    width: 96px;
    height: 96px;
    padding: 10px;
    border: 1px solid var(--pl-border);
    border-radius: 24px;
    background: var(--pl-surface);
    box-shadow: 0 10px 24px rgba(16, 12, 40, 0.08);
}

.cat-hero-logo img {
    width: 100%;
    height: 100%;
    border-radius: 14px;
    object-fit: contain;
}

.cat-hero-body {
    flex: 1 1 320px;
    min-width: 0;
}

.cat-hero .plist-breadcrumb {
    margin-bottom: 4px;
}

.cat-area .cat-title {
    margin: 0 0 6px;
    color: var(--pl-text);
    font-size: 32px;
    font-weight: 800;
}

.cat-desc {
    display: -webkit-box;
    max-width: 640px;
    margin: 0 0 10px;
    overflow: hidden;
    color: var(--pl-muted);
    font-size: 15px;
    line-height: 1.9;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.cat-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cat-stats li {
    margin: 0;
    padding: 3px 12px;
    border-radius: 999px;
    background: var(--pl-accent-soft);
    color: var(--pl-accent);
    font-family: Dana, Dana-fallback, Tahoma, sans-serif;
    font-size: 13px;
}

.cat-stats strong {
    font-weight: 800;
}

.cat-telegram {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 16px;
    background: #229ed9;
    box-shadow: 0 10px 24px rgba(34, 158, 217, 0.3);
    transition: filter 0.15s ease, transform 0.15s ease;
}

.cat-area .cat-telegram {
    color: #fff;
}

.cat-telegram:hover {
    filter: brightness(1.06);
    transform: translateY(-2px);
}

.cat-telegram i {
    font-size: 26px;
}

.cat-telegram span {
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

.cat-telegram strong {
    font-size: 14px;
}

.cat-telegram small {
    font-size: 12px;
    opacity: 0.9;
}

/* ----- Tabs ----- */
.cat-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--pl-border);
}

.cat-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: -1px;
    padding: 12px 16px;
    border-bottom: 3px solid transparent;
    font-size: 15px;
    font-weight: 700;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.cat-area .cat-tabs a {
    color: var(--pl-muted);
}

.cat-area .cat-tabs a:hover {
    color: var(--pl-text);
}

.cat-area .cat-tabs a.is-active {
    border-bottom-color: var(--pl-accent);
    color: var(--pl-accent);
}

.cat-tabs a span {
    padding: 0 8px;
    border-radius: 999px;
    background: var(--pl-surface-2);
    color: var(--pl-muted);
    font-family: Dana, Dana-fallback, Tahoma, sans-serif;
    font-size: 12px;
}

.cat-tabs a.is-active span {
    background: var(--pl-accent-soft);
    color: var(--pl-accent);
}

/* ----- Questions tab header ----- */
.cat-questions-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}

.cat-questions-head p {
    margin: 0;
    color: var(--pl-muted);
    font-size: 14px;
}

/* ----- Sidebar: other categories ----- */
.cat-others {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cat-others a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--pl-border);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    direction: ltr;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.cat-area .cat-others a {
    color: var(--pl-text);
}

.cat-area .cat-others a:hover {
    border-color: var(--pl-accent);
    color: var(--pl-accent);
}

.cat-others small {
    color: var(--pl-muted);
    font-family: Dana, Dana-fallback, Tahoma, sans-serif;
    font-size: 11px;
}

.cat-area .cat-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    color: var(--pl-accent);
    font-size: 13px;
    font-weight: 700;
}

@media (max-width: 575px) {
    .cat-hero {
        padding: 20px 18px;
    }

    .cat-hero-logo {
        width: 72px;
        height: 72px;
        border-radius: 18px;
    }

    .cat-area .cat-title {
        font-size: 26px;
    }

    .cat-telegram {
        width: 100%;
        justify-content: center;
    }

    .cat-tabs a {
        flex: 1;
        justify-content: center;
        padding: 12px 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cat-telegram,
    .cat-tabs a,
    .cat-others a {
        transition: none;
    }

    .cat-telegram:hover {
        transform: none;
    }
}

/* ===== /categories (all categories) ===== */
.cats-hero {
    align-items: flex-end;
}

.cats-filter {
    position: relative;
    flex: 1 1 280px;
    max-width: 360px;
}

.cats-filter i {
    position: absolute;
    top: 50%;
    right: 16px;
    color: var(--pl-muted);
    transform: translateY(-50%);
}

.cat-area .cats-filter input {
    width: 100%;
    height: 50px;
    padding: 0 44px 0 16px;
    border: 1px solid var(--pl-border);
    border-radius: 14px;
    background: var(--pl-surface);
    color: var(--pl-text);
    font-family: Dana, Dana-fallback, Tahoma, sans-serif;
    font-size: 15px;
}

body.active-dark-mode .cat-area .cats-filter input {
    border-color: var(--pl-border);
    background: var(--pl-surface);
    color: var(--pl-text);
}

.cat-area .cats-filter input:focus {
    border-color: var(--pl-accent);
    box-shadow: 0 0 0 4px var(--pl-accent-soft);
    outline: none;
}

.cats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cats-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin: 0;
    padding: 18px;
    border: 1px solid var(--pl-border);
    border-radius: 18px;
    background: var(--pl-surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.cats-card[hidden] {
    display: none;
}

.cats-card:hover,
.cats-card:focus-within {
    border-color: color-mix(in srgb, var(--pl-accent) 35%, transparent);
    box-shadow: 0 14px 30px rgba(16, 12, 40, 0.08);
    transform: translateY(-3px);
}

.cats-logo {
    display: grid;
    flex: none;
    place-items: center;
    width: 56px;
    height: 56px;
    padding: 6px;
    border: 1px solid var(--pl-border);
    border-radius: 16px;
    background: var(--pl-surface-2);
}

.cats-logo img {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    object-fit: contain;
}

.cats-body {
    flex: 1;
    min-width: 0;
}

.cats-name {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 800;
    direction: ltr;
    text-align: right;
}

.cat-area .cats-name a {
    color: var(--pl-text);
}

/* The whole card opens the category */
.cats-name a::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.cat-area .cats-card:hover .cats-name a {
    color: var(--pl-accent);
}

.cats-name a:focus-visible {
    outline: none;
}

.cats-card:has(.cats-name a:focus-visible) {
    outline: 3px solid color-mix(in srgb, var(--pl-accent) 45%, transparent);
    outline-offset: 2px;
}

.cats-desc {
    display: -webkit-box;
    margin: 0 0 8px;
    overflow: hidden;
    color: var(--pl-muted);
    font-size: 13px;
    line-height: 1.85;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.cats-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    color: var(--pl-muted);
    font-family: Dana, Dana-fallback, Tahoma, sans-serif;
    font-size: 12px;
}

.cats-meta i {
    margin-left: 4px;
    color: var(--pl-accent);
}

.cats-go {
    align-self: center;
    color: var(--pl-muted);
    transition: color 0.2s ease, transform 0.2s ease;
}

.cats-card:hover .cats-go {
    color: var(--pl-accent);
    transform: translateX(-4px);
}

.cats-none {
    margin-top: 8px;
}

@media (max-width: 575px) {
    .cats-filter {
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cats-card,
    .cats-go {
        transition: none;
    }

    .cats-card:hover,
    .cats-card:focus-within,
    .cats-card:hover .cats-go {
        transform: none;
    }
}

/* ===== /telegram-groups (on top of the /categories styles) ===== */
.tg-area {
    --tg-blue: #229ed9;
}

.tg-join {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 12px;
    background: #fff;
    color: #1c8fc7;
    font-size: 14px;
    font-weight: 800;
}

.tg-card {
    flex-wrap: wrap;
    align-items: center;
}

.tg-card .cats-body {
    flex: 1 1 150px;
}

.tg-handle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Stacked logos of the group's categories */
.tg-logos {
    display: flex;
    flex: none;
    padding-left: 10px;
}

.tg-logos img {
    width: 44px;
    height: 44px;
    margin-left: -10px;
    padding: 4px;
    border: 2px solid var(--pl-surface);
    border-radius: 14px;
    background: var(--pl-surface-2);
    object-fit: contain;
}

.tg-handle {
    margin: 0 0 6px;
    color: var(--tg-blue);
    font-size: 12px;
    font-weight: 600;
    text-align: right;
}

.tg-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tg-tags span {
    padding: 1px 8px;
    border-radius: 6px;
    background: var(--pl-surface-2);
    color: var(--pl-muted);
    font-size: 11px;
    font-weight: 600;
    direction: ltr;
}

.tg-join--sm {
    flex-basis: 100%;
    justify-content: center;
    padding: 6px 12px;
    background: rgba(34, 158, 217, 0.12);
    color: var(--tg-blue);
    font-size: 12px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.tg-card:hover .tg-join--sm {
    background: var(--tg-blue);
    color: #fff;
}

.tg-more {
    margin: 28px 0 0;
    color: var(--pl-muted);
    font-size: 14px;
    text-align: center;
}

.tg-area .tg-more a {
    color: var(--pl-accent);
    font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
    .tg-join--sm {
        transition: none;
    }
}

/* ===== /telegram-channels (on top of the /telegram-groups styles) ===== */
.tc-avatar {
    display: grid;
    flex: none;
    place-items: center;
    width: 56px;
    height: 56px;
    overflow: hidden;
    border-radius: 50%;
    background: linear-gradient(135deg, #1c8fc7, #2aabee);
    color: #fff;
    font-size: 24px;
    box-shadow: 0 0 0 3px var(--pl-surface), 0 0 0 5px rgba(34, 158, 217, 0.35);
}

.tc-avatar {
    font-weight: 800;
}

.tc-avatar img {
    width: 100%;
    height: 100%;
    background: #fff;
    object-fit: cover;
}

/* The site logo sits on white inside the circle */
.tc-avatar--logo {
    padding: 14px;
    background: #fff;
}

.tc-avatar--logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tc-avatar--lg {
    width: 76px;
    height: 76px;
    font-size: 32px;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5);
}

/* Official channel: big Telegram-blue card */
.tc-official {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 22px;
    margin-bottom: 32px;
    padding: 24px 26px;
    border-radius: 22px;
    background:
        radial-gradient(60% 120% at 100% 0%, rgba(255, 255, 255, 0.22), transparent 60%),
        linear-gradient(135deg, #1c8fc7, #2aabee);
    box-shadow: 0 18px 40px rgba(34, 158, 217, 0.3);
    transition: transform 0.2s ease, filter 0.2s ease;
}

.tg-area .tc-official {
    color: #fff;
}

.tc-official:hover {
    filter: brightness(1.05);
    transform: translateY(-2px);
}

.tc-official-body {
    display: flex;
    flex: 1 1 260px;
    flex-direction: column;
    gap: 3px;
}

.tc-official-body strong {
    font-size: 20px;
    font-weight: 800;
}

.tc-official-body > span:not(.tc-badge) {
    font-size: 14px;
    opacity: 0.92;
}

.tc-official-body small {
    font-size: 12px;
    opacity: 0.85;
    text-align: right;
}

.tc-badge {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    font-size: 12px;
    font-weight: 700;
}

.tg-area .tc-section-title {
    margin: 0 0 14px;
    color: var(--pl-text);
    font-size: 20px;
    font-weight: 800;
}

.tc-card {
    flex-wrap: wrap;
    align-items: center;
}

.tc-card .cats-body {
    flex: 1 1 160px;
}

.tg-area .tc-name {
    direction: rtl;
    font-size: 16px;
}

.tc-tags span {
    direction: rtl;
}

/* Suggest a channel */
.tc-suggest {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 18px;
    margin-top: 28px;
    padding: 20px 22px;
    border: 2px dashed var(--pl-border);
    border-radius: 20px;
}

.tc-suggest > div {
    display: flex;
    flex: 1 1 240px;
    flex-direction: column;
}

.tc-suggest strong {
    color: var(--pl-text);
    font-size: 16px;
}

.tc-suggest > div span {
    color: var(--pl-muted);
    font-size: 14px;
}

.tc-suggest-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--pl-accent-soft);
    color: var(--pl-accent);
    font-size: 20px;
}

.tc-suggest-btn {
    display: inline-flex;
    align-items: center;
    height: 42px;
    padding: 0 18px;
    border-radius: 12px;
    background: var(--color-primary, #49108b);
    font-size: 14px;
    font-weight: 700;
}

.tg-area .tc-suggest-btn {
    color: #fff;
}

body.active-dark-mode .tg-area .tc-suggest-btn {
    background: #6d3fd1;
}

@media (prefers-reduced-motion: reduce) {
    .tc-official {
        transition: none;
    }

    .tc-official:hover {
        transform: none;
    }
}

/* ===== /tags/{tag} (on top of the category page styles) ===== */
.tag-hero-mark {
    display: grid;
    place-items: center;
    color: var(--pl-accent);
    font-family: Morabba, Dana, Tahoma, sans-serif;
    font-size: 56px;
    font-weight: 900;
    line-height: 1;
}

.tag-area .cat-title {
    text-align: right;
    overflow-wrap: anywhere;
}

.tag-area .plist-widget .cat-all {
    margin-top: 0;
}
