/**
 * CommunityMedicine Lightning Child v1.1
 * Archive / search UI refresh.
 */

:root {
    --cm-navy: #183653;
    --cm-blue: #2f80ed;
    --cm-green: #20b879;
    --cm-text: #1f2937;
    --cm-muted: #667085;
    --cm-bg: #f5f9fc;
    --cm-card: #ffffff;
    --cm-line: rgba(24, 54, 83, .12);
    --cm-shadow: 0 18px 50px rgba(24, 54, 83, .10);
    --cm-radius: 24px;
}

body.cmlc-archive-page .siteContent,
body.cmlc-archive-page .site-body,
body.cmlc-archive-page .vk_outer-width,
body.cmlc-archive-page .container {
    max-width: none;
}

body.cmlc-archive-page .siteContent {
    padding-top: 0;
}

.cm-archive-main {
    background:
        radial-gradient(circle at top left, rgba(47, 128, 237, .14), transparent 28rem),
        linear-gradient(180deg, #f7fbff 0%, #ffffff 44%, #f6fafc 100%);
    color: var(--cm-text);
    overflow: hidden;
}

.cm-archive-shell {
    width: min(1160px, calc(100% - 40px));
    margin-inline: auto;
}

.cm-archive-hero {
    position: relative;
    padding: clamp(48px, 8vw, 88px) 0 34px;
    isolation: isolate;
}

.cm-archive-hero::before,
.cm-archive-hero::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 999px;
    filter: blur(2px);
    opacity: .8;
}

.cm-archive-hero::before {
    right: -120px;
    top: 34px;
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, rgba(32, 184, 121, .18), transparent 66%);
}

.cm-archive-hero::after {
    left: -140px;
    bottom: -80px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(47, 128, 237, .14), transparent 70%);
}

.cm-archive-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 5px 13px;
    border: 1px solid rgba(47, 128, 237, .18);
    border-radius: 999px;
    background: rgba(255, 255, 255, .78);
    box-shadow: 0 8px 20px rgba(47, 128, 237, .08);
    color: var(--cm-blue);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .04em;
}

.cm-archive-hero h1 {
    margin: 16px 0 12px;
    color: var(--cm-navy);
    font-size: clamp(30px, 4.4vw, 52px);
    font-weight: 900;
    letter-spacing: -.04em;
    line-height: 1.12;
}

.cm-archive-hero p {
    max-width: 780px;
    margin: 0;
    color: var(--cm-muted);
    font-size: clamp(15px, 1.8vw, 18px);
    line-height: 1.9;
}

.cm-archive-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    width: min(760px, 100%);
    margin-top: 24px;
    padding: 10px;
    border: 1px solid rgba(24, 54, 83, .12);
    border-radius: 20px;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 18px 44px rgba(24, 54, 83, .09);
    backdrop-filter: blur(8px);
}

.cm-archive-search input[type="search"] {
    width: 100%;
    min-height: 52px;
    padding: 0 16px;
    border: 0;
    border-radius: 14px;
    background: #f7fbfd;
    box-shadow: inset 0 0 0 1px rgba(24, 54, 83, .08);
    color: var(--cm-text);
    font-size: 16px;
    outline: none;
}

.cm-archive-search input[type="search"]:focus {
    box-shadow: inset 0 0 0 2px rgba(47, 128, 237, .45);
    background: #fff;
}

.cm-archive-search button {
    min-height: 52px;
    padding: 0 22px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--cm-blue), #1f63c7);
    color: #fff;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 12px 28px rgba(47, 128, 237, .24);
    cursor: pointer;
}

.cm-search-suggest {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 16px;
    color: var(--cm-muted);
    font-size: 13px;
}

.cm-search-suggest a {
    display: inline-flex;
    align-items: center;
    min-height: 31px;
    padding: 5px 11px;
    border: 1px solid rgba(24, 54, 83, .12);
    border-radius: 999px;
    background: #fff;
    color: var(--cm-navy);
    font-weight: 700;
    text-decoration: none;
}

