/* ============================================================
   Red Lotus — Diagram primitives
   Hand-built HTML/CSS/JS illustrations for blog posts.
   No libraries. Each diagram is progressive-enhancement:
   it renders statically and animates only if JS + motion allow.
   ============================================================ */

/* ---- Shared shell around any interactive diagram ---- */
.diagram {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(202, 77, 77, 0.10), transparent 70%),
    var(--dark-surface);
  border: 1px solid var(--dark-border);
  border-radius: 18px;
  padding: clamp(24px, 4vw, 44px);
  position: relative;
  overflow: hidden;
}

.diagram-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.diagram-title {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--red-bright);
  display: flex;
  align-items: center;
  gap: 10px;
}

.diagram-title::before {
  content: '';
  width: 20px;
  height: 1px;
  background: var(--red);
}

.diagram-replay {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--dark-border);
  border-radius: 50px;
  padding: 9px 18px;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.diagram-replay:hover {
  border-color: var(--red);
  background: rgba(202, 77, 77, 0.08);
}

.diagram-replay svg {
  width: 15px;
  height: 15px;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.diagram-replay:hover svg { transform: rotate(-180deg); }
.diagram-replay[disabled] { opacity: 0.45; cursor: default; }
.diagram-replay[disabled]:hover { border-color: var(--dark-border); background: transparent; }

/* ============================================================
   Layered architecture diagram
   ============================================================ */
.arch {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Vertical rail that the request/response packet travels along */
.arch-rail {
  position: absolute;
  left: 50%;
  top: 8px;
  bottom: 8px;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(to bottom, var(--dark-border), rgba(255,255,255,0.12), var(--dark-border));
  z-index: 0;
  border-radius: 2px;
}

/* The travelling glow */
.arch-packet {
  position: absolute;
  left: 50%;
  top: 0;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--red-bright);
  box-shadow: 0 0 0 5px rgba(224, 85, 85, 0.18), 0 0 22px 6px var(--red-glow);
  z-index: 4;
  opacity: 0;
  transform: translateY(0);
  pointer-events: none;
}

.arch-packet.flowing { opacity: 1; }

.arch-packet.is-response {
  background: #6fcf97;
  box-shadow: 0 0 0 5px rgba(111, 207, 151, 0.18), 0 0 22px 6px rgba(111, 207, 151, 0.35);
}

.arch-layer {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 20px;
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 14px;
  padding: 20px 24px;
  transition: border-color 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s ease, background 0.4s ease;
}

.arch-layer .layer-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--dark-border);
  color: var(--text-muted);
  transition: color 0.4s ease, border-color 0.4s ease, background 0.4s ease;
}

.arch-layer .layer-icon svg { width: 22px; height: 22px; stroke-width: 1.5; }

.arch-layer .layer-index {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 1px;
  color: var(--text-muted);
  opacity: 0.6;
  margin-bottom: 4px;
}

.arch-layer h4 {
  font-family: var(--serif);
  font-size: 1.18rem;
  font-weight: 400;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 4px;
}

.arch-layer p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

