.push-subscription {
    display: none;
    position: relative;
    box-sizing: border-box;
    width: auto;
    max-width: 730px;
    margin: 20px 40px 24px;
    overflow: hidden;

    background: var(--site-bg-soft);
    border: 1px solid var(--site-border);
}


/*
 * Тонкая верхняя линия использует основной акцент сайта
 * и визуально связывает блок с остальными элементами интерфейса.
 */
.push-subscription::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;

    background: var(--site-accent);
}


.push-subscription[hidden],
.push-subscription [hidden] {
    display: none !important;
}


.push-subscription__state {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;

    min-height: 104px;
    padding: 18px 20px 17px;
}


/* =========================
   ICON
   ========================= */

.push-subscription__icon {
    display: flex;
    align-items: center;
    justify-content: center;

    box-sizing: border-box;
    width: 48px;
    height: 48px;

    flex-shrink: 0;

    color: var(--site-accent);
    background: var(--site-bg-light);

    border: 1px solid var(--site-border-light);
    border-radius: 50%;
}


.push-subscription__icon svg {
    display: block;
}


.push-subscription__icon--success {
    color: var(--site-success);
    background: var(--site-bg-light);
    border-color: var(--site-border);
}


.push-subscription__icon--muted {
    color: var(--site-text-light);
    background: var(--site-bg-light);
    border-color: var(--site-border-light);
}


/* =========================
   TEXT
   ========================= */

.push-subscription__content {
    min-width: 0;
}


.push-subscription__title {
    margin: 0 0 5px;

    color: var(--site-text-dark);

    font: 700 20px/23px var(--site-font-title);
}


.push-subscription__description {
    max-width: 450px;

    color: var(--site-text-muted);

    font: 13px/19px var(--site-font-main);
}


/* =========================
   ACTION
   ========================= */

.push-subscription__action {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    flex-shrink: 0;
}


.push-subscription__button {
    position: relative;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    box-sizing: border-box;

    min-height: 38px;
    min-width: 160px;

    padding: 9px 14px;

    border: 1px solid var(--site-accent);
    border-radius: 2px;

    background: var(--site-accent);
    color: #ffffff;

    font: 700 13px/18px var(--site-font-main);

    text-align: center;
    white-space: nowrap;

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        opacity 0.15s ease;
}


.push-subscription__button:hover:not(:disabled) {
    background: var(--site-accent-hover);
    border-color: var(--site-accent-hover);
}


.push-subscription__button:active:not(:disabled) {
    background: var(--site-accent);
    border-color: var(--site-accent);
}


.push-subscription__button:focus-visible {
    outline: 2px solid var(--site-accent);
    outline-offset: 2px;
}


/* =========================
   SECONDARY BUTTON
   ========================= */

.push-subscription__button--secondary {
    min-width: auto;

    background: var(--site-bg-light);
    color: var(--site-text-muted);

    border-color: var(--site-border-light);
}


.push-subscription__button--secondary:hover:not(:disabled) {
    background: var(--site-border);
    color: var(--site-text-dark);

    border-color: var(--site-border);
}


/* =========================
   LOADING / DISABLED
   ========================= */

.push-subscription__button:disabled {
    cursor: wait;

    opacity: 0.65;
}


.push-subscription__button:disabled::after {
    content: "";

    box-sizing: border-box;

    width: 13px;
    height: 13px;

    flex: 0 0 13px;

    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;

    opacity: 0.8;

    animation: push-subscription-spinner 0.7s linear infinite;
}


@keyframes push-subscription-spinner {
    to {
        transform: rotate(360deg);
    }
}


/* =========================
   DENIED STATE
   ========================= */

.push-subscription__state--denied {
    grid-template-columns: auto minmax(0, 1fr);
}


.push-subscription__state--denied
.push-subscription__description {
    max-width: none;
}


/* =========================
   TABLET
   ========================= */

@media (max-width: 1169px) {
    .push-subscription {
        max-width: calc(100% - 40px);
        margin-right: 20px;
        margin-left: 20px;
    }
}


/* =========================
   MOBILE
   ========================= */

