/* ============================================================
   Case Studies Grid — case-studies.css  v4
   Image-as-background cards · Dropdown filter pills
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bona+Nova:ital,wght@0,400;0,700;1,400&display=swap');

/* --- Wrapper --- */
.csg-wrapper {
    font-family: "Bona Nova", Sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 0 80px;
}

/* ============================================================
   FILTER BAR — refined inline pills with depth & micro-interaction
   ============================================================ */
.csg-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 4px 0 30px;
    margin-bottom: 44px;
    border-bottom: 1px solid #ececec;
    position: relative;
}

.csg-filter-label {
    font-family: "Bona Nova", Sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #888;
    margin-right: 14px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .18em;
    position: relative;
}

.csg-filter-label::after {
    content: '';
    display: inline-block;
    width: 22px;
    height: 1px;
    background: #d8d8d8;
    vertical-align: middle;
    margin-left: 14px;
}

.csg-filter-btn {
    font-family: "Bona Nova", Sans-serif;
    padding: 13px 30px;
    border-radius: 100px;
    border: 1px solid #e2e2e2;
    background: #fff;
    color: #1a1a1a;
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    transition: background .22s ease, color .22s ease, border-color .22s ease, box-shadow .25s ease, transform .15s ease;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    letter-spacing: .015em;
    box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 1px 1px rgba(0,0,0,.02);
    -webkit-tap-highlight-color: transparent;
}

.csg-filter-btn:hover {
    border-color: #111;
    color: #111;
    background: #fafafa;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    transform: translateY(-1px);
}

.csg-filter-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

.csg-filter-btn.active {
    background: linear-gradient(180deg, #2a2a2a 0%, #0a0a0a 100%);
    color: #fff;
    border-color: #0a0a0a;
    box-shadow: 0 6px 18px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.08);
}

.csg-filter-btn.active:hover {
    background: linear-gradient(180deg, #1a1a1a 0%, #000 100%);
    box-shadow: 0 8px 22px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.1);
}

/* Dropdown wrapper */
.csg-filter-dropdown {
    position: relative;
}

/* Chevron — drawn with CSS so we can morph to × when a term is selected */
.csg-filter-toggle::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform .25s ease, border-color .2s ease;
    display: inline-block;
    margin-left: 2px;
    opacity: .65;
}

.csg-filter-btn:hover.csg-filter-toggle::after {
    opacity: 1;
}

.csg-filter-dropdown.open .csg-filter-toggle::after {
    transform: rotate(225deg) translate(-2px, -2px);
}

.csg-filter-toggle.active::after {
    content: '\00D7';
    width: auto;
    height: auto;
    border: none;
    font-size: 16px;
    line-height: 1;
    margin-left: 6px;
    opacity: .9;
    transform: none;
}

/* Dropdown menu */
.csg-filter-menu {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    min-width: 240px;
    max-height: 340px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 14px;
    box-shadow: 0 20px 48px rgba(0,0,0,.14), 0 2px 6px rgba(0,0,0,.06);
    padding: 8px;
    z-index: 100;
    display: none;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .2s ease, transform .2s ease;
}

/* Tooltip-style arrow pointing up at the toggle */
.csg-filter-menu::before {
    content: '';
    position: absolute;
    top: -7px;
    left: 32px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-top: 1px solid #ececec;
    border-left: 1px solid #ececec;
    transform: rotate(45deg);
}

.csg-filter-dropdown.open .csg-filter-menu {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.csg-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 11px 16px;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-family: "Bona Nova", Sans-serif;
    font-size: 15px;
    color: #333;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, padding-left .15s ease;
    line-height: 1.3;
}

.csg-dropdown-item:hover {
    background: #f4f4f4;
    color: #111;
    padding-left: 18px;
}

.csg-dropdown-item.active {
    background: #111;
    color: #fff;
}

.csg-dropdown-item.active::after {
    content: '\2713';
    font-size: 13px;
    margin-left: 12px;
    opacity: .9;
}

/* Scrollbar styling for the menu */
.csg-filter-menu::-webkit-scrollbar {
    width: 6px;
}
.csg-filter-menu::-webkit-scrollbar-thumb {
    background: #d8d8d8;
    border-radius: 3px;
}
.csg-filter-menu::-webkit-scrollbar-thumb:hover {
    background: #b8b8b8;
}
.csg-filter-menu::-webkit-scrollbar-track {
    background: transparent;
}

/* ============================================================
   GRID
   ============================================================ */
.csg-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

/* ============================================================
   CARDS — image as full background, title overlaid
   ============================================================ */
.csg-card {
    position: relative;
    aspect-ratio: 16 / 10;
    border-radius: 20px;
    overflow: hidden;
    text-decoration: none;
    background-color: #1a1a1a;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: block;
    transition: transform .35s ease, box-shadow .35s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

.csg-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 48px rgba(0,0,0,.18);
}

