/* =====================================================
   CLEANUP
   ===================================================== */

/* Remove the hero banner completely */
.banner {
    display: none !important;
}

/* Remove the folder icon beside the portal title */
.article-overview-page h1 img {
    display: none !important;
}

/* =====================================================
   DESKTOP SITE HEADER
   ===================================================== */

/*
 * Remove the main site header from normal document flow.
 * Position the Experlogix logo in the upper-right corner.
 */
body > header.header {
    position: absolute !important;

    inset-block-start: 0.75rem;
    inset-inline-end: 2vw;

    z-index: 20;

    width: auto !important;
    min-height: 0 !important;

    margin: 0 !important;
    padding: 0 !important;

    background: transparent !important;

    border: 0 !important;
    box-shadow: none !important;
}

body > header.header .header-site-branding {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    margin: 0 !important;
    padding: 0 !important;
}

body > header.header .header-site-branding a {
    display: flex;
    align-items: center;

    margin: 0 !important;
    padding: 0 !important;
}

body > header.header .header-logo {
    width: auto !important;
    height: 40px !important;

    max-width: 210px !important;
    max-height: 40px !important;

    margin: 0 !important;
    padding: 0 !important;

    object-fit: contain;
}

body > header.header .header-content:empty {
    display: none !important;
}

/* =====================================================
   PAGE LAYOUT
   ===================================================== */

body,
main.article-overview-page.detail-layout.body {
    background: #ffffff;
}

.content {
    width: min(1900px, 96vw);
    max-width: none;

    margin: 0 auto;
}

/* Override the original Scroll Sites grid layout */
.article-overview-page .content {
    display: block !important;

    row-gap: 0 !important;
    column-gap: 0 !important;

    padding-block-start: 0 !important;

    padding-block-end:
        calc(var(--padding) * 0.75) !important;
}

/* =====================================================
   INTRO AREA
   ===================================================== */

.article-overview-page .intro {
    max-inline-size: none !important;

    margin-top: 2rem;
    margin-bottom: 2rem !important;

    padding-bottom: 0 !important;
}

/*
 * Prevent the title and intro text from extending
 * beneath the upper-right logo.
 */
.article-overview-page .intro > h1,
.article-overview-page .intro > p {
    max-width: calc(100% - 250px);
}

.article-overview-page .intro > p {
    max-inline-size: unset !important;
}

/* Hide empty image wrappers after JS moves the icons */
.article-overview-page .intro .block-image:empty {
    display: none !important;
}

/* =====================================================
   PAGE TITLE
   ===================================================== */

.article-overview-page h1 {
    margin-top: 0 !important;
    margin-bottom: 0.35rem;

    color: #0c214c;

    font-size: 2.1rem;
    font-weight: 700;
    line-height: 1.15;

    text-align: left !important;
}

.intro p {
    margin-top: 0;
    margin-bottom: 0;

    color: #5b6475;

    font-size: 0.95rem;
    line-height: 1.4;
}

.intro p:empty {
    display: none;
}

/* =====================================================
   CATEGORY CONTAINER
   ===================================================== */

.portal-category-section {
    margin: 0 !important;
    padding: 0 !important;
}

.portal-categories {
    display: flex;
    flex-direction: column;

    gap: 1.4rem;

    margin-top: 0 !important;

    /*
     * Maintain separation between the final APIs
     * product row and the footer.
     */
    padding-bottom: 1.4rem;
}

/* =====================================================
   CATEGORY HEADER
   ===================================================== */

.portal-category-header {
    display: flex;
    align-items: center;

    gap: 1rem;
}

.portal-category-title {
    display: flex;
    align-items: center;

    gap: 0.55rem;

    margin: 0;

    color: #0c214c;

    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.05;

    white-space: nowrap;
}

/* =====================================================
   CATEGORY ICONS
   ===================================================== */

.portal-category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 22px;
    height: 22px;

    flex: 0 0 22px;

    overflow: visible;
}

.portal-category-icon img {
    display: block !important;

    width: 22px !important;
    height: 22px !important;

    max-width: 22px !important;
    max-height: 22px !important;

    margin: 0 !important;
    padding: 0 !important;

    object-fit: contain;
}

/* Divider between category name and product count */
.portal-category-header::after {
    content: "";

    height: 1px;

    flex: 1;

    background: #d7dce5;
}

.portal-category-count {
    color: #6b7280;

    font-size: 0.8rem;
    font-weight: 500;

    white-space: nowrap;
}

/* =====================================================
   PRODUCT GRID
   ===================================================== */

