.fw-demo__io {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 1rem;
  margin: 0 0 0.25rem;
}
.fw-demo__text {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.6;
}
/* The connector arrow sits behind the badge on wide screens. */
.fw-demo__arrow::before {
  content: "";
  width: 1.4rem;
  height: 2px;
  background: var(--md-default-fg-color--lighter, var(--md-default-fg-color--light));
  margin-right: -0.2rem;
}

/* Inline highlight chips inside the demo text. */
.md-typeset .fw-hl {
  border-radius: 4px;
  padding: 0.05em 0.32em;
  font-weight: 600;
  color: var(--md-default-fg-color);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.md-typeset .fw-hl--pii {
  background: color-mix(in srgb, #8f5600 20%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #8f5600 45%, transparent);
}
[data-md-color-scheme="slate"] .md-typeset .fw-hl--pii {
  background: color-mix(in srgb, #e6a23c 22%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #e6a23c 50%, transparent);
}
.md-typeset .fw-hl--danger {
  background: color-mix(in srgb, #b3261e 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #b3261e 45%, transparent);
}
[data-md-color-scheme="slate"] .md-typeset .fw-hl--danger {
  background: color-mix(in srgb, #ff6b6b 20%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #ff6b6b 50%, transparent);
}
.md-typeset .fw-hl--mask {
  background: color-mix(in srgb, var(--md-primary-fg-color) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-primary-fg-color) 45%, transparent);
  font-family: var(--md-code-font-family, monospace);
  font-size: 0.92em;
}

.md-typeset .fw-hl--ok {
  background: color-mix(in srgb, var(--md-primary-fg-color) 15%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-primary-fg-color) 40%, transparent);
}
@media screen and (max-width: 44.9em) {
  .fw-demo__io {
    grid-template-columns: 1fr;
  }
}

.fw-demo__arrow .st {
  white-space: nowrap;
  transition: opacity 0.35s ease;
}
.fw-demo:not(.is-run) .fw-demo__arrow .st {
  display: none;
}
/* Pre-run: animated chevrons that shimmer toward the output, to pull the eye and
   invite a click. Replaced by the real verdict badge once run. */
.fw-demo__arrow::after {
  content: "\203A\203A\203A";
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  color: var(--md-primary-fg-color);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--md-primary-fg-color) 20%, transparent) 0%,
    var(--md-primary-fg-color) 50%,
    color-mix(in srgb, var(--md-primary-fg-color) 20%, transparent) 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fw-ready 1.3s linear infinite;
}
.fw-demo:not(.is-run) .fw-demo__arrow::before {
  display: none;
}
.fw-demo.is-run .fw-demo__arrow::after {
  display: none;
}
@keyframes fw-ready {
  from { background-position: 220% 0; }
  to { background-position: -20% 0; }
}
.fw-demo__out > .fw-demo__label,
.fw-demo__out > .fw-demo__text {
  transition: filter 0.45s ease, opacity 0.45s ease;
}
.fw-demo:not(.is-run) .fw-demo__out::after {
  content: "Press Run to reveal";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--md-default-fg-color--light);
  background: color-mix(in srgb, var(--md-default-bg-color) 82%, transparent);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  border-radius: inherit;
}
.fw-demo__run:disabled {
  cursor: default;
  opacity: 0.7;
}
.fw-demo__card--input {
  position: relative;
  overflow: hidden;
}
.fw-demo.is-scanning .fw-demo__card--input::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--md-primary-fg-color) 40%, transparent),
    transparent
  );
  animation: fw-scan 0.85s ease;
}
@keyframes fw-scan {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .fw-demo__arrow,
  .fw-demo__out,
  .fw-demo__why {
    transition: none;
  }
  .fw-demo.is-scanning .fw-demo__card--input::after,
  .fw-demo__arrow::after {
    animation: none;
  }
}

.fw-demo.is-run .fw-demo__why {
  opacity: 1;
}
.fw-demo__why-label {
  display: inline-block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 800;
  color: var(--md-primary-fg-color);
  margin-right: 0.45rem;
}
.md-typeset .fw-chip {
  display: inline-block;
  padding: 0.05em 0.5em;
  border-radius: 999px;
  font-size: 0.76em;
  font-weight: 700;
  background: color-mix(in srgb, var(--md-primary-fg-color) 14%, transparent);
  color: var(--md-primary-fg-color);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-primary-fg-color) 40%, transparent);
  white-space: nowrap;
}

/* Checks strip: the individual checks the filter ran, each with its per-check
   result (pass / flag / block / skipped). Revealed with the result. */
