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

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

/* Описание прямо внутри flush-панели (без gc-panel-body) — добавляем свой padding */
.gc-stage-description-body {
    padding: var(--space-4);
}
/* 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(--border-subtle);
    border-radius: var(--radius-16);
    overflow: hidden;
    gap: 0;
    background: transparent;
}

.gc-stat-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-product-2);
    padding: var(--space-4);
    background: var(--surface-secondary);
    text-align: center;
    border-right: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

@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-base);
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
    margin: 0;
}

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

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

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

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

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

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

.stage-section-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

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

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

.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(--space-1);
    margin: 0;
    padding: 0;
    margin-inline: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font: inherit;
    color: var(--text-primary);
    text-align: left;
    line-height: inherit;
    transition: color var(--transition-fast);
    font-weight: 500;
    font-size: var(--font-size-15);
    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-15);
    line-height: 1;
    color: var(--text-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-14);
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
}

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

.stage-section-img {
    position: relative;
    overflow: hidden;
    aspect-ratio: var(--gc-media-cover-aspect);
    border-radius: var(--radius-8);
    background: var(--surface-canvas);
}

/* Размытый фон — заполняет весь контейнер */
.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(--space-4); /* 12px со всех сторон */
    width: calc(100% - var(--space-4) * 2);
    height: calc(100% - var(--space-4) * 2);
    object-fit: cover;
    border-radius: var(--radius-8);
    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,
.stage-show-page-layout .stage-show-main {
    gap: var(--space-4);
}

/*
 * Inertia show: ширина колонки — layout-utilities (.gc-page-grid).
 * Context rail ≥1280 — AppShell, не in-grid split-left.
 */
@media (min-width: 1280px) {
    .stage-show-page-layout .stage-show-columns.split-layout {
        max-width: none;
        width: 100%;
        margin: 0;
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "main";
        gap: 0;
    }
}

/*
 * Главная колонка 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(--space-2);
    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-15);
    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(--space-4);
}

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

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

/* Моб.: без обложки нет .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(--space-4);
    }
}

.gc-stage-show-mobile-stats {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    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(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* Статистика — отдельный блок (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-cover {
    border-radius: var(--radius-16);
    overflow: hidden;
    min-width: 0;
    /* better-ui image edge on section photo */
    outline: 1px solid color-mix(in srgb, var(--fill-emphasis) 10%, transparent);
}

.stage-section-cover .gc-briefing-img-container {
    aspect-ratio: var(--gc-media-cover-aspect);
}

.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(--space-4);
}

.gc-stage-show-best-panel .gc-stage-best-shooter-trigger .gc-interactive-row:focus-visible {
    outline: var(--gc-focus-outline);
    outline-offset: 2px;
}

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

.event-show-hero-stats__icon .gc-hit-factor-badge-icon {
    width: var(--font-size-18);
    height: var(--font-size-18);
}

.gc-stage-best-hf-badge > i {
    flex-shrink: 0;
    font-size: var(--font-size-16);
    line-height: 1;
}

/* Переключение иконки ХФ по теме. Специфичность должна перебивать
   `.gc-hit-factor-badge-icon { display:block; }` выше. */
.gc-stage-best-hf-badge .gc-hit-factor-badge-icon--theme-light,
.event-show-hero-stats__icon .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,
html[data-theme="light"] .event-show-hero-stats__icon .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,
html[data-theme="light"] .event-show-hero-stats__icon .gc-hit-factor-badge-icon--theme-light {
    display: block;
}

/* Stage show stats on canvas: primary + hairline — не subtle на page */
.stage-show-main > .event-show-hero-stats .event-show-hero-stats__chip {
    background-color: var(--surface-primary);
    border-color: var(--border-subtle);
}

