/*
 * Battery Finder front end.
 *
 * Every colour is a token. The plain values are the --s4xbf-d-* defaults,
 * which the build measures for contrast. A finder follows the site
 * template's main colour and text; a colour chosen in Options, on a
 * module, or on a menu item overrides its token for that finder alone.
 * Layout settings arrive as classes on the finder.
 */
:root {
    --s4xbf-d-panel: #1d1d1d;
    --s4xbf-d-panel-text: #ffffff;
    --s4xbf-d-field: #ffffff;
    --s4xbf-d-field-text: #1d1d1d;
    --s4xbf-d-field-line: #6c757d;
    --s4xbf-d-off: #e9ecef;
    --s4xbf-d-off-text: #495057;
    --s4xbf-d-button: #ffffff;
    --s4xbf-d-button-text: #1d1d1d;
    --s4xbf-d-solid: #1d1d1d;
    --s4xbf-d-solid-text: #ffffff;
    --s4xbf-d-highlight-text: #ffffff;
    --s4xbf-d-line: #ced4da;
    --s4xbf-d-picture-bg: #ffffff;
    --s4xbf-shade: rgba(0, 0, 0, 0.75);
}

.s4xbf {
    /* --s4xbf-template is read by the script from the template's own main
       button; the variables after it serve where there is none */
    --s4xbf-panel: var(--s4xbf-template, var(--cassiopeia-color-primary, var(--bs-primary, var(--s4xbf-d-panel))));
    --s4xbf-panel-text: var(--s4xbf-template-panel-text, var(--s4xbf-d-panel-text));
    --s4xbf-field: var(--s4xbf-d-field);
    --s4xbf-field-text: var(--s4xbf-d-field-text);
    --s4xbf-field-line: var(--s4xbf-d-field-line);
    --s4xbf-off: var(--s4xbf-d-off);
    --s4xbf-off-text: var(--s4xbf-d-off-text);
    --s4xbf-button: var(--s4xbf-d-button);
    --s4xbf-button-text: var(--s4xbf-d-button-text);
    --s4xbf-clear: transparent;
    --s4xbf-clear-text: var(--s4xbf-panel-text);
    --s4xbf-highlight: var(--s4xbf-template, var(--cassiopeia-color-primary, var(--bs-primary, var(--s4xbf-d-solid))));
    --s4xbf-highlight-text: var(--s4xbf-template-highlight-text, var(--s4xbf-d-highlight-text));
    --s4xbf-card: transparent;
    --s4xbf-card-text: inherit;
    --s4xbf-line: var(--s4xbf-d-line);
    --s4xbf-picture-bg: var(--s4xbf-d-picture-bg);
    --s4xbf-radius: 6px;
    --s4xbf-radius-small: 4px;
    --s4xbf-pic: 140px;
    --s4xbf-pic-tall: 160px;
    container: s4xbf / inline-size;
    width: 100%;
    color: inherit;
}

/* without a solid block the words are the template's own */
.s4xbf--panel-outline,
.s4xbf--panel-plain {
    --s4xbf-panel: transparent;
    --s4xbf-panel-text: inherit;
    --s4xbf-button: var(--s4xbf-d-solid);
    --s4xbf-button-text: var(--s4xbf-d-solid-text);
    --s4xbf-clear-text: inherit;
}

.s4xbf--corners-square { --s4xbf-radius: 0; --s4xbf-radius-small: 0; }
.s4xbf--corners-slight { --s4xbf-radius: 4px; --s4xbf-radius-small: 2px; }
.s4xbf--corners-soft { --s4xbf-radius: 16px; --s4xbf-radius-small: 10px; }
.s4xbf--picsize-small { --s4xbf-pic: 96px; --s4xbf-pic-tall: 96px; }
.s4xbf--picsize-large { --s4xbf-pic: 200px; --s4xbf-pic-tall: 240px; }

.s4xbf {
    position: relative;
}

/* an open list lies over whatever follows the finder on the page */
.s4xbf:focus-within {
    z-index: 30;
}

.s4xbf .s4xbf-said {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.s4xbf [hidden] {
    display: none !important;
}

/* ---- the block ------------------------------------------------------ */

.s4xbf .s4xbf-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    border-radius: var(--s4xbf-radius);
    background: var(--s4xbf-panel);
    color: var(--s4xbf-panel-text);
}

