/* ==============================================
   Enrollment Rx Card Layouts
   Video Library + User Guides
   ============================================== */

/* ==============================================
   Shared card tokens
   ============================================== */

:root {
    --erx-card-shadow: 0 10px 28px rgba(8, 34, 31, 0.08);
    --erx-card-shadow-hover: 0 16px 40px rgba(8, 34, 31, 0.14);
    --erx-card-transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* Fallback in case .portal-button--primary is still commented out in main.css */
.portal-button--primary {
    --button-bg: linear-gradient(135deg, var(--erx-accent) 60%, var(--erx-accent-dark) 100%);
    --button-color: var(--erx-color-white);
    --button-border-color: var(--erx-accent);
    --button-sweep-color: rgba(0, 0, 0, 0.18);
}

/* ==============================================
   Video Library Main Page
   ============================================== */

ul.flex {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    list-style: none;
    padding-inline-start: 0;
    max-width: var(--shell-max, 1200px);
    margin: 2rem auto;
}

ul.flex > li {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--erx-color-white, #fff);
    border: 1px solid var(--erx-color-border-light, #E4EEF0);
    box-shadow: var(--erx-card-shadow);
    overflow: hidden;
    transition: var(--erx-card-transition);
}

ul.flex > li:hover,
ul.flex > li:focus-within {
    transform: translateY(-3px);
    border-color: var(--erx-brand-soft, #E6F3FA);
    box-shadow: var(--erx-card-shadow-hover);
}

ul.flex > li > img,
ul.flex > li > a > img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    height: auto;
    object-fit: contain;
    background: var(--erx-color-white, #fff);
    margin: 0;
}

/* Disable click interaction on Video Library thumbnails only */
ul.flex > li > img,
ul.flex > li > a:has(> img) {
    pointer-events: none;
    cursor: default;
}

ul.flex .heading4 {
    font-family: var(--font-sans);
    font-size: var(--text-md);
    font-weight: 800;
    line-height: var(--line-tight);
    color: var(--erx-ink);
    margin: 1rem 1rem 0.5rem;
}

ul.flex .vid-lib-description {
    flex: 1 1 auto;
    color: var(--erx-text-muted);
    margin: 0 1rem 1.25rem;
}

ul.flex .vid-lib-button {
    margin: auto 1rem 1.25rem;
    padding-bottom: 0.25rem;
}

ul.flex .vid-lib-button > a {
    width: 100%;
}

ul.flex .portal-button__chevrons {
    flex: 0 0 auto;
}

/* ==============================================
   User Guides Main Page
   Distinct product-card treatment
   ============================================== */

/*.product-container {
    width: min(var(--shell-max, 1200px), calc(100% - 2rem));
    margin: 2rem auto 3rem;
}*/

.product-container {
    max-width: 1200px;
    margin: 2rem auto 3rem;
}

ul.flex2 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    list-style: none;
    padding-inline-start: 0;
    max-width: 1200px;
    margin: 0 auto;
}

ul.flex2 > li {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0;
    margin: 0;
    background-color: var(--erx-color-white, #fff) !important;
    border: 1px solid var(--erx-color-border-light, #E4EEF0);
    box-shadow: 0 8px 24px rgba(8, 34, 31, 0.07);
    overflow: hidden;
    transition: var(--erx-card-transition);
}

ul.flex2 > li::before {
    content: none;
}

ul.flex2 > li:hover,
ul.flex2 > li:focus-within {
    transform: translateY(-2px);
    border-color: var(--erx-brand-soft, #E6F3FA);
    box-shadow: 0 14px 34px rgba(8, 34, 31, 0.12);
}

ul.flex2 > li > *:first-child {
    margin-top: 0;
}

ul.flex2 > li > *:last-child {
    margin-bottom: 0;
}

ul.flex2 > li > * {
    margin-left: 0;
    margin-right: 0;
}

ul.flex2 > li > img,
ul.flex2 > li > a > img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    height: auto;
    object-fit: contain;
    background: var(--erx-brand-soft-2, #F7FBFD);
    margin: 0;
    padding: 0.75rem;
}

/* Keep User Guide product thumbnails non-interactive only inside cards */
ul.flex2 > li > img,
ul.flex2 > li > a:has(> img) {
    pointer-events: none;
    cursor: default;
}

ul.flex2 .heading4 {
    font-family: var(--font-sans);
    font-size: var(--text-md);
    font-weight: 800;
    line-height: var(--line-tight);
    color: var(--erx-ink);
    margin: 1.1rem 1.25rem 0.5rem;
}

ul.flex2 .vid-lib-description,
ul.flex2 .ug-description,
ul.flex2 > li > p:not(.heading4):not(.vid-lib-button):not(.ug-button-primary) {
    color: var(--erx-text-muted);
    margin: 0 1.25rem 0.75rem;
}

ul.flex2 .vid-lib-description,
ul.flex2 .ug-description {
    flex: 1 1 auto;
}

ul.flex2 .vid-lib-button,
ul.flex2 .ug-button-primary {
    margin: auto 1.25rem 1.75rem;
    padding-bottom: 0.5rem;
}

ul.flex2 .vid-lib-button > a,
ul.flex2 .ug-button-primary > a {
    width: 100%;
    display: inline-flex;
    justify-content: center;
}

ul.flex2 .ug-button-primary > a {
    box-sizing: border-box;
}

ul.flex2 .portal-button__chevrons {
    flex: 0 0 auto;
}

/* About card: informational, not a CTA card */
ul.flex2 > li#instructions {
    background: linear-gradient(180deg, var(--erx-brand-soft-2, #F7FBFD), var(--erx-color-white, #fff)) !important;
    border-style: dashed;
}

ul.flex2 > li#instructions::before {
    background: var(--erx-brand);
}

ul.flex2 > li#instructions:hover,
ul.flex2 > li#instructions:focus-within {
    transform: none;
    box-shadow: 0 8px 24px rgba(8, 34, 31, 0.07);
}

.ug-title {
    text-align: center !important;
    margin-bottom: 0.5rem;
}

.ug-title2 {
    display: none;
}

/* ==============================================
   Responsive behavior: Video Library
   ============================================== */

@media only screen and (max-width: 1000px) {
    ul.flex {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media only screen and (max-width: 767px) {
    ul.flex {
        grid-template-columns: 1fr;
    }

    ul.flex .vid-lib-button {
        margin-bottom: 1.35rem;
    }
}

/* ==============================================
   Responsive behavior: User Guides
   ============================================== */

/* Large laptop / desktop: keep User Guides capped at 3 cards per row */
@media only screen and (min-width: 1200px) {
    .product-container {
        width: min(var(--shell-max, 1200px), calc(100% - 3rem));
    }

    ul.flex2 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Standard laptop */
@media only screen and (min-width: 1025px) and (max-width: 1199px) {
    .product-container {
        width: min(100% - 3rem, 1080px);
    }

    ul.flex2 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.25rem;
    }
}

/* Tablet landscape */
@media only screen and (min-width: 900px) and (max-width: 1024px) {
    .product-container {
        width: min(100% - 2.5rem, 900px);
    }

    ul.flex2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.25rem;
    }
}

/* Tablet portrait */
@media only screen and (min-width: 768px) and (max-width: 899px) {
    .product-container {
        width: min(100% - 2rem, 720px);
    }

    ul.flex2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    ul.flex2 .heading4 {
        font-size: 1rem;
    }

    ul.flex2 .vid-lib-description,
    ul.flex2 .ug-description,
    ul.flex2 > li > p:not(.heading4):not(.vid-lib-button):not(.ug-button-primary) {
        font-size: 0.95rem;
    }

    ul.flex2 .vid-lib-button,
    ul.flex2 .ug-button-primary {
        margin: auto 1.1rem 1.35rem;
    }
}

/* Mobile */
@media only screen and (max-width: 767px) {
    .product-container {
        width: min(100% - 2rem, var(--shell-max, 1200px));
    }

    ul.flex2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    ul.flex2 .vid-lib-button,
    ul.flex2 .ug-button-primary {
        margin-bottom: 1.35rem;
    }
}

/* ==============================================
   Reduced motion
   ============================================== */

@media (prefers-reduced-motion: reduce) {
    ul.flex > li,
    ul.flex2 > li {
        transition: none;
    }

    ul.flex > li:hover,
    ul.flex > li:focus-within,
    ul.flex2 > li:hover,
    ul.flex2 > li:focus-within {
        transform: none;
    }
}