.portal-category-products {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(220px, 1fr));

    column-gap: 1.5rem;
    row-gap: 0.75rem;

    margin-top: 0.5rem;
}

.portal-category-products > li {
    display: block;

    min-width: 0;

    margin: 0 !important;
    padding: 0 !important;

    list-style: none !important;
}

/* =====================================================
   PRODUCT TILE
   ===================================================== */

.tile {
    position: relative;

    height: 100%;
    min-height: auto !important;

    overflow: visible !important;

    background: #ffffff !important;

    border: 1px solid #d7dce5 !important;
    border-radius: 8px !important;

    box-shadow: none !important;

    /*
     * A slightly slower easing curve makes the stronger
     * hover movement feel smooth rather than abrupt.
     */
    transition:
        transform 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease,
        background-color 0.22s ease !important;

    will-change: transform;
}

/* Stronger hover pop */
.tile:hover {
    z-index: 2;

    transform:
        translateY(-5px)
        scale(1.015) !important;

    background: #ffffff !important;

    border-color: rgba(3, 80, 216, 0.5) !important;

    box-shadow:
        0 12px 28px rgba(12, 33, 76, 0.18),
        0 4px 10px rgba(3, 80, 216, 0.1) !important;
}

/* Matching keyboard-focus treatment */
.tile:focus-within {
    z-index: 2;

    transform:
        translateY(-3px)
        scale(1.01) !important;

    border-color: #0350d8 !important;

    box-shadow:
        0 10px 24px rgba(12, 33, 76, 0.16),
        0 0 0 3px rgba(3, 80, 216, 0.16) !important;
}

/* Keep the requested zero-padding tile body */
.tile-body {
    display: flex;
    flex-direction: column;

    gap: 8px;

    height: 100%;

    padding: 0 !important;
}

/* =====================================================
   PRODUCT TITLE
   ===================================================== */

.tile-title {
    margin: 0 !important;

    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
}

.tile-title a {
    color: #0c214c !important;
    text-decoration: none;
}

.tile-title a:hover,
.tile-title a:focus-visible {
    color: #0350d8 !important;
    text-decoration: underline;
}

/* =====================================================
   PRODUCT SUBTITLE
   ===================================================== */

.portal-product-subtitle {
    margin: 0;

    color: #0350d8;

    font-size: 0.85rem;
    font-weight: 600;
}

/* =====================================================
   PRODUCT DESCRIPTION
   ===================================================== */

.portal-product-description {
    display: -webkit-box;

    overflow: hidden;

    color: #5b6475;

    font-size: 0.9rem;
    line-height: 1.35;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.tile .tile-text {
    color: inherit !important;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 1400px) {
    .portal-category-products {
        grid-template-columns:
            repeat(3, minmax(220px, 1fr));
    }
}

@media (max-width: 1000px) {
    .portal-category-products {
        grid-template-columns:
            repeat(2, minmax(220px, 1fr));
    }
}

@media (max-width: 800px) {
    /*
     * Restore the standard Scroll Sites header flow
     * on smaller screens.
     */
    body > header.header {
        position: relative !important;

        inset: auto !important;

        width: 100% !important;
        min-height: initial !important;

        padding: initial !important;

        background:
            var(--theme-header-background-color) !important;
    }

    body > header.header .header-logo {
        height:
            var(--theme-header-logo-size, 40px) !important;

        max-width: none !important;
        max-height:
            var(--theme-header-logo-size, 40px) !important;
    }

    .article-overview-page .content {
        padding-block-start: 0 !important;
    }

    .article-overview-page .intro {
        margin-top: 1.25rem;
        margin-bottom: 1.5rem !important;
    }

    .article-overview-page .intro > h1,
    .article-overview-page .intro > p {
        max-width: none;
    }

    .article-overview-page h1 {
        font-size: 1.85rem;
    }

    .portal-category-header {
        flex-wrap: wrap;
        row-gap: 0.4rem;
    }

    .portal-category-header::after {
        display: none;
    }

    .portal-category-count {
        width: 100%;
        padding-left: 27.5px;
    }

    .portal-category-products {
        grid-template-columns: 1fr;
        row-gap: 1rem;
    }

    .portal-categories {
        padding-bottom: 1rem;
    }

    .tile-body {
        padding: 0 !important;
    }

    /*
     * Avoid scaling cards on small screens where the
     * available horizontal space is limited.
     */
    .tile:hover,
    .tile:focus-within {
        transform: translateY(-3px) !important;
    }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    .tile {
        transition: none !important;
        will-change: auto;
    }

    .tile:hover,
    .tile:focus-within {
        transform: none !important;
    }
}

body > header.header {
    container-type: normal !important;
}