/*
 * Wikipedia Structure with Veridictum Design
 */

/* ========== Global ========== */
.mediawiki {
    background: var(--v-bg);
    color: var(--v-text);
    font-family: var(--v-font-sans);
    font-size: var(--v-fs-body);
    line-height: var(--v-lh-body);
}

/* Preserve aspect ratio for all images */
.vector-body img,
.mw-parser-output img {
    max-width: 100%;
    height: auto;
}

/* ========== Header ========== */
.mw-header-container {
    background: var(--v-surface);
    border-bottom: 1px solid var(--v-border);
    box-shadow: var(--v-sh1);
    position: sticky;
    top: 0;
    z-index: 150;
}

.vector-header {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    gap: 24px;
}

.mw-logo {
    font-family: 'Linux Libertine', 'Georgia', 'Times', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--v-accent);
    text-decoration: none;
    letter-spacing: 0.01em;
    transition: opacity var(--v-duration-hover);
}

.mw-logo .mw-logo-text {
    font-weight: 700;
}

.mw-logo .logo-cap {
    font-size: 1.15em;
    font-weight: 700;
}

.mw-logo:hover {
    opacity: 0.8;
}

.vector-header-search {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.vector-search-box {
    position: relative;
}

.vector-search-box-input {
    width: 100%;
    padding: 10px 16px;
    padding-right: 80px;
    font-family: var(--v-font-sans);
    font-size: var(--v-fs-body);
    background: var(--v-surface-alt);
    border: 1px solid var(--v-border);
    border-radius: var(--v-radius-button);
    color: var(--v-text);
    transition: all var(--v-duration-hover);
}

.vector-search-box-input:focus {
    outline: none;
    border-color: var(--v-accent);
    background: var(--v-surface);
    box-shadow: var(--v-sh1);
}

.vector-search-box-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 16px;
    background: var(--v-accent);
    color: #fff;
    border: none;
    border-radius: var(--v-radius-item);
    font-size: var(--v-fs-button);
    font-weight: var(--v-fw-medium);
    cursor: pointer;
    transition: background var(--v-duration-hover);
}

.vector-search-box-button:hover {
    background: var(--v-accent-dark);
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--v-surface);
    border: 1px solid var(--v-border);
    border-radius: var(--v-radius-dropdown);
    box-shadow: var(--v-sh2);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.search-suggestions a {
    display: block;
    padding: 12px 16px;
    color: var(--v-text);
    text-decoration: none;
    font-family: var(--v-font-sans);
    font-size: var(--v-fs-body);
    border-bottom: 1px solid var(--v-border);
    transition: background var(--v-duration-hover);
}

.search-suggestions a:hover,
.search-suggestions a.highlighted {
    background: var(--v-surface-alt);
}

.search-suggestions a:last-child {
    border-bottom: none;
}

.vector-user-links {
    display: flex;
    gap: 16px;
}

.vector-user-link {
    font-family: var(--v-font-sans);
    font-size: var(--v-fs-button);
    color: var(--v-text-sec);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--v-radius-item);
    transition: all var(--v-duration-hover);
}

.vector-user-link:hover {
    background: var(--v-surface-alt);
    color: var(--v-text);
}

/* ========== Page Container ========== */
.mw-page-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    gap: 0;
}

/* ========== Sidebar ========== */
/* Mobile dropdown (inside header) — hidden on desktop */
.vector-sidebar-container {
    display: none;
}

/* Desktop sidebar (in page flow) */
.vector-sidebar-desktop {
    width: 240px;
    flex-shrink: 0;
    padding: 24px 0;
    border-right: 1px solid var(--v-border);
    background: var(--v-surface);
}

.vector-sidebar {
    position: sticky;
    top: 80px;
    padding: 0 20px;
}

.vector-main-menu-heading,
.vector-page-tools-heading {
    font-family: var(--v-font-serif);
    font-size: var(--v-fs-h3);
    font-weight: var(--v-fw-semibold);
    color: var(--v-text);
    margin-bottom: 8px;
}

.vector-main-menu-list,
.vector-page-tools-list {
    list-style: none;
    margin-bottom: 16px;
}

.vector-main-menu-list-item,
.vector-page-tools-list-item {
    margin-bottom: 0;
}

.vector-main-menu-action,
.vector-page-tools-action {
    display: block;
    padding: 2px 12px;
    font-family: var(--v-font-sans);
    font-size: var(--v-fs-body);
    color: var(--v-text-sec);
    text-decoration: none;
    border-radius: var(--v-radius-item);
    transition: all var(--v-duration-hover);
}