.cm-search-suggest a:hover {
    border-color: rgba(47, 128, 237, .42);
    color: var(--cm-blue);
}

.cm-archive-body {
    padding: 24px 0 clamp(54px, 7vw, 96px);
}

.cm-archive-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 28px;
    align-items: start;
}

.cm-archive-content {
    min-width: 0;
}

.cm-result-summary {
    display: inline-flex;
    gap: 7px;
    align-items: baseline;
    margin-bottom: 16px;
    padding: 8px 13px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(24, 54, 83, .08);
    color: var(--cm-muted);
    font-size: 13px;
    font-weight: 800;
}

.cm-result-summary strong {
    color: var(--cm-navy);
    font-size: 18px;
}

.cm-post-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.cm-post-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    overflow: hidden;
    border: 1px solid var(--cm-line);
    border-radius: var(--cm-radius);
    background: var(--cm-card);
    box-shadow: 0 14px 34px rgba(24, 54, 83, .08);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.cm-post-card:hover {
    transform: translateY(-4px);
    border-color: rgba(47, 128, 237, .28);
    box-shadow: var(--cm-shadow);
}

.cm-post-card__thumb {
    display: block;
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(47, 128, 237, .16), rgba(32, 184, 121, .14));
    text-decoration: none;
}

.cm-post-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.01);
    transition: transform .35s ease;
}

.cm-post-card:hover .cm-post-card__thumb img {
    transform: scale(1.055);
}

.cm-post-card__thumb-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: rgba(24, 54, 83, .7);
    font-size: 22px;
    font-weight: 900;
    line-height: 1.12;
    text-align: center;
    letter-spacing: -.02em;
}

.cm-post-card__thumb-fallback::before {
    content: "";
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .42);
}

.cm-post-card__thumb-fallback span {
    position: relative;
}

.cm-post-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 18px;
}

.cm-post-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    margin-bottom: 11px;
    color: var(--cm-muted);
    font-size: 12px;
    font-weight: 700;
}

.cm-post-card__cat {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(47, 128, 237, .1);
    color: var(--cm-blue);
    font-weight: 900;
    text-decoration: none;
}

.cm-post-card__cat:hover {
    background: rgba(47, 128, 237, .16);
    color: #1f63c7;
}

.cm-post-card__title {
    margin: 0 0 10px;
    color: var(--cm-navy);
    font-size: clamp(18px, 2vw, 21px);
    font-weight: 900;
    line-height: 1.42;
}

.cm-post-card__title a {
    color: inherit;
    text-decoration: none;
}

.cm-post-card__title a:hover {
    color: var(--cm-blue);
}

.cm-post-card__excerpt {
    margin: 0 0 18px;
    color: var(--cm-muted);
    font-size: 14px;
    line-height: 1.86;
}

.cm-post-card__footer {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(24, 54, 83, .08);
}

.cm-post-card__more {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--cm-blue);
    font-size: 14px;
    font-weight: 900;
    text-decoration: none;
}

.cm-post-card__more::after {
    content: "→";
    transition: transform .2s ease;
}

.cm-post-card__more:hover::after {
    transform: translateX(3px);
}

.cm-post-card__comments {
    color: var(--cm-muted);
    font-size: 12px;
    font-weight: 700;
}

.cm-archive-sidebar {
    position: sticky;
    top: 24px;
    display: grid;
    gap: 16px;
}

.cm-side-card {
    padding: 20px;
    border: 1px solid var(--cm-line);
    border-radius: 22px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 12px 28px rgba(24, 54, 83, .07);
}

.cm-side-card h2 {
    margin: 0 0 12px;
    color: var(--cm-navy);
    font-size: 18px;
    font-weight: 900;
}

.cm-side-card p {
    margin: 0 0 15px;
    color: var(--cm-muted);
    font-size: 14px;
    line-height: 1.75;
}

.cm-side-card__label {
    display: inline-flex;
    margin-bottom: 10px;
    color: var(--cm-blue);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .04em;
}

