/* =====================================================================
   Popup registry — модальний поп-ап (Figma: Modal / Large (Detach), 740px)
   Дизайни: node 3833-156985 / 3811-194837 / 3675-352963.
   Самодостатній файл (підключається глобально в _Layout), тому значення
   з дизайн-системи винесені в локальні змінні під .popup-overlay.
   ===================================================================== */
.popup-overlay {
    --pop-text: #25252a;
    --pop-subtle: #4b4b55;
    --pop-surface: #ffffff;
    --pop-radius: 24px;
    --pop-shadow: 0 0 50px 10px rgba(168, 168, 168, .15);
    --pop-header-grad: linear-gradient(135deg, #efe7ff 0%, #f3ecff 45%, #ffffff 100%);

    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: flex-start;         /* НЕ stretch: інакше картка обріжеться по висоті екрана */
    justify-content: center;
    padding: 48px 16px;
    overflow-y: auto;
    background: rgba(37, 37, 42, 0.28);
    font-family: var(--liga-font-family);
    -webkit-font-smoothing: antialiased;
}

.popup-overlay[hidden] { display: none; }
.popup-overlay * { box-sizing: border-box; }

.popup-card {
    position: relative;
    width: 740px;
    max-width: 100%;
    background: var(--pop-surface);
    border-radius: var(--pop-radius);
    box-shadow: var(--pop-shadow);
    overflow: hidden;
    animation: popup-pop 0.16s ease-out;
}

@keyframes popup-pop {
    from { opacity: 0; transform: translateY(-8px) scale(0.99); }
    to   { opacity: 1; transform: none; }
}

/* ---------- close ---------- */
.popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--pop-text);
    cursor: pointer;
    transition: background .12s;
}
.popup-close:hover { background: rgba(37, 37, 42, .06); }

/* ---------- header (5: довільний HTML + декоративний градієнт) ---------- */
.popup-header {
    position: relative;
    min-height: 120px;
    background: var(--pop-header-grad);
}
.popup-header:empty { min-height: 0; }
.popup-header__custom {
    position: relative;
    display: flex;
    justify-content: center;
    padding: 40px 40px 0;
}
.popup-header__custom img { max-width: 100%; height: auto; }

/* Кольорові варіанти шапки (data-variant на .popup-overlay, за потреби). */
.popup-overlay[data-variant="pink"]   .popup-header { --pop-header-grad: linear-gradient(135deg, #ffe3ee 0%, #ffeef4 45%, #ffffff 100%); }
.popup-overlay[data-variant="purple"] .popup-header { --pop-header-grad: linear-gradient(135deg, #e7e0ff 0%, #efe9ff 45%, #ffffff 100%); }

/* ---------- body ---------- */
.popup-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 32px 40px 40px;
}

/* 2)+3) заголовок: іконка + HTML */
.popup-title {
    display: flex;
    align-items: center;
    gap: 8px;
}
.popup-title__icon {
    flex: none;
    width: 32px;
    height: 32px;
    object-fit: contain;
}
.popup-title__text {
    font-size: 24px;
    line-height: 28px;
    font-weight: 500;
    letter-spacing: -0.02px;
    color: var(--pop-text);
}
.popup-title__text :is(h1, h2, h3, p) { margin: 0; font: inherit; }

/* 4) опис (RTE) */
.popup-desc {
    font-size: 14px;
    line-height: 20px;
    letter-spacing: 0.29px;
    color: var(--pop-subtle);
}
.popup-desc :is(p) { margin: 0 0 8px; }
.popup-desc :is(p):last-child { margin-bottom: 0; }
.popup-desc a { color: #7267e6; }

/* 6) блоки-конструктор */
.popup-blocks {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 1) форма */
.popup-form { width: 100%; }

/* ---------- адаптив ---------- */
@media (max-width: 600px) {
    .popup-overlay { padding: 16px 12px; }
    .popup-body { padding: 24px 20px 28px; gap: 20px; }
    .popup-header__custom { padding: 24px 20px 0; }
    .popup-title__text { font-size: 20px; line-height: 24px; }
}
