// Bootsier CSS rules: self-hosted fonts, form elements, regions and components. // Self-hosted Source Sans 3 (SIL OFL 1.1), served from /bootsier/fonts. Declared as the primary // font family in $font-family-sans-serif (_bootsier-variables.scss). // Font URLs must match the Preload declarations in src/lib.rs; a mismatch causes double downloads. @font-face { font-family: "Source Sans 3"; src: url("/bootsier/fonts/bootsier.font.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; } @font-face { font-family: "Source Sans 3"; src: url("/bootsier/fonts/bootsier.font.italic.woff2") format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; } // Background of the form fields ($input-bg in _bootsier-variables.scss), of disabled fields // ($input-disabled-bg), of unchecked checks ($form-check-input-bg), of fieldsets, of dropdown menus // ($dropdown-bg) and of breadcrumbs ($breadcrumb-bg), color of the group titles of dropdown menus // ($dropdown-header-color, a lighter gray than their items in light mode, nearly white in dark // mode), color of the legends of fieldsets (darker than Bootstrap's secondary color in light mode, // since their thin weight makes them lighter), and shadow of focused fields // ($input-focus-box-shadow), for each color mode. On a dark background the primary color barely // shows, so the dark mode uses a lighter tint of it with more opacity. :root, [data-bs-theme="light"] { --bootsier-input-bg: #f1f3f4; --bootsier-input-disabled-bg: #f7f8f9; --bootsier-check-bg: #e2e5e8; --bootsier-fieldset-bg: #fefefe; --bootsier-dropdown-bg: #fdfdfd; --bootsier-breadcrumb-bg: #f8f9fa; --bootsier-dropdown-header-color: rgba(var(--bs-body-color-rgb), .65); --bootsier-legend-color: rgba(var(--bs-body-color-rgb), .9); --bootsier-focus-shadow: 0 0 2px #{rgba($primary, .15)}, 0 0 6px #{rgba($primary, .35)}; } @include color-mode(dark, true) { --bootsier-input-bg: #{$gray-800}; --bootsier-input-disabled-bg: #31363b; --bootsier-check-bg: #{$gray-700}; --bootsier-fieldset-bg: #292e33; --bootsier-dropdown-bg: #3e444a; --bootsier-breadcrumb-bg: #292e33; --bootsier-dropdown-header-color: rgba(var(--bs-emphasis-color-rgb), .85); --bootsier-legend-color: var(--bs-secondary-color); --bootsier-focus-shadow: 0 0 2px #{rgba(tint-color($primary, 60%), .4)}, 0 0 6px #{rgba(tint-color($primary, 60%), .7)}; } // Disabled form fields also fade as disabled buttons do. .form-control:disabled, .form-select:disabled { opacity: $btn-disabled-opacity; } // Font-relative top offset to keep the skip-link hidden at any font size. .skip-link { top: -3em; } // Required field indicator in forms. .form-required { color: var(--bs-danger); margin: 0 0.25rem; } // Form field with consistent bottom margin. .form-field { margin-bottom: 1rem; &:last-child { margin-bottom: 0; } } // Button set (button::ButtonSet): spaces its buttons with a gap instead of relying on Bootstrap's // .btn-group, which merges adjacent buttons into a single joined control. .button-set { display: flex; flex-wrap: wrap; gap: $spacer * .5; margin: 1rem 0; } // Space below each block (Block), from Bootstrap's spacing unit, so consecutive blocks (and what // follows them) do not sit right together. Twice $spacer, as the 2rem of the Basic theme. .block { margin-bottom: $spacer * 2; } // Fieldset outlined only by a soft shadow (Bootstrap's reboot already removes the border), with a // floating legend. fieldset { position: relative; background-color: var(--bootsier-fieldset-bg); border-radius: var(--bs-border-radius); // Offset down with a negative spread: strongest below, softer at the sides, faintest on top. box-shadow: 0 1px 3px rgba(0, 0, 0, .10), 0 4px 8px -2px rgba(0, 0, 0, .22); padding: 2rem 1rem 1rem; margin: 2rem 0 1rem; } fieldset > legend { position: absolute; top: 0; left: 1rem; transform: translateY(-50%); color: var(--bootsier-legend-color); background-color: var(--bs-body-bg); // Soft outline with the gray of the form fields, in both color modes. border: var(--bs-border-width) solid var(--bootsier-input-bg); border-radius: var(--bs-border-radius); padding: 0.125rem 0.75rem; font-size: ($font-size-sm + $font-size-base) / 2; font-weight: $font-weight-light; line-height: 1.25; width: fit-content; max-width: 75%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .fieldset-description { margin-bottom: 1rem; } // Labels start a little inside, clear of the rounded corner of their field. .form-label { padding-left: .25rem; } // Gap between group label and first inline check. .form-label + .form-check-inline { margin-left: 1rem; } // A region holding only comments (such as the mark of a deferred component that rendered nothing) // matches `:empty`, so it takes no space. .region:empty { display: none; } // Footer region. .region-footer { padding: 0.75rem 0 3rem; text-align: center; } // Images with this class show their colors inverted in dark mode, such as a dark logo that would // otherwise blend into the background. Only for images that keep their look when inverted: a full // color one would change its hues. [data-bs-theme="dark"] .image-invert-dark { filter: invert(1); } // Dropdown menus have no border (_bootsier-variables.scss), so a soft shadow sets them apart from // the content they cover, as fieldsets are outlined. Bootstrap only adds its own with // $enable-shadows. .dropdown-menu { box-shadow: 0 1px 3px rgba(0, 0, 0, .10), 0 4px 8px -2px rgba(0, 0, 0, .22); } // Group titles of dropdown menus in a lighter weight than their items. .dropdown-header { font-weight: $font-weight-light; } // Navbars have no inner container, so they line up with the rest of the page. Fixed bars span the // whole viewport, so they take back the side padding of a container off its edges. .navbar.fixed-top, .navbar.fixed-bottom { padding-right: $container-padding-x * .5; padding-left: $container-padding-x * .5; } // The first link of the first menu and the last link of the last menu drop their outer padding, so // their text lines up with the rest of the page (next to the brand, its own margin keeps them // apart). Collapsed bars stack their links with no side padding already. .navbar-nav:first-child > .nav-item:first-child > .nav-link { padding-left: 0; } .navbar-nav:last-child > .nav-item:last-child > .nav-link { padding-right: 0; } // Disabled links of navbars, lighter in dark mode: Bootstrap's 30% of the text color barely shows // on the dark background (links take 65%). [data-bs-theme="dark"] .navbar { --bs-navbar-disabled-color: rgba(var(--bs-emphasis-color-rgb), .45); } // Messages component. Classes are fixed by pagetop core (`.message`, `.message-info`, // `.message-warning`, `.message-error`); reusing Bootstrap's own `.alert`/`.alert-*` styles keeps // the palette in sync with the active Bootstrap theme instead of duplicating it here. .message { @extend .alert; // Outlined by a shadow tinted with the text color of each variant instead of a border. A single // offset shadow is always stronger below than at the sides, so three are combined (left, right // and below) to reach the same width on those three sides, leaving the top faint. --bootsier-message-shadow: color-mix(in srgb, var(--bs-alert-color) 35%, transparent); border: 0; box-shadow: 0 1px 2px color-mix(in srgb, var(--bs-alert-color) 15%, transparent), -4px 0 6px -4px var(--bootsier-message-shadow), 4px 0 6px -4px var(--bootsier-message-shadow), 0 3px 6px -3px var(--bootsier-message-shadow); } // No shadow in dark mode, where it barely shows: the background of each variant is enough. [data-bs-theme="dark"] .message { box-shadow: none; } .message-info { @extend .alert-info; } .message-warning { @extend .alert-warning; } .message-error { @extend .alert-danger; } // Sort indicator on sortable table headers (`table::SortLink`), using Bootstrap Icons' // sort-up/sort-down glyphs instead of the plain triangle from basic.css. .table-sort::after { font-family: $bootstrap-icons-font; content: "\f575"; // sort-down margin-left: 0.25rem; font-size: 0.8em; opacity: 0.35; } .table-sort-asc::after { content: "\f57b"; // sort-up opacity: 1; } .table-sort-desc::after { content: "\f575"; // sort-down opacity: 1; } // Message of a table without rows, as in the Basic theme: centered, in italics and muted (inside // .table, to win over the color Bootstrap gives to every cell). .table .table-empty { text-align: center; font-style: italic; color: var(--bs-secondary-color); } // List filters (ListFilter): fields and button on one row, wrapping when there is no room. .list-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: ($spacer * .5) $spacer; margin-bottom: $spacer; > .form-field { margin-bottom: 0; } } // Marks of changed filters not applied yet (filters with a button), set by `list-filter.js`. Only // colors and opacity change, never sizes: the dot always takes its room, hidden, so nothing moves // when it shows up. A vivid orange, set apart from the primary color of the button, darkened just // enough to keep a 3:1 contrast against the background. Every changed field gets the dot by its // label, once per field (on the title of a group); text fields, dropdowns and checks also show // their border in that color. Floating labels are left out: Bootstrap draws their background with // `::after`. .list-filter { --list-filter-mark: #{mix(#000, $orange, 15%)}; } .list-filter .form-field:not(.form-floating) > .form-label::after, .list-filter .form-field.form-check > .form-check-label::after { content: "\25CF" / ""; margin-left: .25em; color: var(--list-filter-mark); opacity: 0; } .list-filter .list-filter-changed { &:not(.form-floating) > .form-label::after, &.form-check > .form-check-label::after { opacity: 1; } .form-control, .form-select, .form-check-input { border-color: var(--list-filter-mark); } .form-check-input:checked { background-color: var(--list-filter-mark); } } .list-filter-pending > .btn-secondary[type="submit"] { @extend .btn-primary; } // List view (ListView): action buttons above the table. .list-view { margin-block: $spacer * 1.5; } .list-view-actions { margin-bottom: $spacer; } // Pager component. // `.pagination`, `.page-item`, `.page-link`, `.active` and `.disabled` already come styled by // Bootstrap, since Pager reuses that same markup (the ellipsis is a disabled `.page-link` span, // same as any other cell). Only what Pager adds on top needs rules here: the