/*
 * [promo_subscribe_tg] — блок «Telegram + почта».
 *
 * Все правила — только под .phs-tg: форма [promo_subscribe] на главной и её
 * frontend.css этих классов не знают, и наоборот.
 *
 * Тема Kadence красит ЛЮБЫЕ button/input/a/h2/h3/blockquote/code на странице
 * (заливка кнопки и тень на :hover/:focus, рамка поля, отступы .single-content p).
 * Поэтому у кнопок и поля всё своё задано во всех состояниях, а вес селекторов
 * — не ниже двух классов.
 *
 * Раскладка по ширине самого блока (container queries), а не окна: блок может
 * встать и в узкую колонку. Без их поддержки остаётся раскладка «телефон».
 */

.phs-tg {
    --phs-tg-sand: #f3efe3;
    --phs-tg-line: #e1dac5;
    --phs-tg-field: #d8d2bf;
    --phs-tg-ink: #222;
    --phs-tg-text: #444;
    --phs-tg-green: #375831;
    --phs-tg-green-hover: #2b4526;
    --phs-tg-dot: #6eab58;
    --phs-tg-chat-top: #becf94;
    --phs-tg-chat-bottom: #dfe4b2;
    container: phs-tg / inline-size;
    margin: 0 0 var(--global-md-spacing, 2rem);
    color: var(--phs-tg-text);
}

.phs-tg *,
.phs-tg *::before,
.phs-tg *::after {
    box-sizing: border-box;
}

.phs-tg__grid {
    display: grid;
    gap: 16px;
}

.phs-tg__panel {
    min-width: 0;
    padding: 22px;
    border: 1px solid var(--phs-tg-line);
}

.phs-tg__panel--tg {
    display: grid;
    gap: 24px;
    align-items: center;
    background: var(--phs-tg-sand);
}

.phs-tg__panel--mail {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #fff;
}

/* ── Текст и кнопка канала ─────────────────────────────────────────────── */

.phs-tg__intro {
    min-width: 0;
}

.phs-tg .phs-tg__eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #555;
}

.phs-tg .phs-tg__eyebrow::before {
    content: "";
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--phs-tg-dot);
}

/* Вид заголовка — из темы (h2 сайта: 24px, 400); здесь только отступы. */
.phs-tg .phs-tg__title {
    margin: 0 0 12px;
}

.phs-tg .phs-tg__text {
    margin: 0 0 20px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--phs-tg-text);
}

.phs-tg .phs-tg__open,
.phs-tg .phs-tg__open:hover,
.phs-tg .phs-tg__open:focus,
.phs-tg .phs-tg__open:active {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    padding: 0 28px;
    border: 0;
    border-radius: 999px;
    background: var(--phs-tg-green);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    box-shadow: none;
}

.phs-tg .phs-tg__open:hover,
.phs-tg .phs-tg__open:active {
    background: var(--phs-tg-green-hover);
}

.phs-tg .phs-tg__open:focus-visible {
    outline: 2px solid var(--phs-tg-green);
    outline-offset: 3px;
}

/* ── Карточка поста ────────────────────────────────────────────────────── */

.phs-tg__phone {
    justify-self: center;
    width: 100%;
    max-width: 400px;
    overflow: hidden;
    border: 1px solid var(--phs-tg-field);
    border-radius: 14px;
    background: #fff;
}

.phs-tg .phs-tg__head,
.phs-tg .phs-tg__head:hover,
.phs-tg .phs-tg__head:focus {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: inherit;
    text-decoration: none;
}

.phs-tg .phs-tg__head:focus-visible {
    outline: 2px solid var(--phs-tg-green);
    outline-offset: -2px;
}

.phs-tg .phs-tg__avatar {
    flex: none;
    display: block;
    width: 36px;
    height: 36px;
    margin: 0;
    border-radius: 50%;
    object-fit: cover;
}

.phs-tg__avatar--letter {
    display: grid;
    place-items: center;
    background: var(--phs-tg-dot);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
}

.phs-tg__who {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
}

.phs-tg__name {
    overflow: hidden;
    font-size: 13px;
    font-weight: 700;
    color: #111;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.phs-tg__kind {
    font-size: 11px;
    color: #8c959f;
}

.phs-tg__chat {
    padding: 12px 10px;
    background: linear-gradient(180deg, var(--phs-tg-chat-top), var(--phs-tg-chat-bottom));
}

.phs-tg__bubble {
    overflow: hidden;
    border-radius: 10px;
    background: #fff;
}

.phs-tg .phs-tg__photo {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
}

.phs-tg__msg {
    padding: 8px 11px 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: #111;
}

/* Две первые строки поста, каждая в одну строку: длинная обрезается «…»,
   остальное — в Telegram. */
