/* ============================================================
 * FutureLearn — Advisors and teachers
 * Version: v1.7.1
 * ============================================================ */

.teachers {
    padding-block: var(--section-space-y);
    overflow: hidden;
    background-color: var(--cream);
}

.teachers__header {
    max-width: 48rem;
    margin-inline: auto;
    text-align: center;
}

.teachers__title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(2rem, 7vw, 3rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--primary-blue-1);
    text-wrap: balance;
}

.teachers__intro {
    max-width: 42rem;
    margin: 1rem auto 0;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--natural-black-3);
}

.teachers__carousel {
    --teachers-gap: 1rem;
    position: relative;
    width: 100%;
    margin-top: var(--section-content-gap);
}

.teachers__rail {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-behavior: smooth;
    scroll-snap-type: inline mandatory;
    scrollbar-width: none;
    cursor: grab;
    -ms-overflow-style: none;
}

.teachers__rail::-webkit-scrollbar {
    display: none;
}

.teachers__rail.is-dragging {
    scroll-behavior: auto;
    scroll-snap-type: none;
    cursor: grabbing;
    user-select: none;
}

.teachers__rail:focus-visible {
    outline: 3px solid var(--secondary-cyan);
    outline-offset: 0.35rem;
}

.teachers__track {
    display: flex;
    width: max-content;
    gap: var(--teachers-gap);
    margin: 0;
    padding: 0.75rem 0.2rem 1.5rem;
    list-style: none;
}

.teachers__arrow {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: grid;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border: 2px solid var(--secondary-cyan);
    border-radius: 50%;
    background-color: var(--white);
    box-shadow: 0 7px 20px rgba(0, 75, 135, 0.2);
    color: var(--primary-blue-1);
    cursor: pointer;
    place-items: center;
    transform: translateY(-50%);
    transition:
        background-color 180ms ease,
        color 180ms ease,
        transform 180ms ease;
}

.teachers__arrow--prev {
    left: 0.4rem;
}

.teachers__arrow--next {
    right: 0.4rem;
}

.teachers__arrow svg {
    width: 1.5rem;
    height: 1.5rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.4;
}

.teachers__arrow:focus-visible {
    outline: 3px solid var(--accent-orange);
    outline-offset: 3px;
}

.teachers__item {
    flex: 0 0 clamp(17.5rem, 24vw, 19rem);
    width: clamp(17.5rem, 24vw, 19rem);
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.teacher-card {
    position: relative;
    display: flex;
    height: 100%;
    min-height: 28rem;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1.25rem 1.75rem;
    border: 1px solid var(--secondary-cyan);
    border-radius: var(--radius-card);
    background-color: var(--white);
    box-shadow: 0 8px 24px rgba(0, 125, 211, 0.08);
    text-align: center;
    transform: scale(1);
    transform-origin: center;
    transition:
        transform 220ms ease,
        box-shadow 220ms ease;
    will-change: transform;
}

.teacher-card__portrait {
    width: min(12.5rem, 100%);
    aspect-ratio: 1;
    margin: 0;
    padding: 0.4rem;
    overflow: hidden;
    border: 2px solid var(--secondary-cyan-bright);
    border-radius: 50%;
    background-color: var(--secondary-cyan-light);
}

.teacher-card__image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    pointer-events: none;
    -webkit-user-drag: none;
}

.teacher-card__image--portrait {
    object-position: center 16%;
}

.teacher-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    padding-top: 1.4rem;
}

.teacher-card__name {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--natural-black-2);
    text-wrap: balance;
}

.teacher-card__divider {
    width: 2.75rem;
    height: 2px;
    margin: 0.9rem auto;
    border: 0;
    border-radius: 999px;
    background-color: var(--accent-orange);
    opacity: 1;
}

.teacher-card__role {
    margin: 0;
    color: var(--natural-black-3);
    font-size: 0.96rem;
    line-height: 1.58;
}

@media (hover: hover) and (pointer: fine) {
    .teachers__arrow:hover {
        background-color: var(--secondary-cyan);
        color: var(--white);
        transform: translateY(-50%) scale(1.06);
    }

    .teacher-card:hover {
        z-index: 2;
        box-shadow: 0 14px 34px rgba(0, 125, 211, 0.18);
        transform: scale(1.02);
    }
}

@media (max-width: 767.98px) {
    .teachers__arrow {
        width: 2.75rem;
        height: 2.75rem;
    }

    .teachers__arrow--prev {
        left: 0.15rem;
    }

    .teachers__arrow--next {
        right: 0.15rem;
    }

    .teachers__item {
        flex-basis: min(17.5rem, calc(100vw - 3rem));
        width: min(17.5rem, calc(100vw - 3rem));
        scroll-snap-align: center;
    }

    .teacher-card {
        min-height: 26rem;
        padding: 1.25rem 1rem 1.5rem;
    }
}

@media (min-width: 768px) {
    .teachers__intro {
        font-size: 1.08rem;
    }

    .teachers__carousel {
        --teachers-gap: 1.25rem;
    }

    .teacher-card {
        padding-inline: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .teachers__rail {
        scroll-behavior: auto;
    }
}