.fw-demo__checks,
.fw-demo__severity {
  opacity: 0;
  transition: opacity 0.45s ease;
}
.fw-demo.is-run .fw-demo__checks,
.fw-demo.is-run .fw-demo__severity {
  opacity: 1;
}
.fw-demo__checks-label,
.fw-demo__sev-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: var(--md-default-fg-color--light);
}
.md-typeset .fw-check {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15em 0.6em;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.md-typeset .fw-check::before {
  font-weight: 900;
}
.md-typeset .fw-check--pass {
  color: #0e7048;
  background: rgba(34, 197, 94, 0.14);
}
.md-typeset .fw-check--flag {
  color: #8f5600;
  background: rgba(255, 171, 0, 0.16);
}
.md-typeset .fw-check--block {
  color: #b71d18;
  background: rgba(255, 86, 48, 0.16);
}
.md-typeset .fw-check--skip {
  color: var(--md-default-fg-color--light);
  background: color-mix(in srgb, var(--md-default-fg-color--light) 14%, transparent);
}
[data-md-color-scheme="slate"] .md-typeset .fw-check--pass {
  color: #5be49b;
}
[data-md-color-scheme="slate"] .md-typeset .fw-check--flag {
  color: #ffd666;
}
[data-md-color-scheme="slate"] .md-typeset .fw-check--block {
  color: #ff8f85;
}
.fw-demo__sev-track {
  position: relative;
  flex: 1;
  max-width: 12rem;
  height: 6px;
  border-radius: 999px;
  background: var(--md-default-fg-color--lightest);
  overflow: hidden;
}
.fw-demo__sev-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  transition: width 0.6s ease 0.15s;
}
.fw-demo:not(.is-run) .fw-demo__sev-fill {
  width: 0 !important;
}
.fw-demo__sev-fill--green { background: #22c55e; }
.fw-demo__sev-fill--amber { background: #ffab00; }
.fw-demo__sev-fill--red { background: #ff5630; }
.fw-demo__sev-val {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
@media (prefers-reduced-motion: reduce) {
  .fw-demo__checks,
  .fw-demo__severity {
    transition: none;
  }
  .fw-demo__sev-fill {
    transition: none;
  }
}

/* Scanning state: the output hint changes to a pulsing "Scanning…" so the wait
   feels like work, then the result lands. */
.fw-demo.is-scanning .fw-demo__out::after {
  content: "Scanning\2026";
  animation: fw-pulse 0.7s ease-in-out infinite;
}
@keyframes fw-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
/* On reveal, the verdict badge and the checks pop in with a quick stagger. */
.fw-demo.is-run .fw-demo__arrow .st {
  animation: fw-pop 0.4s ease backwards;
}
.fw-demo.is-run .fw-check {
  animation: fw-pop 0.35s ease backwards;
}
.fw-demo.is-run .fw-check:nth-child(3) { animation-delay: 0.06s; }
.fw-demo.is-run .fw-check:nth-child(4) { animation-delay: 0.12s; }
.fw-demo.is-run .fw-check:nth-child(5) { animation-delay: 0.18s; }
.fw-demo.is-run .fw-check:nth-child(6) { animation-delay: 0.24s; }
@keyframes fw-pop {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: none; }
}

/* Monitoring-mode indicator (the "eye" the dashboard shows): marks a result that
   was flagged but let through because the filter is in monitoring mode. */
.md-typeset .fw-monitor {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #8f5600;
  font-weight: 700;
}
[data-md-color-scheme="slate"] .md-typeset .fw-monitor {
  color: #ffd666;
}
.md-typeset .fw-monitor svg {
  width: 0.95em;
  height: 0.95em;
  stroke: currentcolor;
  fill: none;
  stroke-width: 2;
}
@media (prefers-reduced-motion: reduce) {
  .fw-demo.is-scanning .fw-demo__out::after,
  .fw-demo.is-run .fw-demo__arrow .st,
  .fw-demo.is-run .fw-check {
    animation: none;
  }
}

/* ---------------------------------------------------------------------------
   Compact -> expand behaviour. By default a demo shows only the input card and
   the Run button. On run the panel expands downward: first a loader (while the
   scan runs), then the full result (verdict, output, checks, severity, why).
   --------------------------------------------------------------------------- */
.fw-demo__reveal {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-top: 0;
  transition: max-height 0.5s ease, opacity 0.4s ease, margin-top 0.4s ease;
}
.fw-demo.is-scanning .fw-demo__loader {
  display: flex;
}
.fw-demo__spinner {
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--md-primary-fg-color) 28%, transparent);
  border-top-color: var(--md-primary-fg-color);
  animation: fw-spin 0.7s linear infinite;
}
@keyframes fw-spin {
  to { transform: rotate(360deg); }
}
.fw-demo__body {
  display: none;
}
.fw-demo.is-run .fw-demo__body {
  display: block;
}
@media (prefers-reduced-motion: reduce) {
  .fw-demo__reveal {
    transition: none;
  }
  .fw-demo__spinner {
    animation: none;
  }
}

.fw-demo__io {
  gap: 0;
  margin: 0;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
}
.fw-demo__card {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: var(--md-radius, 8px);
  background: var(--md-default-bg-color);
  box-shadow: var(--mx-shadow);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 0.85rem 1rem;
}
.fw-demo__label {
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--md-default-fg-color--light);
  margin-bottom: 0.45rem;
  font-size: 0.7rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}
