/* ============================================
   CASE STUDIES GRID — Listing in zigzag layout
   Matches The Strategy Department brand
   ============================================ */

:root {
    --csg-bg:        transparent;
    --csg-card-bg:   #FBF7EE;          /* light cream card */
    --csg-badge-bg:  rgba(63, 86, 52, 0.12); /* light green tint */
    --csg-badge-fg:  #3F5634;          /* deep green */
    --csg-ink:       #1A1A1A;
    --csg-muted:     #555;
    --csg-line:      #E5DFD2;
    --csg-link:      #1A1A1A;
    --csg-serif:     'Playfair Display', 'DM Serif Display', Georgia, serif;
    --csg-sans:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.csg {
    font-family: var(--csg-sans);
    color: var(--csg-ink);
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
}

/* ============================================
   FILTER BUTTONS
   ============================================ */
.csg__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 0 0 40px;
    padding: 0;
}
.csg__filter {
    display: inline-block;
    padding: 10px 22px;
    background: transparent;
    color: var(--csg-ink);
    border: 1.5px solid var(--csg-ink);
    border-radius: 999px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: background .2s ease, color .2s ease;
    line-height: 1.2;
    cursor: pointer;
    font-family: inherit;
}
.csg__filter:hover {
    background: var(--csg-ink);
    color: #fff;
}
.csg__filter.is-active {
    background: var(--csg-ink);
    color: #fff;
    border-color: var(--csg-ink);
}

/* ============================================
   CARDS LIST (zigzag layout)
   ============================================ */
.csg__list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.csg__card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: var(--csg-card-bg);
    border-radius: 18px;
    overflow: hidden;
    align-items: stretch;
}

/* Zigzag: alternate sides */
.csg__card--media-right .csg__card-media { order: 2; }
.csg__card--media-right .csg__card-body  { order: 1; }
.csg__card--media-left  .csg__card-media { order: 1; }
.csg__card--media-left  .csg__card-body  { order: 2; }

.csg__card-media {
    display: block;
    overflow: hidden;
    background: #ddd;
    position: relative;
    min-width: 0;
}
/* Truco de proporción con padding: da al cuadro la proporción real de la
   foto (inline desde PHP) SIN afectar jamás el ancho de la columna.
   Si el texto es más alto, el cuadro se estira y la imagen cubre centrada. */
.csg__card-media::before {
    content: "";
    display: block;
    width: 100%;
    padding-top: var(--csg-img-pad, 62.5%);
}
.csg__card-media img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    object-fit: cover !important;
    object-position: center center !important;
    display: block;
}

.csg__card-body {
    min-width: 0;
    padding: 48px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
}

.csg__card-badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--csg-badge-bg);
    color: var(--csg-badge-fg);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-radius: 999px;
    align-self: flex-start;
}

.csg__card-title {
    font-family: var(--csg-sans);
    font-size: clamp(22px, 2.2vw, 28px);
    font-weight: 800;
    line-height: 1.2;
    margin: 0;
    letter-spacing: -0.3px;
}
.csg__card-title a {
    color: var(--csg-ink);
    text-decoration: none;
}

.csg__card-excerpt {
    font-size: 16px;
    line-height: 1.6;
    color: var(--csg-muted);
    margin: 0;
}

.csg__card-link {
    color: var(--csg-link);
    text-decoration: underline;
    text-underline-offset: 6px;
    text-decoration-thickness: 1.5px;
    font-size: 15px;
    font-weight: 600;
    align-self: flex-start;
    margin-top: 6px;
    transition: opacity .2s ease;
}
.csg__card-link:hover {
    opacity: .7;
}

/* Cards without thumbnail: body takes full width */
.csg__card:not(:has(.csg__card-media)) {
    grid-template-columns: 1fr;
}
.csg__card:not(:has(.csg__card-media)) .csg__card-body {
    padding: 60px 60px;
}

/* ============================================
   PAGINATION
   ============================================ */
.csg__pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 50px;
    flex-wrap: wrap;
}
.csg__page-item a,
.csg__page-item span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1.5px solid var(--csg-line);
    background: var(--csg-card-bg);
    color: var(--csg-ink);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all .2s ease;
}
.csg__page-item a:hover {
    background: var(--csg-ink);
    color: #fff;
    border-color: var(--csg-ink);
}
.csg__page-item .current {
    background: var(--csg-ink);
    color: #fff;
    border-color: var(--csg-ink);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.csg__empty {
    text-align: center;
    padding: 60px 20px;
    font-family: var(--csg-serif);
    font-style: italic;
    font-size: 20px;
    color: var(--csg-muted);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .csg { padding: 0 20px; }

    /* --- Filtros: alineados a la izquierda, wrap natural --- */
    .csg__filters {
        justify-content: flex-start;
        flex-wrap: wrap;
        overflow: visible;
        gap: 8px;
        padding-bottom: 0;
        margin-bottom: 32px;
    }
    .csg__filter {
        flex-shrink: 1;
        padding: 8px 16px;
        font-size: 11px;
        letter-spacing: 0.5px;
        max-width: 100%;
        white-space: normal;
        text-align: center;
        line-height: 1.3;
    }

    /* --- Cards: stack vertical --- */
    .csg__card {
        grid-template-columns: 1fr;
        min-height: 0;
    }
    /* En mobile siempre imagen arriba, body abajo --- regardless of zigzag */
    .csg__card--media-right .csg__card-media,
    .csg__card--media-left  .csg__card-media {
        order: 1;
        min-height: 0;
        max-height: none;
        height: auto;
    }
    .csg__card--media-right .csg__card-body,
    .csg__card--media-left  .csg__card-body {
        order: 2;
        padding: 30px 26px;
    }
    .csg__card-media img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    .csg__card-title { font-size: 22px; }

    /* --- Paginación: padding extra abajo para no chocar con el FAB ↑ --- */
    .csg__pagination {
        margin-bottom: 60px;
    }
}
