@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --gb-primary: #346bdb;
    --gb-primary-hover: #2857b8;
    --gb-text: #181d26;
    --gb-text-muted: #57606a;
    --gb-border: #e6e8eb;
    --gb-sidebar-bg: #f7f8fa;
    --gb-content-width: 760px;
    --gb-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.g-root,
.yfm,
.pc-navigation,
.dc-toc,
.dc-mini-toc {
    font-family: var(--gb-font);
}

/* Header + logo */
.pc-navigation {
    border-bottom: 1px solid var(--gb-border);
    box-shadow: none;

    @media (max-width: 768px) {
        padding-inline: 8px;
    }
}

.pc-logo__icon {
    width: 32px;
    height: 32px;
    max-width: 32px;
    max-height: 32px;
    border-radius: 8px;
    object-fit: cover;
}

.pc-logo__text {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.dc-search-suggest {
    margin: 6px;
}

/* Sidebar */
.dc-doc-layout__toc {
    background: var(--gb-sidebar-bg);
    border-right: 1px solid var(--gb-border);
    padding-left: 8px;
}

.dc-toc__content>.dc-toc__list {
    padding-right: 8px;
}

.dc-toc {
    border-right: none;
    background: transparent;

    @media (max-width: 768px) {
        padding: 12px 0 0 16px;
    }
}

.dc-toc__list-item {
    margin-bottom: 4px;
}

.dc-toc-item__icon {
    left: 4px;
}
    
.dc-toc-item__text {
    font-size: 16px;
    line-height: 20px;
    color: var(--gb-text-muted);
}

.dc-toc-item__text:hover {
    color: var(--gb-text);
}

.dc-toc-item__text_active {
    background: rgba(52, 109, 219, 0.12);
    color: var(--gb-primary);
    font-weight: 500;
    border-radius: 3px;
}

.dc-toc-list {
    padding-right: 0;
}

.dc-toc__list-item:not(.dc-toc__list-item_labeled) > .dc-toc__list {
    margin-left: 12px;
    padding-left: 10px;
    border-left: 1px solid var(--gb-border);
}

@media (max-width: 768px) {
    .dc-root_wide-format .dc-subnavigation {
        padding-inline: 0;
        width: 100%;
    }      
    
    .dc-root_wide-format .dc-doc-page__main {
        padding: 24px 16px;
    }  
}

@media (min-width: 769px) {
    .g-root .pc-desktop-navigation__wrapper {
        padding: 0 8px;
    }
}

.g-yc-navigation-item__content,
.yc-navigation-item__content,
.yc-navigation-item {
    display: flex;
    align-items: center;
    gap: 8px !important; 
}

/* Принудительно сбрасываем старые маргины, чтобы они не суммировались с gap */
.g-yc-navigation-item__toggle-icon,
.yc-navigation-item__toggle {
    margin-right: 0 !important;
}

/* Content */

.dc-doc-layout__center {
    max-width: calc(var(--gb-content-width) + 120px);
}

.dc-doc-page__main {
    padding: 24px 32px;
}

.dc-doc-page__body .yfm,
.dc-doc-layout__content .yfm,
.dc-doc-page__content .yfm {
    max-width: var(--gb-content-width);
    font-size: 16px;
    line-height: 1.7;
    color: var(--gb-text);
}

.yfm .yfm-lead {
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--gb-text-muted);
    margin: 0 0 1.5rem;
}

.yfm a:not(.yfm-card):not(.yfm-section-cards a) {
    color: var(--gb-primary);
    text-decoration: none;
}

.yfm a:not(.yfm-card):not(.yfm-section-cards a):hover {
    color: var(--gb-primary-hover);
    text-decoration: underline;
}

/* Doc cards: home + section index (CSS only, no JS) */
.yfm .yfm-section-cards,
.yfm .yfm-card-grid {
    margin: 1.5rem 0 2rem;
}

.yfm .yfm-section-cards > ul,
.yfm .yfm-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.yfm .yfm-card-grid p {
    margin: 0;
}

.yfm .yfm-card,
.yfm .yfm-section-cards > ul > li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--gb-border);
    border-radius: 12px;
    background: #fff;
    color: var(--gb-text);
    font-weight: 500;
    font-size: 15px;
    line-height: 1.4;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

/* Hide inline ": description" text in markdown list cards */
.yfm .yfm-section-cards > ul > li {
    font-size: 0;
}

.yfm .yfm-section-cards > ul > li a {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--gb-text);
    text-decoration: none;
}

.yfm .yfm-section-cards > ul > li a:hover {
    color: var(--gb-text);
    text-decoration: none;
}

.yfm .yfm-card::after,
.yfm .yfm-section-cards > ul > li::after {
    content: '→';
    flex-shrink: 0;
    color: var(--gb-text-muted);
}

.yfm .yfm-card:hover,
.yfm .yfm-section-cards > ul > li:hover {
    background: rgba(52, 109, 219, 0.04);
    border-color: rgba(52, 109, 219, 0.25);
    text-decoration: none;
}

.yfm .yfm-card:hover::after,
.yfm .yfm-section-cards > ul > li:hover::after {
    color: var(--gb-primary);
}

/* Notes */
.yfm .yfm-note {
    border-radius: 8px;
    border: 1px solid transparent;
    padding: 16px 16px 16px 52px;
    margin: 1rem 0;
}

