/* Custom dashboard styling (Glance) — served from /assets/custom.css.
 *
 * Two things:
 *  1. App-Library layout — tile the category cards side by side (wrapping)
 *     instead of stacking one full-width category per row, so the page packs
 *     into far fewer rows and (ideally) needs no scrolling. Glance already
 *     gives each widget-content a card background/border, so each category is
 *     already a box; we just lay the boxes out horizontally and size each to
 *     its icons.
 *  2. Desktop-icon tiles — each service is a square (icon above label), the
 *     whole square clickable, full colour when up and dimmed/greyed when down.
 *     The textual status ("OK / 123ms") and the status glyph are hidden.
 *
 * Uses the *default* monitor style (not `compact`), the only one that renders
 * per-site icons. */

/* ===== App-Library layout: tile the category cards ===== */
.page-column-full {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.4rem;
}
/* Each category card is sized to its icons; cancel the stacked vertical gap. */
.page-column-full > .widget {
    flex: 0 1 auto;
    margin-top: 0 !important;
}
/* Centre the category title on its card. */
.widget-type-monitor .widget-header {
    justify-content: center;
    margin-bottom: 0.7rem;
}

/* ===== Icon grid inside each category ===== */
/* Content-width, wrapping icon grid (stock stretches to equal columns). Cap the
 * width so a busy category wraps into a grid rather than one very wide row. */
.widget-type-monitor .dynamic-columns {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    max-width: 22rem;
}
.widget-type-monitor .dynamic-columns > * {
    border: none !important;
    padding-left: 0 !important;
    margin-top: 0 !important;
    min-width: 0;
}

/* Hide the "OK / 123ms" line and the separate status check/error glyph. The
 * down-state element still exists in the DOM (just hidden), so the :has() rule
 * below can still detect it. */
.widget-type-monitor .list-horizontal-text,
.widget-type-monitor .monitor-site-status-icon {
    display: none !important;
}

/* ===== Square "desktop icon" tiles ===== */
.widget-type-monitor .monitor-site {
    position: relative;            /* anchor for the full-tile click overlay */
    flex-direction: column;        /* icon on top, label below */
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 7rem;
    min-height: 7rem;              /* square-ish; grows a touch for 2-line labels */
    padding: 0.6rem 0.4rem;
    border-radius: 14px;
    text-align: center;
    transition: background-color 0.15s ease, opacity 0.2s ease, filter 0.2s ease;
}
.widget-type-monitor .monitor-site:hover {
    background-color: rgba(255, 255, 255, 0.06);
}
.widget-type-monitor .monitor-site-icon {
    width: 3rem;
    height: 3rem;
    opacity: 1;
    filter: none;
    top: 0;                        /* override the stock -0.1rem nudge */
}
/* Label under the icon: allow wrapping and centring (override the truncate
 * utility that keeps it to a single ellipsised line). */
.widget-type-monitor .monitor-site > .grow {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
}
.widget-type-monitor .monitor-site > .grow > a {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    text-align: center;
    line-height: 1.15;
    font-size: 0.8rem;
}
/* Make the entire square clickable via a stretched-link overlay. */
.widget-type-monitor .monitor-site > .grow > a::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

/* Service down → dim + grey out the whole tile (reads as disabled). */
.widget-type-monitor .monitor-site:has(.color-negative) {
    opacity: 0.38;
    filter: grayscale(1);
}
