/* Match the featured software image to the image treatment of the other mobile cards. */
@media (max-width: 768px) {
    .popular-software-card .software-logo {
        display: none;
    }

        .popular-software-card .software-logo svg {
            width: 27px;
            height: 27px;
            fill: none;
            stroke: #fff;
            stroke-width: 3;
            filter: drop-shadow(0 0 8px rgba(255,255,255,.8));
        }

    .popular-software-card .software-content {
        padding-right: 10px;
    }

    .popular-software-card .software-content {
    }

    .popular-software-card .software-heading h2 {
        display: block;
        font-size: 13px;
        line-height: 1;
        text-align: right;
        margin-top: -10px;
    }

        .popular-software-card .software-heading h2::before {
            content: "";
            display: inline-block;
            width: 35px;
            height: 35px;
            margin: 0 -7px auto 0px;
            vertical-align: middle;
            background: url("/assets/software/popular-software-icon.svg") center / contain no-repeat;
            filter: brightness(0) invert(1) drop-shadow(0 0 4px rgba(255, 255, 255, .8));
            flex-shrink: 0;
        }

    .popular-software-card .popular-title-main,
    .popular-software-card .popular-title-world {
        display: block;
    }

    .popular-software-card .popular-title-world {
        white-space: nowrap;
    }

    .popular-software-card .popular-software-heading-icon {
        display: inline-flex;
        flex: 0 0 26px;
        width: 26px;
        height: 26px;
        color: #d8f7ff;
        filter: drop-shadow(0 0 4px rgba(154, 232, 255, .9));
    }

        .popular-software-card .popular-software-heading-icon svg {
            width: 100%;
            height: 100%;
            fill: none;
            stroke: currentColor;
            stroke-linecap: round;
            stroke-linejoin: round;
            stroke-width: 4;
        }

    .popular-software-card .popular-software-heading-text {
        min-width: 0;
    }
}

/* The mobile heading icon is intentionally absent on desktop. */
@media (min-width: 769px) {
    .popular-software-card .popular-software-heading-icon {
        display: none;
    }
}

/* Keep the featured card aligned with the standard software cards on desktop. */
@media (min-width: 769px) {
    .popular-software-card .software-logo {
        min-width: 160px;
        padding: 20px;
        filter: brightness(0) invert(1) drop-shadow(0 0 4px rgba(255, 255, 255, .8));
    }

        .popular-software-card .software-logo svg {
            width: 110px;
            height: 110px;
            fill: none;
            stroke: #fff;
            stroke-width: 3;
            filter: drop-shadow(0 0 12px rgba(255,255,255,.85));
        }

    .popular-software-card .software-heading h2 {
        white-space: nowrap;
    }

        .popular-software-card .software-heading h2::before {
            display: none;
        }
}

@media (max-width: 768px) {
    .popular-software-card .popular-software-image {
        padding: 0;
        overflow: hidden;
    }

        .popular-software-card .popular-software-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            object-position: center;
        }
}

.popular-software-page-heading {
    margin-top: -28px
}

    .popular-software-page-heading h1 {
        margin-bottom: 18px
    }