.yfm .yfm-note .yfm-note-title,
.yfm .yfm-note > .yfm-note-title::before {
    display: none !important;
    content: none !important;
}

.yfm .yfm-note > :not(.yfm-note-title):first-of-type::before {
    box-sizing: content-box;
    display: block;
    width: 24px;
    height: 24px;
    margin-top: -2px;
    margin-left: -36px;
    padding-right: 12px;
    float: left;
}

.yfm .yfm-note.yfm-accent-info > :not(.yfm-note-title):first-of-type::before {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%23346bdb'/%3E%3Crect width='1' height='5' x='7.5' y='6.5' stroke='%23fff' rx='.5'/%3E%3Ccircle cx='8' cy='4' r='1' fill='%23fff'/%3E%3C/svg%3E");
}

.yfm .yfm-note.yfm-accent-tip > :not(.yfm-note-title):first-of-type::before {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%2310b981'/%3E%3Crect width='1' height='5' x='7.5' y='6.5' stroke='%23fff' rx='.5'/%3E%3Ccircle cx='8' cy='4' r='1' fill='%23fff'/%3E%3C/svg%3E");
}

.yfm .yfm-note.yfm-accent-warning > :not(.yfm-note-title):first-of-type::before {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%23f59e0b'/%3E%3Crect width='1' height='5' x='7.5' y='6.5' stroke='%23fff' rx='.5'/%3E%3Ccircle cx='8' cy='4' r='1' fill='%23fff'/%3E%3C/svg%3E");
}

.yfm .yfm-note.yfm-accent-alert > :not(.yfm-note-title):first-of-type::before {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%23ef4444'/%3E%3Crect width='1' height='5' x='7.5' y='6.5' stroke='%23fff' rx='.5'/%3E%3Ccircle cx='8' cy='4' r='1' fill='%23fff'/%3E%3C/svg%3E");
}

.yfm .yfm-note.yfm-accent-info {
    background: #e8f0fe;
    border-color: rgba(52, 109, 219, 0.22);
}

.yfm .yfm-note.yfm-accent-tip {
    background: #e6f7ed;
    border-color: rgba(16, 185, 129, 0.25);
}

.yfm .yfm-note.yfm-accent-warning {
    background: #fff8e6;
    border-color: rgba(245, 158, 11, 0.28);
}

.yfm .yfm-note.yfm-accent-alert {
    background: #ffebe9;
    border-color: rgba(239, 68, 68, 0.25);
}

/* Media */
.yfm img,
.yfm figure img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--gb-border);
}

.yfm figure figcaption {
    margin-top: 0.5rem;
    font-size: 13px;
    color: var(--gb-text-muted);
    text-align: center;
}

.g-root_theme_dark {
    --gb-text: #f5f7fa;
    --gb-text-muted: #9da7b3;
    --gb-border: #2a3038;
    --gb-sidebar-bg: #151920;
}

.g-root_theme_dark .yfm .yfm-card,
.g-root_theme_dark .yfm .yfm-section-cards > ul > li {
    background: #151920;
    border-color: var(--gb-border);
}

/* Lightbox */

.yfm img {
    cursor: zoom-in;
    transition: opacity 0.2s ease;
}

.yfm img:hover {
    opacity: 0.9;
}

body.lightbox-open {
    overflow: hidden;
}

#diplodoc-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

#diplodoc-lightbox.active {
    display: flex;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 20, 28, 0.55);
    backdrop-filter: blur(4px);
}

.lightbox-dialog {
    position: relative;
    z-index: 1;
    width: 80%;
    max-width: 1024px;
    padding: 12px 12px 16px;
    border-radius: 12px;
    background: #fff;
    box-shadow:
        0 24px 48px rgba(15, 20, 28, 0.28),
        0 8px 16px rgba(15, 20, 28, 0.12);
    animation: lightboxZoom 0.25s cubic-bezier(0.1, 0.8, 0.25, 1);
}

.lightbox-img {
    display: block;
    width: 100%;
    height: auto;
    min-height: 360px;
    max-height: min(1024px, calc(100vh - 120px));
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--gb-border);
    background: #f7f8fa;
}

.lightbox-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--gb-text);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
}

.lightbox-close:hover {
    background: #fff;
}

.lightbox-caption {
    margin-top: 12px;
    color: var(--gb-text-muted);
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
}

.g-root_theme_dark .lightbox-dialog {
    background: #1a1f27;
}

.g-root_theme_dark .lightbox-close {
    background: rgba(26, 31, 39, 0.92);
    color: var(--gb-text);
}

.g-root_theme_dark .lightbox-img {
    background: #151920;
}

@keyframes lightboxZoom {
    from {
        transform: scale(0.96);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Tabs (e.g. HTTP methods) */
.yfm .yfm-tab-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0 0 1rem;
    padding: 0;
}

.yfm .yfm-tab {
    padding: 6px 12px;
    border-radius: 3px;
    font-weight: 400;
    color: var(--gb-text-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.yfm .yfm-tab:hover {
    color: var(--gb-text);
}

.yfm .yfm-tab.active,
.yfm .yfm-tab[data-diplodoc-is-active='true'] {
    background: rgba(52, 109, 219, 0.12);
    color: var(--gb-primary);
    font-weight: 500;
}