/* Wiki Article Styles - Vice Community Redesign */

/* ── Variables ── */
:root {
    --wiki-bg: #f5f6f8;
    --wiki-paper: #ffffff;
    /* Чуть контрастнее на белом фоне страницы */
    --wiki-border: #d4d7df;
    --wiki-border-light: #e6e8ed;
    --wiki-text: #111318;
    --wiki-text-secondary: #374151;
    --wiki-muted: #667085;
    --wiki-accent: #4f6ef7;
    --wiki-accent-light: #6c8cff;
    --wiki-accent-bg: #f0f4ff;
    --wiki-subtle-bg: #f8f9fb;
    --wiki-radius: 0.6vw;
}

/* ── Mobile/Tablet clamp sizes (идентично new_design) ── */
@media (max-width: 1023px) {
    :root {
        --wiki-radius: clamp(8px, 0.6vw, 12px);
    }
}

/* ── Page ── */
/* Фон страницы как у публичной новости: body там --card-bg (#ffffff) */
.wiki-article-page {
    --wiki-tools-subnav-h: clamp(38px, 2.2vw, 48px);
    background: #ffffff !important;
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Отступ снизу — чтобы контент не закрывала нижняя панель */
.wiki-article-page .wiki-editor-container,
.wiki-article-page .wiki-explore-page-wrapper {
    padding-bottom: calc(var(--bottom-bar-h, 64px) + env(safe-area-inset-bottom, 0px) + 24px);
}

/* ── Tab Switcher ── */
/* Desktop: buttons stretch full width, same 8px gap between */
@media (min-width: 1024px) {
    .wiki-tab-switcher {
        display: flex;
        flex-direction: row;
        justify-content: stretch;
        gap: 8px;
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 0;
        margin-bottom: clamp(12px, 1vw, 20px);
        width: 100%;
        overflow: visible;
        box-shadow: none;
    }
    .wiki-tab-switcher .wiki-tab-btn {
        flex: 1;
        justify-content: center;
        min-width: 0;
    }
}

/* Mobile/Tablet: white strip with horizontal scroll */
@media (max-width: 1023px) {
    .wiki-tab-switcher {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 8px;
        background: #fff;
        border: 1px solid #b9c0cc;
        border-radius: 8px;
        padding: 8px 12px;
        margin-bottom: clamp(12px, 1vw, 20px);
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    }
    .wiki-tab-switcher::-webkit-scrollbar { display: none; }
    .wiki-tab-switcher .wiki-tab-btn {
        flex: 0 0 auto;
        width: auto;
        justify-content: center;
        min-width: 0;
    }
}

.wiki-tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.11);
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    white-space: nowrap;
}

.wiki-tab-btn:hover {
    background: rgba(0,0,0,0.04);
    color: #333;
    border-color: rgba(0,0,0,0.15);
}

.wiki-tab-btn.active {
    background: rgba(79,110,247,0.08);
    color: #4f6ef7;
    border-color: rgba(79,110,247,0.32);
    font-weight: 600;
}

.wiki-tab-btn [data-lucide],
.wiki-tab-btn .lucide-icon {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    flex-shrink: 0;
    color: inherit;
}

.wiki-tab-btn.active [data-lucide],
.wiki-tab-btn.active .lucide-icon {
    color: #4f6ef7;
}

.wiki-tab-btn [data-lucide] svg,
.wiki-tab-btn .lucide-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
}

/* ── Article Container ── */
.wiki-article-page .article-main {
    background: var(--wiki-paper);
    border-radius: clamp(8px, 0.6vw, 12px);
    border: 1px solid rgba(0,0,0,0.08);
    padding: clamp(12px, 1.2vw, 24px);
}

/* В сетке как у новостной статьи — без «карточки», отступы как у .article-header-wiki / .article-content-wiki */
.news-article-wiki-container--wiki-explore .article-main,
.wiki-explore-article-main .article-main {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0 clamp(12px, 1.2vw, 24px);
    box-sizing: border-box;
}

/* Desktop: таблица должна показываться полностью, без обрезки */
@media (min-width: 1024px) {
    .wiki-article-page .wiki-editor-container,
    .wiki-article-page .news-article-wiki-container--wiki-explore {
        overflow-x: visible;
    }
    .wiki-article-page .article-main {
        overflow-x: visible;
    }
    .wiki-article-page .article-text {
        overflow-x: visible;
    }
}

