/* ==============================================
   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);
}



/* ==============================================
   Latest Updates homepage cards
   - 4 cards: fills the original full-width row
   - 3 cards: widens cards moderately without stretching too far
   ============================================== */

.portal-updates {
    padding: 2rem 0 3rem;
}

.portal-section-heading {
    margin-bottom: 1.5rem;
}

.portal-section-heading__title {
    margin: 0 0 0.45rem;
}

.portal-section-heading__text {
    max-width: 720px;
    margin: 0;
    color: var(--erx-text-muted);
}

.portal-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    width: 100%;
    margin-top: 2rem;
    justify-content: start;
}

/* Three-card row: keep the row left-aligned and let cards grow, but cap the row. */
.portal-card-grid:has(> .portal-card:nth-child(3):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 980px;
}

.portal-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    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);
}

.portal-card:hover,
.portal-card:focus-within {
    transform: translateY(-3px);
    border-color: var(--erx-brand-soft, #E6F3FA);
    box-shadow: var(--erx-card-shadow-hover);
}

.portal-card__image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    height: auto;
    object-fit: contain;
    background: var(--erx-brand-soft-2, #F7FBFD);
    margin: 0;
    padding: 1rem;
    box-sizing: border-box;
}

.portal-card__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding: 1.1rem 1.1rem 1.25rem;
}

.portal-card__title {
    margin: 0 0 0.55rem;
    font-size: var(--text-md);
    font-weight: 800;
    line-height: var(--line-tight);
    color: var(--erx-ink);
}

.portal-card__text {
    flex: 1 1 auto;
    margin: 0 0 1.25rem;
    color: var(--erx-text-muted);
    font-size: var(--text-sm);
}

.portal-card__actions {
    margin-top: auto;
}

.portal-card__actions .portal-button {
    width: 100%;
    padding-right: 1rem;
    padding-left: 1rem;
}

@media only screen and (max-width: 1199px) {
    .portal-card-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        max-width: 980px;
    }
}

@media only screen and (max-width: 899px) {
    .portal-card-grid,
    .portal-card-grid:has(> .portal-card:nth-child(3):last-child) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-width: none;
    }
}

@media only screen and (max-width: 767px) {
    .portal-updates {
        padding: 1.5rem 0 2.25rem;
    }

    .portal-card-grid,
    .portal-card-grid:has(> .portal-card:nth-child(3):last-child) {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* ==============================================
   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;
    }
}

/* ==============================================
   Override top margin in Latest Updates
   ============================================== */

.portal-updates .portal-shell {
    margin-top: 0;
}


/* ==============================================
   Homepage Latest Release Carousel
   Scoped to homepage-actions.xhtml release feature
   ============================================== */

