/* ============================================================
   YURCONSULT - legal docs (стиль сайта: contrast minimal)
   Чистый чёрно-белый: плоские поверхности, прямые углы,
   волосяные линии, моно-подписи, инверсия при наведении.
   Тёмная тема - базовая; светлая - инверсия (.section--light).
   ============================================================ */

@font-face { font-family: 'Montserrat'; src: url('../fonts/Montserrat-cyrillic-300.woff2') format('woff2'), url('../fonts/Montserrat-latin-300.woff2') format('woff2'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('../fonts/Montserrat-cyrillic-400.woff2') format('woff2'), url('../fonts/Montserrat-latin-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('../fonts/Montserrat-cyrillic-500.woff2') format('woff2'), url('../fonts/Montserrat-latin-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('../fonts/Montserrat-cyrillic-600.woff2') format('woff2'), url('../fonts/Montserrat-latin-600.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }

/* ---------------- tokens ---------------- */

:root {
    --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
    --ease: cubic-bezier(.22, .61, .36, 1);
    --ease-x: cubic-bezier(.65, 0, .15, 1);
    --header-h: 60px;

    /* тема по умолчанию - тёмная (как на сайте) */
    --fg: #ffffff;
    --on-fg: #000000;
    --muted: #b3b3b3;
    --dim: #7a7a7a;
    --line: rgba(255, 255, 255, .18);
    --line-strong: rgba(255, 255, 255, .4);
    --bg: #000000;
    --surface: #0d0d0d;
    --thumb: rgba(255, 255, 255, .35);
}

/* светлая тема - инверсия */
[data-theme="light"] {
    --fg: #000000;
    --on-fg: #ffffff;
    --muted: #4d4d4d;
    --dim: #8a8a8a;
    --line: rgba(0, 0, 0, .18);
    --line-strong: rgba(0, 0, 0, .4);
    --bg: #ffffff;
    --surface: #f2f2f2;
    --thumb: rgba(0, 0, 0, .35);
}

/* ---------------- base ---------------- */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    height: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    color-scheme: dark;
}
[data-theme="light"] { color-scheme: light; }

body {
    font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    display: flex;
    flex-direction: column;
}

a { color: inherit; text-decoration: none; }
img { display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

::selection { background: var(--fg); color: var(--on-fg); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--thumb); border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }

/* логотипы под тему */
.logo-for-light { display: none; }
[data-theme="light"] .logo-for-light { display: block; }
[data-theme="light"] .logo-for-dark { display: none; }

/* ---------------- header ---------------- */

.header {
    position: relative;
    z-index: 101;
    display: flex;
    align-items: center;
    gap: 24px;
    height: var(--header-h);
    padding: 0 24px;
    flex-shrink: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line-strong);
}

.header-logo { display: flex; align-items: center; flex-shrink: 0; }
.header-logo img { height: 30px; width: auto; }

.header-tag {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--dim);
    padding-left: 24px;
    border-left: 1px solid var(--line);
    height: 24px;
    display: inline-flex;
    align-items: center;
}

.header-nav {
    display: flex;
    gap: 2px;
    margin-left: auto;
}

.header-nav-link {
    position: relative;
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 9px 14px;
    transition: color .2s ease;
}
.header-nav-link::after {
    content: '';
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 4px;
    height: 2px;
    background: var(--fg);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .25s var(--ease);
}
.header-nav-link:hover { color: var(--fg); }
.header-nav-link:hover::after { transform: scaleX(1); }

.header-actions { display: flex; align-items: center; gap: 10px; }

/* квадратные кнопки-иконки - инверсия при наведении */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line-strong);
    color: var(--fg);
    transition: background .2s ease, color .2s ease, border-color .2s ease;
    position: relative;
    flex-shrink: 0;
}
.icon-btn:hover { background: var(--fg); color: var(--on-fg); border-color: var(--fg); }
.icon-btn svg { width: 17px; height: 17px; }