@media (max-width: 767px) {
    .push-subscription {
        max-width: none;
        margin: 18px 15px 20px;
    }

    .push-subscription__state {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 12px 14px;

        min-height: 0;
        padding: 15px;
    }

    .push-subscription__icon {
        width: 44px;
        height: 44px;

        align-self: start;
    }

    .push-subscription__icon svg {
        width: 22px;
        height: 22px;
    }

    .push-subscription__title {
        margin-top: 1px;

        font-size: 19px;
        line-height: 22px;
    }

    .push-subscription__description {
        font-size: 13px;
        line-height: 18px;
    }

    .push-subscription__action {
        grid-column: 1 / -1;

        width: 100%;
        margin-top: 2px;
    }

    .push-subscription__button {
        width: 100%;
        min-width: 0;
        min-height: 40px;
    }

    .push-subscription__state--denied {
        grid-template-columns: auto minmax(0, 1fr);
    }
}


@media (max-width: 420px) {
    .push-subscription {
        margin-right: 15px;
        margin-left: 15px;
    }

    .push-subscription__state {
        gap: 11px 12px;
        padding: 14px;
    }

    .push-subscription__icon {
        width: 40px;
        height: 40px;
    }

    .push-subscription__icon svg {
        width: 20px;
        height: 20px;
    }

    .push-subscription__title {
        font-size: 18px;
        line-height: 21px;
    }

    .push-subscription__description {
        font-size: 13px;
        line-height: 18px;
    }
}


/* =========================
   REDUCED MOTION
   ========================= */

@media (prefers-reduced-motion: reduce) {
    .push-subscription__button {
        transition: none;
    }

    .push-subscription__button:disabled::after {
        animation-duration: 1.4s;
    }
}

/* =========================
   MODAL MODE
   ========================= */

[data-push-modal-backdrop] {
    position: fixed;
    inset: 0;

    z-index: 100000;

    background: rgba(33, 36, 39, 0.28);

    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);

    cursor: pointer;

    animation: push-subscription-backdrop-in 0.16s ease-out;
}


/*
 * Модальный режим используется для того же самого
 * push-subscription блока. Никаких копий формы не создаём.
 */
.push-subscription[data-push-modal-open="true"] {
    display: block;
    position: fixed;

    top: 50%;
    left: 50%;

    z-index: 100001;

    box-sizing: border-box;

    width: calc(100% - 40px);
    max-width: 730px;
    max-height: calc(100vh - 40px);

    margin: 0;

    overflow: auto;

    transform: translate(-50%, -50%);

    background: var(--site-bg-soft);
    border: 1px solid var(--site-border);

    box-shadow:
        0 18px 55px rgba(0, 0, 0, 0.24);

    animation: push-subscription-modal-in 0.18s ease-out;
}


/*
 * Оставляем немного пространства сверху,
 * чтобы крестик не пересекался с содержимым.
 */
.push-subscription[data-push-modal-open="true"]
.push-subscription__state {
    padding-top: 27px;
}


/* =========================
   MODAL CLOSE BUTTON
   ========================= */

[data-push-modal-close] {
    display: none;

    position: absolute;
    top: 7px;
    right: 8px;

    z-index: 5;

    box-sizing: border-box;

    width: 30px;
    height: 30px;

    padding: 0;

    border: 0;
    border-radius: 2px;

    background: transparent;
    color: var(--site-text-light);

    font-family: Arial, sans-serif;
    font-size: 25px;
    font-weight: 400;
    line-height: 28px;

    text-align: center;

    cursor: pointer;

    transition:
        color 0.15s ease,
        background-color 0.15s ease;
}


.push-subscription[data-push-modal-open="true"]
[data-push-modal-close] {
    display: block;
}


[data-push-modal-close]:hover {
    background: var(--site-bg-light);
    color: var(--site-text-dark);
}


[data-push-modal-close]:focus-visible {
    outline: 2px solid var(--site-accent);
    outline-offset: 1px;
}


/* =========================
   MODAL ANIMATION
   ========================= */

@keyframes push-subscription-backdrop-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


@keyframes push-subscription-modal-in {
    from {
        opacity: 0;
        transform: translate(-50%, -47%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}


/* =========================
   MODAL MOBILE
   ========================= */

@media (max-width: 767px) {
    .push-subscription[data-push-modal-open="true"] {
        width: calc(100% - 30px);
        max-width: none;
        max-height: calc(100vh - 30px);

        margin: 0;
    }

    .push-subscription[data-push-modal-open="true"]
    .push-subscription__state {
        padding-top: 29px;
    }
}


@media (max-width: 420px) {
    .push-subscription[data-push-modal-open="true"] {
        width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
    }
}


/* =========================
   REDUCED MOTION
   ========================= */

@media (prefers-reduced-motion: reduce) {
    [data-push-modal-backdrop],
    .push-subscription[data-push-modal-open="true"] {
        animation: none;
    }
}
