.hcs-wrap {
    --hcs-navy: #102f50;
    --hcs-navy-dark: #0b223a;
    --hcs-border: #e2e8f0;
    --hcs-muted: #526174;
    --hcs-bg: #f7f9fc;
    max-width: 1380px;
    margin: 2.75rem auto 3.5rem;
    padding: 0 1.25rem;
}

.hcs-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.75rem;
    align-items: stretch;
}

.hcs-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100%;
    padding: 1.75rem;
    text-align: center;
    background: #fff;
    border: 1px solid var(--hcs-border);
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(16, 47, 80, 0.08);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.hcs-card:hover {
    transform: translateY(-4px);
    border-color: #c9d5e2;
    box-shadow: 0 15px 34px rgba(16, 47, 80, 0.14);
}

.hcs-logo-area {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 175px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -0.2rem -0.2rem 1rem;
    padding: .6rem;
    border-radius: 12px;
    background: #fff;
}

.hcs-logo-link {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hcs-logo {
    display: block;
    box-sizing: border-box;
    max-width: 100%;
    max-height: 150px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.hcs-card--wide-logo .hcs-logo {
    width: 100%;
    max-height: 145px;
}

/* The supplied Plumbing Gang artwork has substantial white space around the logo.
   Scale only this sponsor so the visible mark matches the other sponsor logos. */
.hcs-card--plumbing .hcs-logo {
    width: 175%;
    max-width: none;
    max-height: none;
}

.hcs-logo-placeholder {
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--hcs-bg);
    color: var(--hcs-navy);
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: .03em;
}

.hcs-name {
    margin: .35rem 0 .7rem;
    color: var(--hcs-navy-dark);
    font-size: clamp(1.22rem, 2vw, 1.48rem);
    line-height: 1.25;
}

.hcs-description {
    margin: 0;
    color: var(--hcs-muted);
    line-height: 1.6;
    font-size: .98rem;
}

.hcs-contact {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-top: 1rem;
    overflow-wrap: anywhere;
}

.hcs-contact a {
    color: var(--hcs-navy);
    text-decoration: none;
    font-weight: 650;
}

.hcs-contact a:hover,
.hcs-contact a:focus {
    text-decoration: underline;
}

.hcs-actions {
    margin-top: auto;
    padding-top: 1.35rem;
}

.hcs-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    min-height: 44px;
    padding: .78rem 1.15rem;
    border-radius: 999px;
    background: var(--hcs-navy);
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 700;
    line-height: 1.2;
    transition: background .2s ease, transform .2s ease;
}

.hcs-button:hover,
.hcs-button:focus {
    background: var(--hcs-navy-dark);
    transform: translateY(-1px);
}

/* If the final desktop row contains only one sponsor, centre it. */
@media (min-width: 981px) {
    .hcs-grid > .hcs-card:last-child:nth-child(3n + 1) {
        grid-column: 2;
    }
}

@media (max-width: 980px) {
    .hcs-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .hcs-wrap {
        margin-top: 1.75rem;
        padding: 0 .85rem;
    }

    .hcs-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .hcs-card {
        padding: 1.25rem;
        border-radius: 15px;
    }

    .hcs-logo-area {
        height: 135px;
    }

    .hcs-logo,
    .hcs-card--wide-logo .hcs-logo,
    .hcs-card--plumbing .hcs-logo {
        width: auto;
        max-width: 100%;
        max-height: 115px;
        height: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hcs-card,
    .hcs-button {
        transition: none;
    }

    .hcs-card:hover,
    .hcs-button:hover {
        transform: none;
    }
}

/* v1.1.4: hard containment for sponsor artwork.
   These rules deliberately override theme image styles and the older Plumbing Gang scaling rule. */
.hcs-card,
.hcs-logo-area,
.hcs-logo-link {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
}

.hcs-logo-area {
    width: 100%;
    overflow: hidden;
}

.hcs-logo-link {
    overflow: hidden;
}

.hcs-logo,
.hcs-card--wide-logo .hcs-logo,
.hcs-card--plumbing .hcs-logo {
    display: block !important;
    box-sizing: border-box !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 150px !important;
    object-fit: contain !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

@media (max-width: 640px) {
    .hcs-logo-area,
    .hcs-logo-link {
        width: 100% !important;
        max-width: 100% !important;
    }

    .hcs-logo,
    .hcs-card--wide-logo .hcs-logo,
    .hcs-card--plumbing .hcs-logo {
        width: auto !important;
        max-width: 100% !important;
        max-height: 115px !important;
        height: auto !important;
    }
}

/* v1.1.6: keep the new wide Vellquip artwork comfortably inside its card. */
.hcs-card--wide-logo .hcs-logo[src*="vellquip.png"] {
    width: auto !important;
    max-width: 92% !important;
    max-height: 130px !important;
}

@media (max-width: 640px) {
    .hcs-card--wide-logo .hcs-logo[src*="vellquip.png"] {
        max-width: 94% !important;
        max-height: 105px !important;
    }
}

/* v1.1.7: the Plumbing Gang logo is now tightly trimmed with transparency.
   Give it more visual presence while keeping it strictly contained in its card. */
.hcs-card--plumbing .hcs-logo[src*="the-plumbing-gang.png"] {
    width: auto !important;
    height: auto !important;
    max-width: 88% !important;
    max-height: 165px !important;
    object-fit: contain !important;
}

@media (max-width: 640px) {
    .hcs-card--plumbing .hcs-logo[src*="the-plumbing-gang.png"] {
        max-width: 82% !important;
        max-height: 125px !important;
    }
}