.csg-card--no-img {
    background: linear-gradient(135deg, #2a2a2a 0%, #555 100%);
}

/* Dual-axis gradient overlay — darker on the left for the centered stat, softer at the bottom for the tag pill */
.csg-card__overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg,  rgba(0,0,0,.55) 0%,  rgba(0,0,0,.05) 60%, rgba(0,0,0,0) 100%),
        linear-gradient(180deg, rgba(0,0,0,0)   55%, rgba(0,0,0,.45) 100%);
    z-index: 1;
    pointer-events: none;
}

/* Logo badge top-left */
.csg-card__logo-wrap {
    position: absolute;
    top: 22px;
    left: 22px;
    z-index: 3;
    background: #fff;
    border-radius: 12px;
    padding: 12px 22px;
    display: inline-flex;
    align-items: center;
    max-width: 260px;
}

.csg-card__logo {
    max-height: 64px;
    max-width: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

/* Headline stat — sits a touch above vertical center, anchored to the left edge */
.csg-card__stat {
    position: absolute;
    top: 42%;
    left: 32px;
    transform: translateY(-50%);
    z-index: 2;
    max-width: 60%;
    text-align: left;
}

.csg-card__stat-value {
    font-family: "Bona Nova", Sans-serif;
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: .005em;
    text-shadow: 0 2px 14px rgba(0,0,0,.55);
    margin: 0;
    word-break: break-word;
}

/* Title fallback (used only when no stat is set) — same position as stat */
.csg-card__title {
    position: absolute;
    top: 42%;
    left: 32px;
    transform: translateY(-50%);
    z-index: 2;
    max-width: 60%;
    text-align: left;
    font-family: "Bona Nova", Sans-serif;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    margin: 0;
    text-shadow: 0 2px 12px rgba(0,0,0,.5);
    word-break: break-word;
}

/* Tag pill bottom-right */
.csg-card__tag {
    position: absolute;
    bottom: 22px;
    right: 22px;
    z-index: 3;
    background: #fff;
    color: #222;
    font-family: "Bona Nova", Sans-serif;
    font-size: 20px;
    font-weight: 500;
    padding: 11px 26px;
    border-radius: 100px;
    line-height: 1;
    white-space: nowrap;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.csg-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 48px;
}

.csg-page-btn {
    font-family: "Bona Nova", Sans-serif;
    min-width: 38px;
    height: 38px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1.5px solid #e0e0e0;
    background: #fff;
    color: #555;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .18s ease;
    letter-spacing: .01em;
}

.csg-page-btn:hover:not(.active):not(:disabled) {
    border-color: #111;
    color: #111;
}

.csg-page-btn.active {
    background: #111;
    color: #fff;
    border-color: #111;
}

.csg-page-btn:disabled {
    opacity: .25;
    cursor: default;
}

.csg-page-btn--arrow {
    font-size: 16px;
    color: #555;
}

.csg-page-dots {
    padding: 0 6px;
    color: #aaa;
    align-self: center;
    font-size: 14px;
}

/* ============================================================
   NO RESULTS
   ============================================================ */
.csg-no-results {
    text-align: center;
    padding: 80px 20px;
    color: #999;
}

.csg-no-results p {
    font-family: "Bona Nova", Sans-serif;
    font-size: 16px;
    font-style: italic;
    margin: 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .csg-card__stat,
    .csg-card__title {
        left: 24px;
        max-width: 65%;
    }
    .csg-card__stat-value { font-size: 24px; }
    .csg-card__title { font-size: 20px; }
    .csg-card__logo-wrap {
        top: 16px;
        left: 16px;
        padding: 10px 18px;
        max-width: 220px;
    }
    .csg-card__logo { max-height: 52px; }
    .csg-card__tag {
        bottom: 16px;
        right: 16px;
        font-size: 17px;
        padding: 9px 22px;
    }
}

@media (max-width: 700px) {
    .csg-grid { grid-template-columns: 1fr; }
    .csg-card { aspect-ratio: 4 / 3; }
    .csg-card__stat,
    .csg-card__title {
        left: 20px;
        max-width: 70%;
    }
    .csg-card__stat-value { font-size: 22px; }
    .csg-card__title { font-size: 18px; }
    .csg-card__logo-wrap {
        padding: 8px 14px;
        max-width: 190px;
    }
    .csg-card__logo { max-height: 44px; }
    .csg-card__tag {
        font-size: 15px;
        padding: 8px 20px;
    }
    .csg-filters { gap: 8px; }
    .csg-filter-label { margin-right: 4px; }
    .csg-filter-btn {
        padding: 10px 22px;
        font-size: 14px;
    }
    .csg-filter-menu { min-width: 200px; }
}