.fw-demo__arrow::after {
  content: "\2192";
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--md-primary-fg-color--light);
  background: none;
  -webkit-text-fill-color: currentColor;
  animation: none;
}
.fw-demo:not(.is-run) .fw-demo__out > .fw-demo__label,
.fw-demo:not(.is-run) .fw-demo__out > .fw-demo__text {
  filter: blur(5px);
  opacity: 0.4;
  user-select: none;
  filter: none;
  opacity: 0;
}
.fw-demo:not(.is-run) .fw-demo__out::after {
  content: "Run the check to see the result";
  font-weight: 400;
  letter-spacing: 0;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.fw-demo.is-scanning .fw-demo__card--input::after {
  display: none;
}
.fw-demo__run:hover {
  background: color-mix(in srgb, var(--md-primary-fg-color) 20%, var(--md-default-bg-color));
  box-shadow: 0 0 14px color-mix(in srgb, var(--md-primary-fg-color) 30%, transparent);
  background: color-mix(in srgb, var(--md-default-fg-color) 6%, transparent);
  box-shadow: none;
}
.fw-demo__run:focus-visible {
  outline: 2px solid var(--md-primary-fg-color);
  outline-offset: 2px;
  outline: 1px solid var(--md-primary-fg-color--light);
  outline-offset: 3px;
}
.fw-demo__reveal {
  padding: 0 1rem;
}
.fw-demo__out {
  /* Interactive: the verdict badge and the output card stay hidden until the
  reader presses "Run through the firewall". A brief scan sweep animates over
  the input, then the result fades in. Motion is skipped for reduced-motion. */
  /* Pre-run state: no empty boxes. The verdict shows a neutral "Ready" pill and
  the output is present but blurred behind a "Press Run to reveal" hint, so the
  card looks intentional. On run, the badge and the sharp output take over. */
  position: relative;
  overflow: hidden;
  border-left: 1px solid var(--md-default-fg-color--lightest);
}
@media screen and (max-width: 44.9em) {
  .fw-demo__out {
    border-left: none;
    border-top: 1px solid var(--md-default-fg-color--lightest);
  }
}

.fw-demo__checks-label,
.fw-demo__sev-label,
.fw-demo__why-label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--md-default-fg-color--light);
}
.fw-demo.is-scanning .fw-demo__reveal,
.fw-demo.is-run .fw-demo__reveal {
  max-height: 44rem;
  opacity: 1;
  margin-top: 1rem;
  margin-top: 0;
}
/* Colour only where it carries the verdict: the verdict badge and each check's mark. The check
   names, the highlighted text and the chips in the explanation stay in the text colour. */