@media (max-width: 1023px) {
    .wiki-article-page .article-main {
        overflow-x: hidden;
    }
}

@media (max-width: 639px) {
    .wiki-article-page .article-main {
        padding: 12px;
    }
    .news-article-wiki-container--wiki-explore .article-main,
    .wiki-explore-article-main .article-main {
        padding: 0 12px;
    }
}

/* ── Breadcrumb: перенос на следующую строку, без сжатия ── */
.vc-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: clamp(4px, 0.4vw, 8px);
    row-gap: 4px;
    font-size: clamp(12px, 0.95vw, 15px);
    min-width: 0;
}

.vc-breadcrumb a,
.vc-breadcrumb .sep {
    white-space: normal;
    word-break: break-word;
}

.vc-breadcrumb a {
    flex-shrink: 0;
}

.vc-breadcrumb a {
    color: var(--wiki-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.vc-breadcrumb a:hover {
    color: var(--wiki-accent);
}

.vc-breadcrumb .sep {
    color: #c7ccd4;
    margin: 0 clamp(2px, 0.14vw, 4px);
}

/* ── Title ── (переопределяем explore/style.css .article-header h1, чуть больше h2) */
.wiki-article-page .article-header .article-title,
.wiki-article-page .article-title {
    font-size: clamp(24px, 1.8vw, 32px) !important;
    font-weight: 800;
    color: var(--wiki-text);
    margin: clamp(10px, 0.9vw, 18px) 0 clamp(16px, 1.2vw, 24px) !important;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.wiki-article-page .article-header--no-breadcrumb .article-title {
    margin-top: clamp(12px, 1.2vw, 24px);
}

/* ── Headings (clamp как new_design) ── */
.article-text h2 {
    position: relative;
    display: flex;
    align-items: center;
    gap: clamp(6px, 0.5vw, 10px);
    font-size: clamp(16px, 1.2vw, 22px);
    font-weight: 700;
    color: var(--wiki-text);
    margin: clamp(16px, 1.2vw, 24px) 0 clamp(8px, 0.5vw, 12px);
    padding-left: clamp(10px, 0.8vw, 16px);
}

.article-text h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: clamp(2px, 0.15vw, 3px);
    bottom: clamp(2px, 0.15vw, 3px);
    width: clamp(3px, 0.2vw, 4px);
    border-radius: clamp(2px, 0.2vw, 4px);
    background: linear-gradient(to bottom, var(--wiki-accent), var(--wiki-accent-light));
}

.article-text h3 {
    font-size: clamp(14px, 1vw, 18px);
    font-weight: 600;
    color: #111318;
    margin: clamp(8px, 0.6vw, 14px) 0 clamp(4px, 0.3vw, 8px);
    padding-left: 0;
}

/* ── Body Text (clamp как new_design) ── */
.article-text {
    font-size: clamp(14px, 1vw, 17px);
    line-height: 1.75;
    color: var(--wiki-text-secondary);
}

.article-text p {
    margin: 0 0 clamp(8px, 0.6vw, 12px);
}

.article-text ul,
.article-text ol {
    margin: 0 0 clamp(8px, 0.6vw, 12px) clamp(16px, 1.5vw, 24px);
    padding-left: clamp(6px, 0.5vw, 10px);
}

.article-text li {
    margin-bottom: clamp(3px, 0.3vw, 6px);
}

/* ── Links: подчёркивание появляется при hover, пропадает при уходе (анимация как раньше) ── */
.article-text a {
    color: var(--wiki-accent);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 0.207vw;
    font-weight: 500;
    transition: text-decoration-color 0.25s ease, color 0.2s ease;
}

.article-text a:hover {
    text-decoration-color: var(--wiki-accent);
}

/* ── Article Images ── */
.article-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--wiki-radius);
    overflow: hidden;
    border: 0.069vw solid var(--wiki-border);
    background: #e8eaef;
    margin: 0.8vw 0;
}

.article-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-image-caption {
    padding: 0.4vw 0.8vw;
    background: var(--wiki-paper);
    border-top: 0.069vw solid var(--wiki-border);
    font-size: 0.72vw;
    color: var(--wiki-muted);
}

