/* ============================================================
   Кейсы (/cases, /cases/{slug}) - стили только раздела кейсов.
   Палитра и радиусы - переменные темы (app.css :root).
   Подключается через custom_css на страницах cases / case-view.
   ============================================================ */

/* Контейнер раздела: t-container в теме не определён - задаём здесь */
.cases-page .t-container,
.case-page .t-container {
    max-width: 1240px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

.cases-hero {
    padding: calc(var(--site-header-offset, 144px) - 24px) 0 8px;
}

.cases-hero h1 {
    margin: 0 0 14px;
    font-size: clamp(30px, 4vw, 42px);
    line-height: 1.15;
    color: var(--site-ink);
}

.cases-hero p {
    margin: 0;
    max-width: 720px;
    color: rgba(22, 55, 76, 0.75);
    font-size: 17px;
    line-height: 1.6;
}

.cases-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
    padding: 40px 0 24px;
}

/* --- фильтр слева (замечание Дианы по прототипу) --- */

.cases-aside {
    position: sticky;
    top: calc(var(--site-header-offset, 144px) + 16px);
    display: grid;
    gap: 24px;
}

.cases-filter__title,
.cases-aside__title {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(22, 55, 76, 0.55);
}

.cases-filter {
    background: var(--site-surface-muted, #f7f4ef);
    border: 1px solid var(--site-line, rgba(210, 214, 220, 0.9));
    border-radius: 16px;
    padding: 18px;
}

.cases-filter__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    margin: 0 0 6px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--site-ink);
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.cases-filter__item:last-child {
    margin-bottom: 0;
}

.cases-filter__item:hover {
    background: rgba(17, 56, 78, 0.06);
}

.cases-filter__item.is-active {
    background: #fff;
    border-color: var(--site-accent, #11384e);
    font-weight: 600;
}

.cases-filter__count {
    flex: none;
    min-width: 26px;
    text-align: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(17, 56, 78, 0.08);
    color: rgba(22, 55, 76, 0.75);
    font-size: 13px;
}

.cases-aside__links {
    display: grid;
    gap: 8px;
}

.cases-aside__links a {
    padding: 9px 12px;
    border: 1px solid var(--site-line, rgba(210, 214, 220, 0.9));
    border-radius: 10px;
    background: #fff;
    color: var(--site-ink);
    font-size: 14px;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.cases-aside__links a:hover {
    background: var(--site-surface-muted, #f7f4ef);
    border-color: var(--site-accent, #11384e);
}

/* --- карточки кейсов --- */

.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.case-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--site-surface-muted, #f7f4ef);
    border: 1px solid var(--site-line, rgba(210, 214, 220, 0.9));
    border-radius: 16px;
    padding: 22px;
}

.case-card.is-hidden {
    display: none;
}

.case-card__category {
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(17, 56, 78, 0.08);
    color: var(--site-accent, #11384e);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.case-draft {
    display: inline-block;
    margin-left: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fff3e2;
    border: 1px solid #e8b06b;
    color: #8a5a17;
    font-size: 12px;
    font-weight: 600;
    vertical-align: middle;
}

.case-card__title {
    margin: 0;
    font-size: 20px;
    line-height: 1.25;
    color: var(--site-ink);
}

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

.case-card__title a:hover {
    color: var(--site-accent-soft, #2b3f79);
}

.case-card__meta {
    margin: 0;
    color: rgba(22, 55, 76, 0.6);
    font-size: 14px;
    line-height: 1.5;
}

.case-card__summary {
    margin: 0;
    color: var(--site-ink);
    font-size: 15px;
    line-height: 1.6;
}

.case-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.case-tag {
    padding: 5px 11px;
    border: 1px solid var(--site-line, rgba(210, 214, 220, 0.9));
    border-radius: 999px;
    background: #fff;
    color: rgba(22, 55, 76, 0.8);
    font-size: 13px;
}

.case-tag strong {
    color: var(--site-ink);
    font-weight: 600;
}

.btn-case {
    align-self: flex-start;
    display: inline-block;
    margin-top: auto;
    padding: 11px 18px;
    border-radius: 12px;
    background: var(--site-accent, #11384e);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.btn-case:hover {
    background: var(--site-accent-soft, #2b3f79);
    color: #fff;
}

.btn-case--outline {
    background: #fff;
    color: var(--site-accent, #11384e);
    border: 1px solid var(--site-accent, #11384e);
}

.btn-case--outline:hover {
    background: var(--site-accent, #11384e);
    color: #fff;
}

.cases-empty {
    display: none;
    padding: 28px;
    border: 1px dashed var(--site-line, rgba(210, 214, 220, 0.9));
    border-radius: 16px;
    color: rgba(22, 55, 76, 0.6);
}

/* --- детальная страница кейса --- */

.case-breadcrumbs {
    padding: calc(var(--site-header-offset, 144px) - 32px) 0 0;
    font-size: 14px;
    color: rgba(22, 55, 76, 0.55);
}

.case-breadcrumbs a {
    color: inherit;
    text-decoration: none;
}

.case-breadcrumbs a:hover {
    color: var(--site-accent, #11384e);
}

.case-hero {
    padding: 20px 0 8px;
}

.case-hero h1 {
    margin: 12px 0 14px;
    font-size: clamp(28px, 3.6vw, 40px);
    line-height: 1.15;
    color: var(--site-ink);
}

.case-hero__meta {
    margin: 0;
    color: rgba(22, 55, 76, 0.65);
    font-size: 15px;
    line-height: 1.6;
}

.case-section {
    padding: 28px 0;
}

.case-section h2 {
    margin: 0 0 14px;
    font-size: 24px;
    color: var(--site-ink);
}

.case-panel {
    background: var(--site-surface-muted, #f7f4ef);
    border: 1px solid var(--site-line, rgba(210, 214, 220, 0.9));
    border-radius: 16px;
    padding: 24px;
}

.case-panel p {
    margin: 0 0 14px;
    line-height: 1.7;
    color: var(--site-ink);
}

.case-panel p:last-child {
    margin-bottom: 0;
}

.case-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.case-fact {
    background: var(--site-surface-muted, #f7f4ef);
    border: 1px solid var(--site-line, rgba(210, 214, 220, 0.9));
    border-radius: 16px;
    padding: 18px;
}

.case-fact dt {
    margin: 0 0 6px;
    font-size: 13px;
    color: rgba(22, 55, 76, 0.55);
}

.case-fact dd {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--site-ink);
}

.case-related {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.case-cta {
    margin: 16px 0 40px;
    background: var(--site-accent, #11384e);
    border-radius: 20px;
    padding: 28px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
}

.case-cta p {
    margin: 0;
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    max-width: 640px;
}

.case-cta .btn-case {
    background: #fff;
    color: var(--site-accent, #11384e);
    margin: 0;
}

.case-cta .btn-case:hover {
    background: var(--site-surface-muted, #f7f4ef);
    color: var(--site-accent, #11384e);
}

/* --- адаптив --- */

@media (max-width: 960px) {
    .cases-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .cases-aside {
        position: static;
    }

    .cases-filter {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }

    .cases-filter__title {
        width: 100%;
        margin-bottom: 4px;
    }

    .cases-filter__item {
        width: auto;
        margin: 0;
        background: #fff;
        border-color: var(--site-line, rgba(210, 214, 220, 0.9));
    }

    .cases-filter__item.is-active {
        border-color: var(--site-accent, #11384e);
    }
}