.s4xbf--panel-outline .s4xbf-panel {
    border: 2px solid var(--s4xbf-line);
}

.s4xbf--panel-plain .s4xbf-panel {
    padding: 0;
}

.s4xbf--compact .s4xbf-panel {
    gap: 12px;
    padding: 16px;
}

.s4xbf--compact.s4xbf--panel-plain .s4xbf-panel {
    padding: 0;
}

.s4xbf .s4xbf-heading {
    margin: 0;
    color: inherit;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
}

.s4xbf .s4xbf-heading--second,
.s4xbf--compact .s4xbf-heading {
    font-size: 1.125rem;
}

.s4xbf .s4xbf-label {
    display: block;
    margin: 0 0 4px;
    color: inherit;
    font-size: 0.875rem;
    font-weight: 600;
}

/* ---- the application ------------------------------------------------ */

.s4xbf .s4xbf-apps {
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.s4xbf .s4xbf-appbtn {
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid currentColor;
    border-radius: var(--s4xbf-radius-small);
    background: transparent;
    color: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.s4xbf .s4xbf-appbtn[aria-pressed="true"] {
    border-color: var(--s4xbf-highlight);
    background: var(--s4xbf-highlight);
    color: var(--s4xbf-highlight-text);
}

.s4xbf--panel-block .s4xbf-appbtn[aria-pressed="true"] {
    border-color: var(--s4xbf-field);
    background: var(--s4xbf-field);
    color: var(--s4xbf-field-text);
}

/* By width shows buttons too, until the finder's own rule for its switch
   width, written into the page, turns them into the dropdown */
.s4xbf--apps-buttons .s4xbf-apps,
.s4xbf--apps-auto .s4xbf-apps { display: grid; }
.s4xbf--apps-buttons .s4xbf-appsel,
.s4xbf--apps-auto .s4xbf-appsel { display: none; }

/* ---- the fields ------------------------------------------------------ */

.s4xbf .s4xbf-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    align-items: end;
}

.s4xbf .s4xbf-steps {
    display: contents;
}

.s4xbf .s4xbf-field {
    min-width: 0;
}

.s4xbf .s4xbf-combo {
    position: relative;
}

/* in the table the short lines stay whole; the table scrolls instead */
.s4xbf table .s4xbf-oem-text {
    white-space: nowrap;
}

.s4xbf .s4xbf-whole {
    margin: 4px 0 0;
    font-size: 0.875rem;
    overflow-wrap: anywhere;
}

.s4xbf .s4xbf-control {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 48px;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    border: 1px solid var(--s4xbf-field-line);
    border-radius: var(--s4xbf-radius-small);
    background-color: var(--s4xbf-field);
    color: var(--s4xbf-field-text);
    font-size: 1.125rem;
}

.s4xbf .s4xbf-input {
    padding-right: 12px;
    padding-left: 12px;
}

.s4xbf .s4xbf-input::placeholder {
    color: var(--s4xbf-field-text);
    font-size: 1rem;
    opacity: 1;
}

.s4xbf .s4xbf-control:disabled {
    background-color: var(--s4xbf-off);
    color: var(--s4xbf-off-text);
}

.s4xbf .s4xbf-input:disabled::placeholder {
    color: var(--s4xbf-off-text);
}

.s4xbf .s4xbf-list {
    position: absolute;
    z-index: 30;
    top: 100%;
    right: 0;
    left: 0;
    max-height: 320px;
    margin: 4px 0 0;
    padding: 4px;
    overflow: auto;
    border: 1px solid var(--s4xbf-field-line);
    border-radius: var(--s4xbf-radius-small);
    background: var(--s4xbf-field);
    box-shadow: 0 4px 16px var(--s4xbf-shade-soft, rgba(0, 0, 0, 0.18));
    color: var(--s4xbf-field-text);
    list-style: none;
    text-align: left;
}

/* the browser's own popover box is undone; the script places the list */
.s4xbf .s4xbf-list[popover] {
    position: fixed;
    inset: auto;
    margin: 0;
}

/* text highlighted inside a finder is drawn in the highlight and its own
   words colour, whatever a template says about selected text */
.s4xbf ::selection {
    background-color: var(--s4xbf-highlight) !important;
    color: var(--s4xbf-highlight-text) !important;
}

/* words on a solid block, which is the highlight colour as shipped, are
   marked the other way round so the mark can be seen */
.s4xbf--panel-block .s4xbf-panel ::selection {
    background-color: var(--s4xbf-panel-text) !important;
    color: var(--s4xbf-panel) !important;
}

/* the boxes and the list on that block are not that colour */
.s4xbf--panel-block .s4xbf-panel .s4xbf-control::selection,
.s4xbf--panel-block .s4xbf-panel .s4xbf-list ::selection,
.s4xbf--panel-block .s4xbf-panel .s4xbf-appbtn[aria-pressed="true"]::selection {
    background-color: var(--s4xbf-highlight) !important;
    color: var(--s4xbf-highlight-text) !important;
}

/* and what is already filled with the highlight is marked the other way */
.s4xbf .s4xbf-view[aria-pressed="true"]::selection,
.s4xbf .s4xbf-first::selection {
    background-color: var(--s4xbf-highlight-text) !important;
    color: var(--s4xbf-highlight) !important;
}

.s4xbf .s4xbf-list li {
    margin: 0;
    padding: 8px 12px;
    border-radius: var(--s4xbf-radius-small);
    list-style: none;
}

.s4xbf .s4xbf-option {
    cursor: pointer;
}

.s4xbf .s4xbf-option:hover {
    box-shadow: inset 0 0 0 1px var(--s4xbf-field-line);
}

.s4xbf .s4xbf-option[aria-selected="true"] {
    background: var(--s4xbf-highlight);
    color: var(--s4xbf-highlight-text);
}

.s4xbf .s4xbf-go {
    display: flex;
    gap: 8px;
}

.s4xbf .s4xbf-button {
    min-height: 48px;
    padding: 8px 20px;
    border: 1px solid var(--s4xbf-button);
    border-radius: var(--s4xbf-radius-small);
    font-weight: 600;
    cursor: pointer;
}

.s4xbf .s4xbf-search {
    flex: 1;
    background: var(--s4xbf-button);
    color: var(--s4xbf-button-text);
}

.s4xbf .s4xbf-search:disabled {
    border-color: var(--s4xbf-off);
    background: var(--s4xbf-off);
    color: var(--s4xbf-off-text);
    cursor: default;
}

.s4xbf .s4xbf-clear {
    border-color: currentColor;
    background: var(--s4xbf-clear);
    color: var(--s4xbf-clear-text);
}

.s4xbf .s4xbf-brands summary {
    cursor: pointer;
    font-weight: 600;
}

.s4xbf .s4xbf-brand-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    padding-top: 8px;
}

