/* widgets.css — floating live-data widget cards. Token vars only. */

.widget-card {
  position: absolute;
  /* Flex column so an explicit height set by the resize handle actually
     flows down to the body (which fills the remaining space). Without this
     the frame grew but content stayed content-sized. */
  display: flex;
  flex-direction: column;
  min-width: 170px;
  /* Was max-width:260px, which capped whatever width the resize handle wrote
     (widget-host.js makeResizable) so the card couldn't grow past 260px.
     Raised so resize isn't silently clamped; still bounded to the viewport. */
  max-width: min(90vw, 640px);
  padding: 0 0 12px;
  pointer-events: auto;
  user-select: none;
  border-color: rgba(120, 200, 255, 0.10); /* quieter than .glass's default hairline */
  transition: box-shadow var(--dur-fast) var(--ease);
}

.widget-card.dragging {
  opacity: 0.85;
  box-shadow: var(--accent-glow);
}

.widget-card:hover {
  box-shadow: var(--glow-soft), 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* corner brackets — subtle L-shaped accents, top-left + bottom-right */
.widget-card::before,
.widget-card::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  opacity: 0.6;
  pointer-events: none;
}
.widget-card::before {
  top: 0;
  left: 0;
  border-top: 1px solid var(--hairline);
  border-left: 1px solid var(--hairline);
}
.widget-card::after {
  bottom: 0;
  right: 0;
  border-bottom: 1px solid var(--hairline);
  border-right: 1px solid var(--hairline);
}

/* Resize handle — bottom-right corner grip. Hit area extended beyond the
   visual grip to meet the 44px touch target minimum (ui-ux-pro-max §2). */
.widget-resize {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 28px;
  height: 28px;
  cursor: nwse-resize;
  touch-action: none;
}
.widget-resize::after {
  content: '';
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-faint);
  border-bottom: 2px solid var(--text-faint);
}

.widget-title {
  font-size: 10px;
  letter-spacing: 0.29em; /* ADAPT: spec's 0.14em was lower than this file's
    existing 0.22em — increased ~30% from the current value instead, per
    handoff's ADAPT note (never shrink below 10px; already at the floor). */
  color: var(--text-faint);
  padding: 10px 14px 6px;
  cursor: grab;
  touch-action: none;
}

.widget-card.dragging .widget-title { cursor: grabbing; }

/* flex:1 + min-height:0 so the body fills a resized (taller) card and
   scrolls instead of clipping when the card is made shorter than its
   content. min-height:0 is required for overflow to work inside a flex
   column. */
.widget-body { padding: 0 14px; flex: 1 1 auto; min-height: 0; overflow: auto; }

.widget-value {
  font-size: 22px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.widget-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.widget-spark {
  display: block;
  margin-top: 8px;
  width: 100%;
  height: 28px;
}

.widget-feed {
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* No fixed max-height: let the list grow with the (resizable) card and
     rely on .widget-body's own overflow to scroll when the card is small.
     A hard 160px cap here ignored the card height entirely. */
  overflow-y: auto;
}

.widget-feed-row {
  font-size: 11px;
  color: var(--text-dim);
  padding: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-lanes {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.widget-lane-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 2px 0;
  color: var(--text);
}

.widget-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.widget-chip {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
}
.widget-chip.chip-open { color: var(--status-warn); border-color: var(--status-warn); }
.widget-chip.chip-half-open { color: var(--status-degraded); border-color: var(--status-degraded); }
.widget-chip.chip-closed { color: var(--status-ok); border-color: var(--status-ok); }

/* NEWS widget — headline list from /api/news */
/* No fixed max-height: grows with the resizable card; .widget-body scrolls
   when the card is smaller than the list. */
.news-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.news-list::-webkit-scrollbar { width: 4px; }
.news-list::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 2px; }

.news-item {
  display: block;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-dim);
  text-decoration: none;
  padding: 3px 0;
  border-bottom: 1px solid var(--hairline);
}
.news-item:last-child { border-bottom: none; }
.news-item:hover .news-item-title { color: var(--text); }

.news-item-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-item-ago { font-size: 9px; color: var(--text-faint); }

.news-foot { margin-top: 6px; font-size: 9px; color: var(--text-faint); }

/* MEDIA widget — now playing from Windows SMTC */
.widget-art {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
/* The <img> injected into .widget-art was unstyled — it rendered at its
   native pixel size and overflowed the card. .widget-art (the wrapping div)
   already caps height; the image itself needs the same treatment. */
.widget-art-img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}
.media-idle { opacity: 0.4; }

.media-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.media-controls button {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.media-controls button:hover { color: var(--text); background: var(--hairline); }
.media-controls button:active { color: var(--accent); }

.media-progress {
  margin-top: 8px;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--hairline);
  overflow: hidden;
}
.media-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 1s linear;
}