.vector-main-menu-action:hover,
.vector-page-tools-action:hover {
    background: var(--v-surface-alt);
    color: var(--v-text);
}

/* ========== Main Content ========== */
.mw-content-container {
    flex: 1;
    padding: 32px 40px;
    background: var(--v-bg);
    min-width: 0;
}

.mw-body {
    max-width: 900px;
}

.firstHeading {
    font-family: var(--v-font-serif);
    font-size: var(--v-fs-hero);
    font-weight: var(--v-fw-bold);
    color: var(--v-text);
    line-height: var(--v-lh-heading);
    margin-bottom: 16px;
    letter-spacing: var(--v-ls-hero);
}

.vector-body {
    font-family: var(--v-font-sans);
    font-size: var(--v-fs-body);
    line-height: var(--v-lh-body);
    color: var(--v-text);
}

/* ========== Table of Contents ========== */
.toc {
    background: var(--v-surface);
    border: 1px solid var(--v-border);
    border-radius: var(--v-radius-card);
    padding: 7px 12px 9px;
    margin-bottom: 24px;
    box-shadow: var(--v-sh1);
}

.toctitle h2 {
    font-family: var(--v-font-serif);
    font-size: var(--v-fs-h3);
    color: var(--v-text);
    margin-bottom: 3px;
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc-list li {
    margin: 0;
    padding: 0;
}

/* Уровень 1 — главные разделы */
.toc-list li.toclevel-1 {
    margin-top: 2px;
}

.toc-list li.toclevel-1 > .toc-link {
    font-size: 13px;
    font-weight: var(--v-fw-medium);
    color: var(--v-text);
    padding: 1px 0;
}

/* Уровень 2 — подразделы: отступ слева */
.toc-list li.toclevel-2 {
    padding-left: 16px;
}

.toc-list li.toclevel-2 > .toc-link {
    font-size: 12px;
    font-weight: normal;
    color: var(--v-text-sec);
    padding: 1px 0;
}

/* Уровень 3+ — ещё глубже */
.toc-list li.toclevel-3 {
    padding-left: 32px;
}

.toc-list li.toclevel-3 > .toc-link {
    font-size: 11px;
    color: var(--v-text-muted);
    padding: 0;
}

.toc-link {
    display: flex;
    align-items: baseline;
    gap: 5px;
    text-decoration: none;
    font-family: var(--v-font-sans);
    line-height: 1.5;
    transition: color var(--v-duration-hover);
}

.toc-link:hover {
    color: var(--v-accent);
}

.toc-link.active {
    color: var(--v-accent);
    font-weight: var(--v-fw-medium);
}

.tocnumber {
    font-family: var(--v-font-mono);
    color: var(--v-text-muted);
    font-size: 11px;
    flex-shrink: 0;
}

/* ========== Article Content ========== */
.mw-parser-output {
    font-family: var(--v-font-sans);
}

.mw-parser-output p {
    margin: var(--v-margin-p);
    font-size: var(--v-fs-body);
    line-height: var(--v-lh-body);
    color: var(--v-text);
}

.mw-parser-output a {
    color: var(--v-accent);
    text-decoration: none;
    transition: color var(--v-duration-hover);
}

.mw-parser-output a:hover {
    color: var(--v-accent-dark);
    text-decoration: underline;
}

.mw-heading {
    font-family: var(--v-font-serif);
    font-weight: var(--v-fw-semibold);
    color: var(--v-text);
    border-bottom: 1px solid var(--v-border);
    padding-bottom: 8px;
    margin-top: 32px;
    margin-bottom: 16px;
}

.mw-parser-output h2 {
    font-size: 18px; /* было 24px, −40% округлено до читаемого */
    margin: var(--v-margin-h2);
}

.mw-parser-output h3 {
    font-size: 15px; /* было 18px */
    margin: var(--v-margin-h3);
}

.mw-parser-output h4 {
    font-size: 13px; /* было 16px */
    margin: var(--v-margin-h4);
}

.mw-parser-output ul,
.mw-parser-output ol {
    margin: var(--v-margin-list);
    padding-left: 24px;
}

.mw-parser-output li {
    margin-bottom: 4px;
}

.mw-parser-output blockquote {
    margin: var(--v-margin-bq);
    padding: var(--v-space-blockquote);
    border-left: 3px solid var(--v-blockquote-border);
    background: var(--v-blockquote-bg);
    border-radius: var(--v-radius-blockquote);
    font-style: italic;
    color: var(--v-text-sec);
}

.mw-parser-output code {
    font-family: var(--v-font-mono);
    font-size: var(--v-fs-code);
    background: var(--v-surface-alt);
    padding: 2px 6px;
    border-radius: var(--v-radius-code);
    color: var(--v-text);
}

.mw-parser-output pre {
    background: var(--v-surface-alt);
    padding: 16px;
    border-radius: var(--v-radius-card-sm);
    overflow-x: auto;
    font-family: var(--v-font-mono);
    font-size: var(--v-fs-code);
}

.mw-parser-output table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
}