.s4xbf .s4xbf-brand {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin: 0;
}

.s4xbf .s4xbf-brand-count {
    display: inline-block;
    min-width: 24px;
    padding: 0 8px;
    border-radius: 12px;
    background: var(--s4xbf-highlight);
    color: var(--s4xbf-highlight-text);
    text-align: center;
}

.s4xbf .s4xbf-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.s4xbf .s4xbf-tag {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: 4px 4px 4px 12px;
    border: 1px solid currentColor;
    border-radius: var(--s4xbf-radius-small);
}

.s4xbf .s4xbf-tag-x {
    min-width: 24px;
    min-height: 24px;
    padding: 0;
    border: 0;
    border-radius: var(--s4xbf-radius-small);
    background: transparent;
    color: inherit;
    line-height: 1;
    cursor: pointer;
}

.s4xbf .s4xbf-message {
    margin: 12px 0 0;
    font-weight: 600;
}

/* ---- results --------------------------------------------------------- */

.s4xbf .s4xbf-results-wrap {
    padding-top: 20px;
}

.s4xbf .s4xbf-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--s4xbf-highlight);
}

.s4xbf .s4xbf-title {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.25;
}

.s4xbf .s4xbf-sub {
    margin: 0;
}

.s4xbf .s4xbf-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.s4xbf .s4xbf-controls .s4xbf-control {
    width: auto;
    height: 44px;
    font-size: 1rem;
}

.s4xbf .s4xbf-views {
    display: inline-flex;
}

