/*
 * Case studies page refresh (layered on top of case-studies-modern.css).
 * Selectors are prefixed with `html body` so they win over the older
 * `body .case-studies-section … !important` rules without editing them.
 */

:root {
    --csx-navy: #12294f;
    --csx-blue: #2f5597;
    --csx-blue-bright: #2f6fd0;
    --csx-ink: #1f2f4a;
    --csx-muted: #5b6b85;
    --csx-line: #e1e8f3;
    --csx-soft: #f5f8fd;
}

/* ───────────── Intro band ───────────── */
html body .csx-intro {
    background: #fff;
    padding: 36px 0 32px;
    border-bottom: 1px solid var(--csx-line);
}
html body .csx-intro .container { max-width: 1440px; padding-left: 16px; padding-right: 16px; }
html body .csx-intro-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 40px;
    align-items: center;
}
html body .csx-eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--csx-blue-bright);
    margin-bottom: 10px;
}
html body .csx-intro-title {
    font-size: clamp(1.5rem, 2vw, 2rem);
    line-height: 1.22;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--csx-navy);
    margin: 0 0 12px;
    max-width: 32ch;
}
html body .csx-intro-text {
    font-size: 0.98rem;
    line-height: 1.65;
    color: var(--csx-muted);
    margin: 0 0 20px;
    max-width: 68ch;
}
html body .csx-intro-grid--single { grid-template-columns: minmax(0, 1fr); }
html body .csx-intro-grid--single .csx-intro-title { max-width: 40ch; }
html body .csx-intro-links { display: flex; flex-wrap: wrap; gap: 10px; }
html body .csx-jump {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    border: 1px solid #cdd9ec;
    background: #fff;
    color: var(--csx-navy);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: background .2s ease, border-color .2s ease, color .2s ease, transform .2s ease;
}
html body .csx-jump:hover { border-color: var(--csx-blue); color: var(--csx-blue); text-decoration: none; transform: translateY(-1px); }
html body .csx-jump i { font-size: 0.8em; }
html body .csx-jump-primary { background: var(--csx-blue); border-color: var(--csx-blue); color: #fff; }
html body .csx-jump-primary:hover { background: #24467f; border-color: #24467f; color: #fff; }
html body .csx-jump-ghost { border-color: transparent; background: transparent; padding: 0 8px; }
html body .csx-jump-ghost:hover { border-color: transparent; }

html body .csx-intro-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
html body .csx-stat {
    background: var(--csx-soft);
    border: 1px solid var(--csx-line);
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
html body .csx-stat-value {
    font-size: 1.8rem;
    line-height: 1;
    font-weight: 800;
    color: var(--csx-navy);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
html body .csx-stat-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--csx-muted);
}

/* ───────────── Sections ───────────── */
html body .case-studies-section { padding: 44px 0 64px; background: var(--csx-soft); scroll-margin-top: 100px; }
html body .white-papers-section { padding: 56px 0 72px; background: #fff; border-top: 1px solid var(--csx-line); }

/* Results header above each grid */
html body .csx-results-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--csx-line);
}
html body .csx-results-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--csx-navy);
    letter-spacing: -0.01em;
    margin: 0 0 4px;
}
html body .csx-results-count { margin: 0; color: var(--csx-muted); font-size: 0.92rem; }
html body .csx-active-filters { display: flex; flex-wrap: wrap; gap: 8px; }
html body .csx-active-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #e8f0fd;
    border: 1px solid #c9daf6;
    color: var(--csx-blue);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
}
html body .csx-active-chip span { font-size: 1.05rem; line-height: 1; }
html body .csx-active-chip:hover { background: #dbe7fb; color: var(--csx-navy); text-decoration: none; }

/* ───────────── Filter sidebar ───────────── */
html body .case-filter-panel,
html body .resource-side-panel {
    background: #fff;
    border: 1px solid var(--csx-line);
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(18, 41, 79, 0.06);
    padding: 20px;
}
html body .case-filter-title { font-size: 1rem; color: var(--csx-navy); }
html body .case-filter-toolbar { border-bottom-color: var(--csx-line); }
html body .case-filter-count { background: var(--csx-soft); border-color: var(--csx-line); font-size: 0.78rem; }
html body .case-filter-label,
html body .resource-side-label {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: #8090a8;
    margin-bottom: 8px;
}
html body .case-filter-group { margin-bottom: 20px; }

/* Chips become compact list rows */
html body .case-filter-column .case-filter-list { gap: 2px; }
html body .case-filter-column .case-filter-chip,
html body .resource-topic-list li {
    border: 0;
    border-radius: 8px;
    background: transparent;
    padding: 8px 10px;
    font-size: 0.87rem;
    font-weight: 600;
    color: #33476a;
    box-shadow: none;
    transform: none;
}
html body .case-filter-column .case-filter-chip:hover,
html body .resource-topic-list li:hover {
    background: var(--csx-soft);
    color: var(--csx-navy);
    transform: none;
}
html body .case-filter-column .case-filter-chip.active,
html body .resource-topic-list li.active {
    background: #e8f0fd;
    color: var(--csx-blue);
    font-weight: 800;
    box-shadow: inset 3px 0 0 var(--csx-blue);
}
html body .case-filter-column .case-filter-chip.active:hover,
html body .resource-topic-list li.active:hover { background: #dfe9fb; color: var(--csx-blue); }
html body .resource-topic-list { gap: 2px; }
html body .resource-topic-list li.active a { color: var(--csx-blue); }
html body .resource-side-title { color: var(--csx-navy); font-size: 1.1rem; }
html body .resource-side-text { font-size: 0.9rem; }

/* "Show N more" */
html body .csx-collapsed > .csx-chip-extra { display: none !important; }
html body .csx-more-toggle {
    margin-top: 6px;
    padding: 6px 10px;
    border: 0;
    background: none;
    color: var(--csx-blue-bright);
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
}
html body .csx-more-toggle:hover { text-decoration: underline; }

/* ───────────── Cards ───────────── */
html body .case-studies-section .case-study-card.cs-card,
html body .white-papers-section .white-paper-card.cs-card {
    border: 1px solid var(--csx-line) !important;
    border-radius: 14px !important;
    box-shadow: 0 1px 2px rgba(18, 41, 79, 0.04) !important;
    padding: 20px !important;
    gap: 12px !important;
    position: relative;
}
html body .case-studies-section .case-study-card.cs-card:hover,
html body .white-papers-section .white-paper-card.cs-card:hover {
    transform: translateY(-3px) !important;
    border-color: #c5d5ee !important;
    box-shadow: 0 14px 30px rgba(18, 41, 79, 0.1) !important;
}
/* thin accent along the top edge */
html body .case-studies-section .case-study-card.cs-card::before,
html body .white-papers-section .white-paper-card.cs-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--csx-blue) 0%, #5b8fe0 100%);
    opacity: 0;
    transition: opacity .2s ease;
}
html body .case-studies-section .case-study-card.cs-card:hover::before,
html body .white-papers-section .white-paper-card.cs-card:hover::before { opacity: 1; }