.mw-parser-output th,
.mw-parser-output td {
    border: 1px solid var(--v-border);
    padding: 8px 12px;
    text-align: left;
}

.mw-parser-output th {
    background: var(--v-surface-alt);
    font-weight: var(--v-fw-semibold);
    color: var(--v-text);
}

/* Infobox */
.infobox {
    float: right;
    margin: 0 0 16px 16px;
    width: 280px;
    background: var(--v-surface);
    border: 1px solid var(--v-border);
    border-radius: var(--v-radius-card);
    box-shadow: var(--v-sh1);
}

.infobox-above {
    background: var(--v-accent-light);
    color: var(--v-accent);
    font-family: var(--v-font-serif);
    font-size: var(--v-fs-h2);
    font-weight: var(--v-fw-semibold);
    padding: 12px 16px;
    text-align: center;
}

.infobox-image {
    padding: 16px;
}

.infobox-image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--v-radius-card-sm);
}

.infobox-caption {
    font-size: var(--v-fs-small);
    color: var(--v-text-muted);
    margin-top: 8px;
    text-align: center;
}

.infobox-label {
    font-family: var(--v-font-sans);
    font-size: var(--v-fs-small);
    color: var(--v-text-sec);
    font-weight: var(--v-fw-semibold);
    padding: 8px 12px;
    background: var(--v-surface-alt);
    width: 40%;
}

.infobox-data {
    font-family: var(--v-font-sans);
    font-size: var(--v-fs-small);
    color: var(--v-text);
    padding: 8px 12px;
}

.references {
    font-size: var(--v-fs-small);
    color: var(--v-text-sec);
}

/* ========== Footer ========== */
.mw-footer {
    background: var(--v-surface);
    border-top: 1px solid var(--v-border);
    padding: 32px 40px;
    margin-top: 48px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-info,
.footer-places {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.footer-info-item,
.footer-places-item {
    font-size: var(--v-fs-small);
    color: var(--v-text-muted);
}

.footer-link {
    color: var(--v-accent);
    text-decoration: none;
    transition: color var(--v-duration-hover);
}

.footer-link:hover {
    color: var(--v-accent-dark);
    text-decoration: underline;
}

.footer-copyright {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--v-border);
    font-size: var(--v-fs-footer);
    color: var(--v-text-muted);
}

/* ========== Hamburger Button ========== */
.mw-sidebar-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--v-radius-item);
    transition: background var(--v-duration-hover);
}

.mw-sidebar-toggle:hover {
    background: var(--v-accent-light);
}

.mw-sidebar-toggle span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: var(--v-accent);
    border-radius: 1px;
    transition: all 0.25s ease;
}

/* Overlay — invisible click-catcher */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 149;
}

.sidebar-overlay.active {
    display: block;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
    .mw-sidebar-toggle {
        display: flex;
    }

    /* Hide desktop sidebar */
    .vector-sidebar-desktop {
        display: none;
    }

    /* Show mobile dropdown */
    .vector-sidebar-container {
        display: block;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        background: var(--v-surface);
        border-top: 1px solid var(--v-border);
        transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
        padding: 0 20px;
    }

    .vector-sidebar-container.open {
        max-height: 400px;
        opacity: 1;
        padding: 12px 20px;
    }

    .mw-content-container {
        padding: 24px 20px;
    }
}

@media (max-width: 768px) {
    .vector-header {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
    .vector-header-start {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .vector-header-search {
        max-width: 100%;
        order: 3;
        flex-basis: 100%;
    }
    .vector-header-end {
        margin-left: auto;
    }
    .infobox {
        float: none;
        width: 100%;
        margin: 0 0 24px 0;
    }
    .article-layout {
        grid-template-columns: 1fr !important;
    }
}
