/* Артефакты (docs/vnutri/20-artefakty.md, этап 1). Цвета — переменные app.css. */

/* --- Карточка под сообщением --- */
.art-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.art-card {
    display: flex; align-items: center; gap: 12px; max-width: 460px;
    padding: 10px 12px; background: var(--bg-panel); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.art-card-ico {
    flex: none; width: 36px; height: 36px; display: grid; place-items: center;
    border-radius: 9px; background: var(--accent-soft); color: var(--accent);
    font: 600 13px/1 ui-monospace, monospace;
}
.art-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.art-card-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-card-sub { font-size: 12px; color: var(--text-dim); display: flex; gap: 8px; }
.art-card-ver { color: var(--accent); font-weight: 600; }
.art-card-open, .art-act, .art-tab, .art-dev {
    font: inherit; font-size: 13px; color: var(--text); background: var(--bg-soft);
    border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; cursor: pointer;
}
.art-card-open { flex: none; background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.art-card-open:hover { filter: brightness(1.08); }
.art-act:hover, .art-tab:hover, .art-dev:hover { background: var(--bg-hover); }
.msg-text .code-preview { margin-right: 6px; }

/* --- Панель --- */
.art-panel {
    position: fixed; top: 52px; right: 0; bottom: 0; width: var(--art-w, min(52vw, 760px)); z-index: 28;
    container: art / inline-size;
    display: flex; flex-direction: column; min-height: 0;
    background: var(--bg-panel); color: var(--text);
    border-left: 1px solid var(--border); box-shadow: var(--shadow);
    padding-bottom: env(safe-area-inset-bottom);
}
.art-panel[hidden] { display: none; }
body.art-open .chat { padding-right: var(--art-w, min(52vw, 760px)); }
.art-panel.art-full { width: calc(100vw - var(--sidebar-w, 290px)); }
body.art-open.art-wide .chat { padding-right: 0; visibility: hidden; }  /* скрыт, не удалён: скролл и состояние целы */
.art-panel.art-full .art-resizer { display: none; }

/* --- Ручка растягивания на левой границе --- */
.art-resizer {
    position: absolute; left: -5px; top: 0; bottom: 0; width: 10px; z-index: 2;
    cursor: col-resize; touch-action: none;
}
.art-resizer::after {
    content: ""; position: absolute; left: 4px; top: 50%; width: 3px; height: 44px; margin-top: -22px;
    border-radius: 2px; background: var(--border); transition: background .15s;
}
.art-resizer:hover::after, .art-resizer:focus-visible::after, body.art-dragging .art-resizer::after { background: var(--accent); }
.art-resizer:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
body.art-dragging { cursor: col-resize; user-select: none; }
body.art-dragging .art-frame { pointer-events: none; }  /* iframe не съедает мышь при перетаскивании */

.art-head { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.art-ver, .art-ibtn { flex: none; }
.art-title-wrap { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.art-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-kind { font-size: 12px; color: var(--text-dim); }
.art-ver {
    font: inherit; font-size: 13px; color: var(--text); background: var(--bg-soft);
    border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px;
}
.art-ver[hidden] { display: none; }
.art-ibtn {
    font: inherit; width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
    color: var(--text-dim); background: transparent; border: 1px solid transparent;
    display: inline-grid; place-items: center; padding: 0;
}
.art-ico { display: block; flex: none; }
.art-act { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; }
.art-dev { display: inline-flex; align-items: center; justify-content: center; padding: 6px 9px; flex: none; }
.art-lbl { white-space: nowrap; }
.art-tab { white-space: nowrap; flex: none; }
.art-ibtn:hover { background: var(--bg-hover); color: var(--text); }

.art-bar { display: flex; flex-wrap: nowrap; align-items: center; min-width: 0; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.art-tabs, .art-devs { display: flex; gap: 4px; }
.art-devs[hidden], .art-stage[hidden], .art-code[hidden], .art-note[hidden] { display: none; }
.art-tabs, .art-devs { flex: none; }
.art-acts { display: flex; flex: none; gap: 6px; margin-left: auto; flex-wrap: nowrap; }
.art-act:hover { background: var(--bg-hover); }

/* --- Ссылка «Поделиться» --- */
.art-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--bg-soft); }
.art-share[hidden] { display: none; }
.art-share-in { flex: 1 1 200px; min-width: 0; font: inherit; font-size: 13px; color: var(--text); background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.art-share-note { flex-basis: 100%; font-size: 12px; color: var(--text-dim); }

/* --- Страница ссылки /artifact/{token} --- */
.art-share-body { display: flex; flex-direction: column; height: 100vh; margin: 0; }
.art-share-head { display: flex; flex-wrap: nowrap; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg-panel); color: var(--text); }
.art-share-info { flex: 1 1 0; min-width: 0; }
.art-share-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-share-meta { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-share-acts { display: flex; gap: 8px; flex: none; }
.art-share-acts a.art-act { text-decoration: none; }
.art-share-frame { flex: 1; min-height: 0; width: 100%; border: 0; background: #fff; }

/* Узкая панель: подписи прячутся, остаются иконки (по ширине самой панели) */
@container art (max-width: 620px) {
    .art-lbl { display: none; }
    .art-act, .art-dev { padding: 6px 8px; }
    .art-tab { padding: 6px 9px; }
    .art-bar { gap: 6px; }
}
@container art (max-width: 440px) {
    .art-devs { display: none; }
    .art-kind { display: none; }
}
.art-tab.on, .art-dev.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.art-card-open:focus-visible, .art-act:focus-visible, .art-tab:focus-visible, .art-dev:focus-visible,
.art-ibtn:focus-visible, .art-ver:focus-visible, .art-code:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.art-body { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg-soft); }
.art-stage { flex: 1; min-height: 0; display: flex; justify-content: center; overflow: auto; }
.art-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.art-stage[data-dev="tablet"] .art-frame { width: 768px; max-width: 100%; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.art-stage[data-dev="phone"] .art-frame { width: 375px; max-width: 100%; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.art-code {
    flex: 1; min-height: 0; margin: 0; padding: 12px 14px; overflow: auto; background: var(--bg-panel);
    font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; tab-size: 4;
}
.art-note { padding: 16px; color: var(--text-dim); }

/* --- Телефон: на весь экран, как bottom-sheet --- */
@media (max-width: 768px) {
    .art-panel, .art-panel.art-full { top: 0; left: 0; width: 100%; z-index: 80; border-left: 0; animation: art-sheet .18s ease-out; }
    body.art-open .chat { padding-right: 0; }
    .art-devs { display: none; }
    .art-resizer { display: none; }
    .art-lbl { display: none; }
    .art-bar { overflow-x: auto; }
    .art-share-acts .art-act { padding: 6px 8px; }
}
@keyframes art-sheet { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .art-panel, .art-panel.art-full { animation: none; }
}
