/* =====================================================================
   Glance custom CSS.

   Loaded via `theme.custom-css-file: /assets/user.css` in glance.yml --
   without that line this file is fetchable but never applied.

   Organised as: shared primitives (hl- = homelab), then the per-widget
   rules that carry only what is genuinely unique to that widget, then
   overrides of Glance's own classes.
   Consolidated 2026-08-24, step 7 of glance-layout-plan.md.
   ===================================================================== */

:root {
  --hl-ok:   var(--color-positive);
  --hl-warn: #e8a435;
  --hl-bad:  var(--color-negative);
  --hl-mute: var(--color-text-subdue, #6b6b6b);
  --hl-track: var(--color-widget-background-highlight, rgba(255, 255, 255, 0.08));
}

/* --- bars ------------------------------------------------------------ */
/* Track. Height defaults to 8px; -sm and -lg cover the other two sizes. */
.hl-bar {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--hl-track);
}

.hl-bar-sm { height: 5px; border-radius: 3px; margin-top: 3px; }
.hl-bar-lg { height: 10px; }

/* Single fill; colour is set inline by the template. */
.hl-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Segmented variant: children are the segments, no class needed on them. */
.hl-bar-split { display: flex; }
.hl-bar-split > * { height: 100%; transition: width 0.3s ease; }

/* --- severity -------------------------------------------------------- */
.hl-dot {
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  margin-right: 0.4em;
  flex-shrink: 0;
}

.hl-dot.is-ok   { background: var(--hl-ok); }
.hl-dot.is-warn { background: var(--hl-warn); }
.hl-dot.is-bad  { background: var(--hl-bad); }

/* --- numbers --------------------------------------------------------- */
/* Headline stat. tabular-nums stops figures jittering as values update. */
.hl-stat {
  font-size: 1.55em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.hl-stat-unit {
  font-size: 0.55em;
  opacity: 0.7;
  margin-left: 0.25em;
}

/* Small right-aligned figure inside a grid row. */
.hl-num {
  text-align: right;
  font-size: 0.85em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.hl-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8em;
}

/* --- rows ------------------------------------------------------------ */
/* Flex row, for simple label/value pairs. */
.hl-row {
  display: flex;
  align-items: center;
  gap: 0.5em;
  min-width: 0;
}

.hl-row-spread { justify-content: space-between; }

.hl-row > .hl-row-main {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Separated list rows. */
.hl-row-sep,
.hl-grid-row {
  padding: 0.4em 0;
  border-bottom: 1px solid var(--color-separator);
}

.hl-row-sep:last-child,
.hl-grid-row:last-child { border-bottom: none; }

/* Grid row base. Each widget supplies its own grid-template-columns. */
.hl-grid-row {
  display: grid;
  gap: 0 1em;
  align-items: baseline;
  font-size: 0.9em;
}

/* --- Uptime Kuma ----------------------------------------------------- */
.kuma-row {
  grid-template-columns: minmax(9rem, 1.2fr) minmax(6rem, 2fr) 5rem 5rem;
  align-items: center;
  padding: 0.45em 0;
}

.kuma-beats {
  display: flex;
  gap: 2px;
  align-items: stretch;
  height: 16px;
}

.kuma-beat {
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 2px;
  opacity: 0.85;
}

.kuma-beat-up      { background: var(--hl-ok); }
.kuma-beat-down    { background: var(--hl-bad); }
.kuma-beat-pending { background: var(--hl-warn); }
.kuma-beat-maint   { background: var(--hl-mute); }

/* Below ~700px the two numeric columns would crush the bar, so stack. */
@media (max-width: 700px) {
  .kuma-row { grid-template-columns: 1fr 5rem; }
  .kuma-beats { grid-column: 1 / -1; }
}

/* --- Image updates --------------------------------------------------- */
.imgup-row {
  grid-template-columns: minmax(8rem, 1fr) minmax(10rem, 1.8fr) 5rem minmax(9rem, auto);
}

/* .hl-mono supplies the face; these are the digest's own alignment rules */
.imgup-digest { text-align: right; white-space: nowrap; }

@media (max-width: 700px) {
  .imgup-row { grid-template-columns: 1fr auto; }
  .imgup-digest { grid-column: 1 / -1; text-align: left; }
}

/* --- Proxy hosts ----------------------------------------------------- */
.npm-row {
  grid-template-columns: minmax(9rem, 1.2fr) minmax(9rem, 1.4fr) 5.5rem minmax(8rem, auto) 5rem;
}

.npm-row.npm-row-note {
  border-bottom: none;
  padding-bottom: 0;
}

/* Small caps-ish flags for websockets / hsts / http2 */
.npm-flags {
  font-size: 0.7em;
  letter-spacing: 0.04em;
  opacity: 0.75;
  margin-left: 0.4em;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .npm-row { grid-template-columns: 1fr 5.5rem; }
  .npm-upstream { grid-column: 1 / -1; }
  .npm-traffic { grid-column: 1 / -1; text-align: left; }
}

/* --- Storage --------------------------------------------------------- */
.storage-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15em 1em;
  margin-top: 0.5em;
  font-size: 0.85em;
}

.storage-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.storage-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* --- Speedtest ------------------------------------------------------- */
.spark {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 34px;
  width: 100%;
}

.spark-bar {
  flex: 1 1 0;
  min-width: 3px;
  border-radius: 2px 2px 0 0;
  opacity: 0.9;
  transition: height 0.3s ease;
}

.spark-ok    { background: var(--hl-ok); }
.spark-warn  { background: var(--hl-warn); }
.spark-bad   { background: var(--hl-bad); }
.spark-plays { background: var(--color-primary); }

.speed-headline {
  display: flex;
  gap: 1.2em;
  align-items: baseline;
  margin-bottom: 0.15em;
}

.speed-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8em;
  margin-top: 0.5em;
}

/* --- Plex analytics -------------------------------------------------- */
.plex-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5em;
}

.plex-col {
  flex: 1 1 14rem;
  min-width: 0;
}

.plex-row {
  gap: 0.8em;
  align-items: baseline;
  padding: 0.28em 0;
  font-size: 0.88em;
}

.plex-col h4 {
  font-size: 0.78em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-bottom: 0.5em;
  font-weight: normal;
}

/* --- overrides of Glance's own classes ------------------------------- */
.docker-container-status { font-size: 0.95em; }
.bookmarks-group { margin-bottom: 0.5em; }
.clock-time { font-size: 1.8em; }

.card:hover {
  transform: scale(1.02);
  transition: transform 0.15s ease-in-out;
}

/* --- AdGuard DNS ----------------------------------------------------- */
.adguard-row { grid-template-columns: 1fr auto; }

/* Each spark bar is total queries; the inner segment, anchored to the
   bottom, is the blocked share of that bucket. */
.adguard-spark-bar {
  position: relative;
  overflow: hidden;
}

.adguard-spark-blocked {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--hl-bad);
}
