/* Основные переменные задают минималистичный стиль старого синего чертежа. */
:root {
    --blueprint-bg: #f4f0e8;
    --blueprint-paper: #fffdf8;
    --blueprint-ink: #153c63;
    --blueprint-line: rgba(86, 101, 116, 0.16);
    --blueprint-grid: rgba(125, 105, 76, 0.055);
    --blueprint-soft: rgba(21, 60, 99, 0.055);
    --blueprint-muted: #64717c;
}

/* Фон имитирует тонкую чертежную сетку без тяжелых декоративных элементов. */
body {
    min-height: 100vh;
    color: var(--blueprint-ink);
    background-color: var(--blueprint-bg);
    background-image:
        linear-gradient(var(--blueprint-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--blueprint-grid) 1px, transparent 1px);
    background-size: 42px 42px;
    font-family: Arial, Helvetica, sans-serif;
    letter-spacing: 0;
}

/* Контейнер ограничивает ширину контента на полноразмерном экране. */
.blueprint-container {
    width: min(1180px, calc(100% - 72px));
    margin-inline: auto;
    padding-inline: 0;
}

/* Шапка закрепляет навигацию визуально, но не мешает дальнейшим изменениям дизайна. */
.site-header {
    border-bottom: 1px solid var(--blueprint-line);
    background: rgba(244, 240, 232, 0.94);
    backdrop-filter: blur(8px);
}

.navbar {
    padding-block: 18px;
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    padding-block: 0;
    color: var(--blueprint-ink);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.brand-emblem {
    width: 54px;
    height: 34px;
    object-fit: contain;
    opacity: 0.82;
    filter: saturate(0.86);
}

.navbar-brand:hover .brand-emblem,
.navbar-brand:focus .brand-emblem {
    opacity: 0.95;
    filter: saturate(1);
}

.nav-link {
    color: var(--blueprint-muted);
    font-size: 0.92rem;
}

.nav-link:hover,
.nav-link:focus {
    color: var(--blueprint-ink);
}

/* Основная область страницы оставляет достаточно воздуха вокруг технического контента. */
.blueprint-main {
    min-height: calc(100vh - 145px);
    padding-block: 44px 58px;
}

/* Hero-блок сразу объясняет назначение сайта без маркетинговой страницы. */
.hero-section {
    max-width: 900px;
    padding-block: 46px 42px;
    border-bottom: 1px solid var(--blueprint-line);
}

.technical-label {
    margin-bottom: 10px;
    color: var(--blueprint-muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    max-width: 920px;
    margin: 0;
    color: var(--blueprint-ink);
    font-size: clamp(1.35rem, 1.9vw, 2.1rem);
    font-weight: 700;
    line-height: 1.18;
}

.hero-title {
    font-size: clamp(1.6rem, 2.5vw, 2.35rem);
}

.lead,
.page-heading p {
    margin-top: 20px;
    color: var(--blueprint-muted);
    font-size: 1.06rem;
    line-height: 1.6;
}

.home-intro {
    max-width: 820px;
    margin-top: 24px;
    color: #254967;
}

.home-intro p {
    margin: 0 0 14px;
    font-size: 1.02rem;
    line-height: 1.68;
}

.home-intro a {
    color: #1b658f;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.blueprint-action-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 7px 12px;
    color: var(--blueprint-ink);
    background: rgba(255, 253, 248, 0.88);
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
    font-weight: 700;
    text-decoration: none;
}

.blueprint-action-link:hover,
.blueprint-action-link:focus {
    color: #fff;
    background: var(--blueprint-ink);
    text-decoration: none;
}

.feedback-form {
    margin-top: 26px;
}

.feedback-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.feedback-form label {
    display: grid;
    gap: 7px;
    color: var(--blueprint-ink);
    font-size: 0.86rem;
    font-weight: 700;
}

.feedback-form input,
.feedback-form textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    color: var(--blueprint-ink);
    background: rgba(255, 253, 248, 0.92);
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
    font: inherit;
    font-weight: 400;
}

.feedback-form textarea {
    min-height: 170px;
    resize: vertical;
}

.feedback-question {
    margin-top: 18px;
}

.feedback-submit {
    margin-top: 18px;
}

.errorlist {
    margin: 0;
    padding-left: 0;
    color: #9d1d22;
    font-size: 0.82rem;
    font-weight: 700;
    list-style: none;
}

.form-message {
    margin: 20px 0;
    padding: 12px 14px;
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
    font-weight: 700;
}

.form-message-success {
    color: #205b38;
    background: rgba(225, 245, 232, 0.9);
}

.form-message-error {
    color: #9d1d22;
    background: rgba(255, 235, 235, 0.9);
}

/* Сетка разделов рассчитана на полноразмерный экран, но сохраняет базовую адаптивность. */
.section-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-top: 32px;
}

