/**
 * Shoptimised Team Grid
 *
 * Flipbox card grid + modal for the Our Story team section.
 *
 * @package Shoptimised
 */

.shoptimised-team {
    background: #081836;
    padding: 96px 0;
    color: #ffffff;
    /* Inherit width from the parent Oxygen section/container — no viewport breakout.
       Cap at 1520px so cards don't stretch absurdly on 27"+ displays; centred. */
    width: 100%;
    max-width: 1520px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.shoptimised-team__inner {
    /* Full available width inside the section padding — no max-width clamp.
       Cards scale up on larger viewports. */
    width: 100%;
}

.shoptimised-team__grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 24px;
}

@media (max-width: 1200px) {
    .shoptimised-team { padding: 80px 48px; }
}
@media (max-width: 992px) {
    .shoptimised-team__grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 768px) {
    .shoptimised-team { padding: 64px 32px; }
    .shoptimised-team__grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
    .shoptimised-team { padding: 48px 20px; }
    .shoptimised-team__grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}

/* ---------- Card ---------- */

.shoptimised-team__card {
    position: relative;
    aspect-ratio: 4 / 5;
    perspective: 1000px;
    border-radius: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
}

.shoptimised-team__card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.shoptimised-team__flipper {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform 0.55s cubic-bezier(0.4, 0.0, 0.2, 1);
}

@media (hover: hover) and (pointer: fine) {
    .shoptimised-team__card:hover .shoptimised-team__flipper {
        transform: rotateY(180deg);
    }
    /* Pointer events follow the visible face so the See more button on the
       back is clickable, and the name/title overlay on the front doesn't
       intercept those clicks. */
    .shoptimised-team__card:hover .shoptimised-team__face--front,
    .shoptimised-team__card:hover .shoptimised-team__face--front * {
        pointer-events: none;
    }
}

/* Back face is non-interactive until the card is flipped (otherwise its
   absolutely-positioned children would steal hits from the front face). */
.shoptimised-team__face--back,
.shoptimised-team__face--back * {
    pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
    .shoptimised-team__card:hover .shoptimised-team__face--back,
    .shoptimised-team__card:hover .shoptimised-team__face--back * {
        pointer-events: auto;
    }
}

@media (hover: none) {
    /* No flip on touch devices — tap opens modal directly. */
    .shoptimised-team__card { cursor: pointer; }
}

.shoptimised-team__face {
    position: absolute;
    inset: 0;
    border-radius: 16px;
    overflow: hidden;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
}

/* Front */

.shoptimised-team__face--front {
    background: #d6dee8;
}

.shoptimised-team__photo,
.shoptimised-team__photo--placeholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Headshots in landscape frames have the face in the upper portion — anchor
       crop to ~25% from top so faces land roughly the same place in each card.
       Slight zoom tightens whitespace around the head. */
    object-position: center 25%;
    transform: scale(1.08);
    transform-origin: center 25%;
    background: #d6dee8;
    display: block;
}

/* Per-image overrides — for headshots whose framing doesn't match the global anchor.
   Add new rules here when an individual photo looks off. */
.shoptimised-team__photo[src*="Rachel-Irvine"] {
    object-position: center 50%;
    transform-origin: center 50%;
}

.shoptimised-team__overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 16px 18px 14px;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.78) 100%);
    color: #ffffff;
    z-index: 1;
}

.shoptimised-team__name {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.15;
    margin: 0 0 2px;
    color: #ffffff;
}

.shoptimised-team__job {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 0.95rem;
    line-height: 1.3;
    margin: 0;
    color: rgba(255,255,255,0.85);
}

/* Back */

.shoptimised-team__face--back {
    background: #29b688;
    color: #ffffff;
    transform: rotateY(180deg);
    padding: 18px 18px 16px;
    justify-content: flex-start;
    gap: 12px;
}