/* переключатель темы: солнце/луна поверх друг друга */
.theme-toggle svg { position: absolute; transition: opacity .25s ease, transform .3s var(--ease); }
.theme-toggle svg:last-child { opacity: 0; transform: rotate(40deg); }
[data-theme="dark"] .theme-toggle svg:first-child { opacity: 0; transform: rotate(-40deg); }
[data-theme="dark"] .theme-toggle svg:last-child { opacity: 1; transform: none; }

/* тонкий прогресс чтения по нижней кромке шапки */
.hprog {
    position: absolute;
    left: 0;
    bottom: -1px;
    z-index: 2;
    width: 100%;
    height: 2px;
    background: var(--fg);
    transform: scaleX(0);
    transform-origin: left center;
    pointer-events: none;
}

/* ---------------- layout ---------------- */

.docs-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.docs-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ---------------- левый сайдбар: структура ---------------- */

.docs-structure-sidebar {
    width: 320px;
    flex-shrink: 0;
    background: var(--bg);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
}

.docs-structure-content {
    flex: 1;
    overflow-y: auto;
    padding: 22px 18px 26px;
}
.docs-structure-content::-webkit-scrollbar { width: 6px; }
.docs-structure-content::-webkit-scrollbar-track { background: transparent; }
.docs-structure-content::-webkit-scrollbar-thumb { background: var(--line-strong); border: 0; }

.docs-structure-group { margin-bottom: 6px; }

.docs-structure-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 0 10px;
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--dim);
    cursor: pointer;
    user-select: none;
    transition: color .2s ease;
}
.docs-structure-group-header::after {
    content: '−';
    font-size: 13px;
    line-height: 1;
    color: var(--dim);
    transition: transform .25s var(--ease), color .2s ease;
}
.docs-structure-group-header.collapsed::after { content: '+'; }
.docs-structure-group-header:hover { color: var(--fg); }
.docs-structure-group-header:hover::after { color: var(--fg); }

.docs-structure-items {
    padding: 2px 4px 6px 0;
    max-height: 1200px;
    overflow: hidden;
    opacity: 1;
    transition: max-height .3s var(--ease), opacity .2s ease, padding .2s ease;
}
.docs-structure-items.collapsed { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; }

.docs-structure-item {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    margin: 1px 0;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, border-color .2s ease, transform .3s var(--ease);
}
.docs-structure-item:hover {
    border-color: var(--line);
    transform: translateX(4px);
}
.docs-structure-item.active {
    background: var(--fg);
    border-color: var(--fg);
    color: var(--on-fg);
}

.docs-structure-item-title {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 400;
    color: inherit;
    line-height: 1.45;
}
.docs-structure-item:not(.active) .docs-structure-item-title { color: var(--muted); }
.docs-structure-item:not(.active):hover .docs-structure-item-title { color: var(--fg); }
.docs-structure-item.active .docs-structure-item-title { font-weight: 600; }

/* ---------------- центральная область ---------------- */

.docs-main-area { flex: 1; display: flex; overflow: hidden; min-width: 0; }

.docs-scroll-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    min-width: 0;
    scrollbar-width: none;
}
.docs-scroll-content::-webkit-scrollbar { width: 0; height: 0; }

.docs-article {
    flex: 1;
    min-width: 0;
    max-width: 860px;
    margin: 0 auto;
    padding: 52px 56px 40px;
    min-height: 40vh;
}

/* ---------------- крошки ---------------- */

.crumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 26px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--dim);
}
.crumbs a { color: var(--muted); transition: color .2s ease; }
.crumbs a:hover { color: var(--fg); }
.crumbs i { font-style: normal; opacity: .5; }

/* ---------------- welcome ---------------- */

.docs-welcome { padding: clamp(40px, 8vh, 90px) 0; }

.eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 22px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--muted);
}
.eyebrow::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--fg);
    flex: none;
    animation: sq-pulse 2.6s ease-in-out infinite;
}
@keyframes sq-pulse { 50% { opacity: .3; } }

.docs-welcome-title {
    font-size: clamp(36px, 5vw, 58px);
    font-weight: 600;
    letter-spacing: -.03em;
    line-height: 1.04;
    color: var(--fg);
    margin: 0 0 20px;
}
.docs-welcome-text {
    font-size: 15.5px;
    line-height: 1.65;
    color: var(--muted);
    max-width: 560px;
}