/* Карточки выглядят как элементы чертежа и подходят для будущих списков материалов. */
.blueprint-card {
    display: flex;
    min-height: 170px;
    flex-direction: column;
    justify-content: space-between;
    padding: 22px;
    color: var(--blueprint-ink);
    text-decoration: none;
    background: rgba(255, 253, 248, 0.88);
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
}

.blueprint-card:hover {
    background: var(--blueprint-paper);
    border-color: rgba(21, 60, 99, 0.34);
}

.blueprint-card h2,
.blueprint-card strong {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 700;
    line-height: 1.28;
}

.blueprint-card p,
.blueprint-card span {
    margin: 0;
    color: var(--blueprint-muted);
}

.card-index {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* Заголовок внутренних страниц проще hero, чтобы страницы были удобны для наполнения. */
.page-heading {
    padding-bottom: 28px;
    border-bottom: 1px solid var(--blueprint-line);
}

.content-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 32px;
}

/* Empty-state показывает согласованную заглушку under development. */
.empty-state {
    padding: 28px;
    color: var(--blueprint-muted);
    background: rgba(255, 255, 255, 0.66);
    border: 1px dashed var(--blueprint-line);
    border-radius: 4px;
}

/* Страница статьи использует более узкую колонку, чтобы длинный технический текст было удобно читать. */
.article-shell {
    max-width: 980px;
    padding: 34px 38px 44px;
    background: rgba(255, 253, 248, 0.82);
    border: 1px solid rgba(86, 101, 116, 0.11);
    border-radius: 4px;
}

.article-header {
    padding-bottom: 24px;
    border-bottom: 1px solid var(--blueprint-line);
}

.article-header h1 {
    font-size: clamp(1.45rem, 2.2vw, 2.15rem);
    line-height: 1.16;
}

.article-header p {
    max-width: 780px;
    margin-top: 18px;
    color: var(--blueprint-muted);
    font-size: 1.03rem;
    line-height: 1.6;
}

.article-content {
    margin-top: 30px;
    padding-bottom: 40px;
}

.article-content h2 {
    margin-top: 36px;
    margin-bottom: 14px;
    color: var(--blueprint-ink);
    font-size: 1.36rem;
    font-weight: 700;
    text-transform: none;
}

.article-content h3 {
    margin-top: 28px;
    margin-bottom: 10px;
    color: var(--blueprint-ink);
    font-size: 1.08rem;
    font-weight: 700;
}

.article-content p {
    margin-bottom: 16px;
    color: #254967;
    font-size: 1rem;
    line-height: 1.7;
}

