/* /demos/websocket-lab page chrome (PF-S443).
 *
 * Loaded only by this page, through Tags.PageCSS; the ?v= in PageCSSHref is the
 * whole cache-busting story. Colors come from the shared sheet's custom
 * properties (--ink, --ink-muted, --hairline, --surface, --surface-alt,
 * --accent), so this page follows the system preference and the theme toggle
 * without a palette of its own. The two state colors are the one exception,
 * declared with the same three-way discipline p2p-lab.css uses.
 */

.ws-stage {
  --ws-ok: #1a7f37;
  --ws-bad: #b42318;
  margin: 1.5rem 0 2.5rem;
}

@media (prefers-color-scheme: dark) {
  .ws-stage {
    --ws-ok: #3fb950;
    --ws-bad: #f85149;
  }
}

[data-theme="dark"] .ws-stage {
  --ws-ok: #3fb950;
  --ws-bad: #f85149;
}

[data-theme="light"] .ws-stage {
  --ws-ok: #1a7f37;
  --ws-bad: #b42318;
}

.ws-display-only {
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.ws-status {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--surface-alt);
  overflow-wrap: anywhere;
}

.ws-status[data-state="up"],
.ws-status[data-state="done"] {
  border-left-color: var(--ws-ok);
}

.ws-status[data-state="down"],
.ws-status[data-state="refused"],
.ws-status[data-state="error"] {
  border-left-color: var(--ws-bad);
}

.ws-stage section {
  margin: 1.5rem 0;
  padding: 1rem;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface);
}

.ws-stage h2 {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
}

.ws-quotes caption,
.ws-table caption,
.ws-scale-table caption {
  caption-side: top;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.ws-quotes td,
.ws-quotes th {
  font-variant-numeric: tabular-nums;
}

.ws-attribution,
.ws-panel__note,
.ws-cap-note {
  color: var(--ink-muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.ws-table th {
  width: 40%;
  font-weight: 600;
  color: var(--ink-muted);
}

.ws-table td {
  overflow-wrap: anywhere;
}

.ws-lt-form fieldset {
  margin: 0 0 0.5rem;
}

.ws-lt-form legend {
  font-size: 1rem;
  font-weight: 600;
}

.ws-lt-size {
  margin-right: 1rem;
}

.ws-stage .btn {
  margin: 0.5rem 0.5rem 0.5rem 0;
}

/* The two wide tables (thirteen columns at scale, five for the prices) scroll
   inside their own box rather than pushing the page sideways on a phone. */
.ws-scroll {
  overflow-x: auto;
  max-width: 100%;
}

/* Both are keyboard-reachable regions (tabindex, role, label in the markup),
   so a focused one shows the shared anchor ring, as .zk-table-wrap does. */
.ws-scroll:focus-visible {
  outline: 3px solid var(--focus-ring-anchor);
  outline-offset: 1px;
}

.ws-scale-table {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* The two-column tables stack on a phone: each row becomes a label over its
   value, with the roles in the markup keeping them tables for assistive
   technology after `display` changes (p2p-lab.css, css.css's .zk-stack). */
@media (max-width: 767.98px) {
  .ws-table,
  .ws-table tbody,
  .ws-table tr,
  .ws-table th,
  .ws-table td {
    display: block;
    width: auto;
  }

  .ws-table tr {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--hairline);
  }

  .ws-table th,
  .ws-table td {
    border: 0;
    padding: 0.1rem 0;
  }

  .ws-quotes {
    font-size: 0.85rem;
  }

  .ws-quotes th,
  .ws-quotes td {
    padding: 0.25rem;
  }
}
