/* web-widget.css — styles for embedded web content (YouTube iframe panels,
   search-result floating widgets, weather cards). Token vars only. */

/* ---- Overlay panel: video sizing ---- */
/* When the web panel shows video, cap its width so it doesn't fill the screen.
   The base .hud-panel is min(860px, 92vw); this overrides to a smaller max.
   Also drops backdrop-filter: an ancestor with backdrop-filter/filter/transform
   breaks a nested iframe's hardware-accelerated video compositing in Chromium —
   the video paints solid black while audio keeps playing. Falls back to a near-
   opaque flat version of --panel since blur is no longer available to fake the
   translucent look. */

.hud-panel.web-panel-video {
  width: min(720px, 88vw);
  backdrop-filter: none;
  background: rgba(14, 22, 38, 0.97);
  /* The base .hud-panel plays a fadeInUp open animation with fill-mode
     "both" (overlay.css), whose keyframe ends on transform: translateY(0).
     "both" means that transform never clears once the animation finishes —
     it's a non-none transform sitting on this iframe's ancestor forever,
     which is the same compositing-breaking condition as backdrop-filter
     above. animation:none stops fadeInUp from ever running here (so it
     never leaves a transform behind); transform:none is belt-and-suspenders
     in case this class gets applied mid-animation. */
  animation: none;
  transform: none;
}

.hud-panel.web-panel-video .hud-panel-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
}

/* ---- Overlay panel: iframe fill ---- */

.web-iframe-wrap {
  position: relative;
  width: 100%;
  /* 16:9 aspect ratio for video content */
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #000;
}

.web-iframe-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ---- Floating widget: web result cards ---- */

.web-widget-card {
  min-width: 240px;
  max-width: 340px;
}

.web-widget-close {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 16px;
  cursor: pointer;
  padding: 0 0 0 8px;
  line-height: 1;
  /* Re-enable pointer events — the parent .widget-title children get
     pointer-events:none below so drag works, but the close button must
     still receive clicks. */
  pointer-events: auto;
}
.web-widget-close:hover { color: var(--status-warn); }

.web-widget-card .widget-title,
.widget-card .widget-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Fix drag: children (span, button) get pointer-events:none so pointerdown
     fires on the .widget-title div itself, not a child. setPointerCapture
     then correctly captures subsequent moves to the title. The close button
     re-enables pointer-events above. Applies to boot widgets too now that
     their titles carry a hover-reveal hide button. */
}
.web-widget-card .widget-title > *,
.widget-card .widget-title > * {
  pointer-events: none;
}
.web-widget-card .widget-title .web-widget-close,
.widget-card .widget-title .web-widget-close {
  pointer-events: auto;
}

/* Boot-widget hide button: invisible until the card is hovered, so the HUD
   stays clean. Voice ("close the news widget") and this ✕ share one path. */
.widget-card .widget-hide {
  opacity: 0;
  transition: opacity 0.15s ease;
}
.widget-card:hover .widget-hide,
.widget-card .widget-hide:focus-visible {
  opacity: 1;
}

/* Hidden widgets stay mounted (state, subscriptions persist) — just not shown. */
.widget-card.widget-hidden {
  display: none;
}

.web-result-body {
  padding: 4px 0;
}

/* ---- Search/flight/image result rows ---- */

.web-result-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.web-result-row {
  display: block;
  padding: 8px 10px;
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: background var(--dur-fast) var(--ease);
  border: 1px solid transparent;
}
.web-result-row:hover {
  background: var(--bg-hover);
  border-color: var(--hairline);
}

.web-result-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  /* Clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.web-result-snippet {
  font-size: 10px;
  line-height: 1.4;
  /* Clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.web-result-action {
  display: block;
  margin-top: 10px;
  padding: 8px 12px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-decoration: none;
  color: var(--accent);
  background: var(--bg-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  transition: all var(--dur-fast) var(--ease);
}
.web-result-action:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

/* ---- Weather widget card ---- */

.weather-widget-loading {
  text-align: center;
  padding: 12px 4px;
  font-size: 11px;
}

.weather-widget-card {
  text-align: center;
  padding: 8px 4px;
}

.weather-widget-temp {
  font-size: 36px;
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.weather-widget-cond {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}

.weather-widget-sub {
  font-size: 10px;
  letter-spacing: 0.04em;
}

/* ---- Dynamic widget card (Item 11 "Generative UI" — kinds/dynamic.js) ----
   Brain-composed stat/list/table/text layouts, data-only. Every class below
   was referenced by dynamic.js with no matching rule anywhere (16-class
   drift — .text-gold/.text-warn are shared utilities, defined above/in
   tokens.css; the rest are specific to this widget kind). */

.dynamic-widget-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dynamic-stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.dynamic-stat-value {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.dynamic-stat-label {
  font-size: 11px;
}

.dynamic-widget-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dynamic-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  padding: 2px 0;
}
.dynamic-list-label {
  color: var(--text-dim);
}
.dynamic-list-value {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.dynamic-widget-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.dynamic-table-label {
  padding: 3px 6px 3px 0;
  text-align: left;
}
.dynamic-table-value {
  padding: 3px 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.dynamic-widget-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text);
}
.dynamic-text-line {
  line-height: 1.4;
}

.dynamic-widget-footer {
  margin-top: 8px;
  font-size: 9px;
}
