/* ESM App Download Section widget */
.esm-appdl {
    --esm-appdl-bg: #1D1F4E;
    --esm-appdl-accent: #FFD200;
    --esm-appdl-text: #FFFFFF;
    --esm-appdl-caption: #1D1F4E;
    --esm-appdl-height: 320vh;
    position: relative;
    height: var(--esm-appdl-height);
    background: var(--esm-appdl-bg);
    font-family: 'Barlow', sans-serif;
}

.esm-appdl *,
.esm-appdl *::before,
.esm-appdl *::after {
    box-sizing: border-box;
}

.esm-appdl__stage {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
    perspective: 1100px;
    background: var(--esm-appdl-bg);
}

/* Blurred backgrounds */
.esm-appdl__bg {
    position: absolute;
    inset: -6%;
    width: 112% !important;
    max-width: none !important;
    height: 112% !important;
    object-fit: cover;
    filter: blur(14px) saturate(1.1);
    opacity: 0;
    transition: opacity 700ms ease;
    transform: scale(1.04);
}

.esm-appdl__bg.is-active {
    opacity: 0.55;
}

.esm-appdl__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--esm-appdl-bg) 94%, transparent) 0%,
        color-mix(in srgb, var(--esm-appdl-bg) 70%, transparent) 55%,
        color-mix(in srgb, var(--esm-appdl-bg) 82%, transparent) 100%);
}

/* Skewed yellow tag */
.esm-appdl__tag {
    display: inline-block;
    align-self: flex-start;
    background: var(--esm-appdl-accent);
    color: var(--esm-appdl-bg);
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-style: italic;
    font-size: 13px;
    line-height: 1.4;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 5px 14px;
    transform: skewX(-12deg);
    border-radius: 3px;
}

/* Intro (top-left while scrolling) */
.esm-appdl__intro {
    position: absolute;
    top: 48px;
    left: clamp(20px, 4vw, 40px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    z-index: 20000;
    opacity: 0;
}

.esm-appdl__intro-name {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    font-size: clamp(34px, 4vw, 56px);
    line-height: 1;
    color: var(--esm-appdl-text);
}

/* 3D scene */
.esm-appdl__scene {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
}

.esm-appdl__photo {
    position: absolute;
    left: 50%;
    top: 50%;
    margin: 0;
    width: 30vw;
    background: #fff;
    padding: 10px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%);
    will-change: transform, opacity;
}

.esm-appdl__photo img {
    display: block;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 0 !important;
}

.esm-appdl__photo figcaption {
    padding: 10px 4px 2px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 18px;
    line-height: 1.2;
    letter-spacing: 0.02em;
    color: var(--esm-appdl-caption);
}

.esm-appdl__photo.is-hero {
    width: 42vw;
    border-bottom: 6px solid var(--esm-appdl-accent);
    opacity: 1;
    transform: translate(-50%, -50%) translateX(25vw);
}

/* Copy block */
.esm-appdl__copy {
    position: absolute;
    z-index: 20000;
    display: flex;
    flex-direction: column;
    gap: 14px;
    left: 40px;
    top: 50%;
    max-width: 42vw;
    transform: translateY(-50%);
}

.esm-appdl .esm-appdl__title {
    margin: 0;
    padding: 0;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-style: normal;
    text-transform: uppercase;
    font-size: clamp(34px, 5vw, 76px);
    line-height: 0.95;
    letter-spacing: 0;
    color: var(--esm-appdl-text);
    text-wrap: balance;
}

/* Chips */
.esm-appdl__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    scrollbar-width: none;
}

.esm-appdl__chips::-webkit-scrollbar {
    display: none;
}

.esm-appdl .esm-appdl__chip {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.3;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 6px 14px;
    margin: 0;
    border-radius: 3px;
    flex-shrink: 0;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    color: #fff;
    box-shadow: none;
    transition: all 200ms ease;
}

.esm-appdl .esm-appdl__chip:hover,
.esm-appdl .esm-appdl__chip:focus-visible {
    border-color: var(--esm-appdl-accent);
    color: #fff;
    background: transparent;
}

.esm-appdl .esm-appdl__chip.is-active {
    border-color: var(--esm-appdl-accent);
    background: var(--esm-appdl-accent);
    color: var(--esm-appdl-bg);
}

/* Store buttons */
.esm-appdl__stores {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.esm-appdl .esm-appdl__store {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px 8px 14px;
    background: #000;
    color: #fff;
    border: 1px solid #fff;
    border-radius: 8px;
    text-decoration: none;
    font-family: 'Barlow', sans-serif;
    transition: transform 150ms ease, background-color 150ms ease;
}

.esm-appdl .esm-appdl__store:hover {
    transform: translateY(-2px);
    background: #111;
    color: #fff;
}

.esm-appdl__store-icon {
    display: inline-flex;
    font-size: 28px;
    line-height: 1;
}

.esm-appdl__store-icon svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.esm-appdl__store-text {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.esm-appdl__store-small {
    font-size: 11px;
}

.esm-appdl__store-big {
    font-size: 20px;
    font-weight: 600;
}

/* Progress bar */
.esm-appdl__progress {
    position: absolute;
    left: clamp(20px, 4vw, 40px);
    right: clamp(20px, 4vw, 40px);
    bottom: 12px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    z-index: 20000;
    opacity: 0;
}

.esm-appdl__progress-bar {
    height: 100%;
    width: 0;
    background: var(--esm-appdl-accent);
}

/* Mobile fallback before JS takes over */
@media (max-width: 759px) {
    .esm-appdl__copy {
        left: 20px;
        top: auto;
        bottom: 28px;
        max-width: calc(100% - 40px);
        transform: none;
    }

    .esm-appdl__chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        margin-right: -20px;
        padding-right: 20px;
        padding-bottom: 4px;
    }

    .esm-appdl__photo.is-hero {
        width: 62vw;
        transform: translate(-50%, -50%) translateY(-24vh);
    }
}

@media (max-height: 559px) {
    .esm-appdl__chips {
        display: none;
    }
}
