/* Only what is particular to the home page; the rest comes from Creep. */

/* Five columns need the width: small margins on wide screens too. */
.cr-main.ab-main { max-width: 1900px; }

/* The background of the installation: over the plain one, as wide as the window and still while the page
   moves. The body makes its own layer so that this sits above its colour and below its content. */
.ab-has-background { isolation: isolate; }

.ab-has-background::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: url("/branding/background") center / 100% auto no-repeat;
    opacity: .4;
    pointer-events: none;
}

.ab-avatar { width: 28px; height: 28px; border-radius: 50%; }

.cr-user form { margin: 0; }

.ab-user { gap: 8px; }

/* To the right while they fit; with many, the row scrolls and the first ones stay within reach. */
.ab-pages { align-items: center; min-width: 0; }

.ab-pages > :first-child { margin-left: auto; }

.ab-unlocked .ab-tab { border: 1px dashed var(--cr-line-strong); cursor: grab; touch-action: none; user-select: none; }

.ab-tab.ab-dragging { cursor: grabbing; }

.ab-tab-tools { flex: none; }

.ab-menu-apart { border-top: 1px solid var(--cr-line) !important; }

.ab-who { display: flex; align-items: center; gap: 8px; margin: 0 4px; }

/* With the name hidden and no picture, it takes no room. */
@media (max-width: 420px) { .ab-who { gap: 0; margin: 0 -4px; } }

#banner { margin-bottom: 18px; }

#banner .cr-button { margin-left: 10px; }

/* Search */

/* A panel like the others, with no frame while locked. */

.cr-card.ab-search-panel { padding: 6px; background: transparent; border-color: transparent; box-shadow: none; }

.ab-search-panel .ab-body { display: flex; flex-direction: column; }

/* Centred while it fits; if the panel is too small, it scrolls from its top. */
.ab-search { width: 100%; max-width: 780px; margin: auto; padding: 2px 3px; }

.ab-search .ab-engines { margin-top: 9px; }

.ab-search .ab-assistants { margin-top: 6px; }

.ab-search .ab-assistants .ab-link { gap: 4px; padding: 6px; }

.ab-unlocked .cr-card.ab-search-panel { border-color: var(--cr-line-strong); }

/* Its tools float on its corners, so that nothing moves on opening the padlock. */
.ab-search-panel .ab-head { position: absolute; z-index: 1; top: 4px; right: 4px; left: 4px; margin: 0; pointer-events: none; }

.ab-search-panel .ab-head > * { pointer-events: auto; }

.ab-search-panel .ab-head h3 { visibility: hidden; pointer-events: none; }

.cr-card.ab-search-panel { container-type: size; }

/* Small in both directions, the AI shortcuts are only their icons, so that the smallest size is still of use.
   Their names are still read aloud, and the address shows on pointing at them. */
@container (max-width: 620px) and (max-height: 260px) {
    .ab-search .ab-assistants .ab-link { width: auto; padding: 3px; }
    .ab-search .ab-assistants .ab-link-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .ab-search .ab-assistants .ab-icon, .ab-search .ab-assistants .ab-letter { width: 34px; height: 34px; }
    .ab-unlocked .ab-search { padding-top: 24px; }
}

.ab-search-row { display: flex; gap: 10px; }

.ab-query { flex: 1; min-width: 0; padding: 13px 18px; font-size: 17px; border-radius: var(--cr-radius); }

.ab-engines { margin-top: 12px; }

.ab-searchers { justify-content: center; }

.ab-searcher { display: inline-flex; align-items: center; gap: 7px; }

.ab-assistants { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; margin-top: 10px; }

.ab-assistants .ab-link { width: 88px; }

/* Entries: their image, or their initial. */

.ab-icon { width: 40px; height: 40px; flex: none; object-fit: contain; border-radius: 10px; }

.ab-letter { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--cr-surface-2); border: 1px solid var(--cr-line); color: var(--cr-accent); font-size: 18px; font-weight: 600; }

/* Many official icons are dark drawings on nothing: a light plate keeps them visible in both themes. */
img.ab-icon { padding: 5px; background: #ffffff; border: 1px solid var(--cr-line); }

.ab-icon.ab-small, .ab-letter.ab-small { width: 20px; height: 20px; padding: 1px; border-radius: 5px; font-size: 12px; }

.ab-link { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; padding: 10px 6px; border: 1px solid transparent; border-radius: var(--cr-radius-small); color: var(--cr-text); text-decoration: none; }

.ab-link:hover { background: var(--cr-surface-2); border-color: var(--cr-line); }

.ab-link-name { max-width: 100%; overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }

/* Panels: a grid of five columns and rows of fixed height. */

.ab-panels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: 96px; gap: 14px; }

.ab-panel { position: relative; display: flex; flex-direction: column; padding: 14px; overflow: hidden; }

.ab-w1 { grid-column: span 1; }
.ab-w2 { grid-column: span 2; }
.ab-w3 { grid-column: span 3; }
.ab-w4 { grid-column: span 4; }
.ab-w5 { grid-column: span 5; }

.ab-h2 { grid-row: span 2; }
.ab-h3 { grid-row: span 3; }
.ab-h4 { grid-row: span 4; }
.ab-h5 { grid-row: span 5; }
.ab-h6 { grid-row: span 6; }
.ab-h7 { grid-row: span 7; }
.ab-h8 { grid-row: span 8; }

.ab-head { display: flex; align-items: center; gap: 8px; min-height: 30px; margin-bottom: 8px; }

