:root {
  color-scheme: dark;
  --bg: #09101d;
  --panel: #101a2c;
  --panel2: #0c1525;
  --text: #e9eef8;
  --muted: #91a0b8;
  --line: #293752;
  --blue: #6e83ff;
  --cyan: #31c6b0;
  --orange: #f19a62;
  --red: #ee6572;
  --canvas-muted: #91a0b8;
  --canvas-label: #b7c2d6;
  --canvas-strong: #eef2ff;
  --canvas-line: #34425d;
  --binary-color: #eb6170;
  --colormap-gradient: linear-gradient(
    90deg,
    transparent,
    #6177ff,
    #28bfa7,
    #ed985f,
    #eb6170
  );
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel2: #eef2f8;
  --text: #172033;
  --muted: #5f6c82;
  --line: #cbd4e2;
  --blue: #5268df;
  --cyan: #008d7c;
  --orange: #c96e32;
  --red: #cf4053;
  --canvas-muted: #60708a;
  --canvas-label: #344158;
  --canvas-strong: #111827;
  --canvas-line: #9ba8ba;
}
.gallery-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.gallery-link:hover {
  text-decoration: underline;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.45 Inter,
    ui-sans-serif,
    system-ui,
    sans-serif;
  transition:
    background 0.18s,
    color 0.18s;
}
header {
  min-height: 68px;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel2);
}
h1,
h2 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
}
h1 {
  font-size: 18px;
}
h2 {
  font-size: 16px;
}
p {
  margin: 3px 0 0;
  color: var(--muted);
}
.brand {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--blue);
}
.appearance {
  display: flex;
  align-items: end;
  gap: 10px;
}
.appearance label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.appearance select {
  min-width: 110px;
  margin-top: 2px;
  padding: 5px 8px;
  text-transform: none;
  letter-spacing: 0;
}
main {
  padding: 24px;
  max-width: 1500px;
  margin: auto;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}
