/*
 * Help videos anywhere on the site: facade, window, places
 * Ролики справки на любой странице: фасад, окно, места показа
 *
 * AiInstruction-Help, этап 5. Подключается обоими макетами: ролик может
 * стоять на главной, на лендинге, в кабинете. Токены --pd-* есть и там, и
 * там (site-tokens.css). Оглавление и страница темы — в help.css.
 */

/* ---------- фасад плеера ---------- */

.help-player {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 16px;
    background-color: var(--pd-ink);
}

.help-player-facade {
    position: absolute;
    inset: 0;
    display: block;
    color: #fff;
}

.help-player-cover,
.help-player-blank,
.help-player-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.help-player-cover {
    object-fit: cover;
}

/* Без обложки — серая заглушка (обещано админкой, отчёт этапа 3). */
.help-player-blank {
    background: linear-gradient(135deg, #3A3F4A, #23262D);
}

.help-player-play {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    margin: -38px 0 0 -38px;
    padding-left: 4px;
    border-radius: 50%;
    background-color: var(--pd-accent);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .3);
    transition: transform .15s ease, background-color .15s ease;
}

.help-player-facade:hover .help-player-play,
.help-player-facade:focus-visible .help-player-play {
    background-color: var(--pd-accent-hover);
    transform: scale(1.06);
}

.help-player-facade:focus-visible {
    outline: 3px solid var(--pd-marker);
    outline-offset: -3px;
}

.help-player-time {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 3px 8px;
    border-radius: 6px;
    background-color: rgba(0, 0, 0, .7);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 575.98px) {
    .help-player {
        border-radius: 12px;
    }

    .help-player-play {
        width: 60px;
        height: 60px;
        margin: -30px 0 0 -30px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .help-player-play,
    .help-card {
        transition: none;
    }
}

/* ---------- окно (Р8) ---------- */

/* Положение — явно: общие стили сайта снимали с <dialog> поля браузера,
   и окно прижималось к левому верхнему углу (найдено проверкой этапа 5). */
.help-modal {
    position: fixed;
    inset: 0;
    margin: auto;
    height: fit-content;
    width: min(960px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100vh - 32px);
    padding: 0;
    border: 0;
    border-radius: 16px;
    background-color: var(--pd-surface);
    color: var(--pd-ink);
    box-shadow: 0 24px 64px rgba(0, 0, 0, .35);
}

.help-modal::backdrop {
    background-color: rgba(21, 23, 28, .72);
}

/* Под открытым окном страница не прокручивается. */
html.help-modal-open {
    overflow: hidden;
}

.help-modal-box {
    padding: 16px 20px 18px;
}

.help-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.help-modal-title {
    margin: 0;
    font-family: var(--pd-font-serif);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
}

.help-modal-close {
    flex: none;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin: -4px -6px 0 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--pd-muted);
    cursor: pointer;
}

.help-modal-close:hover,
.help-modal-close:focus-visible {
    background-color: var(--pd-line-soft);
    color: var(--pd-ink);
}

.help-modal-player {
    border-radius: 12px;
}

.help-modal-foot {
    margin: 12px 0 0;
    font-size: 15px;
}

.help-modal-article {
    color: var(--pd-accent);
}

@media (max-width: 575.98px) {
    .help-modal {
        width: calc(100vw - 16px);
    }

    .help-modal-box {
        padding: 12px 12px 14px;
    }

    .help-modal-title {
        font-size: 17px;
    }
}

/* ---------- места показа (Р7) ---------- */

/* Ссылка «Как это работает · 5 мин»: с треугольником, чтобы было видно — это ролик. */
.help-slot-link[data-help-video]::before {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    margin-right: 6px;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid currentColor;
    vertical-align: 0;
}

/* Значок «?» в шапке экрана кабинета. */
.help-slot-icon {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border: 1px solid var(--pd-ghost-line);
    border-radius: 50%;
    background-color: var(--pd-surface);
    color: var(--pd-ink);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
}

.help-slot-icon:hover,
.help-slot-icon:focus-visible {
    border-color: var(--pd-accent);
    color: var(--pd-accent);
    text-decoration: none;
}

/* Карточка пустого списка «Мои шаблоны»: обложка ролика и загрузка рядом. */
.help-slot-card {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    gap: 24px;
    align-items: center;
    max-width: 760px;
    margin: 0 auto;
    padding: 20px;
    border: 1px solid var(--pd-line);
    border-radius: 16px;
    background-color: var(--pd-surface);
    text-align: left;
}

@media (max-width: 575.98px) {
    .help-slot-card {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }
}

.help-slot-card-cover {
    position: relative;
    color: #fff;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 12px;
    background-color: var(--pd-ink);
}

.help-slot-card-cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.help-slot-card-cover .help-player-play {
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
}

.help-slot-card-title {
    margin: 0 0 6px;
    font-family: var(--pd-font-serif);
    font-size: 19px;
    font-weight: 600;
    color: var(--pd-ink);
}

.help-slot-card p {
    margin: 0 0 14px;
    color: var(--pd-text);
}

.help-slot-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
}

/* Ролик на месте иллюстрации блока «Свой документ» главной. */
.own-doc-video .help-player {
    box-shadow: 0 20px 40px rgba(0, 0, 0, .25);
}

.own-doc-video-caption {
    margin: 12px 0 0;
    font-size: 14px;
    color: var(--pd-dark-muted);
}

.own-doc-video-caption a {
    color: #fff;
}

/* Ролик над вопросами промо-страницы «Свой документ». */
.help-slot-section .help-player {
    max-width: 56rem;
}

.help-slot-section-head {
    max-width: 56rem;
    margin-bottom: 24px;
}

.help-slot-section-head .pd-lead {
    margin: 12px 0 0;
}

/* Ссылки-окна на «Ценах» и в карточке «Нет нужного?» разделов. */
.help-slot-line {
    margin: 14px 0 0;
}

.section-own .section-own-help {
    margin: 8px 0 0;
}

/* Значок «?» на странице заполнения: слева в шапке формы, напротив
   ссылки администратора; на телефоне — над названием. */
.form-header .form-header-help {
    position: absolute;
    top: .6rem;
    left: 0;
}

.form-header:has(.form-header-help) h1 {
    padding-left: 3rem;
    padding-right: 3rem;
}

@media (max-width: 767.98px) {
    .form-header .form-header-help {
        position: static;
        margin-bottom: .25rem;
    }

    .form-header:has(.form-header-help) h1 {
        padding: 0 1rem;
    }
}