.cm-side-card--cta {
    background: linear-gradient(135deg, #fff, #eef7ff);
}

.cm-side-card--business {
    background: linear-gradient(135deg, #fff, #effcf6);
}

.cm-side-card--cta > a,
.cm-side-card--business > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--cm-navy);
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
}

.cm-side-card--business > a {
    background: var(--cm-green);
}

.cm-side-list {
    display: grid;
    gap: 8px;
}

.cm-side-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 13px;
    background: #f7fbfd;
    color: var(--cm-text);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.cm-side-list a:hover {
    background: rgba(47, 128, 237, .1);
    color: var(--cm-blue);
}

.cm-side-list em {
    min-width: 28px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #fff;
    color: var(--cm-muted);
    font-size: 12px;
    font-style: normal;
    text-align: center;
}

.cm-side-chips,
.cm-side-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cm-side-chips a,
.cm-side-tags a {
    display: inline-flex;
    align-items: center;
    min-height: 31px;
    padding: 5px 10px;
    border: 1px solid rgba(24, 54, 83, .11);
    border-radius: 999px;
    background: #fff;
    color: var(--cm-navy);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.cm-side-chips a:hover,
.cm-side-tags a:hover {
    border-color: rgba(47, 128, 237, .35);
    color: var(--cm-blue);
}

.cm-pagination {
    margin-top: 30px;
}

.cm-pagination ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cm-pagination li {
    margin: 0;
}

.cm-pagination a,
.cm-pagination span {
    display: grid;
    place-items: center;
    min-width: 42px;
    min-height: 42px;
    padding: 6px 12px;
    border: 1px solid rgba(24, 54, 83, .12);
    border-radius: 999px;
    background: #fff;
    color: var(--cm-navy);
    font-weight: 900;
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(24, 54, 83, .06);
}

.cm-pagination .current {
    border-color: transparent;
    background: var(--cm-blue);
    color: #fff;
}

.cm-pagination a:hover {
    border-color: rgba(47, 128, 237, .35);
    color: var(--cm-blue);
}

.cm-empty-state {
    padding: clamp(28px, 5vw, 46px);
    border: 1px solid var(--cm-line);
    border-radius: var(--cm-radius);
    background: #fff;
    box-shadow: var(--cm-shadow);
    text-align: center;
}

.cm-empty-state__icon {
    display: grid;
    place-items: center;
    width: 70px;
    height: 70px;
    margin: 0 auto 16px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(47, 128, 237, .12), rgba(32, 184, 121, .14));
    color: var(--cm-blue);
    font-size: 34px;
    font-weight: 900;
}

.cm-empty-state h2 {
    margin: 0 0 10px;
    color: var(--cm-navy);
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 900;
}

.cm-empty-state p {
    max-width: 620px;
    margin: 0 auto 20px;
    color: var(--cm-muted);
    line-height: 1.85;
}

.cm-empty-state .cm-archive-search {
    margin-inline: auto;
}

.cm-empty-state__links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 16px;
}

.cm-empty-state__links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #f5f9fc;
    color: var(--cm-navy);
    font-weight: 900;
    text-decoration: none;
}

@media (max-width: 1024px) {
    .cm-archive-layout {
        grid-template-columns: 1fr;
    }

    .cm-archive-sidebar {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .cm-archive-shell {
        width: min(100% - 26px, 1160px);
    }

    .cm-archive-hero {
        padding-top: 36px;
    }

    .cm-archive-search {
        grid-template-columns: 1fr;
        border-radius: 18px;
    }

    .cm-archive-search button {
        width: 100%;
    }

    .cm-post-grid,
    .cm-archive-sidebar {
        grid-template-columns: 1fr;
    }

    .cm-post-card__body {
        padding: 16px;
    }

    .cm-post-card__meta {
        gap: 6px;
    }

    .cm-side-card {
        padding: 18px;
    }
}

@media (max-width: 480px) {
    .cm-archive-hero h1 {
        font-size: 30px;
    }

    .cm-archive-hero p {
        font-size: 14px;
    }

    .cm-post-card__thumb {
        aspect-ratio: 1.62 / 1;
    }

    .cm-post-card__title {
        font-size: 18px;
    }
}
