/* Shared readable UI: text/actions/table 18, supporting text 16.
   Keep html/rem geometry, icon fonts and document/print typography independent.
   Important declarations bridge existing Bootstrap utilities and page styles. */
@media screen {
    body.taban-readable-ui {
        --taban-font-text: 18px;
        --taban-font-control: 18px;
        --taban-font-detail: 16px;
        --taban-font-title: 24px;
        --taban-font-subtitle: 20px;
        font-size: var(--taban-font-text) !important;
        line-height: 1.8;
    }

    body.taban-readable-ui :is(p, label, legend, input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="hidden"], [type="button"], [type="submit"], [type="reset"]), select, textarea, .form-label, .form-check-label, .form-control, .form-select, .hsl-input, .select2-search__field, .select2-selection__rendered, .select2-results__option, .fs-5):not(:where(i, svg, .office-detail-paper *, .office-compose-paper *, [contenteditable], [contenteditable] *, .ql-editor, .ql-editor *, .ck-content, .ck-content *, [data-taban-typography="document"], [data-taban-typography="document"] *)) {
        font-size: var(--taban-font-text) !important;
        line-height: 1.8;
    }

    body.taban-readable-ui :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="hidden"], [type="button"], [type="submit"], [type="reset"]), select, .form-control, .form-select, .hsl-input):not(:where(.office-compose-paper *, .office-detail-paper *, [contenteditable], [data-taban-typography="document"], [data-taban-typography="document"] *)) {
        min-height: 44px;
        height: auto;
        min-width: 0;
    }

    body.taban-readable-ui :is(.btn, button[type="submit"], .research-journal-button, nav a, nav button, .nav-link, .page-link, .dropdown-item, .menu-title, .breadcrumb, .unified-search-tab, .reception-nav-link, .archive-results-count, .archive-results-title, .taban-open-tab__title, .taban-user-name, .taban-dashboard-sidebar__item, .taban-dashboard-sidebar__group-direct, .taban-dashboard-sidebar__group-primary, .taban-dashboard-sidebar__child, .taban-frequent-item__link strong, .taban-dashboard-cartable__tabs button, .taban-dashboard-cartable__subject strong, .sm-launcher span, .fs-6):not(:where(i, svg, .office-detail-paper *, .office-compose-paper *, [contenteditable] *, .ql-editor *, .ck-content *, [data-taban-typography="document"] *)) {
        font-size: var(--taban-font-control) !important;
        line-height: 1.6;
    }

    body.taban-readable-ui :is(.table, .archive-results-table) :is(th, td):not(:where(.office-detail-paper *, .office-compose-paper *, [contenteditable] *, .ql-editor *, .ck-content *, [data-taban-typography="document"] *)) {
        font-size: var(--taban-font-control) !important;
        line-height: 1.8;
    }

    body.taban-readable-ui :is(small, .small, .form-text, .invalid-feedback, .valid-feedback, .badge, .fs-7, .fs-8, .fs-9, .fs-10, .unified-search-heading p, .unified-basic-heading > div > span, .taban-user-role, .taban-dashboard-sidebar__display-control, .taban-dashboard-cartable__columns, .taban-dashboard-cartable__kind, .taban-dashboard-cartable__sender, .taban-dashboard-cartable__time, .taban-dashboard-announcements__empty):not(:where(i, svg, .office-detail-paper *, .office-compose-paper *, [contenteditable] *, .ql-editor *, .ck-content *, [data-taban-typography="document"] *)) {
        font-size: var(--taban-font-detail) !important;
        line-height: 1.8;
    }

    body.taban-readable-ui :is(.page-title, .unified-search-heading h2, .edu-pattern-toolbar h1, .fs-1):not(:where(i, svg, .office-detail-paper *, .office-compose-paper *, [contenteditable] *, .ql-editor *, .ck-content *, [data-taban-typography="document"] *)) {
        font-size: var(--taban-font-title) !important;
        line-height: 1.6;
    }

    body.taban-readable-ui :is(h3, h4, .card-title, .fs-3, .fs-4):not(:where(.office-detail-paper *, .office-compose-paper *, [contenteditable] *, .ql-editor *, .ck-content *, [data-taban-typography="document"] *)) {
        font-size: var(--taban-font-subtitle) !important;
        line-height: 1.6;
    }

    body.taban-readable-ui .fs-2:not(:where(i, svg, .office-detail-paper *, .office-compose-paper *, [contenteditable] *, .ql-editor *, .ck-content *, [data-taban-typography="document"] *)) {
        font-size: 22px !important;
    }

    /* The approved search form needs room for labels at the larger text size. */
    body.taban-readable-ui .unified-search-hub .btn {
        min-height: 44px;
        white-space: normal;
    }

    body.taban-readable-ui .unified-basic-advanced > summary strong {
        font-size: var(--taban-font-text) !important;
    }

    body.taban-readable-ui .archive-results-toolbar {
        flex-wrap: wrap;
    }

    body.taban-readable-ui .unified-basic-checklist-options {
        grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr));
    }

    /* Frequent links need room for readable titles, not the compact popup grid. */
    body.taban-readable-ui .taban-dashboard-frequent {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto 272px;
    }

    body.taban-readable-ui .taban-dashboard-frequent > .taban-dashboard-panel__header {
        grid-area: 1 / 1;
    }

    body.taban-readable-ui .taban-dashboard-frequent__list {
        grid-area: 2 / 1;
        grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
        align-content: start;
        min-height: 0;
        overflow-y: auto;
    }

    body.taban-readable-ui .taban-dashboard-frequent__empty {
        grid-area: 2 / 1;
        align-self: center;
    }

    body.taban-readable-ui .taban-dashboard-frequent__list .taban-frequent-item {
        display: block;
    }

    body.taban-readable-ui .taban-dashboard-frequent__list .taban-frequent-item__link strong {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    @media (max-width: 767.98px) {
        body.taban-readable-ui .unified-basic-advanced > summary {
            grid-template-columns: minmax(0, 1fr) auto;
        }

        body.taban-readable-ui .unified-basic-advanced > summary small {
            grid-column: 1;
            grid-row: 2;
            justify-self: start;
        }
    }
}