.software-search {
    display: flex;
    justify-content: center;
}

    .software-search input {
        width: 100%;
        padding: 9px 14px;
        text-align: center;
        color: var(--software-text,#243052);
        background: transparent;
        border: 1px solid #44e6ff;
        border-radius: 12px;
        box-shadow: 0 0 6px rgba(68,230,255,.75),0 0 14px rgba(177,92,255,.35);
        outline: none;
        font: inherit;
        font-size: 14px;
        line-height: 1.5
    }

        .software-search input::placeholder {
            color: var(--software-muted,#74809e);
            font: inherit;
            font-size: 14px;
            opacity: 1
        }

        .software-search input:focus {
            border-color: #bd6cff;
            box-shadow: 0 0 8px rgba(68,230,255,.9),0 0 18px rgba(189,108,255,.65)
        }

.software-box {
    border: 1px solid #44e6ff;
    border-radius: 16px;
    padding: 12px;
    margin-bottom:20px;
    background: transparent;
    box-shadow: 0 0 8px rgba(68,230,255,.35),inset 0 0 16px rgba(68,230,255,.08)
}

.popular-software-grid {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 14px
}

@media (max-width: 768px) {
    .popular-software-grid {
        grid-template-columns: repeat(3,minmax(0,1fr));
        gap: 12px
    }
}

.software-box.expanded {
    /* remove the visible frame but keep padding/spacing so app tiles keep the exact same size */
    border-color: transparent;
    box-shadow: none;
    background: transparent
}

/* While animating the height change, clip content so new tiles don't
   overflow past the box's rounding mid-transition. */
.software-box.is-animating {
    overflow: hidden
}

.show-all-software {
    display: block;
    margin: 14px auto 0;
    padding: 9px 28px;
    border: 1px solid #44e6ff;
    border-radius: 10px;
    background: transparent;
    color: var(--software-text,#3154a4);
    box-shadow: 0 0 7px rgba(68,230,255,.45);
    cursor: pointer
}

    .show-all-software:hover {
        border-color: #bd6cff;
        box-shadow: 0 0 10px rgba(189,108,255,.65)
    }

.show-all-software[hidden] {
    display: none
}

.software-ad {
    margin-top: 18px;
    min-height: 90px;
    border: 1px solid rgba(68,230,255,.7);
    border-radius: 14px;
    background: transparent;
    text-align: center;
    padding: 28px;
    color: var(--software-muted,#789);
    box-shadow: 0 0 8px rgba(68,230,255,.25)
}

.popular-software-page {
    margin-bottom:20px;
    color: var(--text,#243052)
}

.popular-software-page-heading h1 {
    color: #fff;
    text-shadow: 0 0 8px rgba(255,255,255,.25)
}

.popular-app-name {
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,.9)
}

.popular-app-name {
    font-weight: 700
}

@media (prefers-color-scheme: dark) {
    .software-search input, .show-all-software {
        --software-text: #e7f7ff;
        --software-muted: #a9bfd1
    }

    .software-box, .software-ad {
        border-color: #44e6ff
    }
}

html[data-theme="dark"] .software-search input, html[data-theme="dark"] .show-all-software {
    --software-text: #e7f7ff;
    --software-muted: #a9bfd1
}

html[data-theme="light"] .software-search input, html[data-theme="light"] .show-all-software {
    --software-text: #243052;
    --software-muted: #74809e
}

:root.light-theme .popular-software-page {
    --text: #173247;
    --software-text: #173247;
    --software-muted: #527086
}

:root.light-theme .popular-software-page-heading h1, :root.light-theme .popular-app-name {
    color: #fff
}

:root.light-theme .software-ad {
    color: #527086
}

:root.light-theme .show-all-software {
    background: #eaf7ff;
    color: #173247;
    border-color: #087d9e;
    box-shadow: 0 2px 8px rgba(8,125,158,.22)
}

html[data-theme="light"] .show-all-software {
    background: #eaf7ff;
    color: #173247;
    border-color: #087d9e;
    box-shadow: 0 2px 8px rgba(8,125,158,.22)
}

:root.light-theme .software-search input,
html[data-theme="light"] .software-search input {
    color: #173247;
    background: rgba(255,255,255,.72);
    -webkit-text-fill-color: #173247
}

:root.light-theme .popular-app-name,
html[data-theme="light"] .popular-app-name {
    padding: 3px 6px;
    border-radius: 6px;
}

.popular-app-icon {
    border-width: 2px;
    box-shadow: 0 0 14px rgba(68,230,255,.8),0 0 28px rgba(177,92,255,.48)
}

/* Desktop: more breathing room between the software tiles.
   This file loads after styles.css, so it wins the cascade over the
   smaller gap defined there. */
@media (min-width: 1025px) {
    .popular-software-grid {
        gap: 44px 36px;
    }
}

/* Keep the first media box on both pages at 16:9 on desktop. */
@media (min-width: 769px) {
    .software-intro-image {
        width: 100%;
        margin-inline: auto;
    }

    .ads-page-content > .featured-banner {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        min-height: 0;
        max-height: none;
    }

    .ads-page-content > .featured-banner .featured-banner-image {
        height: 100%;
        aspect-ratio: auto;
        min-height: 0;
        max-height: none;
    }

    .ads-page-content > .featured-banner .featured-banner-image img {
        object-fit: contain;
    }
}

.software-intro-image {
    position: relative;
    aspect-ratio: 16 / 9;
    margin-bottom: 44px;
    min-height: 0;
    padding: 0;
    border-radius: var(--radius-2xl);
    background: var(--surface);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .software-intro-image {
        margin-bottom: 28px;
    }
}

.software-intro-image-frame {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
}

.software-intro-image::before,
.software-intro-image::after {
    z-index: 2;
}

.software-intro-image-media {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: calc(var(--radius-2xl) - 4px);
}

/* Show the full home-page hero slide inside its existing desktop height. */
@media (min-width: 769px) {
    .hero {
        width: min(104%, calc(100vw - 24px));
        height: auto;
        min-height: 0;
        aspect-ratio: 16 / 9;
        margin-inline: auto;
    }

    .hero-image {
        height: 100%;
        min-height: 0;
    }

    .hero-image img.hero-slide {
        object-fit: cover;
        object-position: center;
    }
}

@media (max-width: 768px) {
    .hero {
        width: 100%;
        height: auto;
        min-height: 0;
        aspect-ratio: 16 / 9;
    }

    .hero-image {
        height: 100%;
        min-height: 0;
    }

    .hero-image img.hero-slide {
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center;
    }
}

@media (max-width: 460px) {
    .hero {
        height: auto;
        min-height: 0;
        aspect-ratio: 16 / 9;
    }
}