.pipeline {
  display: flex;
  align-items: center;
  gap: 18px;
  overflow-x: auto;
  padding: 30px 6px 38px;
}
.product {
  position: relative;
  flex: 0 0 210px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.product canvas {
  width: 210px;
  height: 190px;
  display: block;
}
.product strong,
.product span {
  display: block;
  text-align: center;
}
.product strong {
  margin-top: 5px;
}
.product span {
  font:
    12px ui-monospace,
    SFMono-Regular,
    monospace;
  color: var(--muted);
}
.product.selected canvas {
  filter: drop-shadow(0 0 8px rgba(110, 131, 255, 0.55));
}
.edge {
  position: relative;
  flex: 0 0 88px;
  height: 2px;
  background: var(--line);
}
.edge:after {
  content: "";
  position: absolute;
  right: -1px;
  top: -4px;
  border-left: 8px solid var(--line);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}
.edge.disconnected {
  height: 1px;
  background: none;
  opacity: 0.8;
}
.edge.disconnected:after {
  display: none;
}
.edge span {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}
.inspector {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.inspect-grid {
  display: grid;
  grid-template-columns: minmax(400px, 1fr) 260px;
  gap: 28px;
  margin-top: 14px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}
#volume {
  width: 100%;
  height: 450px;
  display: block;
  cursor: grab;
  touch-action: none;
}
#volume:active {
  cursor: grabbing;
}
aside {
  display: flex;
  flex-direction: column;
  gap: 17px;
}
.fixed-dimensions {
  min-width: 0;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.fixed-dimensions legend {
  padding: 0 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.fixed-dimension + .fixed-dimension {
  margin-top: 12px;
}
.fixed-dimension label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.fixed-dimensions p {
  margin-top: 8px;
  font-size: 11px;
}
label {
  font-weight: 600;
}
select,
input[type="range"] {
  display: block;
  width: 100%;
  margin-top: 7px;
}
select,
button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  padding: 8px 10px;
}
button {
  cursor: pointer;
}
button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}
button:focus-visible,
select:focus-visible,
input:focus-visible,
#volume:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
.check {
  font-weight: 400;
}
.check input {
  margin-right: 6px;
}
.scale {
  height: 9px;
  background: var(--colormap-gradient);
}
.scale.binary {
  height: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(
    90deg,
    transparent 0 48%,
    var(--line) 48% 50%,
    var(--binary-color) 50% 100%
  );
}
.scale-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  margin-top: -14px;
}
output {
  float: right;
  color: var(--muted);
  font-weight: 400;
}
dl {
  margin: 0;
  border-top: 1px solid var(--line);
}
dl div {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
dt {
  font-size: 11px;
  color: var(--muted);
}
dd {
  margin: 2px 0 0;
  font-variant-numeric: tabular-nums;
}
.empty-state {
  width: 100%;
  padding: 36px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  text-align: center;
}
@media (max-width: 780px) {
  main {
    padding: 16px;
  }
  .inspect-grid {
    grid-template-columns: 1fr;
  }
  .product {
    flex-basis: 170px;
  }
  .product canvas {
    width: 170px;
  }
  .edge {
    flex-basis: 50px;
  }
  #volume {
    height: 330px;
  }
  .appearance {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .brand {
    display: none;
  }
}

/* Keep native vertical scrolling, projected onto the overview depth axis.
   Counter-rotate cards so the plots and labels stay upright. */
.tap-stack {
  flex: 0 0 230px;
  min-width: 0;
}
.tap-stack h3 {
  height: 36px;
  margin: 0;
  text-align: center;
  font-size: 14px;
  line-height: 18px;
  overflow: hidden;
}
.view-carousel {
  position: relative;
  height: 420px;
  margin-block: 65px;
  width: calc(100% + 70px);
  margin-inline: -35px;
  transform: rotate(10deg);
  overflow-y: auto;
  overflow-x: hidden;
  padding-block: 90px;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  mask-image: linear-gradient(transparent, black 8%, black 92%, transparent);
}
.view-carousel .product {
  display: block;
  width: 210px;
  height: 240px;
  margin: 0 auto;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  z-index: 1;
  opacity: var(--view-opacity, 0.3);
  transform: rotate(-10deg) scale(var(--view-scale, 0.68));
  /* Scroll position supplies continuous interpolation, without a delayed snap. */
}
/* Overlap the neighbors, retaining end padding for exact scroll centering. */
.view-carousel .product:not(:last-child) {
  margin-bottom: -120px;
}
.view-carousel .product::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, var(--bg) 58%, transparent 78%);
  opacity: var(--view-focus, 0);
}
.view-carousel .product:focus-visible {
  outline: 2px solid #6177ff;
  outline-offset: -2px;
  opacity: 1;
}
.view-controls {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.view-controls[hidden] {
  display: flex;
  visibility: hidden;
}
.view-controls span {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
.view-controls button {
  padding: 3px 9px;
  font-size: 16px;
}
.view-controls button:disabled {
  opacity: 0.3;
  cursor: default;
}
@media (prefers-reduced-motion: reduce) {
  .view-carousel .product { transition: none; }
}
@media (max-width: 780px) {
  .tap-stack { flex-basis: 190px; }
  .view-carousel .product { width: 170px; }
}

/* Room for diagonal previews at the two ends of the horizontal pipeline. */
.pipeline { padding-inline: 55px; }

.comparison {
  border-top: 1px solid var(--line);
  padding-block: 20px;
}
.comparison[hidden] { display: none; }
.comparison-views {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 8px 2px 16px;
  scroll-snap-type: x proximity;
}
.comparison-card {
  flex: 0 0 max(460px, calc((100% - 14px) / 2));
  min-width: 0;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  scroll-snap-align: start;
}
.comparison-card header { min-height: 40px; background: transparent; border: 0; display: flex; justify-content: space-between; gap: 10px; padding: 0; }
.comparison-card h3 { margin: 0; font-size: 14px; }
.comparison-card iframe { display: block; width: 100%; height: 780px; border: 0; margin-top: 8px; }
.comparison-card > p { font-size: 12px; }
.embedded-viewer body > header > div:first-child,
.embedded-viewer #gallery-link,
.embedded-viewer .brand,
.embedded-viewer section[aria-labelledby="pipeline-title"],
.embedded-viewer #comparison,
.embedded-viewer #hold-comparison,
.embedded-viewer #save-chain { display: none; }
.embedded-viewer main { padding: 12px; }
.embedded-viewer .inspector { border: 0; padding: 0; }
.embedded-viewer .inspect-grid { grid-template-columns: 1fr; }
.embedded-viewer #volume { height: 330px; }
.embedded-viewer aside { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.embedded-viewer aside > dl, .embedded-viewer aside > fieldset { grid-column: 1 / -1; }
#comparison-count { color: var(--muted); font-size: 14px; }
#comparison-status:empty { display: none; }

.comparison-card img[hidden] { display: none; }

.embedded-viewer body > header { min-height: 0; padding: 8px 12px; justify-content: flex-end; }