.shoptimised-team__icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shoptimised-team__social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255,255,255,0.18);
    color: #ffffff;
    text-decoration: none;
    transition: background 0.15s ease;
}
.shoptimised-team__social:hover,
.shoptimised-team__social:focus-visible { background: rgba(255,255,255,0.32); outline: none; }
.shoptimised-team__social svg { width: 15px; height: 15px; display: block; }

.shoptimised-team__about {
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    line-height: 1.5;
    margin: 0;
    color: #ffffff;
    overflow: hidden;
    /* Truncation is text-based; this is a safety guard. */
    display: -webkit-box;
    -webkit-line-clamp: 11;
    -webkit-box-orient: vertical;
    flex-grow: 1;
}

.shoptimised-team__see-more {
    align-self: flex-start;
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.16);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 999px;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    padding: 6px 12px 6px 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.shoptimised-team__see-more:hover,
.shoptimised-team__see-more:focus-visible {
    background: #ffffff;
    color: #29b688;
    border-color: #ffffff;
    outline: none;
}
.shoptimised-team__see-more-arrow {
    display: inline-block;
    transition: transform 0.18s ease;
}
.shoptimised-team__see-more:hover .shoptimised-team__see-more-arrow,
.shoptimised-team__see-more:focus-visible .shoptimised-team__see-more-arrow {
    transform: translateX(3px);
}

/* ---------- Modal ---------- */

.shoptimised-team-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.shoptimised-team-modal[aria-hidden="false"] { display: flex; }

.shoptimised-team-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 24, 54, 0.85);
    animation: shoptimised-team-fade 0.2s ease;
}

.shoptimised-team-modal__panel {
    position: relative;
    display: grid;
    grid-template-columns: 40% 60%;
    width: 100%;
    max-width: 880px;
    max-height: 85vh;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.4);
    animation: shoptimised-team-pop 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes shoptimised-team-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes shoptimised-team-pop {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

.shoptimised-team-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    border: none;
    color: #0f1f3d;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.shoptimised-team-modal__close:hover,
.shoptimised-team-modal__close:focus-visible { background: #f4f7fb; outline: none; }
@media (max-width: 768px) {
    .shoptimised-team-modal__close { width: 44px; height: 44px; top: 8px; right: 8px; }
}

.shoptimised-team-modal__media {
    position: relative;
    background: #d6dee8;
    min-height: 100%;
}
.shoptimised-team-modal__media img {
    width: 100%;
    height: 100%;
    min-height: 320px;
    object-fit: cover;
    object-position: center;
    display: block;
}

.shoptimised-team-modal__body {
    padding: 32px 32px 28px;
    color: #0f1f3d;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.shoptimised-team-modal__body h2 {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    line-height: 1.15;
    margin: 0;
    color: #081836;
}

.shoptimised-team-modal__job {
    font-family: 'Inter', sans-serif;
    color: #5c6b82;
    margin: 0;
    font-size: 1.05rem;
}

.shoptimised-team-modal__about {
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #0f1f3d;
    margin: 0;
    white-space: pre-wrap; /* preserve line breaks from the about text */
}

.shoptimised-team-modal__icons {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.shoptimised-team-modal__social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #e9eff6;
    color: #005983;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.shoptimised-team-modal__social:hover,
.shoptimised-team-modal__social:focus-visible { background: #005983; color: #ffffff; outline: none; }
.shoptimised-team-modal__social svg { width: 18px; height: 18px; display: block; }

@media (max-width: 768px) {
    .shoptimised-team-modal__panel {
        grid-template-columns: 1fr;
        max-height: 90vh;
    }
    .shoptimised-team-modal__media {
        aspect-ratio: 4 / 3;
        min-height: 0;
    }
    .shoptimised-team-modal__media img { min-height: 0; }
    .shoptimised-team-modal__body { padding: 24px; }
    .shoptimised-team-modal__social { width: 44px; height: 44px; }
}

/* Lock body scroll when modal is open */
body.shoptimised-team-modal-open { overflow: hidden; }