/* ---------------- типографика документа ---------------- */

.docs-article > h1 {
    font-size: clamp(30px, 3.6vw, 44px);
    font-weight: 600;
    letter-spacing: -.03em;
    line-height: 1.06;
    color: var(--fg);
    margin: 0 0 30px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line-strong);
}

.docs-article h2 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -.02em;
    line-height: 1.2;
    color: var(--fg);
    margin: 46px 0 18px;
    scroll-margin-top: 20px;
}

.docs-article h3 {
    font-size: 16.5px;
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--fg);
    margin: 34px 0 14px;
    scroll-margin-top: 20px;
}

.docs-article h4 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--fg);
    margin: 28px 0 12px;
}

.docs-article p {
    font-size: 14.5px;
    line-height: 1.8;
    color: var(--muted);
    margin-bottom: 18px;
}
.docs-article[data-file="education-safety-rules"] p { line-height: 2; }

.docs-article ul { list-style: none; margin: 18px 0 22px; }
.docs-article ul li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 11px;
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--muted);
}
.docs-article ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: .6em;
    width: 6px;
    height: 6px;
    border: 1px solid var(--dim);
}

.docs-article ol { margin: 18px 0 22px; padding-left: 26px; }
.docs-article ol li {
    margin-bottom: 11px;
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--muted);
}
.docs-article ol li::marker {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--dim);
}

.docs-article a {
    color: var(--fg);
    text-decoration: underline;
    text-decoration-color: var(--line-strong);
    text-underline-offset: 4px;
    transition: background .15s ease, color .15s ease, text-decoration-color .15s ease;
}
.docs-article a:hover {
    background: var(--fg);
    color: var(--on-fg);
    text-decoration-color: var(--fg);
}
.docs-article a[href^="http"]::after {
    content: '↗';
    display: inline-block;
    margin-left: 4px;
    font-size: .8em;
    text-decoration: none;
}

.docs-article strong { font-weight: 600; color: var(--fg); }
.docs-article em { font-style: italic; }

.docs-article code {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--fg);
    border: 1px solid var(--line);
    padding: 2px 7px;
}

.docs-article pre {
    border: 1px solid var(--line);
    padding: 20px 22px;
    overflow-x: auto;
    margin: 22px 0;
}
.docs-article pre code {
    border: 0;
    padding: 0;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--muted);
}

.docs-article blockquote {
    border-left: 2px solid var(--fg);
    padding: 4px 0 4px 18px;
    margin: 22px 0;
    color: var(--muted);
    font-style: italic;
}

.docs-article hr { border: 0; border-top: 1px solid var(--line); margin: 34px 0; }

/* «ведомость»: волосяные пунктирные строки */
.docs-article table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 13px;
}
.docs-article th {
    padding: 11px 14px;
    text-align: left;
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--dim);
    border-bottom: 1px solid var(--line-strong);
    white-space: nowrap;
}
.docs-article td {
    padding: 12px 14px;
    color: var(--muted);
    border-bottom: 1px dashed var(--line);
    vertical-align: top;
    line-height: 1.6;
}
.docs-article tbody tr { transition: background .15s ease; }
.docs-article tbody tr:hover { background: var(--surface); }
.docs-article tbody tr:last-child td { border-bottom-color: var(--line-strong); }

.docs-article img {
    max-width: 100%;
    border: 1px solid var(--line);
    margin: 20px 0;
}

/* ---------------- правый сайдбар: содержание ---------------- */

.docs-toc-sidebar {
    width: 264px;
    flex-shrink: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.docs-toc-header {
    padding: 22px 20px 0;
    flex-shrink: 0;
}
.docs-toc-header span {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--dim);
}
.docs-toc-header span::before {
    content: '';
    width: 7px;
    height: 7px;
    background: var(--fg);
    flex: none;
}

.docs-toc-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 20px;
}
.docs-toc-content::-webkit-scrollbar { width: 5px; }
.docs-toc-content::-webkit-scrollbar-track { background: transparent; }
.docs-toc-content::-webkit-scrollbar-thumb { background: var(--line-strong); border: 0; }