/* ── Gallery Slider ── */
.article-gallery-slider {
    position: relative;
    border-radius: var(--wiki-radius);
    overflow: hidden;
    border: 0.069vw solid var(--wiki-border);
    margin: 0.8vw 0;
}

.article-gallery-slider .slider-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #e8eaef;
}

.article-gallery-slider .slider-viewport img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.article-gallery-slider .slider-counter {
    position: absolute;
    right: 0.6vw;
    top: 0.6vw;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.7vw;
    font-weight: 600;
    padding: 0.2vw 0.5vw;
    border-radius: 0.4vw;
    backdrop-filter: blur(0.276vw);
}

.article-gallery-slider .slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 1.8vw;
    height: 1.8vw;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    backdrop-filter: blur(0.276vw);
}

.article-gallery-slider:hover .slider-arrow {
    opacity: 1;
}

.article-gallery-slider .slider-arrow--prev { left: 0.4vw; }
.article-gallery-slider .slider-arrow--next { right: 0.4vw; }

.article-gallery-slider .slider-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3vw;
    padding: 0.4vw;
    border-top: 0.069vw solid var(--wiki-border);
    background: var(--wiki-paper);
}

.article-gallery-slider .slider-dot {
    width: 0.35vw;
    height: 0.35vw;
    border-radius: 0.35vw;
    background: #d1d5dc;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.article-gallery-slider .slider-dot.active {
    width: 1.2vw;
    background: var(--wiki-accent);
}

/* ── Gallery Tab ── */
.wiki-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6vw;
}

.wiki-gallery-thumb {
    position: relative;
    overflow: hidden;
    border-radius: 0.5vw;
    border: 0.069vw solid var(--wiki-border);
    background: #f5f6f8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wiki-gallery-thumb:hover {
    border-color: rgba(79, 110, 247, 0.4);
    box-shadow: 0 0.138vw 0.552vw rgba(0, 0, 0, 0.08);
}

.wiki-gallery-thumb__img {
    aspect-ratio: 16 / 9;
    width: 100%;
    overflow: hidden;
}

.wiki-gallery-thumb__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.wiki-gallery-thumb:hover .wiki-gallery-thumb__img img {
    transform: scale(1.05);
}

.wiki-gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2vw;
    color: var(--wiki-muted);
    font-size: 0.85vw;
}

/* ── History Tab ── */
.wiki-history-placeholder {
    padding: 2vw;
    text-align: center;
    color: var(--wiki-muted);
    font-size: 0.85vw;
}

/* ── Placeholder for "coming soon" tabs (Edit History, Discussion) ── */
.wiki-tab-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: clamp(24px, 3rem, 48px) clamp(16px, 2rem, 32px);
    text-align: center;
    color: var(--wiki-muted);
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: clamp(8px, 0.6vw, 12px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    margin: clamp(12px, 1.2vw, 20px) 0;
    max-width: 100%;
    box-sizing: border-box;
}

.wiki-tab-placeholder-icon {
    width: clamp(32px, 3rem, 48px);
    height: clamp(32px, 3rem, 48px);
    color: var(--wiki-muted);
    opacity: 0.7;
}

.wiki-tab-placeholder-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}

.wiki-tab-placeholder-text {
    margin: 0;
    font-size: clamp(13px, 0.95rem, 16px);
    font-weight: 500;
    color: var(--wiki-muted);
}

/* ── Мобильные: единый размер текста в статье, breadcrumb переносится ── */
@media (max-width: 1023px) {
    .vc-breadcrumb {
        row-gap: 6px;
    }
}

@media (max-width: 639px) {
    /* Один размер шрифта в тексте статьи — без скачков из-за vw */
    .wiki-article-page .article-text {
        font-size: 15px !important;
    }
    .wiki-article-page .article-text p,
    .wiki-article-page .article-text li,
    .wiki-article-page .article-text td,
    .wiki-article-page .article-text th,
    .wiki-article-page .article-text blockquote,
    .wiki-article-page .article-text span:not([class]),
    .wiki-article-page .article-text div:not([class]) {
        font-size: inherit !important;
    }
    .wiki-article-page .article-text h2 {
        font-size: 17px !important;
    }
    .wiki-article-page .article-text h3 {
        font-size: 15px !important;
    }
    .wiki-article-page .article-image-caption {
        font-size: 13px !important;
    }
    .wiki-article-page .article-text table {
        font-size: 15px !important;
    }
}
