/* MJM Profile Grid — front-end + editor shared styles */

.mjm-profile-grid {
    width: 100vw;
    max-width: 100vw;
    position: relative;
    margin: 0 calc(50% - 50vw);
    padding: 0 clamp(1.5rem, 3vw, 2rem) 2rem;
    box-sizing: border-box;
}

.mjm-profile-grid__inner {
    border-top: 1px solid #000;
    padding-top: clamp(1rem, 2vw, 1.4rem);
}

.mjm-profile-grid__title {
    font-family: var(--font-headline);
    font-size: var(--text-level-2);
    line-height: var(--leading-level-3);
    letter-spacing: var(--tracking-tight);
    font-weight: normal;
    margin: 0 0 1.5rem;
}

/* ── Grid ─────────────────────────────────────────────────────────── */

.mjm-profile-grid__list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(1rem, 2vw, 1.5rem);
    list-style: none;
    padding: 0;
    margin: 0;
}

@media (max-width: 1023px) {
    .mjm-profile-grid__list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {
    .mjm-profile-grid__list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 479px) {
    .mjm-profile-grid__list {
        grid-template-columns: 1fr;
    }
}

/* ── Card ─────────────────────────────────────────────────────────── */

.mjm-profile-grid__card {
    min-width: 0;
}

.mjm-profile-grid__card-btn {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
}

.mjm-profile-grid__card-btn:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

.mjm-profile-grid__photo {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    margin-bottom: 0.6rem;
}

.mjm-profile-grid__photo-placeholder {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: #e0e0e0;
    margin-bottom: 0.6rem;
}

.mjm-profile-grid__name {
    font-family: "KF Zuka Medium", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.05;
    font-weight: normal;
    margin: 0 0 0.25rem;
}

.mjm-profile-grid__short {
    font-family: var(--font-body);
    font-size: 0.75rem;
    line-height: 1.25;
    margin: 0;
    color: var(--color-black);
}

/* Promoted card is removed from flow on ≥480px so the detail row replaces it */
@media (min-width: 480px) {
    .mjm-profile-grid__card.is-promoted {
        display: none;
    }
}

/* ── Detail panel ─────────────────────────────────────────────────── */

.mjm-profile-grid__detail {
    grid-column: 1 / -1;
    display: none;
}

.mjm-profile-grid__detail:not([hidden]) {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: clamp(1rem, 2vw, 2rem);
    align-items: start;
    padding: clamp(1rem, 2vw, 1.5rem) 0;
    border-top: 1px solid #e0e0e0;
}

@media (max-width: 479px) {
    .mjm-profile-grid__detail:not([hidden]) {
        grid-template-columns: 1fr;
    }
}

.mjm-profile-grid__detail-card .mjm-profile-grid__photo {
    margin-bottom: 0.6rem;
}

.mjm-profile-grid__detail-body {
    position: relative;
    padding-top: 0.25rem;
}

.mjm-profile-grid__long {
    font-family: var(--font-body);
    font-size: var(--text-level-4);
    line-height: var(--leading-level-4);
    margin: 0;
}

.mjm-profile-grid__long p {
    margin: 0 0 0.75em;
}

.mjm-profile-grid__long p:last-child {
    margin-bottom: 0;
}

.mjm-profile-grid__close {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--color-black);
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mjm-profile-grid__close:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

/* ── Expand / collapse animations ────────────────────────────────── */

/* 1 — Panel wipes open top-to-bottom, revealing photo first */
@keyframes mjm-panel-wipe {
    from { clip-path: inset(0 0 100% 0); opacity: 0.6; }
    to   { clip-path: inset(0 0 0%   0); opacity: 1; }
}

/* 2 — Photo rises from below (card position) and settles with a bounce */
@keyframes mjm-photo-rise {
    0%   { opacity: 0; transform: translateY(70px) scale(1.35); }
    55%  { opacity: 1; transform: translateY(-8px) scale(0.97); }
    75%  { transform: translateY(4px)  scale(1.01); }
    90%  { transform: translateY(-2px) scale(0.995); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* 3 — Name + short text drift up under the settled photo */
@keyframes mjm-text-rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 4 — Bio slides in from the right */
@keyframes mjm-bio-enter {
    from { opacity: 0; transform: translateX(32px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* 5 — Collapse: quick fade + shrink upward */
@keyframes mjm-profile-leave {
    from { opacity: 1; transform: translateY(0) scaleY(1);    transform-origin: top; }
    to   { opacity: 0; transform: translateY(-12px) scaleY(0.94); transform-origin: top; }
}

/* Panel: clip-path wipe reveals top → bottom */
.mjm-profile-grid__detail.is-entering {
    animation: mjm-panel-wipe 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Photo rises up with a multi-step bounce */
.mjm-profile-grid__detail.is-entering .mjm-profile-grid__photo {
    animation: mjm-photo-rise 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both;
}

/* Name settles in after photo lands */
.mjm-profile-grid__detail.is-entering .mjm-profile-grid__name {
    animation: mjm-text-rise 0.35s ease-out 0.38s both;
}

/* Short description follows the name */
.mjm-profile-grid__detail.is-entering .mjm-profile-grid__short {
    animation: mjm-text-rise 0.35s ease-out 0.46s both;
}

/* Bio sweeps in from the right while photo is still rising */
.mjm-profile-grid__detail.is-entering .mjm-profile-grid__detail-body {
    animation: mjm-bio-enter 0.5s cubic-bezier(0.34, 1.3, 0.64, 1) 0.18s both;
}

/* Collapse: fast and decisive */
.mjm-profile-grid__detail.is-leaving {
    animation: mjm-profile-leave 0.22s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@media (prefers-reduced-motion: reduce) {
    .mjm-profile-grid__detail.is-entering,
    .mjm-profile-grid__detail.is-entering .mjm-profile-grid__photo,
    .mjm-profile-grid__detail.is-entering .mjm-profile-grid__name,
    .mjm-profile-grid__detail.is-entering .mjm-profile-grid__short,
    .mjm-profile-grid__detail.is-entering .mjm-profile-grid__detail-body,
    .mjm-profile-grid__detail.is-leaving {
        animation: none;
    }
}

/* ── Empty state (editor only – but harmless on front end) ────────── */

.mjm-profile-grid__empty-state {
    padding: 2rem;
    text-align: center;
    background: #f9f9f9;
    border: 1px dashed #ccc;
}
