/* BoulderCAST "Right now" sidebar widget. Loaded by currentwx-widget.html.
   Scoped to #bcwxw so the theme and the rest of the page are left alone.
   The card is dark in both light and dark mode, like the page's frames. */

#bcwxw {
  --w-red: #C41E3A;
  --w-panel: #102030;
  --w-stage: #0A1622;
  --w-text: #E9EFF5;
  --w-muted: #9DB0C2;
  --w-line: rgba(255, 255, 255, 0.10);
  --w-rule: rgba(255, 255, 255, 0.18);  /* the lines in the details table, a little stronger */
  --w-warm: #F28B82;
  --w-cool: #8AB4F8;
  --w-stale: #D9B26F;
  --w-premium: #F9C802;
  position: relative;
  /* Never wider than the sidebar it sits in, whatever's inside */
  width: 100%;
  min-width: 0;
  max-width: 360px;
  margin: 0 0 1.5em;
  color: var(--w-text);
  font-size: 16px;
  line-height: 1.4;
}
#bcwxw *, #bcwxw *::before, #bcwxw *::after { box-sizing: border-box; }
#bcwxw br { display: none; }
#bcwxw [hidden] { display: none !important; }

#bcwxw .bcwxw-card {
  overflow: hidden;
  border-top: 3px solid var(--w-red);
  border-radius: 12px;
  background: var(--w-panel);
}

/* Title bar: place name, report time, gear */
#bcwxw .bcwxw-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 12px;
}
#bcwxw .bcwxw-name {
  margin-right: auto;
  color: #fff;
  font-size: 0.95em;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#bcwxw .bcwxw-when {
  flex: none;
  color: var(--w-muted);
  font-size: 0.75em;
  font-variant-numeric: tabular-nums;
}
#bcwxw .bcwxw-card.is-stale .bcwxw-when { color: var(--w-stale); }

/* Reset whatever the theme does to buttons and links */
#bcwxw button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: inherit;
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
}
#bcwxw a { text-decoration: none; box-shadow: none; border: 0; }

#bcwxw .bcwxw-gear {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--w-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}
#bcwxw .bcwxw-gear:hover,
#bcwxw .bcwxw-gear[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
#bcwxw button:focus-visible,
#bcwxw a:focus-visible {
  outline: 2px solid #4C9AD8;
  outline-offset: 2px;
}

/* Location menu: drops down over the picture */
#bcwxw .bcwxw-menu {
  position: absolute;
  top: 47px;
  right: 8px;
  left: 8px;
  z-index: 5;
  display: grid;
  gap: 2px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: var(--w-panel);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
#bcwxw .bcwxw-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--w-text);
  font-size: 0.9em;
  font-weight: 600;
  text-align: left;
}
#bcwxw .bcwxw-opt:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
#bcwxw .bcwxw-opt::before {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--w-muted);
  border-radius: 50%;
}
#bcwxw .bcwxw-opt[aria-checked="true"] { background: rgba(196, 30, 58, 0.22); color: #fff; }
#bcwxw .bcwxw-opt[aria-checked="true"]::before {
  border-color: #fff;
  background: radial-gradient(circle, #fff 0 3px, transparent 3.5px);
}

/* The tile */
#bcwxw .bcwxw-tile {
  display: block;
  color: inherit;
}
#bcwxw a.bcwxw-tile[href]:hover .bcwxw-more { text-decoration: underline; }

#bcwxw .bcwxw-cam {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--w-stage);
}
#bcwxw .bcwxw-cam img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  object-fit: cover;
}
#bcwxw .bcwxw-card.is-offline .bcwxw-cam img { visibility: hidden; }
#bcwxw .bcwxw-card.is-offline .bcwxw-cam::after {
  content: "Camera not responding";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--w-muted);
  font-size: 0.8em;
}

/* Two columns: the big temperature and conditions on the left, the details
   on the right */
/* Both columns are the same height (the taller one sets it). The right one
   spreads its rows top to bottom. On the left the temperature and conditions
   stay together: centered, or at the top with "Full conditions" at the bottom
   when there's a link, so it lines up with the first and last rows. */
/* The details column is as wide as its longest row (so a value can never be
   pushed past the card's edge, whatever the theme's font); the temperature
   side takes what's left, and the temperature and icon shrink a little when
   that's tight (sized from the body's width) */
#bcwxw .bcwxw-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 12px;
  padding: 12px;
  container-type: inline-size;
}
#bcwxw .bcwxw-now {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
#bcwxw .bcwxw-main {
  display: flex;
  align-items: center;
  gap: 6px;
}
#bcwxw .bcwxw-main .bcwxw-icon {
  flex: none;
  width: clamp(36px, 16cqw, 56px);
  height: clamp(36px, 16cqw, 56px);
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
}
#bcwxw .bcwxw-temp {
  color: #fff;
  font-size: clamp(30px, 16cqw, 48px);
  white-space: nowrap;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
#bcwxw .bcwxw-card.is-stale .bcwxw-temp { opacity: 0.6; }
#bcwxw .bcwxw-wx {
  margin-top: 4px;
  color: #fff;
  font-size: 1.05em;
  font-weight: 600;
  line-height: 1.25;
}

/* The details as a small table: label on the left, value right-aligned,
   a thin rule between rows and one down the left side; centered against
   the temperature */
#bcwxw .bcwxw-facts {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  margin: 0;
  padding: 0 0 0 12px;
  border-left: 1px solid var(--w-rule);
  font-size: 0.8em;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
#bcwxw .bcwxw-facts div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 3px 0;
  border-bottom: 1px solid var(--w-rule);
}
#bcwxw .bcwxw-facts div:last-child { border-bottom: 0; }
/* Values stay on one line when there's room; in a very narrow sidebar a long
   one ("NNE 15 mph") wraps rather than pushing the card past its column */
#bcwxw .bcwxw-facts dt,
#bcwxw .bcwxw-facts dd {
  margin: 0;
  padding: 0;
  font-size: inherit;
  line-height: inherit;
}
#bcwxw .bcwxw-facts dt {
  flex: none;
  color: var(--w-muted);
  font-weight: 600;
  white-space: nowrap;
}
#bcwxw .bcwxw-facts dd {
  min-width: 0;
  color: #fff;
  font-weight: 700;
  text-align: right;
}
#bcwxw .bcwxw-facts dd.bcwxw-hi { color: var(--w-warm); }
#bcwxw .bcwxw-facts dd.bcwxw-lo { color: var(--w-cool); }

/* Under the conditions, in the left column */
#bcwxw .bcwxw-more {
  display: block;
  margin-top: auto;   /* takes the spare height, so it sits at the bottom */
  padding-top: 8px;
  color: var(--w-cool);
  font-size: 0.8em;
  font-weight: 700;
}

#bcwxw .bcwxw-card[data-state="loading"] .bcwxw-body { opacity: 0.4; }