html body .case-studies-section .cs-tag,
html body .white-papers-section .cs-tag {
    min-height: 22px !important;
    padding: 0 8px !important;
    font-size: 0.6rem !important;
    letter-spacing: 0.08em !important;
    border-radius: 6px !important;
}

html body .case-studies-section .cs-card-title,
html body .white-papers-section .cs-card-title {
    color: var(--csx-navy) !important;
    font-size: 1.02rem !important;
    line-height: 1.38 !important;
    font-weight: 800 !important;
    letter-spacing: -0.01em !important;
}

/* Exactly three lines; min-height used to be taller than the clamp, so a
   half-cut fourth line showed through. */
html body .case-studies-section .cs-card-problem,
html body .white-papers-section .cs-card-problem {
    font-size: 0.86rem !important;
    line-height: 1.6 !important;
    min-height: calc(1.6em * 3) !important;
    max-height: calc(1.6em * 3) !important;
    -webkit-line-clamp: 3 !important;
    color: var(--csx-muted) !important;
}

html body .case-studies-section .cs-outcome {
    border: 0 !important;
    background: #ecf7f1 !important;
    color: #1d6b45 !important;
    border-radius: 6px !important;
    padding: 5px 10px !important;
    font-size: 0.74rem !important;
    gap: 6px;
}
html body .case-studies-section .cs-outcome::before {
    content: '\2713';
    font-weight: 900;
}

html body .case-studies-section .cs-card-footer,
html body .white-papers-section .cs-card-footer {
    border-top: 1px solid var(--csx-line) !important;
    padding-top: 14px !important;
}

/* Lighter CTA: outline that fills on hover */
html body .case-studies-section .cs-btn-full,
html body .white-papers-section .cs-btn-full {
    background: #fff !important;
    color: var(--csx-blue) !important;
    border: 1px solid #c5d5ee !important;
    box-shadow: none !important;
    min-height: 40px !important;
    border-radius: 9px !important;
    font-size: 0.84rem !important;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}