.phs-tg__line {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.phs-tg .phs-tg__msg b {
    font-weight: 700;
}

.phs-tg .phs-tg__msg a {
    color: #2a6fb0;
    text-decoration: none;
}

.phs-tg .phs-tg__msg code {
    margin: 0;
    padding: 0;
    background: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .95em;
    color: inherit;
}

.phs-tg .phs-tg__meta,
.phs-tg .phs-tg__meta:hover,
.phs-tg .phs-tg__meta:focus {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 3px 11px 7px;
    font-size: 11px;
    line-height: 1.3;
    color: #9ba3aa;
    text-decoration: none;
}

.phs-tg__views {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* ── Почта ─────────────────────────────────────────────────────────────── */

.phs-tg .phs-tg__mail-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.3;
    color: var(--phs-tg-ink);
}

.phs-tg .phs-tg__mail-text {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--phs-tg-text);
}

.phs-tg .phs-tg__form {
    position: relative;
    max-width: 460px;
    margin: 0;
}

.phs-tg__field {
    position: relative;
}

.phs-tg .phs-tg__input,
.phs-tg .phs-tg__input:focus {
    display: block;
    width: 100%;
    max-width: none;
    height: 50px;
    margin: 0;
    padding: 0 150px 0 18px;
    border: 1px solid var(--phs-tg-field);
    border-radius: 999px;
    background: #fff;
    color: var(--phs-tg-ink);
    font: inherit;
    font-size: 15px;
    line-height: normal;
    box-shadow: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.phs-tg .phs-tg__input:focus {
    border-color: var(--phs-tg-dot);
    box-shadow: 0 0 0 3px rgba(110, 171, 88, .2);
}

.phs-tg .phs-tg__input::placeholder {
    color: #999;
    opacity: 1;
}

.phs-tg .phs-tg__submit,
.phs-tg .phs-tg__submit:hover,
.phs-tg .phs-tg__submit:focus,
.phs-tg .phs-tg__submit:active {
    position: absolute;
    top: 4px;
    right: 4px;
    bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    margin: 0;
    padding: 0 20px;
    border: 0;
    border-radius: 999px;
    background: var(--phs-tg-green);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-style: normal;
    font-weight: 700;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    box-shadow: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.phs-tg .phs-tg__submit:hover,
.phs-tg .phs-tg__submit:active {
    background: var(--phs-tg-green-hover);
}

.phs-tg .phs-tg__submit:focus-visible {
    outline: 2px solid var(--phs-tg-green);
    outline-offset: 2px;
}

.phs-tg .phs-tg__submit:disabled {
    background: var(--phs-tg-green);
    opacity: .7;
    cursor: default;
}

.phs-tg .phs-tg__status {
    margin: 12px 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--phs-tg-text);
}

.phs-tg .phs-tg__status[hidden] {
    display: none;
}

.phs-tg .phs-tg__status--success {
    color: #1d7a32;
}

.phs-tg .phs-tg__status--info,
.phs-tg .phs-tg__status--pending {
    color: #245d91;
}

.phs-tg .phs-tg__status--error {
    color: #b3261e;
}

.phs-tg .phs-tg__support {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
}

.phs-tg__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Раскладка по ширине блока ─────────────────────────────────────────── */

/* Совсем узко (телефон 320px): кнопка «Подписаться» уходит под поле.
   На 375px блок ~327px, и кнопка ещё помещается в капсулу, как в макете 1b-m. */
@container phs-tg (max-width: 299px) {
    .phs-tg .phs-tg__input,
    .phs-tg .phs-tg__input:focus {
        padding-right: 18px;
    }

    .phs-tg .phs-tg__submit,
    .phs-tg .phs-tg__submit:hover,
    .phs-tg .phs-tg__submit:focus,
    .phs-tg .phs-tg__submit:active {
        position: static;
        width: 100%;
        height: 48px;
        margin-top: 8px;
    }
}

/* Текст канала и карточка поста — рядом. */
@container phs-tg (min-width: 620px) {
    .phs-tg__panel {
        padding: 28px;
    }

    .phs-tg__panel--tg {
        grid-template-columns: minmax(0, 1fr) 288px;
        gap: 28px;
    }

    .phs-tg__panel--solo {
        grid-template-columns: minmax(0, 1fr);
    }

    .phs-tg .phs-tg__open,
    .phs-tg .phs-tg__open:hover,
    .phs-tg .phs-tg__open:focus,
    .phs-tg .phs-tg__open:active {
        display: inline-flex;
        width: auto;
    }

    .phs-tg__phone {
        max-width: none;
    }
}

/* Канал и почта — двумя колонками, как в макете 1b. */
@container phs-tg (min-width: 980px) {
    .phs-tg__grid {
        grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    }
}