.article-content a {
    color: #1b658f;
    font-weight: 700;
    font-size: 1em;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.article-content a:hover,
.article-content a:focus {
    color: var(--blueprint-ink);
}

.article-content strong {
    color: var(--blueprint-ink);
    font-weight: 700;
}

.article-content code {
    padding: 2px 5px;
    color: var(--blueprint-ink);
    background: rgba(255, 253, 248, 0.9);
    border: 1px solid var(--blueprint-line);
    border-radius: 3px;
    font-size: 0.92em;
}

.article-content ul,
.article-content ol {
    margin: 18px 0 22px;
    padding-left: 1.25rem;
    color: #254967;
}

.article-content li {
    margin-bottom: 10px;
    line-height: 1.65;
}

.article-content .article-note {
    margin: 22px 0;
    padding: 16px 18px;
    color: var(--blueprint-ink);
    background: rgba(255, 253, 248, 0.82);
    border-left: 4px solid #4aa6c7;
}

.article-content figure {
    margin: 28px 0;
    padding: 12px;
    background: rgba(255, 253, 248, 0.9);
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
}

.article-content figure.article-image-sized {
    width: min(100%, var(--image-width));
    margin-inline: auto;
}

.article-content img {
    display: block;
    width: 100%;
    height: auto;
}

.article-content figcaption {
    margin-top: 10px;
    color: var(--blueprint-muted);
    font-size: 0.96rem;
    line-height: 1.5;
}

.article-content table {
    width: 100%;
    margin: 24px 0;
    background: rgba(255, 253, 248, 0.92);
    border-collapse: collapse;
    table-layout: fixed;
}

.article-content table.article-table-sized {
    width: min(100%, var(--table-width));
}

.article-content td,
.article-content th {
    padding: 7px 10px;
    color: #254967;
    border: 1px solid var(--blueprint-line);
    line-height: 1.38;
    overflow-wrap: anywhere;
    white-space: normal;
    vertical-align: top;
}

.article-content .math-block {
    margin: 26px 0;
    padding: 16px 18px;
    overflow-x: auto;
    color: var(--blueprint-ink);
    background: rgba(255, 253, 248, 0.86);
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
}

.formula-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 24px 0;
}

.formula-pair div {
    display: grid;
    gap: 10px;
    padding: 16px 18px;
    background: rgba(255, 253, 248, 0.9);
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
}

.formula-pair span {
    color: var(--blueprint-ink);
    font-size: 1.15rem;
    font-weight: 700;
}

.original-paper-viewer {
    margin-top: 44px;
    padding-top: 28px;
    border-top: 1px solid var(--blueprint-line);
}

.original-paper-header {
    display: flex;
    gap: 18px;
    align-items: start;
    justify-content: space-between;
    margin-bottom: 18px;
}

.original-paper-header h2 {
    margin-top: 0;
}

.original-paper-header p {
    max-width: 680px;
    margin-bottom: 0;
}

