/* Page-specific styles for the toxic demo.
 * Built on top of theme.css (which loads lib/ds/styles.css), mirroring the
 * clear-demo / schemer-demo visual system: intro + try-it panel in one
 * card, mono row labels, chip samples, 2px progress, swarm loader. */

.intro-try .cols-2 {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.intro-try .cols-2 > * { min-width: 0; }
@media (max-width: 900px) {
  .intro-try .cols-2 { grid-template-columns: 1fr; }
}
.intro .display { font-size: clamp(3rem, 7vw, 6rem); }
.intro .lead { max-width: 40ch; }

.try-label { margin: 0 0 var(--space-3); }

.try-it .panel {
  background: var(--bg-surface);
  border: var(--border-hair) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.try-it .row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.try-it .row-label {
  font-family: var(--font-mono);
  font-size: var(--size-meta);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Content warning: sits inside the panel, right above the textarea. */
.content-warning {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-sm);
  background: var(--amber-50);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text-secondary);
}
.content-warning strong {
  font-family: var(--font-mono);
  font-size: var(--size-meta);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--warning);
}
[data-theme="dark"] .content-warning,
.dark .content-warning { background: color-mix(in srgb, var(--warning) 12%, transparent); }

.samples { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.samples .chip {
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  border: var(--border-hair) solid var(--border-subtle);
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-colors);
}
.samples .chip:hover { background: var(--bg-sunken); color: var(--text-primary); }
.samples .chip.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }

.input {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 7.5rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  border: var(--border-hair) solid var(--border-default);
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-standard);
}
.input:focus { border-color: var(--accent); }

.lang-select {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: var(--border-hair) solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
}

/* Loading states, mirroring schemer: reserved loader slot, one-line
 * status, 2px progress with tabular numbers. */
.status-line {
  font-family: var(--font-mono);
  font-size: var(--size-meta);
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.toolbar .swarm { display: inline-flex; visibility: hidden; }
.toolbar .swarm.visible { visibility: visible; }

.progress {
  height: 2px;
  border-radius: var(--radius-full);
  background: var(--border-subtle);
  overflow: hidden;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-standard);
}
.progress.visible { opacity: 1; }
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 160ms var(--ease-standard);
}

/* Fallback / retry gate (data saver or a failed load). */
.model-gate {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: flex-start;
}
.model-gate[hidden] { display: none; }
.model-gate p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  max-width: 44ch;
}

.btn {
  padding: 0.55rem 1.4rem;
  border-radius: var(--radius-full);
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition-colors);
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ─────────── Results ─────────── */

.result { display: block; }
.result:empty::before {
  content: attr(data-placeholder);
  font-family: var(--font-mono);
  font-size: var(--size-meta);
  color: var(--text-faint);
}

.verdict {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}
.verdict strong { font-weight: var(--weight-semibold); }
.verdict .verdict-meta {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.verdict-flagged { background: var(--oxide-50); color: var(--danger); }
.verdict-clear { background: var(--moss-50); color: var(--success); }
[data-theme="dark"] .verdict-flagged,
.dark .verdict-flagged { background: color-mix(in srgb, var(--danger) 14%, transparent); }
[data-theme="dark"] .verdict-clear,
.dark .verdict-clear { background: color-mix(in srgb, var(--success) 12%, transparent); }

.head-chip {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  white-space: nowrap;
  border: var(--border-hair) solid currentColor;
  border-radius: var(--radius-full);
  padding: 0.1rem 0.6rem;
}

/* Score rows use table layout: the label and value cells shrink-wrap their
   (nowrap) content, so the numbers can never overflow their column or wrap
   onto a second line at any pane width; the bar takes whatever is left. */
.meters {
  display: table;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 var(--space-2);
  font-size: var(--text-xs);
}

.meter { display: table-row; }

.meter-label {
  display: table-cell;
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
  padding-right: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-secondary);
}

.meter-flagged .meter-label,
.meter-flagged .meter-value {
  color: var(--danger);
  font-weight: var(--weight-semibold);
}

.meter-bar {
  display: table-cell;
  width: 98%;
  vertical-align: middle;
}

.meter-track {
  position: relative;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--bg-sunken);
}

.meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  transition: width var(--duration-fast) var(--ease-out);
}

.meter-flagged .meter-fill { background: var(--danger); }

.meter-tick {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--border-default);
}

.meter-value {
  display: table-cell;
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
  padding-left: var(--space-3);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  text-align: right;
}

.targets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.target-chip {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-wide);
  white-space: nowrap;
  color: var(--danger);
  border: var(--border-hair) solid color-mix(in srgb, var(--danger) 40%, transparent);
  border-radius: var(--radius-full);
  padding: 0.2rem 0.75rem;
}

/* Framing card lead: wider measure for the longer prose. */
.framing-lead { max-width: 70ch; font-size: var(--text-lg); }
.framing-lead code { font-size: 0.85em; }
