/*
 * Homepage phone/tablet fixes (below the 1280px desktop hero). Unlayered, so
 * these override the generated utilities without !important.
 */

@media (max-width: 1279.98px) {
    /*
     * Hero, matching the desktop design: white, full-bleed banner, controls
     * centred underneath. Most slides are 2560x1655 desktop banners with the
     * copy baked into the artwork, so cover-cropping them into a ~390px square
     * cut that copy off; show each slide whole at the banner's own ratio.
     */
    .hero-animation-section [data-hero-carousel-root]:not(.hero-field) {
        --hero-band: #000;
        padding-top: 80px;
        background: var(--hero-band);
        transition: background-color .6s ease;
    }

    /* Each slide's admin theme decides the band: light slides sit on white. */
    .hero-animation-section [data-hero-carousel-root]:not(.hero-field)[data-hero-content-theme="light"] {
        --hero-band: #fff;
    }

    .hero-animation-section [data-hero-carousel-root]:not(.hero-field) .hero-background-container {
        position: relative;
        inset: auto;
        height: auto;
        overflow: hidden;
        aspect-ratio: 2560 / 1655;
        isolation: isolate;
    }

    /* The banner fades into the band so the controls below sit on it, not under it. */
    .hero-animation-section [data-hero-carousel-root]:not(.hero-field) .hero-background-container::after {
        position: absolute;
        inset: auto 0 0;
        z-index: 3;
        height: 36%;
        background: linear-gradient(180deg, transparent, var(--hero-band));
        content: "";
        pointer-events: none;
    }

    .hero-animation-section [data-hero-carousel-root]:not(.hero-field) .hero-background-container + div {
        position: static;
        padding: 0 16px 22px;
    }

    /* Titles (used by the video slides) sit centred on the media. */
    .hero-animation-section [data-hero-carousel-root]:not(.hero-field) .hero-background-container + div > div:first-child {
        position: absolute;
        top: 0;
        right: 0;
        left: 0;
        z-index: 3;
        width: auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 16px;
        aspect-ratio: 2560 / 1655;
        pointer-events: none;
    }

    .hero-animation-section [data-hero-carousel-root]:not(.hero-field) [data-hero-slide-title] {
        font-size: clamp(28px, 7.4vw, 56px);
    }

    /*
     * Controls: desktop order (previous, button, next) without the glass box.
     * Light slides get dark-on-white controls; dark slides keep the original
     * white-on-glass ones.
     */
    .hero-animation-section [data-hero-carousel-root]:not(.hero-field) .hero-background-container + div > div:last-child {
        position: relative;
        z-index: 4;
        margin-top: -30px;
    }

    .hero-animation-section [data-hero-carousel-root]:not(.hero-field) .hero-button-container {
        justify-content: center;
        gap: 10px;
    }

    .hero-animation-section [data-hero-carousel-root]:not(.hero-field) div:has(> .hero-button-container) {
        padding: 0;
        border: 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
        backdrop-filter: none;
    }

    .hero-animation-section [data-hero-carousel-root]:not(.hero-field) .hero-navigation-move-wrapper {
        display: contents;
    }

    .hero-animation-section [data-hero-carousel-root]:not(.hero-field) .hero-nav-prev {
        order: 0;
    }

    .hero-animation-section [data-hero-carousel-root]:not(.hero-field) .hero-button-move-wrapper {
        order: 1;
        flex: 0 1 230px;
    }

    .hero-animation-section [data-hero-carousel-root]:not(.hero-field) .hero-nav-next {
        order: 2;
    }

    .hero-animation-section [data-hero-carousel-root]:not(.hero-field)[data-hero-content-theme="light"] .hero-button-carousel a {
        --template-color: #181819 !important;
        --primary-color: #181819 !important;
        background: rgb(255 255 255 / 76%);
        box-shadow: 0 8px 24px rgb(0 0 0 / 8%), inset 0 0 0 1px rgb(255 255 255 / 70%);
        backdrop-filter: blur(16px) saturate(160%);
    }

    .hero-animation-section [data-hero-carousel-root]:not(.hero-field)[data-hero-content-theme="light"] .hero-button-carousel p {
        color: #181819;
    }

    .hero-animation-section [data-hero-carousel-root]:not(.hero-field)[data-hero-content-theme="light"] :is(.hero-nav-prev, .hero-nav-next) {
        color: #181819;
        background: rgb(255 255 255 / 76%);
        border-color: transparent;
        box-shadow: 0 8px 24px rgb(0 0 0 / 8%);
        backdrop-filter: blur(16px) saturate(160%);
    }

    .hero-animation-section [data-hero-carousel-root]:not(.hero-field)[data-hero-content-theme="light"] :is(.hero-nav-prev, .hero-nav-next) rect:not(.hero-nav-progress) {
        fill: #fff;
        stroke: #181819;
        stroke-opacity: .12;
    }

    /*
     * Ecosystem: the mobile cards were pinned to the bottom of a fixed-height
     * section, so a longer heading (the English one) ran underneath them.
     * Keep them at the bottom of the same minimum height, but in flow, so the
     * section grows instead of overlapping.
     */
    .planet-section {
        display: flex;
        flex-direction: column;
    }

    .planet-section > div {
        display: flex;
        flex: 1;
        flex-direction: column;
    }

    /*
     * In a flex column an absolute child's static position is the top of the
     * container, which would slide the planet over the heading. Keep it right
     * after the heading as before, full section width over the 24px wrapper
     * padding, taking no space (its height is 927/1350 of its width).
     */
    .planet-section > div > div:has(> .planet-earth-reveal) {
        position: relative;
        left: 0;
        flex-shrink: 0;
        width: calc(100% + 48px);
        margin-inline: -24px;
        margin-bottom: calc((100% + 48px) * -927 / 1350);
        translate: none;
    }

    .planet-section > div > .absolute.inset-x-0:last-child {
        position: relative;
        inset: auto;
        margin-top: auto;
        /* Span the section like before, not the 24px-padded wrapper. */
        margin-inline: -24px;
        padding-top: 40px;
        padding-bottom: 20px;
    }

    /* Other products: stack the two title halves instead of squeezing them side by side. */
    [data-other-products-section] h2 {
        display: block;
    }

    [data-other-products-section] h2 > span {
        display: block;
    }

    /* The 336px desktop fade covered almost the whole product image on a phone. */
    [data-other-products-media-swiper] .swiper-wrapper > .pointer-events-none {
        display: none;
    }

    /*
     * The product image sat small under the copy in a 16:9 strip. Lead with
     * it instead, full card width, then the copy and controls.
     */
    [data-other-products-section] > .relative.z-2 > div {
        overflow: visible;
    }

    [data-other-products-section] > .relative.z-2 > div > div:has([data-other-products-media-swiper]) {
        order: -1;
        width: calc(100% + 40px);
        height: auto;
        margin-inline: -20px;
        aspect-ratio: 1;
    }

    [data-other-products-media-swiper] .swiper-slide > div {
        height: 100%;
        aspect-ratio: auto;
    }

    /*
     * The product photos are opaque with black backgrounds: show them edge to
     * edge on the black card and fade the bottom edge into it, so no photo
     * rectangle shows.
     */
    [data-other-products-media-swiper] img {
        padding: 0;
        object-fit: cover;
        mask-image: linear-gradient(180deg, #000 72%, transparent);
    }

    [data-other-products-section] > .relative.z-2 > div > div:has([data-other-products-content-swiper]) {
        padding-top: 0;
        padding-bottom: 28px;
    }
}

@media (max-width: 767.98px) {
    /*
     * Ecosystem cards: phones under 400px (most Androids) got one stacked
     * column that covered the planet, while wider iPhones got 2x2. Use 2x2
     * everywhere, with the icon above the copy so the narrow cards fit.
     */
    .planet-section > div > .absolute.inset-x-0:last-child > .grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .planet-section > div > .absolute.inset-x-0:last-child > .grid > div {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px;
    }

    .planet-section > div > .absolute.inset-x-0:last-child .whitespace-nowrap {
        white-space: normal;
    }

    /*
     * Ecosystem products were cover-cropped inside a 40px white circle. Keep
     * the circle as a backdrop and show the whole cut-out product on it,
     * larger than the circle.
     */
    .planet-section > div > .absolute.inset-x-0:last-child > .grid > div > div:first-child {
        position: relative;
        width: 56px;
        height: 56px;
        margin: 6px 0 2px;
        overflow: visible;
    }

    .planet-section > div > .absolute.inset-x-0:last-child > .grid > div > div:first-child > img {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 118%;
        max-width: none;
        height: 118%;
        object-fit: contain;
        translate: -50% -54%;
        filter: drop-shadow(0 6px 10px rgb(0 0 0 / 35%));
    }

    /* Product cards: size to their content rather than a fixed 490px. */
    .products-section article {
        min-height: 0;
    }

    .products-section article > div:has(> img) {
        width: 56%;
        margin-top: 8px;
    }

    .products-section article > div:has(> img) img {
        max-height: 180px;
    }
}

@media (max-width: 1279.98px) {
    /*
     * Long feature lines ran off the card on 360px phones and under the
     * product image on tablets; let them wrap.
     */
    .products-section article li {
        align-items: flex-start;
    }

    .products-section article li > span:first-child {
        margin-top: .35em;
    }

    .products-section article li > span:last-child {
        white-space: normal;
    }
}

@media (min-width: 1024px) and (max-width: 1279.98px) {
    .planet-section > div > .absolute.inset-x-0:last-child {
        padding-bottom: 48px;
    }
}

/* Tablets: the image is pinned bottom-right, so keep the list clear of it. */
@media (min-width: 768px) and (max-width: 1279.98px) {
    .products-section article > div:has(> ul) {
        max-width: 56%;
    }

    .products-section article > div:has(> img) {
        width: 42%;
    }
}

/*
 * Mobile implant story: a short pinned intro (implant, sparks and the
 * technology statement filling in as it turns), then swipeable feature cards.
 */
.mobile-story {
    position: relative;
    padding-bottom: 56px;
    background: #000;
    color: #fff;
}

.mobile-story-track {
    position: relative;
    height: 240svh;
}

.mobile-story-sticky {
    position: sticky;
    top: 0;
    display: flex;
    height: 100svh;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    padding: 0 24px calc(48px + env(safe-area-inset-bottom));
}

.mobile-story-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.mobile-story-statement {
    position: relative;
    margin: 0 auto;
    max-width: 20ch;
    font-family: "Google Sans Flex", sans-serif;
    font-size: clamp(28px, 8vw, 52px);
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -.025em;
    text-align: center;
    text-wrap: balance;
    color: rgb(255 255 255 / 26%);
}

.mobile-story-statement::after {
    position: absolute;
    inset: 0;
    color: #fff;
    content: attr(data-text);
    clip-path: inset(0 0 calc(100% - var(--story-fill, 0%)) 0);
}

/* Feature cards */
.mobile-story-slides {
    padding-top: 8px;
}

.mobile-story-rail,
.why-mobile-rail {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 0 16px 4px;
    scroll-padding-inline: 16px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.mobile-story-rail::-webkit-scrollbar,
.why-mobile-rail::-webkit-scrollbar {
    display: none;
}

.mobile-story-card {
    display: flex;
    flex: 0 0 min(84vw, 420px);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgb(255 255 255 / 9%);
    border-radius: 28px;
    background: linear-gradient(180deg, #121212, #0a0a0a);
    scroll-snap-align: center;
}

.mobile-story-media {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: #000;
}

.mobile-story-media :is(canvas, video) {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-story-media::after {
    position: absolute;
    inset: auto 0 0;
    height: 30%;
    background: linear-gradient(180deg, transparent, #111);
    content: "";
    pointer-events: none;
}

.mobile-story-circle {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1;
    width: 42%;
    aspect-ratio: 1;
    object-fit: contain;
    filter: drop-shadow(0 12px 32px rgb(0 0 0 / 60%));
}

.mobile-story-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 14px;
    padding: 4px 20px 24px;
}

.mobile-story-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.mobile-story-stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 10px;
    border-top: 2px solid rgb(255 255 255 / 25%);
}

.mobile-story-stat.is-orange {
    border-color: #f58220;
}

.mobile-story-stat-value {
    font-family: "Google Sans Flex", sans-serif;
    font-size: clamp(40px, 12vw, 60px);
    font-weight: 200;
    line-height: .85;
    color: #d9d9d9;
}

.mobile-story-stat.is-orange :is(.mobile-story-stat-value, .mobile-story-stat-label) {
    color: #f58220;
}

.mobile-story-stat-label {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    color: rgb(255 255 255 / 80%);
}

.mobile-story-title {
    display: flex;
    flex-direction: column;
    font-size: clamp(26px, 7.4vw, 36px);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -.03em;
    text-wrap: balance;
}

.mobile-story-title .is-orange {
    color: #f58220;
}

.mobile-story-text {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.45;
    color: rgb(255 255 255 / 72%);
    text-wrap: pretty;
}

.mobile-story-button {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    gap: 14px;
    height: 46px;
    margin-top: auto;
    padding: 0 5px 0 20px;
    border-radius: 999px;
    background: #f58220;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.02em;
    color: #fff;
}

.mobile-story-button i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    color: #f58220;
}

.mobile-story-button svg {
    width: 18px;
    height: 18px;
}

/* The video card lets the clip fill the card, with its title and button on top. */
.mobile-story-card:has(video) {
    position: relative;
}

.mobile-story-card:has(video) .mobile-story-media {
    position: absolute;
    inset: 0;
    aspect-ratio: auto;
}

.mobile-story-card:has(video) .mobile-story-media::after {
    height: 60%;
    background: linear-gradient(180deg, transparent, rgb(0 0 0 / 88%));
}

.mobile-story-card:has(video) .mobile-story-body {
    position: relative;
    justify-content: flex-end;
    min-height: 100%;
    padding-top: 24px;
}

.mobile-story-card:has(video) .mobile-story-button {
    margin-top: 4px;
}

.mobile-story-pager {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
}

.mobile-story-pager button {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgb(255 255 255 / 25%);
    cursor: pointer;
    transition: width .35s cubic-bezier(.22, 1, .36, 1), background-color .35s;
}

.mobile-story-pager button[aria-current="true"] {
    width: 28px;
    background: #f58220;
}

/* Why MODE (mobile): one swipeable card per reason. */
.why-mobile-title {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -.02em;
    text-align: center;
    color: #1d1d1f;
}

.why-mobile-rail {
    margin: 28px -24px 0;
    padding-inline: 24px;
    scroll-padding-inline: 24px;
}

.why-mobile-card {
    display: flex;
    flex: 0 0 min(76vw, 340px);
    flex-direction: column;
    gap: 12px;
    padding: 22px 20px 24px;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 14px 36px rgb(29 29 31 / 6%);
    scroll-snap-align: start;
}

.why-mobile-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.why-mobile-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #f58220;
    box-shadow: 0 10px 24px rgb(245 130 32 / 24%);
}

.why-mobile-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.why-mobile-index {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .14em;
    color: #b0b6bd;
}

.why-mobile-card-title {
    font-size: 19px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -.02em;
    color: #1d1d1f;
}

.why-mobile-card-text {
    font-size: 15px;
    line-height: 1.5;
    color: #56697a;
}

.why-mobile-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 24px;
}

.why-mobile-nav-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgb(255 255 255 / 90%);
    box-shadow: 0 10px 30px rgb(29 29 31 / 6%);
    color: #28323b;
    cursor: pointer;
    transition: opacity .3s, color .3s;
}

.why-mobile-nav-button:disabled {
    opacity: .45;
    color: #9ca6b2;
    cursor: default;
}

.why-mobile-nav-button > svg:last-child {
    width: 20px;
    height: 20px;
}

.why-mobile-nav-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    rotate: -90deg;
}

.why-mobile-nav-ring [data-why-ring] {
    stroke-dasharray: var(--why-ring, 10) 100;
    transition: stroke-dasharray .45s cubic-bezier(.22, 1, .36, 1);
}

.why-mobile-count {
    min-width: 64px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: .14em;
    text-align: center;
    color: #7e8792;
}

@media (min-width: 768px) {
    .mobile-story-rail {
        justify-content: safe center;
    }
}
