/**
 * mod_latest_article_push — native-like push notification
 * Override any variable from YOOtheme > Custom Code > CSS, e.g.:
 *   .ikpush { --ikpush-accent: #c8102e; --ikpush-width: 400px; }
 */

.ikpush {
    --ikpush-accent: #1e87f0;
    --ikpush-width: 380px;
    --ikpush-offset: 20px;
    --ikpush-offset-mobile: 10px;
    --ikpush-radius: 18px;
    --ikpush-z: 990; /* above UIkit sticky navbar (980), below offcanvas (1000) and modal (1010) */

    --ikpush-bg: #ffffff;
    --ikpush-bg-glass: rgba(255, 255, 255, 0.82);
    --ikpush-color: #1c1c1e;
    --ikpush-muted: #6b6b70;
    --ikpush-border: rgba(0, 0, 0, 0.07);
    --ikpush-close-hover: rgba(0, 0, 0, 0.06);
    --ikpush-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 14px 36px -10px rgba(0, 0, 0, 0.28);

    --ikpush-enter-y: -14px;

    position: fixed;
    z-index: var(--ikpush-z);
    width: min(var(--ikpush-width), calc(100vw - 2 * var(--ikpush-offset)));
    pointer-events: none;
    margin: 0;
}

/* ---------- Themes ---------- */

.ikpush--theme-dark {
    --ikpush-bg: #2c2c2e;
    --ikpush-bg-glass: rgba(44, 44, 46, 0.82);
    --ikpush-color: #f5f5f7;
    --ikpush-muted: #a1a1a6;
    --ikpush-border: rgba(255, 255, 255, 0.08);
    --ikpush-close-hover: rgba(255, 255, 255, 0.1);
    --ikpush-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -10px rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
    .ikpush--theme-auto {
        --ikpush-bg: #2c2c2e;
        --ikpush-bg-glass: rgba(44, 44, 46, 0.82);
        --ikpush-color: #f5f5f7;
        --ikpush-muted: #a1a1a6;
        --ikpush-border: rgba(255, 255, 255, 0.08);
        --ikpush-close-hover: rgba(255, 255, 255, 0.1);
        --ikpush-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -10px rgba(0, 0, 0, 0.6);
    }
}

/* ---------- Desktop positions ---------- */

.ikpush--d-top-right    { top: calc(var(--ikpush-offset) + env(safe-area-inset-top, 0px)); right: var(--ikpush-offset); }
.ikpush--d-top-left     { top: calc(var(--ikpush-offset) + env(safe-area-inset-top, 0px)); left: var(--ikpush-offset); }
.ikpush--d-bottom-right { bottom: calc(var(--ikpush-offset) + env(safe-area-inset-bottom, 0px)); right: var(--ikpush-offset); --ikpush-enter-y: 14px; }
.ikpush--d-bottom-left  { bottom: calc(var(--ikpush-offset) + env(safe-area-inset-bottom, 0px)); left: var(--ikpush-offset); --ikpush-enter-y: 14px; }

/* ---------- Card ---------- */

.ikpush__card {
    position: relative;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
    padding: 14px 42px 14px 14px;
    border: 1px solid var(--ikpush-border);
    border-radius: var(--ikpush-radius);
    background: var(--ikpush-bg);
    color: var(--ikpush-color);
    box-shadow: var(--ikpush-shadow);
    overflow: hidden;
    pointer-events: auto;
    font-size: 14px;
    line-height: 1.4;
    text-align: left;

    opacity: 0;
    transform: translate3d(0, var(--ikpush-enter-y), 0) scale(0.97);
    transition:
        opacity 0.32s ease,
        transform 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.12);
    will-change: transform, opacity;
    touch-action: pan-y;
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .ikpush__card {
        background: var(--ikpush-bg-glass);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        backdrop-filter: saturate(180%) blur(20px);
    }
}

.ikpush--no-icon .ikpush__card {
    grid-template-columns: minmax(0, 1fr);
}

