/* ============================================================
   content.css — изображения, видео, цитаты, заголовки в постах
   ============================================================ */

/* --- Изображения: не выходят за пределы контейнера --- */
.md img,
.post-text img,
.news-body img,
.announcement-body img,
.review-body img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 10px 0;
    border-radius: 6px;
    border: 1px solid var(--border);
    box-sizing: border-box;
}

/* Если изображение-ссылка — обёртка тоже ограничена */
.md a img { display: inline-block; }

/* --- Видео-встраивание (YouTube, Rutube) --- */
.md .video-embed,
.post-text .video-embed {
    position: relative;
    width: 100%;
    max-width: 720px;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    margin: 16px 0;
    border-radius: 8px;
    background: #000;
    box-shadow: var(--shadow);
}

.md .video-embed iframe,
.post-text .video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.md .video-error,
.post-text .video-error {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(255,100,103,.1);
    border: 1px solid rgba(255,100,103,.3);
    border-radius: 4px;
    color: #ff6467;
    font-size: 13px;
}

/* --- Заголовки [h]...[/h] --- */
.md h3.post-heading,
.post-text h3.post-heading {
    font-size: 18px;
    font-weight: 700;
    margin: 20px 0 10px;
    color: var(--text);
    line-height: 1.3;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

/* --- Цитата с автором [quote=Author]...[/quote] --- */
.md blockquote.quote-with-author,
.post-text blockquote.quote-with-author {
    margin: 14px 0;
    padding: 12px 16px;
    border-left: 3px solid var(--accent);
    background: var(--accent-10);
    border-radius: 0 6px 6px 0;
    font-style: normal;
}

.md blockquote.quote-with-author .quote-author,
.post-text blockquote.quote-with-author .quote-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 6px;
}

.md blockquote.quote-with-author .quote-body,
.post-text blockquote.quote-with-author .quote-body {
    font-style: italic;
    color: var(--text-dim);
    line-height: 1.6;
}

/* Обычная цитата [quote]...[/quote] — уже оформлена в editor.css */

/* --- Email-ссылки --- */
.md a[href^="mailto:"],
.post-text a[href^="mailto:"] {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-style: dotted;
}

/* --- Мобильные: компактнее --- */@media (max-width: 640px) {
    .md img,
    .post-text img {
        margin: 8px 0;
        border-radius: 4px;
    }
    .md .video-embed,
    .post-text .video-embed {
        margin: 10px 0;
        border-radius: 6px;
    }
    .md h3.post-heading,
    .post-text h3.post-heading {
        font-size: 16px;
        margin: 14px 0 8px;
    }
    .md blockquote.quote-with-author,
    .post-text blockquote.quote-with-author {
        padding: 10px 12px;
        margin: 10px 0;
    }
}
/* Нативные опции — во всех формах сайта */
select option {
    background: var(--panel-deep);
    color: var(--text);
}
html.light select option {
    background: #fff;
    color: #101828;
}
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent);
}

/* ============================================================
   Нативные select на основном сайте (installer38d)
   ============================================================ */
html.dark select,
html.dark .field select {
    background-color: #1a2232;
    color: var(--text);
}
html.dark select option {
    background-color: #1a2232;
    color: var(--text);
}
html.dark select:focus {
    background-color: #1f2a3d;
    border-color: var(--accent-30);
}

html.light select,
html.light .field select {
    background-color: #f3f4f6;
    color: #101828;
}
html.light select option {
    background-color: #fff;
    color: #101828;
}
html.light select:focus {
    background-color: #eff6ff;
    border-color: var(--accent-30);
}

/* --- Смайлики: старые коды, заменённые на эмодзи ---
   Символ наследует размер шрифта и строку, поэтому растёт вместе с текстом
   и не ломает вёрстку. Размер задан чуть крупнее основного текста, иначе
   эмодзи кажутся мелкими рядом с буквами. */
.smiley {
    font-size: 1.15em;
    line-height: 1;
    vertical-align: -0.1em;
    font-style: normal;
}

/* --- Блок [console]: вид окна терминала ---
   Внутри — обычный pre, поэтому переносы и отступы сохраняются как в коде. */
.console-block {
    margin: 14px 0;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    overflow: hidden;
    background: var(--panel-deep);
}
/* Три точки стоят в шапке блока кода, поэтому только они и нужны. */
.console-dots { display: inline-flex; align-items: center; gap: 5px; margin-right: 4px; }
.console-block .code-head { background: var(--panel-soft); }
.console-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--border-strong); flex: none;
}
.console-title {
    margin-left: 6px; font-size: 12px; color: var(--text-mute);
}
.console-body {
    margin: 0; padding: 12px 14px;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 13px; line-height: 1.5;
    color: var(--text);
    overflow-x: auto; white-space: pre;
}
.console-body code { background: none; border: none; padding: 0; }

/* ============================================================
   Кнопки у картинок в сообщениях (post-images.js)

   Кнопки стоят слева от картинки — в пустой части блока автора, поэтому места
   у самой картинки не отнимают. Ширину и отступ для разворота задаёт скрипт:
   они зависят от раскладки, а в предпросмотре редактора блока автора нет.
   ============================================================ */
.post-image { position: relative; }

/* Кнопки — в пустой части блока автора, у нижнего края картинки. */
.post-image-tools {
    position: absolute; bottom: 10px; right: calc(100% + 10px); z-index: 3;
    display: flex; flex-direction: column; gap: 4px;
    width: 116px;
}
/* Парные правила к hidden: и у панели, и у кнопки задан display, без пары
   атрибут hidden не сработает. Панель скрывается целиком, когда картинка уже
   ширины блока — растягивать её некуда. */
.post-image-tools[hidden] { display: none; }
.post-image-tools button {
    width: 100%; padding: 4px 6px;
    font-size: 11px; line-height: 1.25; text-align: center;
    border: 1px solid var(--border); border-radius: 5px;
    background: var(--panel-soft); color: var(--text-dim);
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.post-image-tools button:hover { border-color: var(--accent-30); color: var(--text); }
/* Парное правило: у кнопок задан display, без него hidden не сработает. */
.post-image-tools button[hidden] { display: none; }

.post-image img { transition: width .18s ease-out; }

/* Узкий экран: блок автора переезжает наверх, место слева пропадает —
   кнопки встают строкой над картинкой. */
@media (max-width: 720px) {
    .post-image-tools {
        position: static; flex-direction: row; flex-wrap: wrap;
        width: auto; margin: 0 0 6px;
    }
    .post-image-tools button { width: auto; }
}

/* Картинка на весь экран. */
.image-fullscreen {
    position: fixed; inset: 0; z-index: 1200;
    display: flex; align-items: center; justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, .92);
}
.image-fullscreen[hidden] { display: none; }
.image-fullscreen img {
    max-width: 100%; max-height: 100%;
    width: auto; height: auto;
    margin: 0; border: none; border-radius: 4px;
}
.image-fullscreen-close {
    position: absolute; top: 12px; right: 14px;
    width: 36px; height: 36px;
    font-size: 22px; line-height: 1;
    border: 1px solid rgba(255, 255, 255, .35); border-radius: 8px;
    background: rgba(0, 0, 0, .5); color: #fff;
    cursor: pointer;
}
.image-fullscreen-close:hover { background: rgba(0, 0, 0, .75); }
body.image-fullscreen-open { overflow: hidden; }
