/**
 * Стили для редактора описания брифинга (TipTap)
 * С bubble menu и улучшенной типографией
 */

/* Editor styles migrated to `public/css/tiptap-editor.css` */

/* Описание прямо внутри flush-панели (без gc-panel-body) — добавляем свой padding */
.gc-stage-description-body {
    padding: var(--spacing-md);
}
/* TipTap read-only stage content migrated to `public/css/tiptap-content.css` */

/* ===================================
   Статистика брифинга — Figma: десктоп 4 колонки в ряд; ниже lg — 2 колонки (адаптив)
   =================================== */

.gc-stat-grid {
    display: grid;
    width: 100%;
    border: 1px solid var(--ui-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    gap: 0;
    background: transparent;
}

.gc-stat-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-4xs);
    padding: var(--spacing-mdl);
    background: var(--bg-content-main);
    text-align: center;
    border-right: 1px solid var(--ui-border);
    border-bottom: 1px solid var(--ui-border);
}

@media (max-width: 991.98px) {
    .gc-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gc-stat-grid-item:nth-child(2n) {
        border-right: none;
    }

    .gc-stat-grid-item:nth-child(n + 3) {
        border-bottom: none;
    }
}

@media (min-width: 992px) {
    .gc-stat-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .gc-stat-grid-item {
        border-bottom: none;
    }

    .gc-stat-grid-item:last-child {
        border-right: none;
    }
}

.gc-stat-grid-number {
    font-size: var(--font-size-md);
    font-weight: 500;
    color: var(--font-primary);
    line-height: 1.2;
    margin: 0;
}

.gc-stat-grid-label {
    font-size: var(--font-size-xs);
    font-weight: 400;
    color: var(--font-secondary);
    margin: 0;
    white-space: nowrap;
}

/* ===================================
   Блок отдельной секции
   =================================== */

/* ─── Секция внутри панели ─────────────────────────────────── */

/* ─── Блок секции ──────────────────────────────────────────── */

.stage-section-block {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* ─── Текстовая часть секции ───────────────────────────────── */

.stage-section-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2xs);
}

/* ─── Заголовок секции ─────────────────────────────────────── */

/* Один блок: .stage-section-header.stage-section-header--title-row — без второго align-items (был flex-start → ломал центр и многорядность) */
.stage-section-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.stage-section-header--title-row {
    justify-content: flex-start;
    gap: 0;
    /* полная ширина колонки — иначе % и shrink-to-fit у вложенных inline-block дают схлопывание */
    width: 100%;
    min-width: 0;
}

/*
 * Заголовок секции: inline-block + width:100% на кнопке даёт цикл shrink-to-fit → процент схлопывается («Сек…»).
 * Grid: колонка по max-content контента, max-width:100% режет только у края колонки; без % на кнопке.
 */
.gc-show-main-panel .stage-section-title-dropdown.gc-dropdown,
.gc-stage-show-main .stage-section-title-dropdown.gc-dropdown {
    position: relative;
    display: inline-grid;
    grid-template-columns: minmax(0, max-content);
    max-width: 100%;
    flex: 0 1 auto;
    min-width: 0;
    vertical-align: top;
    box-sizing: border-box;
    overflow: visible;
}

.gc-show-main-panel .stage-section-name-trigger,
.gc-stage-show-main .stage-section-name-trigger {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--spacing-xs);
    margin: 0;
    padding: 0;
    margin-inline: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font: inherit;
    color: var(--font-primary);
    text-align: left;
    line-height: inherit;
    transition: color var(--transition-fast);
    font-weight: 500;
    font-size: var(--font-size-mdl);
    box-sizing: border-box;
    width: auto;
    min-width: 0;
    max-width: none;
    overflow: hidden;
}

.gc-show-main-panel .stage-section-name-trigger:hover,
.gc-stage-show-main .stage-section-name-trigger:hover {
    color: var(--accent-link);
}

.gc-show-main-panel .stage-section-name-trigger:hover .stage-section-name-trigger-icon,
.gc-stage-show-main .stage-section-name-trigger:hover .stage-section-name-trigger-icon {
    color: var(--accent-link);
}

.gc-show-main-panel .stage-section-name-trigger[aria-expanded="true"],
.gc-stage-show-main .stage-section-name-trigger[aria-expanded="true"] {
    color: var(--accent-link);
}

.gc-show-main-panel .stage-section-name-trigger[aria-expanded="true"] .stage-section-name-trigger-icon,
.gc-stage-show-main .stage-section-name-trigger[aria-expanded="true"] .stage-section-name-trigger-icon {
    color: var(--accent-link);
}

.gc-show-main-panel .stage-section-name-trigger .stage-section-name-trigger-label,
.gc-stage-show-main .stage-section-name-trigger .stage-section-name-trigger-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gc-show-main-panel .stage-section-name-trigger .stage-section-name-trigger-icon,
.gc-stage-show-main .stage-section-name-trigger .stage-section-name-trigger-icon {
    flex-shrink: 0;
    font-size: var(--font-size-mdl);
    line-height: 1;
    color: var(--font-secondary);
    transition: color var(--transition-fast);
}

.stage-section-title {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    font-size: var(--font-size-sm);
    color: var(--font-primary);
    margin: 0;
    line-height: 1.4;
}

/* ─── Картинка секции ──────────────────────────────────────── */

.stage-section-img {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
    background: var(--bg-main);
}

/* Размытый фон — заполняет весь контейнер */
.stage-section-img-blur {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(24px);
    transform: scale(1.15);
    opacity: 0.75;
}

/* Само изображение — с отступом со всех сторон и скруглением */
.stage-section-img img {
    position: absolute;
    inset: var(--spacing-mdl); /* 12px со всех сторон */
    width: calc(100% - var(--spacing-mdl) * 2);
    height: calc(100% - var(--spacing-mdl) * 2);
    object-fit: cover;
    border-radius: var(--radius-sm);
    display: block;
    z-index: 1;
}