.ikpush.is-visible .ikpush__card {
    opacity: 1;
    transform: none;
}

.ikpush.is-leaving .ikpush__card {
    opacity: 0;
    transform: translate3d(0, var(--ikpush-enter-y), 0) scale(0.97);
    transition-duration: 0.22s, 0.25s;
    transition-timing-function: ease-in, ease-in;
}

/* ---------- Icon ---------- */

.ikpush__icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--ikpush-accent);
    color: #fff;
    overflow: hidden;
    flex-shrink: 0;
}

.ikpush__icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ikpush__icon svg {
    display: block;
}

/* ---------- Body ---------- */

.ikpush__body {
    min-width: 0;
}

.ikpush__meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
    font-size: 12px;
    color: var(--ikpush-muted);
}

.ikpush__label {
    font-weight: 600;
    color: var(--ikpush-accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ikpush__time {
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

.ikpush__title,
.ikpush__title:hover,
.ikpush__title:focus {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--ikpush-color);
    text-decoration: none;
}

/* Whole card is clickable through the title link */
.ikpush__title::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.ikpush__title:focus-visible {
    outline: none;
}

.ikpush__title:focus-visible::after {
    outline: 2px solid var(--ikpush-accent);
    outline-offset: -3px;
}

.ikpush__excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    margin: 3px 0 0;
    font-size: 13px;
    color: var(--ikpush-muted);
}

.ikpush__actions {
    margin-top: 8px;
}

.ikpush__cta {
    position: relative;
    z-index: 2;
}

.ikpush__cta--link,
.ikpush__cta--link:hover {
    font-size: 13px;
    font-weight: 600;
    color: var(--ikpush-accent);
    text-decoration: none;
}

.ikpush__cta--link:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ---------- Close ---------- */

.ikpush__close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ikpush-muted);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.ikpush__close:hover {
    background: var(--ikpush-close-hover);
    color: var(--ikpush-color);
}

.ikpush__close:focus-visible {
    outline: 2px solid var(--ikpush-accent);
    outline-offset: 1px;
}

/* ---------- Auto-close progress ---------- */

.ikpush__progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    pointer-events: none;
}

.ikpush__progress span {
    display: block;
    height: 100%;
    background: var(--ikpush-accent);
    opacity: 0.45;
    transform-origin: left center;
}

.ikpush.is-visible .ikpush__progress span {
    animation-name: ikpush-progress;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

@keyframes ikpush-progress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* ---------- Mobile (< UIkit @s breakpoint, 640px) ---------- */

@media (max-width: 639.98px) {
    .ikpush {
        left: var(--ikpush-offset-mobile);
        right: var(--ikpush-offset-mobile);
        width: auto;
    }

    .ikpush--m-top {
        top: calc(var(--ikpush-offset-mobile) + env(safe-area-inset-top, 0px));
        bottom: auto;
        --ikpush-enter-y: -14px;
    }

    .ikpush--m-bottom {
        top: auto;
        bottom: calc(var(--ikpush-offset-mobile) + env(safe-area-inset-bottom, 0px));
        --ikpush-enter-y: 14px;
    }

    .ikpush__card {
        grid-template-columns: 34px minmax(0, 1fr);
        gap: 10px;
        padding: 11px 38px 11px 11px;
        border-radius: 16px;
    }

    .ikpush--no-icon .ikpush__card {
        grid-template-columns: minmax(0, 1fr);
    }

    .ikpush__icon {
        width: 34px;
        height: 34px;
        border-radius: 9px;
    }

    .ikpush__title,
    .ikpush__title:hover,
    .ikpush__title:focus {
        font-size: 14px;
    }

    .ikpush__excerpt {
        -webkit-line-clamp: 1;
        line-clamp: 1;
    }

    .ikpush__actions {
        margin-top: 6px;
    }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    .ikpush__card,
    .ikpush.is-leaving .ikpush__card {
        transform: none;
        transition: opacity 0.2s linear;
    }
}
