/*
 * Owner testimonial - Figma 1:2940 (desktop) / 1:1625 (mobile).
 *
 * A White 100 panel: video left at 793 x 584, a 440 text column right with 32
 * of padding, and the attribution pushed to the bottom of that column rather
 * than sitting under the quote - the frame's 158 gap is space-between, not a
 * measured gap, so it holds at any quote length.
 *
 * Mobile stacks the media over the text and the panel loses its side inset.
 */

.owner-testimonial {
    padding: var(--spacing-large) var(--spacing-small);
}

.owner-testimonial-panel {
    display: flex;
    align-items: center;
    gap: 56px;
    background: var(--color-white-100);
}

/*
 * About us 1:3725 mirrors the panel - quote left, photograph right. Only the
 * column order differs, so it is `row-reverse` rather than a second set of
 * rules, and the markup order is left alone so a screen reader still meets the
 * quote before the photograph either way.
 *
 * Scoped to the width where the panel is actually a row: below 992 it stacks,
 * and an unscoped modifier would outrank the `column` rule in the stacking
 * query and lay the mobile panel out sideways.
 */
@media (min-width: 992px) {
    .owner-testimonial-reversed .owner-testimonial-panel {
        flex-direction: row-reverse;
    }
}

/*------------------------------------------------------------
#MEDIA
--------------------------------------------------------------*/

.owner-testimonial-media {
    position: relative;
    /* 793 x 584. */
    aspect-ratio: 793 / 584;
    flex: 1 1 auto;
    align-self: stretch;
    overflow: hidden;
}

.owner-testimonial-poster,
.owner-testimonial-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* The video only appears once asked for; until then the poster stands in. */
.owner-testimonial-video {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.owner-testimonial-media.is-playing .owner-testimonial-video {
    opacity: 1;
    pointer-events: auto;
}

.owner-testimonial-media.is-playing .owner-testimonial-play {
    opacity: 0;
    pointer-events: none;
}

.owner-testimonial-play {
    position: absolute;
    top: calc(50% - 45px);
    left: calc(50% - 45px);
    display: flex;
    align-items: center;
    justify-content: center;
    /* 90px disc at 60% Off-White. */
    height: 90px;
    width: 90px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 252, 252, 0.6);
    color: var(--color-shark);
    cursor: pointer;
    transition: opacity 200ms ease, background-color 200ms ease;
}

.owner-testimonial-play:hover,
.owner-testimonial-play:focus-visible {
    background: rgba(255, 252, 252, 0.85);
}

/*------------------------------------------------------------
#TEXT
--------------------------------------------------------------*/

.owner-testimonial-text {
    display: flex;
    flex-direction: column;
    /*
     * The frame's 158 gap between quote and attribution is what is left over,
     * not a fixed measure - space-between keeps the attribution on the baseline
     * of the panel whatever the quote runs to.
     */
    justify-content: space-between;
    gap: 56px;
    flex: 0 0 440px;
    align-self: stretch;
    padding-block: 32px;
    padding-inline-end: 32px;
}

.owner-testimonial-quote-group {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.owner-testimonial-label {
    font-family: var(--font-secondary);
    font-size: 14px;
    font-weight: 700;
    line-height: 18px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--color-shark);
    margin: 0;
}

.owner-testimonial-quote {
    font-family: var(--font-primary);
    /* 38 in the frame, 28 at 375. */
    font-size: clamp(28px, 2.64vw, 38px);
    font-weight: 400;
    line-height: 1.1;
    color: var(--color-shark);
    margin: 0;
    padding: 0;
    border: 0;
    quotes: none;
}

.owner-testimonial-attribution {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-block: 24px;
}

.owner-testimonial-name {
    font-family: var(--font-secondary);
    font-size: 20px;
    font-weight: 300;
    line-height: 1.3;
    color: var(--color-shark);
    margin: 0;
}

.owner-testimonial-role {
    font-family: var(--font-secondary);
    font-size: 12px;
    font-weight: 300;
    line-height: 1.3;
    color: var(--color-shark);
    margin: 0;
}

/*------------------------------------------------------------
#YOUTUBE DIALOG
--------------------------------------------------------------*/

/*
 * A native `dialog`, so the focus trap, Escape and page inertness come from the
 * platform. It is styled from scratch because the UA default is a small centred
 * white box with a border.
 */
.owner-testimonial-dialog {
    width: min(1200px, calc(100vw - 2 * var(--spacing-small)));
    max-width: none;
    max-height: calc(100vh - 2 * var(--spacing-small));
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-offwhite);
    overflow: visible;
}

.owner-testimonial-dialog::backdrop {
    background: rgba(23, 23, 23, 0.85);
}

.owner-testimonial-dialog-inner {
    position: relative;
}

.owner-testimonial-dialog-frame {
    /* Film, not the panel's 793 x 584 crop. */
    aspect-ratio: 16 / 9;
    width: 100%;
    background: var(--color-black);
    overflow: hidden;
}

.owner-testimonial-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.owner-testimonial-dialog-close {
    position: absolute;
    /* Above the frame, clear of the film. */
    top: -48px;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    width: 40px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-offwhite);
    cursor: pointer;
}

.owner-testimonial-dialog-close:hover,
.owner-testimonial-dialog-close:focus-visible {
    opacity: 0.7;
}

@media (max-width: 576px) {
    .owner-testimonial-dialog {
        width: calc(100vw - 32px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .owner-testimonial-play {
        transition: none;
    }
}

/* Medium devices (tablets, less than 992px) - the frame's stacked form. */
@media (max-width: 991.98px) {
    .owner-testimonial-panel {
        flex-direction: column;
        gap: 0;
    }

    .owner-testimonial-media {
        /* 343 x 253 in the mobile frame - shallower than the desktop box. */
        aspect-ratio: 343 / 253;
        width: 100%;
        flex: 0 0 auto;
        align-self: auto;
    }

    .owner-testimonial-text {
        flex: 0 0 auto;
        align-self: auto;
        /* 16 either side of the 311 text column in a 343 panel. */
        padding: 24px 16px;
        gap: 24px;
    }
}

/* X-Small devices (portrait phones, less than 576px) */
@media (max-width: 576px) {
    .owner-testimonial {
        padding: 72px 16px;
    }

    .owner-testimonial-play {
        /* Proportionate to the shallower mobile media box. */
        height: 64px;
        width: 64px;
        top: calc(50% - 32px);
        left: calc(50% - 32px);
    }
}