.arch-layer .layer-tags {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.arch-layer .layer-tags span {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border: 1px solid var(--dark-border);
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
  transition: color 0.4s ease, border-color 0.4s ease;
}

/* Active (packet currently here) */
.arch-layer.active {
  border-color: rgba(202, 77, 77, 0.55);
  background: #1b1620;
  transform: translateX(4px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(202, 77, 77, 0.25);
}

.arch-layer.active .layer-icon {
  color: var(--red-bright);
  border-color: rgba(202, 77, 77, 0.5);
  background: rgba(202, 77, 77, 0.10);
}

.arch-layer.active .layer-tags span {
  color: var(--text-primary);
  border-color: rgba(202, 77, 77, 0.35);
}

/* Visited (packet already passed on the way down) */
.arch-layer.visited { border-color: rgba(255, 255, 255, 0.14); }

/* Response highlight tint */
.arch-layer.responded {
  border-color: rgba(111, 207, 151, 0.45);
}
.arch-layer.responded .layer-icon {
  color: #6fcf97;
  border-color: rgba(111, 207, 151, 0.4);
  background: rgba(111, 207, 151, 0.08);
}

/* Legend under the stack */
.arch-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--dark-border);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.arch-legend .legend-item { display: flex; align-items: center; gap: 9px; }

.arch-legend .legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.arch-legend .legend-dot.req {
  background: var(--red-bright);
  box-shadow: 0 0 10px var(--red-glow);
}

.arch-legend .legend-dot.res {
  background: #6fcf97;
  box-shadow: 0 0 10px rgba(111, 207, 151, 0.4);
}

.arch-status {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  min-width: 120px;
  text-align: right;
}

@media (max-width: 600px) {
  .arch-layer {
    grid-template-columns: 40px 1fr;
    gap: 14px;
    padding: 16px 16px;
  }
  .arch-layer .layer-tags { display: none; }
  .diagram-toolbar { margin-bottom: 24px; }
  .arch-status { display: none; }
}

/* Static fallback: if JS never runs, show the path lit so the
   diagram still reads as a connected request flow. */
.diagram.no-js .arch-rail {
  background: linear-gradient(to bottom, var(--red), rgba(202,77,77,0.25));
}
.diagram.no-js .arch-packet { display: none; }

@media (prefers-reduced-motion: reduce) {
  .arch-layer.active { transform: none; }
}

/* ============================================================
   Vendor-swap diagram
   Consumer (top) → middleware (middle) → swappable store (bottom).
   The top card never changes; the bottom payload does.
   ============================================================ */
.vendor-switch {
  display: inline-flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--dark-border);
  border-radius: 50px;
  padding: 4px;
}

.vendor-btn {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 50px;
  padding: 7px 16px;
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease;
}

.vendor-btn:hover { color: var(--text-primary); }

.vendor-btn.active {
  color: #fff;
  background: var(--red);
  box-shadow: 0 2px 12px var(--red-glow);
}

/* Widen this figure past the 720px text column so three cards fit in a row */
.article-body > figure:has(.swap) { max-width: 820px; }

.swap {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) auto minmax(0, 1fr) auto minmax(0, 1.15fr);
  align-items: stretch;
  gap: 8px;
}

.swap-node {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 14px;
  padding: 13px 16px;
  min-width: 0;
}

.swap-node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-bottom: 8px;
}

.swap-kind {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.swap-flag {
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.5px;
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
}

.swap-flag--same {
  color: #6fcf97;
  border: 1px solid rgba(111, 207, 151, 0.4);
  background: rgba(111, 207, 151, 0.08);
}

.swap-flag--diff {
  color: var(--red-bright);
  border: 1px solid rgba(202, 77, 77, 0.4);
  background: rgba(202, 77, 77, 0.10);
}

/* Consumer card */
.swap-consumer {
  border-color: rgba(111, 207, 151, 0.3);
}

.swap-consumer h4 {
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 400;
  color: #fff;
  margin-bottom: 8px;
}

.swap-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.swap-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
  border-bottom: 1px solid var(--dark-border);
}

.swap-row:last-child { border-bottom: none; }

.swap-row span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.swap-row b {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-primary);
  text-align: right;
}

.swap-row b.ok { color: #6fcf97; }

/* Middleware */
.swap-middle {
  border-color: rgba(202, 77, 77, 0.35);
  background: #1b1620;
}

.swap-mid-text {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.5;
}

.swap-mid-text code {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--red-bright);
  background: rgba(202, 77, 77, 0.10);
  border: 1px solid rgba(202, 77, 77, 0.25);
  border-radius: 6px;
  padding: 1px 7px;
}

.swap-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.swap-badges span {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border: 1px solid var(--dark-border);
  border-radius: 6px;
  padding: 4px 10px;
}

