/* «КР коротко» section (/kr/). Loaded after /styles.css, /calendar/event.css and /manuals/manuals.css.
   Pages are generated by scripts/gen-kr.py. Classes use the kr- prefix; tables reuse .mn-table. */

.kr-main { max-width: 1040px; }

/* meta box: guideline ID, year, review date, developers */
.kr-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 20px;
    margin: 0 0 16px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid rgba(164, 48, 63, 0.15);
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
}
.kr-meta > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(164, 48, 63, 0.08); }
.kr-meta > div.kr-meta-full { grid-column: 1 / -1; border-bottom: none; }
.kr-meta dt { font-weight: 700; color: var(--text-muted); }
.kr-meta dd { margin: 0; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.kr-meta a { color: var(--accent-rose); }

.kr-disclaimer {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-secondary);
    background: #fffbf2;
    border: 1px solid #f1dfb8;
    border-left: 5px solid #e08a10;
    border-radius: 12px;
    padding: 10px 14px;
    margin: 0 0 16px;
}
.kr-disclaimer a { color: var(--accent-rose); font-weight: 600; }

/* section nav: stays under the fixed site header while the page scrolls */
.kr-toc {
    position: sticky;
    top: 72px;
    z-index: 900;
    margin: 0 0 18px;
    padding: 8px 0;
    background: var(--bg-deep, #fdf6f7);
    border-bottom: 1px solid rgba(164, 48, 63, 0.15);
}
.kr-toc ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.kr-toc li { margin: 0; flex: none; }
.kr-toc a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    font-size: 13px;
    font-weight: 700;
    color: #7a1f2e;
    background: rgba(164, 48, 63, 0.07);
    border-radius: 100px;
    padding: 4px 12px;
    text-decoration: none;
}
.kr-toc a:hover { background: rgba(164, 48, 63, 0.14); }
.kr-toc a[aria-current] { background: #800020; color: #fff; }

/* html sets scroll-padding-top: 100px; the margin adds the height of the section nav */
.kr-sec-block { scroll-margin-top: 70px; }

/* keyboard: skip link and a visible focus ring for all controls */
.kr-skip {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 3000;
    padding: 10px 16px;
    background: #800020;
    color: #fff;
    border-radius: 10px;
    font-weight: 700;
    transform: translateY(-200%);
}
.kr-skip:focus { transform: none; }
a:focus-visible, button:focus-visible { outline: 3px solid #800020; outline-offset: 2px; border-radius: 4px; }
.kr-toc a:focus-visible { outline-offset: -3px; border-radius: 100px; }
.kr-toc a[aria-current]:focus-visible { outline-color: #fff; }

/* the page pattern sits directly under body text on these pages */
body::before { opacity: 0.18; }

.hamburger-btn { min-width: 44px; min-height: 44px; margin: -4px -10px -4px 0; display: none; align-items: center; justify-content: center; }
.mobile-menu-close { min-width: 44px; min-height: 44px; }

.ev-breadcrumbs { color: #75555f; }
.pc-byline, .pc-note { color: #75555f; }
.footer-bottom-text { color: #bd949d; }

.kr-disc-note { font-size: 14px; line-height: 1.5; color: var(--text-secondary); margin: 0 0 16px; }

.kr-table caption {
    caption-side: top;
    text-align: left;
    font-weight: 800;
    color: var(--deep);
    padding: 10px 12px 2px;
}
.kr-table th { text-transform: none; letter-spacing: 0; font-size: 13px; }
.kr-table td.kr-sec, .kr-table th:last-child { white-space: nowrap; width: 1%; }
.kr-table td.kr-sec { color: var(--muted); font-size: 13px; font-weight: 600; }
.kr-table q { quotes: '«' '»'; font-style: italic; }

/* callout under a row: the guideline text states this value differently in two places */
.kr-table tr.kr-has-disc td { border-bottom: none; }
.kr-table tr.kr-disc-row td { background: #fff; padding: 0 10px 10px; color: inherit; font-weight: 400; }
.kr-table tr.kr-has-disc:nth-child(even) + tr.kr-disc-row td { background: #fdfafb; }
.kr-disc {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    background: #fff8ec;
    border: 1px solid #f1dfb8;
    border-left: 4px solid #e08a10;
    border-radius: 10px;
    padding: 7px 11px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
}
.kr-disc + .kr-disc { margin-top: 6px; }
.kr-disc p { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kr-disc b { color: #8a5200; }
.kr-disc a { color: var(--accent-rose); font-weight: 600; }
.kr-disc-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border-radius: 50%;
    background: #b45f00;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

/* phones: each row becomes a card, the column name is shown before each value */
@media screen and (max-width: 900px) {
    .hamburger-btn { display: inline-flex; }
    .kr-toc { top: 64px; margin-left: -16px; margin-right: -16px; padding: 6px 0; }
    .kr-toc ol { flex-wrap: nowrap; overflow-x: auto; padding: 0 16px; scrollbar-width: none; }
    .kr-toc ol::-webkit-scrollbar { display: none; }
    .kr-toc a { min-height: 44px; padding: 4px 14px; white-space: nowrap; }
    .kr-sec-block { scroll-margin-top: 30px; }

    /* one line of breadcrumbs, 44 px high links, scrolls sideways when long */
    .ev-breadcrumbs { display: flex; align-items: center; white-space: nowrap; overflow-x: auto; scrollbar-width: none; margin: -14px -16px 6px; padding: 0 16px; }
    .ev-breadcrumbs::-webkit-scrollbar { display: none; }
    .ev-breadcrumbs a { display: inline-flex; align-items: center; min-height: 44px; }

    /* the footer columns hold the privacy policy and the contacts: phones need them too */
    .footer-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
    .footer-col-links { gap: 0; }
    .footer-col-links a { display: flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; }
    .mn-actions .ev-cta, .mn-btn-ghost { min-height: 44px; }
}

@media screen and (max-width: 640px) {
    .kr-meta { grid-template-columns: minmax(0, 1fr); padding: 10px 14px; }
    .kr-meta > div { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .kr-table { overflow: visible; background: transparent; border: none; }
    .kr-table table, .kr-table tbody, .kr-table tr, .kr-table td, .kr-table caption { display: block; width: 100%; }
    .kr-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .kr-table caption { padding: 0 0 6px; }
    .kr-table tr {
        background: #fff;
        border: 1px solid #ecdade;
        border-radius: 12px;
        margin-bottom: 10px;
        padding: 6px 0;
    }
    .kr-table tr:nth-child(even) td { background: transparent; }
    .kr-table td { border-bottom: 1px dashed var(--line); padding: 6px 12px; }
    .kr-table td:last-child { border-bottom: none; }
    .kr-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 12px;
        font-weight: 700;
        color: #75555f;
        margin-bottom: 1px;
    }
    /* «Раздел КР 1.6» on one line: 106 rows on the longest page, so each line counts */
    .kr-table td.kr-sec { width: auto; white-space: normal; display: flex; gap: 8px; align-items: baseline; color: #75555f; }
    .kr-table td.kr-sec::before { margin: 0; flex: none; }
    /* the callout joins the card of the row above */
    .kr-table tr.kr-has-disc { margin-bottom: 0; border-bottom: none; border-radius: 12px 12px 0 0; }
    .kr-table tr.kr-disc-row { border-top: none; border-radius: 0 0 12px 12px; padding: 0 0 2px; }
    .kr-table tr.kr-disc-row td, .kr-table tr.kr-has-disc:nth-child(even) + tr.kr-disc-row td { padding: 2px 10px 8px; background: transparent; }
    .kr-table tr.kr-disc-row td::before { content: none; display: none; }
}

/* print: A4, only the content, tables keep their rows together */
@media print {
    @page { size: A4; margin: 12mm 11mm 14mm; }
    .ambient-bg, .site-header, .mobile-menu, .site-footer, .ev-breadcrumbs, .mn-actions, .mn-end, .kr-toc, .pc-byline, .kr-skip, .kr-disc-note { display: none !important; }
    html, body { background: #fff !important; }
    body::before, body::after { display: none !important; }
    .ev-main, .kr-main { padding: 0 !important; margin: 0 !important; max-width: none !important; }
    .ev-title { font-size: 20pt !important; margin-bottom: 4pt !important; }
    .pc-q { font-size: 12pt; margin: 2pt 0; }
    .pc-answer { font-size: 10pt !important; }
    .ev-badge { display: none !important; }
    .kr-meta { font-size: 8.5pt; padding: 6pt 8pt; break-inside: avoid; border-color: #bbb; }
    .kr-meta > div { padding: 2pt 0; grid-template-columns: 120pt minmax(0, 1fr); }
    .kr-disclaimer { font-size: 8.5pt; padding: 5pt 8pt; background: #fff; }
    .manual { font-size: 9.5pt; line-height: 1.4; }
    .manual h2.mn-sh { font-size: 13pt; margin: 12pt 0 6pt; break-after: avoid; }
    .mn-table { overflow: visible !important; border-color: #bbb; border-radius: 0; margin: 4pt 0 10pt; }
    .mn-table table { font-size: 8.5pt; min-width: 0 !important; }
    .mn-table th { font-size: 8pt; padding: 3pt 5pt; background: #f3eef0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .mn-table td { padding: 3pt 5pt; border-color: #ccc; }
    .mn-table thead { display: table-header-group; }
    .mn-table tr, .mn-table caption { break-inside: avoid; }
    .kr-table caption { break-after: avoid; }
    .kr-table tr.kr-has-disc { break-after: avoid; }
    .kr-table tr.kr-disc-row td { padding: 0 5pt 4pt !important; background: #fff !important; }
    .kr-disc { font-size: 8pt; padding: 3pt 6pt; background: #fff; border-color: #bbb; border-left: 3pt solid #555; }
    .kr-disc + .kr-disc { margin-top: 3pt; }
    .kr-disc b { color: #000; }
    .kr-disc-icon { background: #555; -webkit-print-color-adjust: exact; print-color-adjust: exact; width: 11pt; height: 11pt; font-size: 7pt; }
    .mn-src a::after { content: " (" attr(href) ")"; font-weight: 400; word-break: break-all; }
}
.mn-print { cursor: pointer; font: inherit; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}
