/* Person Showcase – frontend styles
 * All visual values are driven by CSS variables set inline on .ps-showcase
 * (see templates/showcase.php). The values below are pure fallbacks.
 *
 * Animation choreography:
 *  - Open  : card grows + figure slides left immediately, text slides in from
 *            the right with a small delay (so it appears just as the figure
 *            reaches its target).
 *  - Close : text slides out to the right immediately, card + figure shrink
 *            back with a small delay so the figure goes down with the box.
 */

.ps-showcase {
    --ps-gap: 16px;
    --ps-radius: 18px;
    --ps-border-color: rgba(255, 255, 255, 0.18);
    --ps-transition: 550ms cubic-bezier(0.65, 0, 0.35, 1);
    --ps-transition-ms: 550ms;
    --ps-text-in-delay: 300ms;
    --ps-close-lag: 250ms;
    --ps-text: #ffffff;
    --ps-text-muted: rgba(255, 255, 255, 0.75);
    --ps-btn-bg: #1976ff;
    --ps-btn-bg-hover: #0f5fe0;
    --ps-btn-text: #ffffff;
    --ps-card-min-h: 480px;
    --ps-inactive-flex: 8%;
    --ps-active-flex: 60%;

    display: flex;
    gap: var(--ps-gap);
    width: 100%;
    box-sizing: border-box;
    color: var(--ps-text);
    font-family: inherit;
}

.ps-showcase *,
.ps-showcase *::before,
.ps-showcase *::after {
    box-sizing: border-box;
}

/* ----- Card base ----- */
.ps-card {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
    border: 1px solid var(--ps-border-color);
    border-radius: var(--ps-radius);
    overflow: hidden;
    cursor: pointer;
    min-height: var(--ps-card-min-h);
    outline: none;

    /* Default = closing direction: card shrinks AFTER text leaves. */
    transition: flex var(--ps-transition);
    transition-delay: var(--ps-close-lag);
}

.ps-showcase.has-active .ps-card {
    flex: 0 0 var(--ps-inactive-flex);
    /* Opening direction: card grows immediately. */
    transition-delay: 0ms;
}

.ps-showcase.has-active .ps-card.is-active {
    flex: 1 1 var(--ps-active-flex);
}

.ps-card:focus-visible {
    box-shadow: 0 0 0 2px var(--ps-btn-bg);
}

.ps-card__inner {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: var(--ps-card-min-h);
}

/* ----- Short caption (collapsed) -----
 * pointer-events: none so it never blocks clicks on the close button
 * (which sits in the same top-right area when active). */
.ps-card__short {
    position: absolute;
    top: 22px;
    left: 22px;
    right: 22px;
    z-index: 2;
    font-weight: 700;
    font-size: clamp(13px, 1vw, 16px);
    line-height: 1.35;
    color: var(--ps-text);
    pointer-events: none;
    transition: opacity var(--ps-transition);
}

/* ----- Plus icon (collapsed) ----- */
.ps-card__plus {
    position: absolute;
    right: 14px;
    bottom: 12px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--ps-text);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 3;
    pointer-events: none;
    transition: opacity 220ms ease;
}

.ps-card__plus .ps-icon {
    width: 16px;
    height: 16px;
    display: block;
    pointer-events: none;
}

/* ----- Media (figure container) ----- */
.ps-card__media {
    position: absolute;
    top: 70px;
    bottom: 0;
    left: 10px;
    right: 10px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
    overflow: hidden;

    /* Closing: figure shrinks back AFTER text has left. */
    transition: right var(--ps-transition);
    transition-delay: var(--ps-close-lag);
}

.ps-card__img {
    width: auto;
    height: 92%;
    max-height: 100%;
    flex-shrink: 0;
    object-fit: contain;
    object-position: bottom center;
    /* Closing: figure shrinks/desaturates AFTER text leaves. */
    transition:
        filter var(--ps-transition),
        max-height var(--ps-transition);
    transition-delay: var(--ps-close-lag);
}

/* ----- Content panel (text, button) ----- */
.ps-card__content {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 58%;
    padding: 36px 50px 36px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;

    visibility: hidden;
    opacity: 0;
    transform: translateX(60px);
    pointer-events: none;

    /* Closing direction (default): text slides out immediately, then we
       wait for the card/figure animation to complete before hiding. */
    transition:
        visibility 0s linear var(--ps-transition-ms),
        opacity 280ms ease 0ms,
        transform 380ms cubic-bezier(0.65, 0, 0.35, 1) 0ms;
}

.ps-card__content-inner {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.ps-card__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--ps-text);
    border: 0;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: auto;
}

.ps-card__close .ps-icon {
    width: 18px;
    height: 18px;
    display: block;
}

/* Block ALL descendants (including SVG children like <line>) from being
 * the click target. SVG <line> elements have pointer-events: visiblePainted
 * by default, so a `> *` selector is not enough — use a deep wildcard. */
.ps-card__close * {
    pointer-events: none !important;
}

.ps-card__close:hover {
    background: rgba(255, 255, 255, 0.16);
}

.ps-card__subtitle {
    font-size: clamp(13px, 1vw, 16px);
    font-weight: 600;
    margin: 0 0 14px;
    color: var(--ps-text);
    max-width: 80%;
}

.ps-card__divider {
    border: 0;
    border-top: 1px solid var(--ps-border-color);
    margin: 0 0 18px;
    max-width: 80%;
}

.ps-card__title {
    font-size: clamp(22px, 2.4vw, 38px);
    line-height: 1.15;
    font-weight: 800;
    margin: 0 0 18px;
    color: var(--ps-text);
}

.ps-card__quote {
    font-style: italic;
    font-size: clamp(14px, 1.05vw, 17px);
    line-height: 1.5;
    color: var(--ps-text-muted);
    margin: 0 0 12px;
    max-width: 90%;
}