.portal-feature-card.portal-release-carousel {
    display: block !important;
    width: 100%;
    max-width: none;
    padding: 0;
    overflow: hidden;
    background: var(--erx-color-white, #fff);
    border: 1px solid var(--erx-color-border-light, #E4EEF0);
    box-shadow: var(--erx-card-shadow, 0 10px 28px rgba(8, 34, 31, 0.08));
}

.portal-release-carousel__viewport {
    width: 100%;
    overflow: hidden;
}

.portal-release-carousel__track {
    display: flex;
    width: 100%;
    transform: translateX(0);
    transition: transform 0.35s ease;
    will-change: transform;
}

.portal-release-carousel__slide {
    flex: 0 0 100%;
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(280px, 3fr);
    min-width: 100%;
    background: var(--erx-color-white, #fff);
}

.portal-release-carousel__media {
    position: relative;
    min-width: 0;
    background: var(--erx-brand-soft-2, #F7FBFD);
}

.portal-release-carousel__image-button {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 360px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.portal-release-carousel__image {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 360px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    object-position: center;
    background: var(--erx-brand-soft-2, #F7FBFD);
}

.portal-release-carousel__zoom-label {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    padding: 0.45rem 0.75rem;
    color: var(--erx-color-white, #fff);
    background: rgba(8, 34, 31, 0.84);
    border-radius: 999px;
    font-size: var(--text-xs, 0.8125rem);
    font-weight: 700;
    pointer-events: none;
}

.portal-release-carousel__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    background: var(--erx-color-white, #fff);
}

.portal-release-carousel__title {
    margin: 0 0 0.8rem;
    font-size: clamp(1.65rem, 2.4vw, 2.5rem);
    line-height: 1.1;
    color: var(--erx-ink, #08221F);
}

.portal-release-carousel__text {
    margin: 0 0 1.35rem;
    color: var(--erx-text-muted, #5B6F6C);
}

.portal-release-carousel__controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem clamp(1rem, 2vw, 1.5rem);
    border-top: 1px solid var(--erx-color-border-light, #E4EEF0);
    background: var(--erx-color-white, #fff);
}

.portal-release-carousel__arrows {
    display: flex;
    gap: 0.5rem;
}

.portal-release-carousel__arrow,
.portal-release-carousel__dot,
.erx-carousel-lightbox__close {
    font-family: var(--font-sans, Arial, Helvetica, sans-serif);
}

.portal-release-carousel__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border: 1px solid var(--erx-color-border-light, #E4EEF0);
    border-radius: 999px;
    color: var(--erx-ink, #08221F);
    background: var(--erx-color-white, #fff);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.portal-release-carousel__arrow:hover,
.portal-release-carousel__arrow:focus {
    color: var(--erx-color-white, #fff);
    background: var(--erx-accent, #EE5519);
    border-color: var(--erx-accent, #EE5519);
}

.portal-release-carousel__dots {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.portal-release-carousel__dot {
    width: 0.75rem;
    height: 0.75rem;
    padding: 0;
    border: 1px solid var(--erx-brand, #259789);
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
}

.portal-release-carousel__dot[aria-selected="true"] {
    background: var(--erx-brand, #259789);
}

.erx-carousel-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20000;
    padding: 2rem;
    background: rgba(8, 34, 31, 0.92);
}

.erx-carousel-lightbox[aria-hidden="false"] {
    display: flex;
    align-items: center;
    justify-content: center;
}

.erx-carousel-lightbox__dialog {
    position: relative;
    width: min(1200px, 100%);
    max-height: calc(100vh - 4rem);
}

.erx-carousel-lightbox__image {
    display: block;
    width: 100%;
    max-height: calc(100vh - 4rem);
    object-fit: contain;
    background: var(--erx-color-white, #fff);
}

.erx-carousel-lightbox__close {
    position: absolute;
    top: -1rem;
    right: -1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 2px solid var(--erx-color-white, #fff);
    border-radius: 999px;
    color: var(--erx-color-white, #fff);
    background: var(--erx-accent, #EE5519);
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
}

@media only screen and (max-width: 991px) {
    .portal-release-carousel__slide {
        grid-template-columns: 1fr;
    }

    .portal-release-carousel__image-button,
    .portal-release-carousel__image {
        min-height: 0;
    }
}

@media only screen and (max-width: 767px) {
    .portal-release-carousel__body {
        padding: 1.35rem;
    }

    .portal-release-carousel__controls {
        align-items: flex-start;
        flex-direction: column;
    }

    .erx-carousel-lightbox {
        padding: 1rem;
    }

    .erx-carousel-lightbox__close {
        top: 0.5rem;
        right: 0.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .portal-release-carousel__track {
        transition: none;
    }
}

/* ==============================================
   Homepage release carousel external-script support
   ============================================== */

html.erx-carousel-lightbox-open,
body.erx-carousel-lightbox-open {
    overflow: hidden;
}

.portal-release-carousel[data-erx-carousel-ready="true"] .portal-release-carousel__track {
    transform: translate3d(0, 0, 0);
}

.portal-release-carousel__slide[aria-hidden="true"] {
    pointer-events: none;
}