.s4xbf .s4xbf-view,
.s4xbf .s4xbf-quiet {
    min-height: 44px;
    padding: 4px 12px;
    border: 1px solid var(--s4xbf-d-field-line);
    border-radius: var(--s4xbf-radius-small);
    background: transparent;
    color: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.s4xbf .s4xbf-view + .s4xbf-view {
    border-left: 0;
    border-radius: 0 var(--s4xbf-radius-small) var(--s4xbf-radius-small) 0;
}

.s4xbf .s4xbf-view:first-child {
    border-radius: var(--s4xbf-radius-small) 0 0 var(--s4xbf-radius-small);
}

.s4xbf .s4xbf-view[aria-pressed="true"] {
    border-color: var(--s4xbf-highlight);
    background: var(--s4xbf-highlight);
    color: var(--s4xbf-highlight-text);
}

.s4xbf .s4xbf-set {
    margin-top: 20px;
}

.s4xbf .s4xbf-set-heading {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.375;
}

.s4xbf .s4xbf-requirement {
    margin: 4px 0 0;
    font-size: 0.875rem;
    font-weight: 400;
}

.s4xbf .s4xbf-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-top: 12px;
}

.s4xbf .s4xbf-card {
    display: grid;
    grid-template-columns: minmax(0, min(var(--s4xbf-pic), 40%)) minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    align-content: start;
    border: 1px solid var(--s4xbf-line);
    border-radius: var(--s4xbf-radius);
    background: var(--s4xbf-card);
    color: var(--s4xbf-card-text);
}

.s4xbf .s4xbf-card--nopic,
.s4xbf--pic-top .s4xbf-card,
.s4xbf--pic-none .s4xbf-card {
    grid-template-columns: minmax(0, 1fr);
}

.s4xbf .s4xbf-picture {
    position: relative;
    grid-column: 1;
    align-self: start;
    display: block;
    margin: 8px;
    padding: 4px;
    border: 0;
    border-radius: var(--s4xbf-radius-small);
    background: var(--s4xbf-picture-bg);
    color: var(--s4xbf-d-field-text);
}

.s4xbf button.s4xbf-picture {
    cursor: zoom-in;
}

.s4xbf .s4xbf-picture .s4xbf-img {
    display: block;
    width: 100%;
    max-height: var(--s4xbf-pic-tall);
    aspect-ratio: 4 / 3;
    object-fit: contain;
}

.s4xbf .s4xbf-eye {
    box-sizing: content-box;
    padding: 4px;
    border: 1px solid var(--s4xbf-d-field-line);
    border-radius: var(--s4xbf-radius-small);
    background: var(--s4xbf-d-field);
}

.s4xbf .s4xbf-picture .s4xbf-eye {
    position: absolute;
    right: 0;
    bottom: 0;
}

.s4xbf .s4xbf-who {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    padding: 12px 12px 8px 4px;
}

.s4xbf--pic-top .s4xbf-who,
.s4xbf--pic-none .s4xbf-who,
.s4xbf .s4xbf-card--nopic .s4xbf-who {
    grid-column: 1;
    grid-row: auto;
    padding-left: 12px;
}

.s4xbf .s4xbf-first {
    display: inline-block;
    margin-bottom: 4px;
    padding: 0 8px;
    border-radius: var(--s4xbf-radius-small);
    background: var(--s4xbf-highlight);
    color: var(--s4xbf-highlight-text);
    font-size: 0.875rem;
    font-weight: 600;
}

.s4xbf .s4xbf-maker {
    display: block;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
}

.s4xbf .s4xbf-nameline {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    align-items: center;
}

