/* ============================================================
   PAC — ВИЗУАЛЬНОЕ ОФОРМЛЕНИЕ ЗАСЕКРЕЧИВАНИЯ
   ============================================================
   В этом файле собраны стили для:
   - обычных зачёркнутых фрагментов;
   - восстановленного текста и сообщений API;
   - визуально заблокированных крупных блоков документа.
   ============================================================ */


/* ============================================================
   1. ОБЫЧНАЯ МАСКА: ЧЁРНЫЕ КВАДРАТЫ
   ============================================================ */

.pac-redacted {
    display: inline-block;
    appearance: none !important;
    -webkit-appearance: none !important;

    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border-radius: 0 !important;

    padding: 0 !important;
    margin: 0 !important;

    color: #111 !important;
    font: inherit;
    font-size: inherit;
    line-height: inherit;
    text-align: inherit;
    vertical-align: baseline;
    word-spacing: 0;
    letter-spacing: -0.08em;

    max-width: 100%;
    box-sizing: border-box;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;

    user-select: none;
    cursor: pointer;
    opacity: 1 !important;
    transition: none;
}

.pac-redacted:hover,
.pac-redacted:focus,
.pac-redacted:focus-visible,
.pac-redacted:active {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
}


/* ============================================================
   2. ВОССТАНОВЛЕННАЯ ИНФОРМАЦИЯ
   ============================================================ */

.pac-redacted.pac-redaction-revealed {
    /* Восстановленный текст выглядит как обычная часть документа. */
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;

    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;

    color: inherit !important;
    letter-spacing: normal;
    user-select: text;
    cursor: pointer;
    font-weight: inherit;
}


/* ============================================================
   3. СООБЩЕНИЯ О СОСТОЯНИИ ИНФОРМАЦИИ
   ============================================================ */

.pac-redaction-denied,
.pac-redaction-unavailable,
.pac-redaction-error,
.pac-redacted.pac-redaction-denied,
.pac-redacted.pac-redaction-unavailable,
.pac-redacted.pac-redaction-error {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border-radius: 0 !important;

    padding: 0 !important;
    margin: 0 !important;

    color: #c62828 !important;
    letter-spacing: normal;
    font-weight: 600;
    cursor: pointer;
}


/* ============================================================
   4. СТАРЫЕ / ОТДЕЛЬНЫЕ ЗАБЛОКИРОВАННЫЕ ФРАГМЕНТЫ
   ============================================================ */

.pac-locked {
    display: inline;
    appearance: none;
    -webkit-appearance: none;

    border: 1px solid #d8b6b8;
    border-radius: 2px;
    padding: 0 3px;
    margin: 0;

    color: #8d1d24;
    background: #f4e8e8;
    font: inherit;
    line-height: inherit;
    vertical-align: baseline;
    font-weight: 700;
    cursor: not-allowed;
}

.pac-redacted[aria-busy="true"],
.pac-locked[aria-busy="true"] {
    opacity: .7 !important;
    cursor: progress;
}


/* ============================================================
   5. КРУПНЫЕ ВИЗУАЛЬНО ЗАБЛОКИРОВАННЫЕ БЛОКИ
   ============================================================
   Внутреннее содержимое остаётся в потоке документа и сохраняет
   свою высоту, но до нажатия невидимо. Кнопка-маска располагается
   поверх него. Используется отдельный класс, не .hidden, поэтому
   архивный режим документа не снимает эту блокировку.
   ============================================================ */

.pac-block-redaction {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    isolation: isolate;
}

.pac-block-redaction-content {
    display: flow-root;
}

.pac-block-redaction-content--hidden {
    visibility: hidden !important;
    pointer-events: none !important;
    user-select: none !important;
}

.pac-block-redaction-trigger {
    position: absolute;
    inset: 0;
    z-index: 2;

    display: block;
    width: 100%;
    height: 100%;
    min-height: 2.25rem;
    box-sizing: border-box;
    overflow: hidden;

    appearance: none;
    -webkit-appearance: none;
    border: none;
    border-radius: 0;
    outline: none;
    box-shadow: none;
    margin: 0;
    padding: 0;

    background: transparent;
    color: inherit;
    font: inherit;
    line-height: inherit;
    text-align: left;
    cursor: pointer;
}

.pac-block-redaction-trigger:hover,
.pac-block-redaction-trigger:active {
    background: transparent;
    border: none;
    box-shadow: none;
}

.pac-block-redaction-trigger:focus-visible {
    outline: 2px dashed #777;
    outline-offset: -3px;
}

.pac-block-redaction-label {
    display: none;
}

.pac-block-redaction-bars {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    padding: .35em .45em;

    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-evenly;
    gap: .25em;
    overflow: hidden;
    pointer-events: none;
}

.pac-block-redaction-bar {
    display: block;
    flex: 0 0 auto;
    height: .72em;
    min-height: 5px;
    max-height: 12px;
    max-width: 100%;
    background: #111;
    border-radius: 0;
}

/* Вариант с одной надписью вместо имитации строк документа. */

.pac-block-redaction[data-mask-style="label"]:not(.pac-block-redaction--revealed) .pac-block-redaction-bars {
    display: none;
}

.pac-block-redaction[data-mask-style="label"]:not(.pac-block-redaction--revealed) .pac-block-redaction-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: .75em;

    color: #222;
    background: rgba(240, 240, 240, .94);
    font: inherit;
    font-weight: 700;
    text-align: center;
    letter-spacing: .02em;
}

/* После открытия маска исчезает, а исходное содержимое становится видимым. */

.pac-block-redaction--revealed .pac-block-redaction-content--hidden {
    visibility: visible !important;
    pointer-events: auto !important;
    user-select: auto !important;
}

.pac-block-redaction--revealed .pac-block-redaction-trigger {
    position: relative;
    inset: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    min-height: 0;
    margin-top: .55em;
    padding: .25em .55em;

    border: 1px solid #aaa;
    background: transparent;
    color: #666;
    font-size: .85em;
    line-height: 1.3;
    cursor: pointer;
}

.pac-block-redaction--revealed .pac-block-redaction-trigger:hover,
.pac-block-redaction--revealed .pac-block-redaction-trigger:active {
    border: 1px solid #777;
    background: rgba(128, 128, 128, .08);
}

.pac-block-redaction--revealed .pac-block-redaction-bars {
    display: none;
}

.pac-block-redaction--revealed .pac-block-redaction-label {
    position: static;
    inset: auto;
    display: inline;
    padding: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    font-weight: 600;
    text-align: center;
    letter-spacing: normal;
}


/* ============================================================
   6. УМЕНЬШЕНИЕ АНИМАЦИИ
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    .pac-redacted,
    .pac-locked,
    .pac-block-redaction-trigger {
        transition: none;
    }
}