.viewer-count {
    flex: 0 0 auto;
    padding: 7px 10px;
    color: var(--blueprint-muted);
    background: rgba(255, 253, 248, 0.86);
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.paper-scroll {
    max-height: min(78vh, 920px);
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: rgba(21, 60, 99, 0.08);
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
}

.paper-scroll:focus {
    outline: 2px solid rgba(31, 111, 139, 0.55);
    outline-offset: 3px;
}

.paper-page {
    margin: 0 0 16px;
    padding: 10px;
    background: #fff;
    border: 1px solid rgba(86, 101, 116, 0.2);
    border-radius: 4px;
    box-shadow: 0 10px 24px rgba(21, 60, 99, 0.09);
}

.paper-page:last-child {
    margin-bottom: 0;
}

.paper-page img {
    user-select: none;
    pointer-events: none;
}

/* Футер завершает страницу и дублирует статус стартовой версии. */
.site-footer {
    border-top: 1px solid var(--blueprint-line);
    color: var(--blueprint-muted);
    font-size: 0.9rem;
    background: rgba(244, 240, 232, 0.72);
}

.site-footer a {
    color: var(--blueprint-muted);
    font-weight: 700;
    text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus {
    color: var(--blueprint-ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.site-footer .blueprint-container {
    display: flex;
    justify-content: space-between;
    padding-block: 18px;
}

/* Минимальная адаптивность нужна, чтобы сайт не ломался при уменьшении окна. */
@media (max-width: 1100px) {
    .section-grid,
    .content-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .blueprint-container {
        width: min(100% - 28px, 1180px);
    }

    .blueprint-main {
        padding-block: 34px;
    }

    h1 {
        font-size: clamp(1.45rem, 8vw, 2.2rem);
    }

    .hero-title {
        font-size: clamp(1.6rem, 9vw, 2.4rem);
    }

    .article-shell {
        padding: 24px 18px 32px;
    }

    .article-header h1 {
        font-size: clamp(1.45rem, 8vw, 2.25rem);
    }

    .formula-pair {
        grid-template-columns: 1fr;
    }

    .original-paper-header {
        flex-direction: column;
    }

    .paper-scroll {
        max-height: 72vh;
        padding: 10px;
    }

    .paper-page {
        padding: 6px;
    }

    .section-grid,
    .content-list {
        grid-template-columns: 1fr;
    }

    .feedback-form-grid {
        grid-template-columns: 1fr;
    }

    .site-footer .blueprint-container {
        gap: 8px;
        flex-direction: column;
    }
}

.tool-heading {
    display: flex;
    gap: 18px;
    align-items: end;
    justify-content: space-between;
}

.tool-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.8fr);
    gap: 18px;
    margin-top: 28px;
}

.tool-disclaimer {
    display: inline-flex;
    margin: 14px 0 0 !important;
    padding: 8px 10px;
    color: #6f4b00 !important;
    background: rgba(255, 244, 205, 0.92);
    border: 1px solid rgba(194, 142, 19, 0.38);
    border-radius: 4px;
    font-size: 0.92rem !important;
    font-weight: 700;
}

.tool-reference-link {
    margin: 10px 0 0;
    color: var(--blueprint-muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.tool-reference-link a {
    color: var(--blueprint-ink);
}

.tool-workspace-secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tool-panel {
    padding: 20px;
    background: rgba(255, 253, 248, 0.88);
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
}

.tool-panel-header {
    display: flex;
    gap: 14px;
    align-items: start;
    justify-content: space-between;
    margin-bottom: 18px;
}

.tool-panel h2 {
    margin: 4px 0 0;
    font-size: 1.08rem;
    font-weight: 700;
}

.tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.blueprint-button {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 7px 12px;
    color: var(--blueprint-ink);
    background: rgba(255, 253, 248, 0.92);
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.blueprint-button:hover,
.blueprint-button:focus {
    color: #fff;
    background: var(--blueprint-ink);
    text-decoration: none;
}

.blueprint-button-primary {
    color: #fff;
    background: #1f6f8b;
    border-color: #1f6f8b;
}

.tool-form-grid,
.tool-options-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.tool-options-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 16px;
}

.tool-form-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pile-form label,
.tool-option label {
    display: grid;
    gap: 7px;
    color: var(--blueprint-ink);
    font-size: 0.82rem;
    font-weight: 700;
}

.pile-form input,
.batch-upload-form input {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    color: var(--blueprint-ink);
    background: rgba(255, 253, 248, 0.96);
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
    font: inherit;
    font-weight: 400;
}

.tool-check {
    display: inline-flex !important;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px !important;
}

.tool-check input {
    width: 18px;
    min-height: 18px;
}

.tool-option {
    padding: 14px;
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
}

.tool-table-wrap {
    margin-top: 18px;
}

.tool-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.tool-table th,
.tool-table td {
    padding: 8px 9px;
    border: 1px solid var(--blueprint-line);
    color: #254967;
    font-size: 0.86rem;
    vertical-align: top;
}

.tool-table th {
    color: var(--blueprint-ink);
    background: rgba(21, 60, 99, 0.07);
    font-weight: 700;
}

.tool-table input {
    min-height: 34px;
    padding: 6px 7px;
}

.result-status {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 4px;
    font-weight: 700;
}

.result-ok {
    color: #205b38;
    background: rgba(225, 245, 232, 0.9);
}

.result-error {
    color: #9d1d22;
    background: rgba(255, 235, 235, 0.9);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.result-grid div {
    padding: 10px;
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
}

.result-grid dt {
    color: var(--blueprint-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.result-grid dd {
    margin: 4px 0 0;
    color: var(--blueprint-ink);
    font-size: 1rem;
    font-weight: 700;
}

.tool-chart {
    width: 100%;
    height: auto;
    margin-top: 16px;
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
    background: rgba(255, 253, 248, 0.96);
}

.diagram-grid {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.diagram-title {
    color: var(--blueprint-ink);
    font-size: 0.98rem;
    font-weight: 700;
    text-transform: uppercase;
}

.batch-upload-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-bottom: 16px;
}

.batch-panel .tool-panel-header {
    display: grid;
    grid-template-columns: 1fr;
}

.batch-panel .tool-panel-header h2 {
    white-space: nowrap;
}

.batch-panel .tool-actions {
    justify-content: flex-start;
}

.validation-scope,
.validation-summary-grid,
.validation-chart-panel,
.validation-evidence-panel,
.validation-method {
    margin-top: 18px;
}

.validation-grid {
    grid-template-columns: repeat(2, minmax(180px, 260px));
    margin-top: 10px;
}

.validation-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.validation-card h2 {
    margin: 7px 0 0;
    color: var(--blueprint-ink);
    font-size: 2rem;
}

.validation-card p {
    margin: 4px 0 14px;
    color: var(--blueprint-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.validation-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}

.validation-card dl div {
    padding: 8px;
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
}

.validation-card dt {
    color: var(--blueprint-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.validation-card dd {
    margin: 3px 0 0;
    color: var(--blueprint-ink);
    font-weight: 700;
}

.validation-chart {
    margin-top: 12px;
    overflow-x: auto;
}

.validation-chart svg {
    display: block;
    width: 100%;
    min-width: 760px;
    height: auto;
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
}

.validation-evidence-table-wrap {
    max-height: 520px;
    margin-top: 12px;
    overflow: auto;
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
}

.validation-evidence-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.64);
}

.validation-evidence-table th,
.validation-evidence-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--blueprint-line);
    color: var(--blueprint-ink);
    font-size: 0.82rem;
    text-align: left;
    white-space: nowrap;
}

.validation-evidence-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #153c63;
    color: #fff;
    font-size: 0.72rem;
    text-transform: uppercase;
}

.validation-evidence-link {
    position: relative;
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
    background: #fff;
    color: var(--blueprint-ink);
}

.validation-evidence-link svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.validation-evidence-link:hover,
.validation-evidence-link:focus {
    border-color: var(--blueprint-ink);
    outline: none;
}

.validation-evidence-preview {
    position: absolute;
    right: 34px;
    bottom: 0;
    z-index: 5;
    display: none;
    width: min(420px, 72vw);
    padding: 6px;
    border: 1px solid var(--blueprint-line);
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(21, 60, 99, 0.18);
}

.validation-evidence-preview img {
    display: block;
    width: 100%;
    height: auto;
}

.validation-evidence-link:hover .validation-evidence-preview,
.validation-evidence-link:focus .validation-evidence-preview {
    display: block;
}

.validation-notes {
    margin: 10px 0 0;
    padding-left: 18px;
    color: var(--blueprint-muted);
    line-height: 1.55;
}

.tool-messages {
    margin-top: 18px;
}

@media (max-width: 980px) {
    .tool-heading,
    .tool-panel-header {
        align-items: stretch;
        flex-direction: column;
    }

    .tool-workspace,
    .tool-workspace-secondary,
    .tool-form-grid,
    .tool-options-grid,
    .validation-grid,
    .validation-summary-grid {
        grid-template-columns: 1fr;
    }

    .batch-upload-form {
        grid-template-columns: 1fr;
    }
}
