/* ==========================================================================
   Shared iPhone frame for every mobile screenshot on the site.
   Same look as the phone on /get-engager: metal rim, black bezel, side
   buttons, plus a Dynamic Island that sits over the screenshot's status bar.

   Size it with --w (the screen width). Each image ships in exact-size copies
   (images/mobile-apps/sized/) and a matching `sizes` attribute, so the
   browser never resizes the screenshot and it stays sharp. Tilt and float
   effects come from each page (see Effects below).

   Markup:
   <div class="cs-iphone">
     <span class="cs-iphone-btn cs-iphone-btn-1"></span> ... btn-4
     <div class="cs-iphone-bezel"><div class="cs-iphone-screen">
       <img ...><span class="cs-iphone-island"></span>
     </div></div>
   </div>
   ========================================================================== */

.cs-iphone {
    --w: 180px;
    --rim: 2px;
    --bz: 5px;
    position: relative;
    display: inline-block;
    vertical-align: top;
    flex: none;
    padding: var(--rim);
    border-radius: calc(var(--w) * 0.143 + var(--bz) + var(--rim));
    background: linear-gradient(135deg, #8d8f94 0%, #3d3f44 18%, #6f7177 40%, #2c2e33 62%, #9a9ca1 82%, #4a4c51 100%);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.35), 0 8px 18px rgba(0, 0, 0, 0.2);
    line-height: 0;
    transform: none;
    animation: none;
}

/* whole-pixel rim and bezel so the screen lands on exact pixels */
@supports (width: round(1.5px, 1px)) {
    .cs-iphone {
        --rim: max(2px, round(calc(var(--w) * 0.0125), 1px));
        --bz: round(calc(var(--w) * 0.025), 1px);
    }
}

.cs-iphone-bezel {
    padding: var(--bz);
    border-radius: calc(var(--w) * 0.143 + var(--bz));
    background: #000;
}

.cs-iphone-screen {
    position: relative;
    width: var(--w);
    aspect-ratio: 1320 / 2868;
    border-radius: calc(var(--w) * 0.143);
    overflow: hidden;
    background: #000;
}

/* beats any older page rules aimed at screenshot images */
.cs-iphone .cs-iphone-screen img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    object-fit: cover;
    object-position: top;
    border-radius: 0 !important;
    box-shadow: none !important;
    filter: none !important;
    transform: none !important;
}

.cs-iphone-island {
    position: absolute;
    z-index: 2;
    top: calc(var(--w) * 0.025);
    left: 50%;
    width: calc(var(--w) * 0.286);
    height: calc(var(--w) * 0.084);
    margin-left: calc(var(--w) * -0.143);
    border-radius: 999px;
    background: #000;
}

.cs-iphone-btn {
    position: absolute;
    width: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, #4a4c51, #9a9ca1 50%, #4a4c51);
}
.cs-iphone-btn-1 { left: -2px; top: 15.6%; height: 4.1%; }
.cs-iphone-btn-2 { left: -2px; top: 23%; height: 7.7%; }
.cs-iphone-btn-3 { left: -2px; top: 32.2%; height: 7.7%; }
.cs-iphone-btn-4 { right: -2px; top: 26.2%; height: 12.1%; }

/* --------------------------------------------------------------------------
   Sizes per placement. If you change a --w here, change the img `sizes`
   attribute on that page to match.
   -------------------------------------------------------------------------- */

/* Homepage: "iOS & Android" phone beside the web player */
.showcase-left .cs-iphone { --w: 146px; }
@media (max-width: 1024px) { .showcase-left .cs-iphone { --w: 116px; } }
@media (max-width: 768px)  { .showcase-left .cs-iphone { --w: 164px; } }

/* Homepage "Your Listeners. Everywhere." and Mobile Apps "Built For Listeners On The Go" */
.listener-experience .cs-iphone,
.hero-visual .cs-iphone { --w: 180px; }
@media (max-width: 768px) {
    .listener-experience .cs-iphone,
    .hero-visual .cs-iphone { --w: 128px; }
}
@media (max-width: 480px) {
    .listener-experience .cs-iphone,
    .hero-visual .cs-iphone { --w: 108px; }
}

/* Mobile Apps: live video phone */
.video-visual .cs-iphone { --w: 200px; }
@media (max-width: 768px) { .video-visual .cs-iphone { --w: 144px; } }

/* Radio Streaming: phone beside the web player */
.player-showcase-phone .cs-iphone { --w: 128px; }
@media (max-width: 1024px) { .player-showcase-phone .cs-iphone { --w: 108px; } }
@media (max-width: 480px)  { .player-showcase-phone .cs-iphone { --w: 90px; } }

/* Video Streaming: phones beside the desktop video players */
.player-mobile .cs-iphone { --w: 128px; }
@media (max-width: 768px) { .player-mobile .cs-iphone { --w: 108px; } }
@media (max-width: 480px) { .player-mobile .cs-iphone { --w: 90px; } }

/* Players: Mobile Apps card */
.mobile-dual-image .cs-iphone { --w: 136px; }
@media (max-width: 768px) { .mobile-dual-image .cs-iphone { --w: 100px; } }
@media (max-width: 480px) { .mobile-dual-image .cs-iphone { --w: 84px; } }

/* --------------------------------------------------------------------------
   Effects. The phones keep each page's original tilt, float, hover and glow:
   the page's old frame classes sit on the .cs-iphone element (homepage,
   Mobile Apps) or on its parent (Radio, Video). These rules only swap the old
   frame's look for the iPhone look; transforms, animations and shadows still
   come from the page.
   -------------------------------------------------------------------------- */
.cs-iphone.cs-iphone.cs-iphone {
    width: auto;
    padding: var(--rim);
    background: linear-gradient(135deg, #8d8f94 0%, #3d3f44 18%, #6f7177 40%, #2c2e33 62%, #9a9ca1 82%, #4a4c51 100%);
    border-radius: calc(var(--w) * 0.143 + var(--bz) + var(--rim));
}

/* Radio + Video: the old frame wrapper keeps its motion and shadow, loses its look */
.player-showcase-phone.player-showcase-phone,
.player-mobile.player-mobile {
    width: auto;
    padding: 0;
    background: none;
    border-radius: 24px;
}
@media (max-width: 1024px) {
    .player-showcase-phone.player-showcase-phone { border-radius: 21px; }
}
@media (max-width: 768px) {
    .player-mobile.player-mobile { border-radius: 21px; }
}
@media (max-width: 480px) {
    .player-showcase-phone.player-showcase-phone,
    .player-mobile.player-mobile { border-radius: 18px; }
}
.player-showcase-phone .cs-iphone,
.player-mobile .cs-iphone { box-shadow: none; }