.md-typeset .fw-demo .fw-check {
  padding: 0;
  margin-right: 0.7rem;
  background: none;
  border-radius: 0;
  font-weight: 500;
  color: var(--md-default-fg-color);
}
.md-typeset .fw-check--pass::before {
  content: "\2713"; color: #0e7048; }
.md-typeset .fw-check--flag::before {
  content: "\26A0"; color: #8f5600; }
.md-typeset .fw-check--block::before {
  content: "\2717"; color: #b71d18; }
.md-typeset .fw-check--skip::before {
  content: "\2013"; color: var(--md-default-fg-color--light); }
[data-md-color-scheme="slate"] .md-typeset .fw-check--pass::before { color: #5be49b; }
[data-md-color-scheme="slate"] .md-typeset .fw-check--flag::before { color: #ffd666; }
[data-md-color-scheme="slate"] .md-typeset .fw-check--block::before { color: #ff8f85; }
.md-typeset .fw-demo .fw-chip {
  padding: 0;
  font-size: inherit;
  font-weight: 700;
  background: none;
  box-shadow: none;
  color: var(--md-default-fg-color);
}
.md-typeset .fw-demo .fw-hl {
  padding: 0;
  border-radius: 0;
  background: none;
  font-weight: inherit;
}
.md-typeset .fw-demo .fw-hl--danger { box-shadow: inset 0 -2px 0 #b3261e; }
.md-typeset .fw-demo .fw-hl--pii { box-shadow: inset 0 -2px 0 #8f5600; }
.md-typeset .fw-demo .fw-hl--mask,
.md-typeset .fw-demo .fw-hl--ok { box-shadow: inset 0 -2px 0 var(--md-primary-fg-color--light); }
[data-md-color-scheme="slate"] .md-typeset .fw-demo .fw-hl--danger { background: none; box-shadow: inset 0 -2px 0 #ff6b6b; }
[data-md-color-scheme="slate"] .md-typeset .fw-demo .fw-hl--pii { background: none; box-shadow: inset 0 -2px 0 #e6a23c; }
/* Tabs that hold the demo: no panel of their own around it, the demo box is the panel. */
.md-typeset .tabbed-set:has(.fw-demo) {
  box-shadow: none;
  overflow: visible;
}
.md-typeset .tabbed-set:has(.fw-demo) > .tabbed-content {
  padding: 0.5rem 0 0;
}
.fw-demo__reveal {
  padding: 0 1rem 0.2rem;
}
.fw-demo__checks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.9rem;
  margin-top: 0.1rem;
}
.fw-demo__severity {
  /* Severity meter: a thin bar that fills to the request's severity on run. */
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.65rem;
  font-size: 0.72rem;
  color: var(--md-default-fg-color--light);
  margin-top: 0.4rem;
}
/* Only the input and the result are boxed; the button and the explanation sit under the box as
   page content, aligned with the text. */
.fw-demo {
  /* ---------------------------------------------------------------------------
  "See it in action": before/after filtering demo on the home page. Two cards
  (the text coming IN and what MATVIS forwards OUT) with a verdict badge in the
  middle, plus inline highlighted spans showing what was detected (PII/danger)
  and how the text was rewritten (masked placeholders). Pure HTML+CSS, works in
  both themes, collapses to a single column on narrow screens.
  --------------------------------------------------------------------------- */
  /* The whole demo is a distinct interactive panel: a faint brand-tinted surface
  so the section reads as a hands-on widget, not just prose. */
  border: 1px solid color-mix(in srgb, var(--md-primary-fg-color) 22%, transparent);
  border-radius: 14px;
  padding: 1.1rem 1.15rem 1.2rem;
  background:
    radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--md-primary-fg-color) 7%, transparent), transparent 70%),
    var(--md-default-bg-color);
  /* "See it in action", flattened: one box like a code block, the input and the result in two
  columns with a line between them, a plain arrow, the run button like the terminal's. These
  rules sit last so they win over the demo's earlier ones; the demo's behaviour is unchanged. */
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: var(--md-radius, 4px);
  padding: 0;
  background: var(--md-code-bg-color);
  border: none;
  border-radius: 0;
  background: none;
}
.fw-demo__io {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: var(--md-radius, 4px);
  background: var(--md-code-bg-color);
}
.fw-demo__run {
  display: block;
  margin: 0.9rem auto 0;
  padding: 0.5rem 1.15rem;
  border: 1px solid var(--md-primary-fg-color);
  border-radius: 999px;
  background: color-mix(in srgb, var(--md-primary-fg-color) 12%, var(--md-default-bg-color));
  color: var(--md-primary-fg-color);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
  display: inline-block;
  margin: 0.75rem 1rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--md-primary-fg-color--light);
  border-radius: 6px;
  background: transparent;
  color: var(--md-default-fg-color);
  font-size: 0.72rem;
  font-weight: 600;
  /* Tighter result: the button, the checks, the severity and the explanation close together. */
  margin: 0.6rem 1rem;
  margin: 0.6rem 0 0.2rem;
}
.fw-demo__reveal {
  padding: 0;
}
.fw-demo__why {
  /* "Why this result": revealed with the output, it names the check that fired and
  the exact firewall-config setting behind the outcome (allowlist entry, bypass
  tag, monitoring mode, ...) so the reader sees *why*, not just *what*. */
  opacity: 0;
  transition: opacity 0.45s ease;
  margin-top: 0.85rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--md-default-fg-color--lightest);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--md-default-fg-color--light);
  margin: 0.5rem 0 0.7rem;
  padding-top: 0.5rem;
  border-top: none;
  padding-top: 0;
  margin: 0.45rem 0 0;
}
/* While scanning: a quiet line next to the button, not a headline. */
.fw-demo__loader {
  display: none;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 0.2rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--md-primary-fg-color);
  padding: 0.3rem 0;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--md-default-fg-color--light);
}
.fw-demo__spinner {
  border-color: color-mix(in srgb, var(--md-primary-fg-color--light) 30%, transparent);
  border-top-color: var(--md-primary-fg-color--light);
}
.fw-demo__spinner {
  width: 0.8rem;
  height: 0.8rem;
}

/* Demo verdict badge: no connector dash before it, and room on both sides so it never touches
   the divider between the two cards. */
.fw-demo__arrow::before {
  display: none;
}
.fw-demo__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.5rem;
  padding: 0 0.9rem;
}