.swap-middle.pulsing {
  animation: swapPulse 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes swapPulse {
  0%   { border-color: rgba(202, 77, 77, 0.35); box-shadow: none; }
  40%  { border-color: var(--red); box-shadow: 0 0 0 1px var(--red), 0 0 28px 2px var(--red-glow); }
  100% { border-color: rgba(202, 77, 77, 0.35); box-shadow: none; }
}

/* Store payload */
.swap-vendor { border-color: rgba(202, 77, 77, 0.3); }

.article-body .swap-payload {
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  max-width: none;
  white-space: pre;
  overflow: visible;
}

.swap-payload.swap-in {
  animation: swapIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes swapIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Connector arrows between nodes (data flows upward on a read) */
.swap-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 1px 0;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

/* Horizontal layout: the narrative lives in the figcaption, arrows point at the consumer */
.swap-arrow span { display: none; }

.swap-arrow svg {
  width: 18px;
  height: 18px;
  stroke: var(--red);
  flex-shrink: 0;
  transform: rotate(-90deg);
}

@media (max-width: 760px) {
  .swap {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .swap-arrow span { display: inline; }
  .swap-arrow svg { transform: none; }
  .vendor-switch { width: 100%; justify-content: space-between; }
  .swap-node { padding: 16px 16px; }
  .swap-payload { font-size: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
  .swap-middle.pulsing,
  .swap-payload.swap-in { animation: none; }
}

/* ============================================================
   Components / topology diagram
   Consumers (left) → middleware (center) → systems (right).
   ============================================================ */
.topo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(150px, 1fr) 28px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.topo-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topo-colhead {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-left: 4px;
  margin-bottom: 2px;
}

.topo-node {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 12px;
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 12px;
  padding: 13px 14px;
  transition: border-color 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.diagram:not(.no-js) .topo-node:hover {
  border-color: rgba(202, 77, 77, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.3);
}

.topo-node-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--dark-border);
  color: var(--text-muted);
}

.topo-node-icon svg { width: 20px; height: 20px; stroke-width: 1.5; }

.topo-node h4 {
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.25;
  margin: 0;
}

.topo-node > div { min-width: 0; }

.topo-node-tag {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

/* Middleware hub */
.topo-mid {
  background: #1b1620;
  border: 1px solid rgba(202, 77, 77, 0.45);
  border-radius: 16px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(202, 77, 77, 0.12), 0 12px 40px rgba(0, 0, 0, 0.35);
}

.topo-mid-kind {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--red-bright);
  margin-bottom: 8px;
}

.topo-mid h4 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.16rem;
  color: #fff;
  margin: 0 0 14px;
}

.topo-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 14px;
}

.topo-badges span {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  border: 1px solid rgba(202, 77, 77, 0.3);
  background: rgba(202, 77, 77, 0.08);
  border-radius: 6px;
  padding: 3px 8px;
}

.topo-host {
  font-family: var(--mono);
  font-size: 0.64rem;
  color: var(--text-muted);
}

.topo-host code { color: var(--text-primary); }

/* Connectors between the columns */
.topo-link {
  position: relative;
  height: 2px;
  min-width: 22px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--dark-border) 25%, var(--dark-border) 75%, transparent);
}

.topo-link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: var(--red);
  opacity: 0;
}

.diagram:not(.no-js) .topo-link--l::after { animation: topoPulse 3.2s ease-in-out infinite; }
.diagram:not(.no-js) .topo-link--r::after { animation: topoPulse 3.2s ease-in-out infinite 1.6s; }

@keyframes topoPulse {
  0%, 100% { opacity: 0; box-shadow: none; }
  50%      { opacity: 0.55; box-shadow: 0 0 12px var(--red-glow); }
}