.s4xbf .s4xbf-card .s4xbf-name {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.s4xbf .s4xbf-card .s4xbf-link {
    color: inherit;
}

.s4xbf .s4xbf-type,
.s4xbf .s4xbf-warranty {
    display: block;
    margin: 4px 0 0;
    font-size: 0.875rem;
}

.s4xbf .s4xbf-oem {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.s4xbf .s4xbf-oem-text {
    font-size: 0.875rem;
    font-weight: 600;
}

.s4xbf .s4xbf-specs {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
    border-top: 1px solid var(--s4xbf-line);
}

/* a row of figures shares one line for the names and one for the values,
   so a long value never pushes its neighbours down */
.s4xbf .s4xbf-spec {
    display: grid;
    grid-row: span 2;
    grid-template-rows: subgrid;
    row-gap: 0;
    padding: 8px 12px;
    border-bottom: 1px solid var(--s4xbf-line);
}

.s4xbf .s4xbf-spec dt {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.25;
}

.s4xbf .s4xbf-spec dd {
    align-self: baseline;
    margin: 4px 0 0;
    padding: 0;
    font-size: 1.125rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.s4xbf .s4xbf-spec--key dd {
    font-size: 1.5rem;
    line-height: 1.25;
}

.s4xbf .s4xbf-card .s4xbf-notes {
    grid-column: 1 / -1;
    margin: 0;
    padding: 8px 12px 12px;
    font-size: 0.875rem;
}

.s4xbf .s4xbf-empty {
    margin-top: 20px;
}

/* ---- the table ------------------------------------------------------- */

.s4xbf .s4xbf-scroll {
    margin-top: 16px;
    overflow-x: auto;
}

.s4xbf .s4xbf-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.s4xbf .s4xbf-table th,
.s4xbf .s4xbf-table td {
    padding: 8px;
    border: 0;
    border-bottom: 1px solid var(--s4xbf-line);
    text-align: left;
    vertical-align: middle;
}

.s4xbf .s4xbf-table thead th {
    font-size: 0.875rem;
}

.s4xbf .s4xbf-table .s4xbf-num {
    text-align: right;
}

.s4xbf .s4xbf-table .s4xbf-sethead th {
    padding-top: 20px;
    border-bottom: 2px solid var(--s4xbf-highlight);
}

.s4xbf .s4xbf-stick {
    position: sticky;
    left: 8px;
    display: inline-block;
}

.s4xbf .s4xbf-stick span {
    display: block;
}

/* the product's name stays in sight as the table scrolls sideways */
.s4xbf .s4xbf-table .s4xbf-prod {
    position: sticky;
    z-index: 1;
    left: 0;
    min-width: 140px;
    background: var(--bs-body-bg, Canvas);
    color: var(--bs-body-color, CanvasText);
}

.s4xbf .s4xbf-table .s4xbf-name {
    display: block;
    font-weight: 700;
}

.s4xbf .s4xbf-table .s4xbf-notes {
    display: block;
    font-size: 0.875rem;
}

.s4xbf .s4xbf-thumb {
    position: relative;
    display: block;
    width: calc(var(--s4xbf-pic) / 2);
    min-width: 64px;
    padding: 4px;
    border: 1px solid var(--s4xbf-line);
    border-radius: var(--s4xbf-radius-small);
    background: var(--s4xbf-picture-bg);
    color: var(--s4xbf-d-field-text);
    cursor: zoom-in;
}

.s4xbf .s4xbf-thumb .s4xbf-img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
}

.s4xbf .s4xbf-thumb .s4xbf-eye {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 12px;
    height: 12px;
    padding: 2px;
}

/* ---- waiting, and the large picture ---------------------------------- */

.s4xbf .s4xbf-busy {
    display: flex;
    justify-content: center;
    padding: 48px 0;
}

.s4xbf .s4xbf-busy::before {
    content: "";
    width: 48px;
    height: 48px;
    border: 4px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: s4xbf-turn 0.8s linear infinite;
}

@keyframes s4xbf-turn {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .s4xbf .s4xbf-busy::before {
        animation: none;
    }
}

.s4xbf .s4xbf-preview {
    max-width: 90vw;
    max-height: 90vh;
    padding: 16px;
    border: 1px solid var(--s4xbf-line);
    border-radius: var(--s4xbf-radius);
    background: var(--bs-body-bg, Canvas);
    color: var(--bs-body-color, CanvasText);
}

.s4xbf .s4xbf-preview::backdrop {
    background: var(--s4xbf-shade, rgba(0, 0, 0, 0.75));
}

.s4xbf .s4xbf-preview-head {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.s4xbf .s4xbf-preview-name {
    margin: 0;
    color: inherit;
    font-weight: 700;
}

.s4xbf .s4xbf-preview-img {
    display: block;
    max-width: 80vw;
    max-height: 70vh;
    margin: 12px auto 0;
    background: var(--s4xbf-picture-bg);
    object-fit: contain;
}

.s4xbf .s4xbf-preview-btn:disabled {
    cursor: default;
}

.s4xbf .s4xbf-preview-btn:disabled .s4xbf-eye {
    display: none;
}

/* where the keyboard is, in a colour that shows on what it sits on */
.s4xbf button:focus-visible,
.s4xbf a:focus-visible,
.s4xbf summary:focus-visible,
.s4xbf .s4xbf-scroll:focus-visible,
.s4xbf .s4xbf-control:focus-visible,
.s4xbf .s4xbf-control:focus {
    outline: 3px solid currentColor;
    outline-offset: 2px;
    box-shadow: none;
}

.s4xbf .s4xbf-panel .s4xbf-control:focus,
.s4xbf .s4xbf-panel .s4xbf-control:focus-visible,
.s4xbf .s4xbf-panel .s4xbf-appbtn:focus-visible,
.s4xbf .s4xbf-panel .s4xbf-clear:focus-visible,
.s4xbf .s4xbf-panel .s4xbf-search:focus-visible {
    outline-color: var(--s4xbf-panel-text);
}

/* a pressed button's own text colour would not show on the page */
.s4xbf .s4xbf-view[aria-pressed="true"]:focus-visible,
.s4xbf .s4xbf-controls .s4xbf-control:focus,
.s4xbf .s4xbf-controls .s4xbf-control:focus-visible {
    outline-color: var(--s4xbf-highlight);
}

.s4xbf--panel-outline .s4xbf-panel .s4xbf-control:focus,
.s4xbf--panel-plain .s4xbf-panel .s4xbf-control:focus,
.s4xbf--panel-outline .s4xbf-panel .s4xbf-appbtn:focus-visible,
.s4xbf--panel-plain .s4xbf-panel .s4xbf-appbtn:focus-visible,
.s4xbf--panel-outline .s4xbf-panel .s4xbf-clear:focus-visible,
.s4xbf--panel-plain .s4xbf-panel .s4xbf-clear:focus-visible,
.s4xbf--panel-outline .s4xbf-panel .s4xbf-search:focus-visible,
.s4xbf--panel-plain .s4xbf-panel .s4xbf-search:focus-visible {
    outline-color: var(--s4xbf-highlight);
}

/* ---- by width -------------------------------------------------------- */

@container s4xbf (max-width: 459px) {
    .s4xbf-card {
        --s4xbf-pic: 96px;
    }

    .s4xbf .s4xbf-spec {
        padding: 8px;
    }

    .s4xbf .s4xbf-spec dd {
        font-size: 1rem;
    }

    .s4xbf .s4xbf-spec--key dd,
    .s4xbf .s4xbf-card .s4xbf-name {
        font-size: 1.125rem;
    }
}

@container s4xbf (min-width: 460px) {
    .s4xbf--apps-auto .s4xbf-apps,
    .s4xbf--apps-buttons .s4xbf-apps {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .s4xbf--fields-auto .s4xbf-fields {
        display: flex;
        flex-wrap: wrap;
    }

    .s4xbf--fields-auto .s4xbf-field {
        flex: 1 1 calc(50% - 6px);
    }

    .s4xbf--fields-auto .s4xbf-go {
        flex: 1 0 100%;
    }
}

@container s4xbf (min-width: 700px) {
    .s4xbf--apps-auto .s4xbf-apps,
    .s4xbf--apps-buttons .s4xbf-apps {
        display: flex;
        flex-wrap: wrap;
    }

    /* the fields share a row, however many the application has */
    .s4xbf--fields-auto .s4xbf-field {
        flex: 1 1 9rem;
    }

    .s4xbf--fields-auto .s4xbf-field:first-child {
        flex: 0.6 1 7rem;
    }

    .s4xbf--fields-auto .s4xbf-field:last-child {
        flex: 1.6 1 12rem;
    }

    .s4xbf--fields-auto .s4xbf-go {
        flex: 0 0 200px;
    }
}

/* Cards in a row: at most the number set, and fewer wherever a card
   would be too narrow for its picture and name */
.s4xbf--cols-auto .s4xbf-grid,
.s4xbf--cols-2 .s4xbf-grid,
.s4xbf--cols-3 .s4xbf-grid,
.s4xbf--cols-4 .s4xbf-grid {
    --s4xbf-card-min: calc(var(--s4xbf-pic) + 172px);
    grid-template-columns: repeat(auto-fill, minmax(min(100%, max(var(--s4xbf-card-min), calc((100% - (var(--s4xbf-cols) - 1) * 12px) / var(--s4xbf-cols)))), 1fr));
}

.s4xbf--pic-top .s4xbf-grid,
.s4xbf--pic-none .s4xbf-grid {
    --s4xbf-card-min: 220px;
}

.s4xbf--cols-auto { --s4xbf-cols: 3; }
.s4xbf--cols-2 { --s4xbf-cols: 2; }
.s4xbf--cols-3 { --s4xbf-cols: 3; }
.s4xbf--cols-4 { --s4xbf-cols: 4; }
