/*
 * Roof constructor page (templates/calculator/konstruktor-kryshi.html.twig): presets, the form with folded
 * sections, the tabbed result, tables and drawing frames. On top of engine.css and site.css, tokens only.
 * Without JS the five panels stand one under another; assets/roof.js turns them into tabs (.rc--tabs).
 */

/* ---------- Presets ---------- */
.rc-presets { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin: 0 0 var(--s-4); }
.rc-presets__label { font-size: var(--fs-sm); color: var(--c-muted); }
.rc-presets ul { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.rc-presets .chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s-4); border: 1px solid var(--c-border-strong); border-radius: 999px; background: var(--c-surface); color: var(--c-text); font-size: var(--fs-sm); font-weight: 600; }
.rc-presets .chip:hover { border-color: var(--c-accent); background: var(--c-accent-soft); color: var(--c-link); }

@media (max-width: 719px) {
    /* One scrolling row instead of three stacked chips: the form is what the visitor came for. */
    .rc-presets { display: block; margin-bottom: var(--s-3); }
    .rc-presets__label { display: block; margin-bottom: var(--s-1); }
    .rc-presets ul { flex-wrap: nowrap; overflow-x: auto; padding-bottom: var(--s-1); scrollbar-width: thin; }
    .rc-presets li { flex: none; }
}

/* ---------- Form: sub-groups and folded sections ---------- */
.form-sub { min-width: 0; margin: 0; padding: var(--s-3) 0 0; border: 0; border-top: 1px dashed var(--c-border); }
.form-sub[hidden] { display: none; }
.form-sub legend { float: left; width: 100%; margin: 0 0 var(--s-2); padding: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--c-muted); }
.form-sub legend + * { clear: both; }
.form-fold { margin: 0 0 var(--s-2); border-top: 1px solid var(--c-border); }
.form-fold > summary { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 var(--s-3); min-height: 44px; padding: var(--s-3) var(--s-6) var(--s-3) 0; font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 700; cursor: pointer; }
.form-fold > summary:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.form-fold__hint { font-family: var(--font); font-size: var(--fs-xs); font-weight: 400; color: var(--c-muted); }
.form-fold[open] > summary { padding-bottom: var(--s-2); }

/* ---------- Result block ---------- */
.rc-result { padding-inline: var(--s-3); }

/* The example of the clean page: a closed <details> under the form, its text and tables stay in the HTML. */
.rc-example { margin: 0 0 var(--s-5); }
.rc-example > summary { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-1) var(--s-3); min-height: 44px; padding: var(--s-3) 0; cursor: pointer; }
.rc-example > summary:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.rc-example > summary h2 { display: inline; margin: 0; font-size: var(--fs-h3); }
.rc-example__hint { font-size: var(--fs-xs); color: var(--c-muted); }
.rc-example[open] > summary { margin-bottom: var(--s-2); border-bottom: 1px solid var(--c-border); }
.rc-more { margin-top: var(--s-3); }
.rc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin: 0 0 var(--s-4); }
.rc-actions .print-actions { margin: 0; }
/* The engine button prints this page; the PDF of the constructor is the print version (the link next to it). */
/* Specificity above `.rc-actions .btn` below, which would show it again. */
.rc-actions .print-actions .print-actions__pdf { display: none; }
.rc-actions .btn { display: inline-flex; align-items: center; }

.rc-tabs { margin: 0 calc(-1 * var(--s-3)) var(--s-4); border-bottom: 1px solid var(--c-border); }
.rc-tabs ul { display: flex; gap: var(--s-1); margin: 0; padding: 0 var(--s-3); list-style: none; overflow-x: auto; scrollbar-width: thin; }
.rc-tabs li { flex: none; }
.rc-tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s-3); border-bottom: 3px solid transparent; color: var(--c-text); font-size: var(--fs-sm); font-weight: 600; text-decoration: none; white-space: nowrap; }
.rc-tabs a:hover { color: var(--c-link); }
.rc-tabs a:focus-visible { outline: 2px solid var(--c-focus); outline-offset: -2px; }
.rc-tabs a[aria-selected="true"] { border-bottom-color: var(--c-accent); color: var(--c-link); }