html body .case-studies-section .cs-btn-full:hover,
html body .white-papers-section .cs-btn-full:hover,
html body .case-studies-section .case-study-card:hover .cs-btn-full,
html body .white-papers-section .white-paper-card:hover .cs-btn-full {
    background: var(--csx-blue) !important;
    border-color: var(--csx-blue) !important;
    color: #fff !important;
}
html body .case-studies-section .cs-btn-full.text-light,
html body .white-papers-section .cs-btn-full.text-light { color: var(--csx-blue) !important; }
html body .case-studies-section .case-study-card:hover .cs-btn-full.text-light,
html body .white-papers-section .white-paper-card:hover .cs-btn-full.text-light { color: #fff !important; }

html body .filter-empty-state {
    background: #fff;
    border: 1px dashed #c5d5ee;
    border-radius: 14px;
    padding: 28px 20px;
    text-align: center;
    color: var(--csx-muted);
}

/* ───────────── Closing CTA ───────────── */
html body .csx-cta { padding: 0 0 72px; background: #fff; }
html body .csx-cta .container { max-width: 1440px; padding-left: 16px; padding-right: 16px; }
html body .csx-cta-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    padding: 36px 40px;
    border-radius: 18px;
    background:
        radial-gradient(600px 200px at 10% -20%, rgba(91, 143, 224, 0.35), rgba(91, 143, 224, 0) 70%),
        linear-gradient(120deg, #10213f 0%, #1f3f76 60%, #23497f 100%);
    color: #dbe6f7;
}
html body .csx-cta-title { color: #fff; font-size: 1.5rem; font-weight: 800; margin: 0 0 6px; }
html body .csx-cta-text { margin: 0; color: rgba(219, 230, 247, 0.9); max-width: 56ch; }
html body .csx-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 24px;
    border-radius: 10px;
    background: #fff;
    color: var(--csx-navy);
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .2s ease, box-shadow .2s ease;
}
html body .csx-cta-btn:hover { color: var(--csx-navy); text-decoration: none; transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25); }

/* ───────────── Responsive ───────────── */
@media (max-width: 991px) {
    html body .csx-intro-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
    html body .csx-intro-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    html body .csx-stat { padding: 14px; }
    html body .csx-stat-value { font-size: 1.6rem; }
}
@media (max-width: 767px) {
    html body .csx-intro { padding: 36px 0 30px; }
    html body .csx-intro-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    html body .case-filter-column .case-filter-list { grid-template-columns: minmax(0, 1fr) !important; }
    html body .csx-cta-inner { padding: 28px 22px; }
    html body .csx-cta-title { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    html body .csx-jump,
    html body .csx-cta-btn,
    html body .case-studies-section .case-study-card.cs-card,
    html body .white-papers-section .white-paper-card.cs-card { transition: none !important; }
}

/* Item count beside each filter option */
html body .csx-chip-count {
    margin-left: auto;
    padding-left: 10px;
    font-size: 0.74rem;
    font-weight: 700;
    color: #8a97ad;
    font-variant-numeric: tabular-nums;
}
html body .case-filter-chip.active .csx-chip-count,
html body .resource-topic-list li.active .csx-chip-count { color: var(--csx-blue); }
html body .case-filter-column .case-filter-chip,
html body .resource-topic-list li a.case-filter-chip { display: flex !important; align-items: center !important; }

/* Align the page width with the rest of the site (was edge-to-edge 1440px). */
html body .csx-intro .container,
html body .csx-cta .container,
html body .case-studies-section > .container,
html body .white-papers-section > .container {
    max-width: 1240px !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
}

/* ───────────── Uniform cards ─────────────
 * Every card reserves the same space for each part, so titles, previews,
 * outcomes and buttons line up across a row whatever the text length.
 */
html body .case-studies-section .cs-card-tags,
html body .white-papers-section .cs-card-tags {
    flex-wrap: nowrap !important;
    overflow: hidden;
    min-height: 22px;
}
html body .case-studies-section .cs-tag,
html body .white-papers-section .cs-tag {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap !important;
    display: inline-block !important;
    line-height: 22px !important;
}
html body .case-studies-section .cs-tag-ind { flex-shrink: 2; }

html body .case-studies-section .cs-card-title,
html body .white-papers-section .cs-card-title {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 3 !important;
    overflow: hidden !important;
    min-height: calc(1.38em * 3) !important;
    max-height: calc(1.38em * 3) !important;
}

html body .case-studies-section .cs-outcomes { min-height: 28px; flex-wrap: nowrap !important; }
html body .case-studies-section .cs-outcome {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}
html body .case-studies-section .cs-card-body,
html body .white-papers-section .cs-card-body { gap: 12px !important; }

/* The JS equaliser sets row heights; keep the button pinned to the bottom. */
html body .case-studies-section .case-study-card.cs-card,
html body .white-papers-section .white-paper-card.cs-card { justify-content: space-between; }

/* Filter options: one line each, full name on hover */
html body .case-filter-column .case-filter-chip .csx-chip-label,
html body .resource-topic-list .csx-chip-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
html body .case-filter-column .case-filter-chip,
html body .resource-topic-list li a.case-filter-chip { white-space: nowrap !important; }
html body .csx-chip-count { flex: 0 0 auto; }

/* Show first 6 cards, then "Show more" */
html body .csx-card-extra.is-hidden { display: none !important; }
html body .csx-show-more-wrap { display: flex; justify-content: center; margin: 8px 0 4px; }
html body .csx-show-more {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 24px;
    border: 1px solid #c5d5ee;
    border-radius: 999px;
    background: #fff;
    color: var(--csx-blue);
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(18, 41, 79, 0.06);
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}
html body .csx-show-more:hover { background: var(--csx-blue); border-color: var(--csx-blue); color: #fff; }
html body .csx-show-more i { font-size: 0.8em; }

/* Tags: wrap so names show in full, but every card reserves two tag rows so
   titles still start at the same height. */
html body .case-studies-section .cs-card-tags,
html body .white-papers-section .cs-card-tags {
    flex-wrap: wrap !important;
    align-content: flex-start;
    min-height: 50px;
}
html body .white-papers-section .cs-card-tags { min-height: 22px; }
html body .case-studies-section .cs-tag,
html body .white-papers-section .cs-tag { flex: 0 0 auto; }
