/* ==========================================================================
   CONTENT EDITING STYLES
   ========================================================================== */

/* Заголовок H1 — как в Figma (text-4xl font-extrabold tracking-tight text-foreground) */
.article-title-wiki {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 2.25rem;   /* 2.486vw — text-4xl Figma */
    font-weight: 800;    /* font-extrabold */
    line-height: 1.25;
    letter-spacing: -0.025em; /* tracking-tight */
    color: #1e1e24;      /* text-foreground Figma */
    margin: 0 0 2.21vw 0;
    outline: none;
    position: relative;
    padding-bottom: 0;
}
.article-title-wiki[contenteditable="true"]:empty:before {
    content: attr(data-default-text);
    color: #9ca3af;      /* muted-foreground */
    opacity: 0.5;
    display: block;
}

/* Контент */
.article-content-wrapper {
    animation: fadeInContent 0.5s ease-out 0.25s both;
}

@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(0.691vw);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Контент статьи — шрифты как в Figma (заголовки h2/h3 оставлены ниже) */
.article-content-wiki {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 1.125rem; /* 1.243vw — text-lg Figma */
    line-height: 1.625;  /* leading-relaxed Figma */
    color: rgba(30, 30, 36, 0.8); /* foreground/80 Figma #1e1e24 */
    min-height: 27.624vw;
    outline: none;
}

/* Отступ вниз от обычного текста — как в Figma (увеличен) */
/* Размер текста — единый для всех абзацев (p и div — contenteditable создаёт оба) */
.article-content-wiki p,
.article-content-wiki > div:not(.img-wrapper-content):not(.gallery-wrapper-content):not(.embed-wrapper-content):not(.quote-wrapper-content):not(.table-wrapper-content),
.article-content-wiki .editor-quote p { 
    font-size: 1.0125rem !important;
}
/* Enter = один пропуск строки; отступ как одна строка */
.article-content-wiki p,
.article-content-wiki > div:not(.img-wrapper-content):not(.gallery-wrapper-content):not(.embed-wrapper-content):not(.quote-wrapper-content):not(.table-wrapper-content) { 
    margin-bottom: 0.75em;
    margin-top: 0;
    transition: padding-left 0.2s ease;
}
.article-content-wiki h2 + p,
.article-content-wiki h3 + p {
    margin-top: 0;
}
.article-content-wiki p:focus {
    padding-left: 0.276vw;
}
/* H2 — как в Figma: flex + полоска primary слева (w-1 h-6 bg-primary rounded-full) + text-2xl font-bold */
/* Размер h2 увеличен на 5% */
.article-content-wiki h2 {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 1.42rem;  /* +5% от 1.35rem */
    font-weight: 700;
    color: #1e1e24;
    margin: 1.381vw 0 0.552vw 0;  /* увеличен отступ сверху */
    display: flex;
    align-items: center;
    gap: 0.552vw;
    position: relative;
    padding-left: 0;
    transition: padding-left 0.2s ease;
}
.article-content-wiki h2::before {
    content: '';
    width: 0.276vw;         /* w-1 Figma */
    height: 1.657vw;       /* h-6 */
    background: #8b5cf6; /* primary Figma */
    border-radius: 690.539vw;
    flex-shrink: 0;
}
.article-content-wiki h2:focus {
    padding-left: 0;
}
/* H3 — без полоски слева (в отличие от h2) */
.article-content-wiki h3 {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 1.25rem; /* 1.381vw — text-xl */
    font-weight: 600;
    color: #1e1e24;
    margin: 0.691vw 0 0.552vw 0;
    padding-left: 0;
    transition: padding-left 0.2s ease;
}
.article-content-wiki h3:focus {
    padding-left: 0;
}
/* Список — такой же отступ сверху/снизу, как между абзацами */
.article-content-wiki ul, .article-content-wiki ol {
    margin: 0.75em 0; 
    padding-left: 2.21vw;
    font-size: 1.0125rem; /* как у обычного текста (p) */
}
.article-content-wiki li { 
    margin-bottom: 0.691vw; 
    line-height: 1.7;
    font-size: inherit; /* как у обычного текста */
    transition: padding-left 0.2s ease;
}
.article-content-wiki li:focus {
    padding-left: 0.552vw;
}

/* Ссылки в тексте — как в Figma (primary, font-medium, без подчёркивания) */
.article-link {
    color: #8b5cf6; /* primary Figma */
    text-decoration: none;
    font-weight: 500;
    border-bottom: none;
    padding-bottom: 0;
    position: relative;
    cursor: default;
    transition: color 0.2s ease;
}
.article-link:hover {
    color: #8b5cf6;
}

/* Изображения в контенте — по Figma: центрирование, object-contain, заглушка обтекает равномерно */
.article-content-wiki .img-wrapper-content .img-image-container img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: auto;
}

/* Неизменяемый заголовок Description */
.immutable-heading {
    user-select: none;
    cursor: default;
    color: var(--text-color);
    margin-top: 0 !important;
    outline: none;
}

.immutable-heading:focus {
    outline: none;
    border: none;
}

/* Спойлер в редакторе — по Figma (EditorContent Spoiler) */
/* px-1 rounded transition-all duration-300 cursor-pointer select-none */
/* Не раскрыт: bg-gray-800 text-transparent hover:bg-gray-700 */
/* Раскрыт: bg-transparent text-inherit */
.spoiler {
    display: inline-block;
    padding: 0 0.276vw; /* px-1 */
    border-radius: 0.25rem; /* rounded */
    cursor: pointer;
    user-select: none; /* select-none */
    transition: all 0.3s ease; /* transition-all duration-300 */
    background: #1f2937; /* bg-gray-800 Figma */
    color: transparent; /* text-transparent */
    font-style: normal;
    font-weight: normal;
    border: none;
    position: relative;
}

.spoiler:hover:not(.revealed) {
    background: #374151; /* hover:bg-gray-700 */
}

/* Раскрытый спойлер — после клика (bg-transparent text-inherit) */
.spoiler.revealed {
    background: transparent !important;
    color: inherit !important;
}

/* Анимация подсветки при вставке нового элемента */
@keyframes highlightFade {
    0% { background-color: rgba(99, 102, 241, 0.2); }
    100% { background-color: transparent; }
}

.inserted-highlight {
    animation: highlightFade 1.5s ease-out forwards;
}

/* Wiki Type Header */
.wiki-type-header {
    background: var(--bg-secondary);
    color: var(--text-color);
    padding: 0.552vw 0.691vw;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.035vw;
    border: 0.069vw solid var(--border-color);
    border-bottom: none;
    border-radius: 0.552vw 0.552vw 0 0;
    position: relative;
    margin-bottom: 0;
    min-height: 2.417vw;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wiki-type-header .edit-type-btn {
    position: absolute;
    right: 0.552vw;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.414vw 0.691vw;
    border-radius: 0.552vw;
    width: 2.21vw;
    height: 2.21vw;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0.138vw 0.552vw rgba(99, 102, 241, 0.3);
}

.wiki-type-header:hover .edit-type-btn {
    opacity: 1;
}

.wiki-type-header .edit-type-btn:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    transform: translateY(-50%) scale(1.1) rotate(5deg);
    box-shadow: 0 0.276vw 0.829vw rgba(99, 102, 241, 0.5);
}

.wiki-type-header .edit-type-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.article-title-wiki {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    background: var(--bg-color);
    margin-top: 0 !important;
}

.main-image-wrapper {
    margin-bottom: 0.691vw;
}