@media (max-width: 820px) {
  .topo { grid-template-columns: 1fr; gap: 8px; }
  .topo-colhead { text-align: center; padding-left: 0; }
  .topo-link {
    height: 22px;
    width: 2px;
    min-width: 0;
    margin: 2px auto;
    background: linear-gradient(180deg, transparent, var(--dark-border), transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .topo-link::after { animation: none !important; }
}

/* -----------------------------------------------------------
   Flow diagram — direct-vs-middleware toggle
   ----------------------------------------------------------- */
.flow-switch {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--dark-border);
}
.flow-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  transition: background 0.25s ease, color 0.25s ease;
}
.flow-btn:hover { color: var(--text-primary); }
.flow-btn.active {
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 14px var(--red-glow);
}
.diagram.no-js .flow-switch { display: none; }

.flow-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 3;
  container-type: size;
  margin-top: 10px;
}

.flow-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  z-index: 1;
}
.flow-link {
  fill: none;
  stroke: var(--red);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.flow-links--direct .flow-link {
  stroke: #b06a6a;
  stroke-dasharray: 5 5;
}
.flow-stage:not(.with-mw) .flow-links--direct .flow-link { opacity: 0.5; }
.flow-stage.with-mw .flow-links--mw .flow-link { opacity: 0.7; }
.diagram:not(.no-js) .flow-stage.with-mw .flow-links--mw .flow-link {
  animation: flowPulse 3.4s ease-in-out infinite;
}
@keyframes flowPulse {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.85; }
}

.flow-colhead {
  position: absolute;
  top: 0;
  font-family: var(--mono);
  font-size: clamp(8px, 1.7cqw, 11px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  z-index: 2;
}
.flow-colhead--in { left: 1%; }
.flow-colhead--out { right: 1%; text-align: right; }

/* Absolutely-positioned nodes (reuse .topo-node card styling) */
.flow-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 26cqw;
  grid-template-columns: clamp(26px, 8cqw, 40px) 1fr;
  gap: 2cqw;
  padding: 1.8cqw 2.2cqw;
  border-radius: 2.2cqw;
  margin: 0;
  z-index: 2;
}
.flow-node .topo-node-icon {
  width: clamp(26px, 8cqw, 40px);
  height: clamp(26px, 8cqw, 40px);
  border-radius: 1.6cqw;
}
.flow-node .topo-node-icon svg {
  width: clamp(14px, 4.4cqw, 22px);
  height: clamp(14px, 4.4cqw, 22px);
}
.flow-node h4 { font-size: clamp(10px, 2.4cqw, 15px); }
.flow-node .topo-node-tag { font-size: clamp(8px, 1.6cqw, 11px); }

.flow-mid {
  position: absolute;
  transform: translate(-50%, -50%) scale(0.92);
  width: 34cqw;
  margin: 0;
  opacity: 0;
  z-index: 3;
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.flow-stage.with-mw .flow-mid {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.flow-mid h4 { font-size: clamp(14px, 3.4cqw, 24px); }
.flow-mid .topo-mid-kind,
.flow-mid .topo-host { font-size: clamp(8px, 1.6cqw, 11px); }
.flow-mid .topo-badges { gap: 1cqw; margin: 1.4cqw 0; }
.flow-mid .topo-badges span {
  font-size: clamp(8px, 1.7cqw, 11px);
  padding: 0.8cqw 1.4cqw;
}

@media (max-width: 560px) {
  .flow-stage { aspect-ratio: 1 / 1; }
  .flow-node { width: 30cqw; padding: 2.2cqw 2.4cqw; }
  .flow-mid { width: 40cqw; }
}

@media (prefers-reduced-motion: reduce) {
  .flow-link { transition: none !important; animation: none !important; }
  .flow-mid { transition: none !important; }
}

/* ============================================================
   Migration-type spectrum (static)
   Three cards along a cost-vs-fidelity rail. Pure CSS, no JS.
   ============================================================ */
.spectrum-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.spectrum-card {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 14px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spectrum-card--iii {
  border-color: rgba(202, 77, 77, 0.45);
  background: #1b1620;
}

.spectrum-kind {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.spectrum-card--iii .spectrum-kind { color: var(--red-bright); }

.spectrum-card h4 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.1rem;
  line-height: 1.25;
  color: #fff;
  margin: 0;
}

.spectrum-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

.spectrum-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
}

.spectrum-tags span {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border: 1px solid var(--dark-border);
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
}

.spectrum-card--iii .spectrum-tags span {
  color: var(--text-primary);
  border-color: rgba(202, 77, 77, 0.35);
}

.spectrum-rail {
  position: relative;
  height: 4px;
  border-radius: 4px;
  margin: 24px 4px 12px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.10), rgba(202, 77, 77, 0.5), var(--red-bright));
  box-shadow: 0 0 16px rgba(202, 77, 77, 0.18);
}

