﻿/* =========================================================
   BRAND / PARTNER GRID
   Smart Theme Engine Compatible
   ========================================================= */

.logo-entity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 16px);
    overflow: hidden;
    background-color: var(--surface-color);
    color: var(--default-color);
}

/* Each brand / partner cell */
.logo-entity-item {
    position: relative;
    min-width: 0;
    min-height: 150px;
    padding: 22px 18px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    background-color: var(--surface-color);
    color: var(--default-color);
    text-decoration: none;
    transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

/* Cell separators */
.logo-entity-item {
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

/* Remove right border from the last visible column when possible */
.logo-entity-grid > .logo-entity-item:last-child {
    border-right-color: transparent;
}

/* Logo container */
.logo-entity-image {
    width: 100%;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    /* Normalize all logos */
    .logo-entity-image img {
        display: block;
        width: auto;
        height: auto;
        max-width: 140px;
        max-height: 72px;
        object-fit: contain;
    }

/* Brand / Partner name */
.logo-entity-title {
    margin: 0;
    max-width: 100%;
    color: var(--heading-color);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

/* Clickable brand */
.logo-entity-item-link {
    cursor: pointer;
}

    /* Modern hover */
    .logo-entity-item-link:hover {
        background-color: var(--accent-soft);
        color: var(--accent-color);
        text-decoration: none;
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
        z-index: 2;
    }

        /* Hover brand title */
        .logo-entity-item-link:hover .logo-entity-title {
            color: var(--accent-color);
        }

    /* Keyboard accessibility */
    .logo-entity-item-link:focus-visible {
        outline: 2px solid var(--accent-color);
        outline-offset: -3px;
        background-color: var(--accent-soft);
        z-index: 3;
    }

/* =========================================================
   SECTION SPACING
   ========================================================= */

#brand-section .section-title,
#partners-section .section-title {
    margin-bottom: 28px;
}

#brand-section .container,
#partners-section .container {
    position: relative;
}

/* Reduce excessive spacing around these sections */
#brand-section.section,
#partners-section.section {
    padding-top: 48px;
    padding-bottom: 48px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

/* Large screens */
@media (min-width: 1400px) {
    .logo-entity-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .logo-entity-item {
        min-height: 150px;
    }
}

/* Desktop */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .logo-entity-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

/* Tablet landscape */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .logo-entity-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 991.98px) {
    .logo-entity-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .logo-entity-item {
        min-height: 145px;
        padding: 20px 16px;
    }

    .logo-entity-image {
        height: 68px;
    }

        .logo-entity-image img {
            max-width: 130px;
            max-height: 68px;
        }
}

/* Mobile */
@media (max-width: 767.98px) {
    .logo-entity-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        border-radius: 14px;
    }

    .logo-entity-item {
        min-height: 135px;
        padding: 18px 12px;
        gap: 10px;
    }

    .logo-entity-image {
        height: 60px;
    }

        .logo-entity-image img {
            max-width: 115px;
            max-height: 60px;
        }

    .logo-entity-title {
        font-size: 14px;
    }

    #brand-section .section-title,
    #partners-section .section-title {
        margin-bottom: 22px;
    }

    #brand-section.section,
    #partners-section.section {
        padding-top: 36px;
        padding-bottom: 36px;
    }
}

/* Very small screens */
@media (max-width: 420px) {
    .logo-entity-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .logo-entity-item {
        min-height: 125px;
        padding: 16px 10px;
    }

    .logo-entity-image {
        height: 56px;
    }

        .logo-entity-image img {
            max-width: 100px;
            max-height: 56px;
        }

    .logo-entity-title {
        font-size: 13px;
    }
}

/* =========================================================
   DARK MODE
   ========================================================= */

:root[data-theme="dark"] .logo-entity-grid {
    background-color: var(--surface-color);
    border-color: var(--border-color);
}

:root[data-theme="dark"] .logo-entity-item {
    background-color: var(--surface-color);
    color: var(--default-color);
    border-color: var(--border-color);
}

:root[data-theme="dark"] .logo-entity-title {
    color: var(--heading-color);
}

:root[data-theme="dark"] .logo-entity-item-link:hover {
    background-color: var(--accent-soft);
    color: var(--accent-color);
}

/* =========================================================
   OPTIONAL LOGO POLISH
   Helps logos with white backgrounds look cleaner
   ========================================================= */

.logo-entity-image img {
    border-radius: 6px;
}

    /* Prevent broken images from distorting layout */
    .logo-entity-image img[src=""],
    .logo-entity-image img:not([src]) {
        visibility: hidden;
    }
