/*
 * The ATV page's range: sections/atv/range. One band per ATV, its photo (or, on a
 * computer, its own film) with the name and buttons, then a bar of facts and price.
 */

.atv-range {
    /* The section bar's height, so a band linked from it starts just under it. */
    --atv-nav: 50px;

    /* "See the range" in the hero jumps here, so the range must clear the sticky header. */
    scroll-margin-top: var(--header-height);
}

.atv-range:not(:has(.section-nav)) {
    --atv-nav: 0px;
}

.atv-band {
    scroll-margin-top: calc(var(--header-height) + var(--atv-nav));
}


/* Picture and words. On a phone the words sit under the picture.
   ========================================================================== */

.atv-band__stage {
    position: relative;
    isolation: isolate;
}

.atv-band__media {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--color-footer-bg);
}

.atv-band__media > * {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* The film fades in over the photo once it plays. */
.atv-band__film {
    opacity: 0;
    transition: opacity 0.8s;
}

.atv-band__film.is-playing {
    opacity: 1;
}

/* No action shot: the cut-out, whole, on the white it was photographed on. */
.atv-band--studio .atv-band__media {
    background: #fff;
}

.atv-band--studio .atv-band__media img {
    padding: var(--space-5);
    object-fit: contain;
}

.atv-band__inner {
    padding-block: var(--space-6);
}

.atv-band__text {
    display: grid;
    justify-items: start;
    gap: var(--space-3);
    max-width: 36rem;
}

.atv-band__eyebrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    color: var(--color-text-muted);
    font-family: var(--font-label);
    font-size: var(--text-sm);
    font-weight: 700;
    letter-spacing: var(--eyebrow-tracking);
    text-transform: uppercase;
}

/* 01, 02… and a short line in the brand's colour. */
.atv-band__number {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--color-text);
}

.atv-band__number::after {
    content: "";
    width: 2.5rem;
    height: 2px;
    background: var(--color-primary);
}

.atv-band__name {
    font-size: clamp(2.25rem, 1.4rem + 3.6vw, 4.5rem);
    font-weight: var(--heading-1-weight);
    line-height: 1;
    letter-spacing: var(--heading-1-tracking);
    text-transform: var(--heading-1-transform);
    overflow-wrap: anywhere;
}

.atv-band__line {
    max-width: 34rem;
    color: var(--color-text-muted);
    font-size: var(--text-lg);
}

.atv-band__text .button-row {
    margin-top: var(--space-2);
}

/* Pause and sound, shown once the film plays. On the side away from the words. */
.atv-band__controls {
    position: absolute;
    right: var(--page-gutter);
    bottom: var(--space-4);
    display: flex;
    gap: var(--space-2);
}

.atv-band__controls[hidden] {
    display: none;
}

.atv-band--flip .atv-band__controls {
    right: auto;
    left: var(--page-gutter);
}

.atv-band__controls button {
    min-height: 36px;
    padding: var(--space-1) var(--space-3);
    border: 1px solid var(--color-hero-text);
    border-radius: var(--radius-button);
    background: var(--color-hero-chip);
    color: var(--color-hero-text);
    font: inherit;
    font-size: var(--text-sm);
    cursor: pointer;
    backdrop-filter: blur(6px);
}


/* On a computer the picture fills the band, behind the words.
   ========================================================================== */

@media (min-width: 768px) {
    .atv-band__stage {
        --color-text: var(--color-hero-text);

        display: flex;
        align-items: flex-end;
        min-height: clamp(480px, calc(100svh - var(--header-height) - var(--atv-nav) - 8rem), 860px);
    }

    .atv-band__media {
        position: absolute;
        inset: 0;
        z-index: -2;
        aspect-ratio: auto;
    }

    /* The fade that keeps the words readable, darkest on their side. */
    .atv-band__stage::after {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        background: var(--hero-scrim);
        pointer-events: none;
    }

    .atv-band__inner {
        padding-block: var(--space-8) var(--space-7);
    }

    /* Every other band reads from the right, so the range has a rhythm. */
    .atv-band--flip .atv-band__stage::after {
        scale: -1 1;
    }

    .atv-band--flip .atv-band__text {
        justify-items: end;
        margin-inline-start: auto;
        text-align: end;
    }

    .atv-band--flip .atv-band__text .button-row {
        justify-content: flex-end;
    }

    /* A cut-out takes the far half of the band, beside the words. */
    .atv-band--studio .atv-band__stage {
        align-items: center;
    }

    .atv-band--studio .atv-band__stage::after {
        content: none;
    }

    .atv-band--studio .atv-band__media {
        inset: 0 0 0 auto;
        width: 52%;
    }

    .atv-band--studio.atv-band--flip .atv-band__media {
        inset: 0 auto 0 0;
    }

    .atv-band--studio .atv-band__text {
        max-width: min(36rem, 42%);
    }
}


/* Facts, price and finance under the picture
   ========================================================================== */

.atv-band__bar {
    border-top: 1px solid var(--color-border);
}

.atv-band__bar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5) var(--space-6);
    padding-block: var(--space-5);
}

.atv-facts {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4) var(--space-5);
    margin: 0;
}

.atv-facts dt {
    color: var(--color-text-muted);
    font-family: var(--font-label);
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: var(--eyebrow-tracking);
    text-transform: uppercase;
}

.atv-facts dd {
    margin: var(--space-1) 0 0;
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.atv-facts__price {
    grid-column: 1 / -1;
}

.atv-facts__price dd {
    font-size: var(--text-2xl);
    line-height: 1.1;
}

.atv-facts small {
    display: block;
    margin-top: var(--space-1);
    color: var(--color-text-muted);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 400;
}

.atv-facts__finance {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.atv-band__spec {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 48px;
    color: var(--color-text);
    font-family: var(--font-label);
    font-weight: var(--button-weight);
    letter-spacing: var(--button-tracking);
    text-decoration: none;
    text-transform: var(--button-transform);
}

.atv-band__spec svg {
    transition: translate 0.2s;
}

.atv-band__spec:hover {
    color: var(--color-accent-text);
}

.atv-band__spec:hover svg {
    translate: 4px 0;
}

@media (min-width: 768px) {
    .atv-facts {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: var(--space-4) 0;
    }

    .atv-facts > div {
        margin-inline-end: var(--space-6);
        padding-inline-end: var(--space-6);
        border-inline-end: 1px solid var(--color-border);
    }

    .atv-facts > div:last-child {
        margin: 0;
        padding: 0;
        border: 0;
    }
}


/* As a band comes into view its picture settles and its words rise.
   Only where the browser ties animation to scrolling; elsewhere it simply shows.
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
    @supports (animation-timeline: view()) {
        .atv-band__media > * {
            animation: atv-settle linear both;
            animation-timeline: view();
            animation-range: entry 0% cover 50%;
        }

        .atv-band__text {
            animation: atv-rise linear both;
            animation-timeline: view();
            animation-range: entry 0% cover 30%;
        }
    }
}

@keyframes atv-settle {
    from {
        scale: 1.15;
    }
}

@keyframes atv-rise {
    from {
        opacity: 0;
        translate: 0 2rem;
    }
}
