/* wx-embeds.css — cached outside-product panels (assets/js/wx-embeds.js).
 * Colors come from styles.css custom properties. Tints are mixed from --card
 * and --text rather than using --card-soft: api.js applySettingsTheme()
 * overrides --card/--text from saved settings but not --card-soft, so in
 * light mode the two can disagree. */

.wx-embed {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--text) 5%, var(--card));
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}
/* On a page the surrounding section-card is the box; don't draw a second one. */
.section-card > [data-wx-embed] > .wx-embed {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
}
.wx-embed-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.wx-embed-title {
  margin: 0;
  font-size: var(--text-md);
  color: var(--text);
}
.wx-embed-src {
  font-size: var(--text-xs);
  color: var(--accent);
  white-space: nowrap;
  text-decoration: none;
}
.wx-embed-src:hover { text-decoration: underline; }
.wx-embed-status {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
}
.wx-embed-status--error { color: var(--warn); }
.wx-embed-note {
  margin: var(--space-2) 0 0;
  color: var(--muted);
  font-size: var(--text-xs);
}
.wx-embed-imgfail {
  display: block;
  padding: var(--space-4) var(--space-2);
  color: var(--muted);
  font-size: var(--text-sm);
  text-align: center;
}

/* A thumbnail that opens the lightbox. */
.wx-embed-thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;   /* the upstream maps are drawn on white */
  cursor: zoom-in;
  overflow: hidden;
}
.wx-embed-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wx-embed-thumb img {
  display: block;
  width: 100%;
  height: auto;
}

/* SPC Mesoanalysis: six fields as 3x2 on a page, 2x3 in the drawer and hub
 * cards, one column on a phone. */
.wx-meso-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}
.wx-res-drawer .wx-meso-grid,
.wx-res-card .wx-meso-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
@media (max-width: 900px) {
  .wx-meso-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .wx-meso-grid,
  .wx-res-card .wx-meso-grid { grid-template-columns: minmax(0, 1fr); }
}
.wx-meso-cell { margin: 0; }
.wx-meso-cell figcaption {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--muted);
}

/* FDEM outlook card. */
.wx-fdem-title { margin: 0 0 var(--space-1); font-size: var(--text-base); color: var(--text); }
.wx-fdem-issued { display: block; color: var(--muted); font-size: var(--text-xs); margin-bottom: var(--space-2); }
.wx-fdem-points { margin: 0 0 var(--space-2); padding-left: 1.1rem; font-size: var(--text-sm); color: var(--text); }
.wx-fdem-points li { margin-bottom: var(--space-1); }
.wx-fdem-links { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: 0; font-size: var(--text-sm); }
.wx-fdem-link { color: var(--accent); text-decoration: none; }
.wx-fdem-link:hover { text-decoration: underline; }
.wx-fdem-older { margin-top: var(--space-2); font-size: var(--text-sm); }
.wx-fdem-older summary { cursor: pointer; color: var(--muted); }
.wx-fdem-older ul { margin: var(--space-2) 0 0; padding-left: 1.1rem; }
.wx-fdem-older time { color: var(--muted); font-size: var(--text-xs); }

/* IEM map + level toggle. */
.wx-embed-toggle { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-2); }
.wx-embed-toggle-btn {
  font: inherit;
  font-size: var(--text-xs);
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.wx-embed-toggle-btn[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}
.wx-iem-fig { margin: 0; }
.wx-iem-fig figcaption { margin-top: var(--space-1); font-size: var(--text-xs); color: var(--muted); }

/* Lightbox. Above the Resources drawer (1150), below WxUI dialogs (1200). */
.wx-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1190;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 3.5rem;
  background: rgba(2, 1, 12, 0.85);
}
.wx-lightbox-fig {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.wx-lightbox-fig img {
  max-width: 100%;
  max-height: calc(100vh - 8rem);
  background: #fff;
  border-radius: var(--radius-sm);
}
.wx-lightbox-cap { margin-top: var(--space-2); color: #e8e6f2; font-size: var(--text-sm); text-align: center; }
.wx-lightbox-btn {
  position: absolute;
  font: inherit;
  font-size: 1.8rem;
  line-height: 1;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-pill);
  background: rgba(21, 18, 43, 0.8);
  color: #e8e6f2;
  cursor: pointer;
}
.wx-lightbox-btn:focus-visible { outline: 2px solid var(--accent); }
.wx-lightbox-close { top: 0.8rem; right: 0.8rem; }
.wx-lightbox-prev { left: 0.6rem; top: 50%; transform: translateY(-50%); }
.wx-lightbox-next { right: 0.6rem; top: 50%; transform: translateY(-50%); }
@media (max-width: 640px) {
  .wx-lightbox { padding: 3rem 0.5rem; }
  .wx-lightbox-prev, .wx-lightbox-next { top: auto; bottom: 0.6rem; transform: none; }
}