.ps-card__quote p {
    margin: 0 0 8px;
}

.ps-card__author {
    font-size: 14px;
    color: var(--ps-text-muted);
    margin: 0 0 22px;
}

.ps-card__btn {
    align-self: flex-start;
    background: var(--ps-btn-bg);
    color: var(--ps-btn-text);
    text-decoration: none;
    padding: 12px 26px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 15px;
    transition: background 200ms ease, transform 200ms ease;
}

.ps-card__btn:hover,
.ps-card__btn:focus {
    background: var(--ps-btn-bg-hover);
    color: var(--ps-btn-text);
    transform: translateY(-1px);
}

/* ----- Optional logo (below the button) ----- */
.ps-card__logo {
    margin-top: 18px;
    display: flex;
    align-items: center;
    max-width: 90%;
}

.ps-card__logo img {
    max-height: 60px;
    max-width: 500px;
    width: 95%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* ----- Active state (desktop) ----- */
@media (min-width: 768px) {
    /* Figure slides to the left – uses zero delay (opening). */
    .ps-showcase.has-active .ps-card.is-active .ps-card__media {
        right: 58%;
        transition-delay: 0ms;
    }

    /* Text panel slides in from the right with a delay so it lands just
       as the figure reaches its target on the left. */
    .ps-showcase.has-active .ps-card.is-active .ps-card__content {
        visibility: visible;
        opacity: 1;
        transform: translateX(0);
        pointer-events: auto;
        transition:
            visibility 0s linear 0ms,
            opacity 320ms ease var(--ps-text-in-delay),
            transform 420ms cubic-bezier(0.2, 0.8, 0.25, 1) var(--ps-text-in-delay);
    }

    .ps-showcase.has-active .ps-card.is-active .ps-card__short,
    .ps-showcase.has-active .ps-card.is-active .ps-card__plus {
        opacity: 0;
    }

    /* Active card's figure resizes/colors immediately (opening direction). */
    .ps-showcase.has-active .ps-card.is-active .ps-card__img {
        transition-delay: 0ms;
    }

    /* Inactive cards in an active showcase: dimmed grayscale figure, capped height. */
    .ps-showcase.has-active .ps-card:not(.is-active) .ps-card__img {
        filter: grayscale(100%) brightness(0.6);
        max-height: 150px;
    }

    .ps-showcase.has-active .ps-card:not(.is-active) .ps-card__short {
        opacity: 0;
    }
}

/* ----- Tablet ----- */
@media (max-width: 1199px) and (min-width: 768px) {
    /* Override the configured min-height: at tablet widths the cards become
       narrow, so a fixed 480px makes them look unnaturally tall. Scale with
       viewport so the aspect ratio stays roughly 1:2. */
    .ps-card,
    .ps-card__inner {
        min-height: clamp(280px, 36vw, 420px);
    }

    .ps-showcase.has-active .ps-card.is-active .ps-card__media {
        right: 62%;
    }
    .ps-card__content {
        width: 62%;
        padding: 30px 30px 24px 12px;
    }

    .ps-card__media {
        top: 80px;
		left: 7px;
		right: 7px;
    }
}

/* ----- Mobile (accordion) ----- */
@media (max-width: 767px) {
    .ps-showcase {
        flex-direction: column;
        align-items: stretch;
    }

    .ps-card {
        width: 100%;
        min-height: 0;
        flex: 0 0 auto;
        transition: none;
    }
	
	.ps-card__media{
		top: 20px;
	}

    /* Flex column with custom order so the figure stays anchored to the
     * bottom of the card in BOTH collapsed and expanded states.
     * Order: short → content (slides in between) → media (always last). */
    .ps-card__inner {
        min-height: 0;
        height: auto;
        display: flex;
        flex-direction: column;
        padding: 0;
    }

    .ps-card__short {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        padding: 22px 22px 10px;
        order: 1;
    }

    .ps-card__content {
        position: relative;
        width: 100%;
        padding: 0 22px;
        max-height: 0;
        opacity: 0;
        transform: translateY(20px);
        visibility: hidden;
        pointer-events: none;
        overflow: hidden;
        order: 2;
        transition:
            visibility 0s linear var(--ps-transition-ms),
            max-height var(--ps-transition),
            padding-top var(--ps-transition),
            padding-bottom var(--ps-transition),
            opacity 280ms ease 0ms,
            transform 320ms ease 0ms;
    }

    .ps-card.is-active .ps-card__content {
        max-height: 1200px;
        padding: 8px 22px 18px;
        opacity: 1;
        transform: translateY(0);
        visibility: visible;
        pointer-events: auto;
        transition:
            visibility 0s linear 0ms,
            max-height var(--ps-transition),
            padding-top var(--ps-transition),
            padding-bottom var(--ps-transition),
            opacity 320ms ease var(--ps-text-in-delay),
            transform 360ms ease var(--ps-text-in-delay);
    }

    /* Media is always the last flex child = always at the bottom of the
     * card, with the figure inside touching the bottom edge. */
    .ps-card__media {
        position: relative;
        height: 280px;
        flex: 0 0 280px;
        right: auto;
        order: 3;
        transition: none;
        padding: 0;
    }

    .ps-card__img {
        height: 100%;
        width: auto;
    }

    .ps-card__plus {
        bottom: 12px;
        right: 14px;
    }

    .ps-card__close {
        top: 8px;
        right: 8px;
    }

    .ps-card.is-active .ps-card__short,
    .ps-card.is-active .ps-card__plus {
        opacity: 0;
    }

    .ps-card__subtitle,
    .ps-card__divider,
    .ps-card__quote {
        max-width: 100%;
    }
}