.ab-head h3 { flex: 1; min-width: 0; overflow: hidden; font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }

.ab-body { flex: 1; min-height: 0; overflow: auto; }

.ab-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }

.ab-notes { height: 100%; resize: none; }

/* Tools, only with the padlock open. */

.ab-unlocked .ab-panel { border-style: dashed; border-color: var(--cr-line-strong); }

.ab-tools { display: flex; gap: 2px; }

.ab-tools .cr-icon-button { width: 30px; height: 30px; }

.ab-grip, .ab-resize { display: inline-grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--cr-muted); touch-action: none; user-select: none; }

.ab-grip { width: 24px; height: 28px; border-radius: 6px; cursor: grab; }

.ab-grip svg { width: 18px; height: 18px; }

.ab-resize { position: absolute; right: 1px; bottom: 1px; width: 26px; height: 26px; border-radius: 8px; cursor: nwse-resize; }

.ab-resize svg { width: 20px; height: 20px; }

.ab-grip:hover, .ab-resize:hover { color: var(--cr-accent); }

.ab-dragging { opacity: .55; cursor: grabbing; }

.ab-resizing, .ab-dragging { border-color: var(--cr-accent) !important; user-select: none; }

/* Settings windows */

.cr-dialog h3 { margin: 16px 0 6px; font-size: 14px; }

.cr-dialog .cr-note { margin-bottom: 12px; }

.ab-rows { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 10px; }

.ab-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) minmax(0, 2fr) minmax(0, 2fr) auto; gap: 8px; align-items: start; }

.ab-preview { display: grid; place-items: center; height: 38px; }

.ab-row-tools { display: flex; gap: 2px; }

.ab-sizes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Panels of a server placed on a page: the chart takes the height the panel has. */

.ab-remote, .ab-remote-content { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.ab-remote .cr-chart { flex: 1; min-height: 40px; margin-top: 4px; }

.ab-remote .cr-chart canvas { position: absolute; inset: 0; height: 100%; }

.ab-remote .cr-facts { margin-top: 0; }

.ab-remote-state { flex: none; }

.ab-pin { width: 26px; height: 26px; flex: none; }

.ab-pin svg { width: 15px; height: 15px; }

.ab-remote .cr-legend, #server-live .cr-legend { align-self: flex-start; margin-top: 4px; font-size: 12px; color: var(--cr-muted); }

#server-live .cr-tile-label { align-items: center; }

.cr-section-title .ab-pin { margin-left: 4px; }

.cr-dialog .cr-field, .cr-dialog .cr-check { margin-top: 10px; }

/* The VPN */

.ab-vpn .cr-dot { width: 8px; height: 8px; margin-right: 8px; }

.ab-vpn small { display: block; margin-left: 16px; font-size: 11.5px; }

.ab-vpn td { white-space: nowrap; }

.ab-vpn td:first-child { white-space: normal; overflow-wrap: anywhere; }

.ab-vpn .ab-traffic span + span { margin-left: 10px; }

.ab-vpn-wrap > p { padding: 8px 14px; }

.ab-remote .ab-vpn { font-size: 12.5px; }

.ab-remote .ab-vpn th, .ab-remote .ab-vpn td { padding: 5px 4px; white-space: normal; }

.ab-remote .ab-vpn td + td { white-space: nowrap; }

.ab-remote .ab-vpn .ab-traffic span { display: block; margin: 0; font-size: 11.5px; }

.ab-remote .ab-vpn small { display: none; }

/* Servers */

.ab-clickable { cursor: pointer; }

.ab-clickable:hover { border-color: var(--cr-accent); }

.ab-open { color: inherit; text-decoration: none; }

.ab-system { margin: -4px 0 8px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.ab-measure { display: grid; grid-template-columns: minmax(0, 92px) minmax(0, 1fr) 46px; gap: 8px; align-items: center; margin-bottom: 4px; font-size: 12.5px; }

.ab-measure span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ab-measure .cr-meter { margin: 0; }

.ab-measure b { text-align: right; font-weight: 600; }

.ab-server-title { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }

.ab-server-title h2 { font-size: 20px; }

#server-view > section + section { margin-top: 30px; }

.ab-use { min-width: 180px; white-space: nowrap; }

.ab-use .cr-meter { display: inline-block; width: 110px; margin: 0 10px 0 0; vertical-align: middle; }

.ab-code { margin: 10px 0; font-family: var(--cr-mono); font-size: 28px; font-weight: 700; letter-spacing: .08em; text-align: center; }

#databar.cr-stale b { opacity: .4; }

@media (max-width: 1200px) {
    .ab-panels { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .ab-w4, .ab-w5 { grid-column: span 3; }
}

@media (max-width: 700px) {
    .ab-panels { grid-template-columns: minmax(0, 1fr); }
    .ab-w1, .ab-w2, .ab-w3, .ab-w4, .ab-w5 { grid-column: auto; }
    /* On a phone the AI shortcuts take two rows. */
    .ab-search-panel.ab-h2 { grid-row: span 3; }
    .ab-unlocked .ab-search-panel .ab-search { margin-top: 30px; }
    .ab-assistants .ab-link { width: 76px; }
    .ab-row { grid-template-columns: 24px minmax(0, 1fr) auto; padding-bottom: 10px; border-bottom: 1px solid var(--cr-line); }
    .ab-row > .cr-control { grid-column: 2; }
    .ab-preview { grid-row: 1; }
    .ab-row-tools { grid-column: 3; grid-row: 1 / span 3; align-self: start; flex-direction: column; }
}