/* Without JS the panels stand one under another, each with its heading. */
.rc-panel { margin: 0 0 var(--s-6); scroll-margin-top: var(--s-4); }
.rc-panel > h3 { margin-top: 0; }
.rc-panel h4 { margin: var(--s-5) 0 var(--s-2); font-size: var(--fs-base); }
.rc--tabs .rc-panel { margin-bottom: 0; }
.rc--tabs .rc-panel[hidden] { display: none; }
.rc--tabs .rc-panel > h3 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.rc-main dd.rc-note { margin: 2px 0 0; font-family: var(--font); font-size: var(--fs-xs); font-weight: 400; line-height: 1.4; color: var(--c-muted); }
.rc-main > div { min-width: 0; }
.rc-kv { margin-bottom: var(--s-4); }
.rc-limits { margin: var(--s-4) 0; }
.rc-limits ul { margin: var(--s-1) 0 0; padding-left: 1.2em; }
.rc-notes { padding-left: 1.2em; }

/* ---------- Tables ---------- */
.rc-table-wrap { margin-top: var(--s-3); }
.rc-table caption { padding: var(--s-2) var(--s-3); text-align: left; font-size: var(--fs-sm); font-weight: 600; }
.rc-table th[scope="row"] { position: sticky; left: 0; background: var(--c-surface); color: var(--c-text); font-weight: 600; }
.rc-table .num { text-align: right; }
.rc-table td { white-space: nowrap; }
.rc-table tfoot th, .rc-table tfoot td { border-top: 2px solid var(--c-border-strong); border-bottom: 0; background: var(--c-surface-alt); font-weight: 600; }
.rc-table tfoot th[scope="row"] { background: var(--c-surface-alt); }
.rc-note-line { margin: 0 0 var(--s-4); max-width: var(--measure); }
.rc-table td:last-child { white-space: normal; min-width: 12rem; }
.rc-plan { margin: var(--s-3) 0; }
.rc-plan > summary { min-height: 44px; padding: var(--s-2) 0; cursor: pointer; font-weight: 600; }

/* ---------- Drawings ---------- */
.rc-fig { margin: 0 0 var(--s-5); padding: var(--s-2); border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); }
.rc-fig svg { background: var(--c-surface); }
.rc-fig figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-1) var(--s-3); padding: var(--s-2) var(--s-1) 0; font-size: var(--fs-sm); color: var(--c-muted); }
.rc-fig figcaption a { display: inline-flex; align-items: center; min-height: 44px; }

/* A drawing of the example is fetched when its tab is opened (roof.js); until then, and without JS, only the caption. */
.rc--js .rc-fig--lazy:not(.is-loaded)::before { display: flex; align-items: center; justify-content: center; min-height: 12rem; padding: var(--s-3); background: var(--c-surface-alt); color: var(--c-muted); font-size: var(--fs-sm); text-align: center; content: 'Чертёж загружается…'; }
.rc--js .rc-fig--lazy.is-failed::before { content: 'Не удалось загрузить чертёж: откройте его по ссылке «Открыть крупно».'; }

/* ---------- Print of the page itself (the print version with sheets is /pechat) ---------- */
@media print {
    .rc-panel, .rc--tabs .rc-panel[hidden] { display: block !important; margin-bottom: 14pt; }
    .rc--tabs .rc-panel > h3 { position: static; width: auto; height: auto; clip: auto; }
    .rc-tabs, .rc-presets, .rc-actions, .rc-plan > summary { display: none !important; }
    .rc-fig { break-inside: avoid; border: 0; padding: 0; }
    .rc-table th[scope="row"] { position: static; }
    .rc-table td { white-space: normal; }
}