/* 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-15);
}

.gc-stage-sidebar-weapons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Soft type labels — surface-subtle, без badge/chip outline */
.gc-stage-sidebar-weapon-type {
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 28px;
    padding: var(--space-1) var(--space-2-5);
    border-radius: var(--radius-full);
    background: var(--surface-subtle);
    color: var(--text-secondary);
    font-size: var(--font-size-13);
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

/* Stage show: prose / section body inset (= chrome space/3) */
.stage-show-main .gc-open-list-section--framed > .gc-list-section-shell--flush > .gc-list-zone-inset.event-description-text {
    padding: var(--gc-open-list-section-inset, var(--space-3));
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.stage-show-rail-stack {
    display: flex;
    flex-direction: column;
    /* как .weapon-sidebar-stack--show-rail: воздух между статами / чипами / identity */
    gap: var(--space-2);
    width: 100%;
    min-width: 0;
}

/* Context rail show брифинга (≥1280): sidebar в .gc-context-rail, не catalog-sidebar */
.stage-show-context-rail .stage-show-sidebar-cell {
    width: 100%;
}

.stage-show-context-rail .stage-show-sidebar-info-block {
    flex: 1 1 auto;
}

.stage-show-rail-identity {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    min-width: 0;
}

/* Exercise show: open briefing in context rail (≥1280) */
.exercise-show-context-rail .exercise-briefing-rail,
.exercise-show-context-rail .sidebar-event-info-cell {
    width: 100%;
}

.exercise-show-context-rail .exercise-briefing-rail__frame,
.exercise-show-context-rail .exercise-briefing-rail__inset,
.exercise-show-context-rail .sidebar-event-info-block {
    flex: 1 1 auto;
}

.exercise-briefing-rail__frame {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    width: 100%;
}

/*
 * Desktop rail: обложка flush к chrome; тело/статы/строки — sibling --rail.
 * Adaptive карточку не трогает — там BriefingCard в gc-until-layout-rail.
 */
@media (min-width: 1280px) {
    .exercise-show-context-rail .event-show-about-rail-hero--has-cover {
        border: none;
        border-radius: 0;
    }
}

.gc-responsive-context-panel__body--flush .exercise-briefing-rail .event-show-about-rail-hero--has-cover {
    border: none;
    border-radius: 0;
}

.exercise-briefing-rail .event-show-hero-card__body--cover-caption .event-info-event-heading {
    padding: 0;
}

.gc-inset-list.exercise-briefing-rail__inset {
    --gc-inset-gap: 0;
    gap: 0;
}

.exercise-briefing-rail__inset > .event-info-event-heading {
    padding: var(--space-4) 0;
}

.exercise-briefing-rail__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}
.exercise-briefing-rail__author { padding: 0 0 var(--space-2); }
.exercise-briefing-rail__page-button { width: 100%; }

.exercise-briefing-rail__weapon-tag {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    background: var(--surface-secondary);
    color: var(--text-primary);
    font-size: var(--font-size-14);
    font-weight: 500;
    line-height: 1.4;
    box-sizing: border-box;
}

.exercise-briefing-rail__inset > .stage-show-rail-stack {
    padding-block: var(--space-4);
}

.exercise-briefing-rail__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    min-width: 0;
    width: 100%;
    margin-inline: 0;
    padding: var(--space-4) 0;
    box-sizing: border-box;
}

.exercise-briefing-rail__divider {
    width: calc(100% + (2 * var(--gc-inset-padding)));
    max-width: none;
    margin-inline: calc(-1 * var(--gc-inset-padding));
    height: 0;
    border: 0;
    border-top: 1px solid var(--border-subtle);
}

.exercise-briefing-rail__section {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
}

.exercise-briefing-rail__section-title {
    margin: 0;
    font-size: var(--font-size-15);
    font-weight: 500;
    line-height: var(--gc-list-title-line-height, 1.35);
    color: var(--text-primary);
}

.exercise-show-rail-fallback {
    min-width: 0;
    width: 100%;
}



/* Exercise briefing selection: compact catalog and shared briefing preview. */
.exercise-add-stage-catalog .catalog-main { gap: var(--space-4); container-type: inline-size; }
.exercise-add-stage-catalog .gc-cards-grid-briefings {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-8) var(--space-6);
}
@container (max-width: 959px) {
    .exercise-add-stage-catalog .gc-cards-grid-briefings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 559px) {
    .exercise-add-stage-catalog .gc-cards-grid-briefings { grid-template-columns: 1fr; }
}
.exercise-add-stage-filters { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-6); }
.exercise-add-stage-filters__title { margin: 0; font-size: var(--font-size-16); font-weight: 600; }
.exercise-add-stage-filters__group { border: 0; padding: 0; margin: 0; min-width: 0; }
.exercise-add-stage-filters__group legend { margin-bottom: var(--space-3); font-size: var(--font-size-14); font-weight: 600; color: var(--text-secondary); }
.exercise-add-stage-filters__actions, .stage-pick-modal__footer { display: flex; flex-direction: column; gap: var(--space-2); width: 100%; }
@media (min-width: 992px) and (max-width: 1279.98px) {
    .exercise-add-stage-subheader .gc-three-col-subheader__tabs--adaptive { display: block; }
    .exercise-add-stage-subheader .gc-three-col-subheader__center { display: none; }
}
@media (max-width: 767.98px) {
    .exercise-add-stage-catalog .gc-cards-grid-briefings { grid-template-columns: 1fr; }
}