.spectrum-rail::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-top: 2.5px solid var(--red-bright);
  border-right: 2.5px solid var(--red-bright);
  transform: translateY(-50%) rotate(45deg);
}

.spectrum-axis {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.spectrum-axis span:last-child {
  text-align: right;
  color: var(--text-primary);
}

@media (max-width: 720px) {
  .spectrum-cards { grid-template-columns: 1fr; }
}

/* ============================================================
   Spreadsheet mock — a table rendered as an Excel-style sheet
   (used by the vendor-matrix post)
   ============================================================ */
.sheet {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 14px;
  overflow: hidden;
}
.sheet-titlebar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  background: var(--dark-surface);
  border-bottom: 1px solid var(--dark-border);
}
.sheet-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}
.sheet-filename {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--text-muted);
}
.sheet-filename::before {
  content: 'X';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: #1d6f42;
  color: #fff;
  font-family: var(--sans);
  font-size: 0.6rem;
  font-weight: 700;
}
.sheet-scroll { overflow-x: auto; }
.sheet-grid {
  display: grid;
  grid-template-columns: 44px 0.7fr 1.5fr 1.3fr 1.1fr;
  min-width: 540px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.4;
}
.sheet-grid > div {
  padding: 9px 14px;
  border-bottom: 1px solid var(--dark-border);
  border-right: 1px solid var(--dark-border);
  white-space: nowrap;
}
.sheet-grid > div:nth-child(5n) { border-right: none; }
.sheet-grid > div:nth-last-child(-n+5) { border-bottom: none; }
.sheet-corner,
.sheet-colhead,
.sheet-rowhead {
  background: var(--dark-surface);
  color: var(--text-muted);
  font-size: 0.68rem;
  text-align: center;
}
.sheet-cell { color: var(--text-primary); }
.sheet-cell--head {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-weight: 600;
}
.sheet-cell--hit { background: rgba(202, 77, 77, 0.12); }
.sheet-rowhead--hit {
  color: var(--red-bright);
  background: rgba(202, 77, 77, 0.12);
}

/* ============================================================
   Form mock duo — redundant form vs. essentials-only form
   (used by the vendor-matrix post)
   ============================================================ */
.formduo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 640px) {
  .formduo { grid-template-columns: 1fr; }
}
.formmock {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 14px;
  padding: 18px;
}
.formmock--smart { border-color: rgba(202, 77, 77, 0.4); }
.formmock-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.formmock-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.66rem;
  flex: none;
}
.formmock-badge--bad {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}
.formmock-badge--good {
  background: var(--red);
  color: #fff;
}
.formmock-field { margin-bottom: 12px; }
.formmock-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-family: var(--sans);
  font-size: 0.74rem;
  color: var(--text-primary);
}
.formmock-chip {
  font-family: var(--mono);
  font-size: 0.58rem;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(202, 77, 77, 0.12);
  color: var(--red-bright);
  white-space: nowrap;
}
.formmock-input {
  padding: 8px 12px;
  border: 1px solid var(--dark-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-family: var(--sans);
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.formmock-input--select {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.formmock-input--area {
  min-height: 58px;
  white-space: normal;
}
.formmock-note {
  margin: 2px 0 14px;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-style: italic;
  color: var(--text-muted);
}
.formmock-btn {
  display: inline-block;
  padding: 8px 22px;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 600;
}
.formmock-btn--muted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}
.formmock-btn--red {
  background: var(--red);
  color: #fff;
}