.docs-toc-item {
    display: block;
    padding: 8px 0 8px 16px;
    margin: 2px 0;
    border-left: 1px solid var(--line);
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--dim);
    text-decoration: none;
    transition: color .2s ease, border-color .2s ease;
}
.docs-toc-item:hover { color: var(--fg); }
.docs-toc-item.active {
    color: var(--fg);
    border-left-color: var(--fg);
    font-weight: 500;
}
.docs-toc-item-sub { padding-left: 32px; font-size: 11.5px; }

.docs-toc-spacer { padding: 14px; flex-shrink: 0; }

/* ---------------- footer ---------------- */

.docs-page-footer {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 56px 46px;
}

.footer-inner {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 36px;
    padding: 44px 0 38px;
    border-top: 1px solid var(--line-strong);
}

.footer-brand .footer-logo { height: 32px; width: auto; }
.footer-desc { margin-top: 22px; font-size: 12.5px; line-height: 1.6; color: var(--dim); max-width: 300px; }

.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-col .footer-title {
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--dim);
    margin-bottom: 8px;
}
.footer-link { font-size: 13px; color: var(--dim); width: max-content; transition: color .2s ease; }
.footer-link:hover { color: var(--fg); }
.footer-text { font-size: 13px; line-height: 1.6; color: var(--dim); }

.footer-copy {
    padding: 18px 0 0;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--dim);
    letter-spacing: .04em;
}
.footer-note {
    padding: 10px 0 0;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--dim);
}

/* ---------------- мобильное меню ---------------- */

.docs-menu-toggle { display: none; }

/* бургер → крестик при открытом меню */
.docs-menu-toggle svg line {
    transform-box: view-box;
    transform-origin: 50% 50%;
    transition: transform .3s var(--ease), opacity .2s ease;
}
.docs-menu-open .docs-menu-toggle svg line:nth-child(1) { opacity: 0; }
.docs-menu-open .docs-menu-toggle svg line:nth-child(2) { transform: rotate(45deg); }
.docs-menu-open .docs-menu-toggle svg line:nth-child(3) { transform: rotate(-45deg); }

.docs-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
}

/* ---------------- responsive ---------------- */

@media (max-width: 1200px) {
    .docs-structure-sidebar { width: 290px; }
    .docs-toc-sidebar { width: 240px; }
    .docs-article { padding: 44px 44px 36px; }
    .docs-page-footer { padding: 0 44px 40px; }
}

@media (max-width: 1024px) {
    .docs-toc-sidebar { display: none; }
    .footer-inner { grid-template-columns: 1fr 1fr; gap: 28px; }
}

@media (max-width: 900px) {
    .header-nav { display: none; }
    .header-actions { margin-left: auto; }
}

@media (max-width: 768px) {
    .docs-structure-sidebar {
        position: fixed;
        left: -100%;
        top: var(--header-h);
        height: calc(100vh - var(--header-h));
        height: calc(100dvh - var(--header-h));
        z-index: 100;
        width: 100%;
        border-right: 0;
        box-shadow: none;
    }
    .docs-structure-sidebar.open { left: 0; }
    .docs-structure-content { padding: 26px 24px 30px; }
    .docs-structure-item { padding: 12px 14px; }
    .docs-structure-item-title { font-size: 14px; }
    .docs-menu-toggle { display: inline-flex; }
    .docs-overlay.active { display: block; opacity: 1; visibility: visible; }
    .header { padding: 0 16px; gap: 14px; }
    .header-tag { display: none; }
    .header-logo img { height: 26px; }
    .docs-article { padding: 34px 24px 30px; }
    .docs-article > h1 { font-size: 27px; }
    .docs-article h2 { font-size: 20px; margin-top: 38px; }
    .docs-page-footer { padding: 0 24px 34px; }
    .footer-inner { grid-template-columns: 1fr; padding: 34px 0 30px; }
    .docs-welcome { padding: 40px 0; }
    .docs-welcome-title { font-size: 32px; }
}

/* ---------------- reduced motion ---------------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
    .docs-scroll-content { scroll-behavior: auto; }
}

/* cms: пункты навигации - ссылки */
a.docs-structure-item { color: inherit; text-decoration: none; }