.stage-section-img--clickable {
    cursor: pointer;
}

.stage-section-img--clickable img {
    transition: transform var(--transition-slow);
}

.stage-section-img--clickable:hover img {
    transform: scale(1.008);
}

/* ===================================
   Страница брифинга /stages/{id} (Figma: брифинг, brief_grid, лучшие стрелки)
   =================================== */

.stage-show-page.catalog-layout .catalog-main.catalog-main--content {
    gap: var(--spacing-mdl);
}

/*
 * Главная колонка show-страницы (брифинг, оружие, диск, подписки): без gap у панели, overflow hidden.
 * Разметка: .gc-panel.gc-show-main-panel. Legacy: .gc-stage-show-main
 */
.gc-show-main-panel,
.gc-stage-show-main {
    gap: 0;
    overflow: hidden;
}

/* Сабхедер первой строкой внутри панели: плотнее gap, заголовок mdl/500. Класс: .gc-show-main-subheader (legacy: .gc-stage-show-subheader) */
.gc-show-main-panel > .gc-show-main-subheader.gc-subheader--in-panel,
.gc-stage-show-main > .gc-stage-show-subheader.gc-subheader--in-panel {
    gap: var(--spacing-sm);
    align-items: center;
}

.gc-show-main-panel .gc-subheader.gc-subheader--in-panel.gc-show-main-subheader .gc-subheader-title,
.gc-stage-show-main .gc-subheader.gc-subheader--in-panel.gc-stage-show-subheader .gc-subheader-title {
    font-size: var(--font-size-mdl);
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gc-stage-show-hero {
    padding: var(--spacing-mdl);
}

.gc-stage-show-hero .gc-briefing-img-container {
    border-radius: var(--radius-lg);
}

/* Ведущее описание на /stages/{id}: типографика .gc-stage-content-description + отступы колонки */
.gc-stage-content-description--main {
    padding: 0 var(--spacing-mdl) var(--spacing-mdl);
}

/* Моб.: без обложки нет .gc-stage-show-hero, сабхедер скрыт (d-lg-flex) — описание иначе вплотную к верху панели */
@media (max-width: 991.98px) {
    .gc-show-main-panel:not(:has(.gc-stage-show-hero)) .gc-stage-content-description--main,
    .gc-stage-show-main:not(:has(.gc-stage-show-hero)) .gc-stage-content-description--main {
        padding-top: var(--spacing-mdl);
    }
}

.gc-stage-show-mobile-stats {
    padding: var(--spacing-mdl);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-mdl);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Секции брифинга: порядок из БД (order_num) */
.gc-show-main-panel .gc-stage-show-sections,
.gc-stage-show-main .gc-stage-show-sections {
    padding: var(--spacing-mdl);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* Статистика — отдельный блок (Figma brief_grid, без заголовка) */
.gc-stage-show-stats-panel {
    min-width: 0;
    width: 100%;
}

.gc-stat-grid.gc-stat-grid--stage-show .gc-stat-grid-number {
    font-weight: 600;
}

.stage-section-block .stage-section-cover {
    border-radius: var(--radius-lg);
}

.stage-section-block .stage-section-prose {
    margin-top: 0;
}

/* Лучшие стрелки: gc-panel-header + gc-panel-content--list (список строк).
   История настрела: см. weapon-gallery.css — weapon-history-panel-months. */
.gc-stage-show-best-panel .gc-stage-show-best-stack {
    width: 100%;
    min-width: 0;
    gap: var(--spacing-mdl);
}

.gc-stage-show-best-panel .event-participant-card.gc-stage-best-shooter-trigger:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Иконка ХФ в бадже «лучшие стрелки» (файл: public/images/hf.svg) */
.gc-stage-best-hf-badge .gc-hit-factor-badge-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: block;
    object-fit: contain;
}

/* Переключение иконки ХФ по теме. Специфичность должна перебивать
   `.gc-stage-best-hf-badge .gc-hit-factor-badge-icon { display:block; }` выше. */
.gc-stage-best-hf-badge .gc-hit-factor-badge-icon--theme-light {
    display: none;
}

html[data-theme="light"] .gc-stage-best-hf-badge .gc-hit-factor-badge-icon--theme-dark {
    display: none;
}

html[data-theme="light"] .gc-stage-best-hf-badge .gc-hit-factor-badge-icon--theme-light {
    display: block;
}

/* TipTap read-only stage column rhythm migrated to `public/css/tiptap-content.css` */

.gc-show-main-panel .stage-section-title,
.gc-stage-show-main .stage-section-title {
    font-weight: 500;
    font-size: var(--font-size-mdl);
}

.gc-stage-sidebar-shots-row {
    justify-content: space-between;
    align-items: center;
}

.gc-stage-sidebar-shots-icon {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

.gc-stage-sidebar-shots-icon .weapon-card-shots-badge-icon,
.gc-stage-sidebar-shots-icon svg {
    height: 14px;
    width: auto;
    display: block;
}

.gc-stage-sidebar-params .gc-stat-value {
    font-weight: 400;
}

/* Чипы: в Figma tag_cloud — только px с края, gap 10px между бейджами; без margin-top (есть gap у .gc-panel-content) */
.gc-stage-sidebar-params .gc-panel-content {
    gap: var(--spacing-mdl);
}

.gc-stage-sidebar-params .gc-stat-list {
    gap: var(--spacing-sm);
}

.gc-stage-sidebar-params .gc-stat-label {
    font-weight: 500;
    color: var(--font-primary);
}

.gc-stage-sidebar-weapons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-2sm);
    margin: 0;
}

