/* The primal/dual comparison and the three-point construction in Part 5. */
.dual-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.dual-compare .c34-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.dual-route {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0;
  font-weight: 600;
}

.dual-route span {
  display: inline-block;
  padding: 5px 10px;
  border: 1px solid #426174;
  border-radius: 6px;
}

.reveal .dual-route { font-size: 25px; }
.c34-reading .dual-compare .c34-card {
  padding: 12px 16px;
  border: 1px solid #c9d8dd;
  border-top: 3px solid #138b81;
  border-radius: 8px;
}

.c34-reading .dual-compare .dual-route span { border-color: #b7c9d1; }

.dual-geometry {
  --negative: #85b7ff;
  --positive: #ffb486;
  --normal: #64e4ce;
  --violation: #ff8e9a;
  --surface: #151e2c;
  --plot: #0f1723;
  color: #e6edf7;
  font: 24px/1.34 "Segoe UI", sans-serif;
}

.dual-geometry *, .dual-geometry *::before, .dual-geometry *::after { box-sizing: border-box; }
.dual-geometry [hidden] { display: none !important; }

.dual-layout {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1fr);
  gap: 18px;
}

.dual-figure, .dual-body {
  min-width: 0;
  margin: 0;
  border: 1px solid #34465b;
  border-radius: 12px;
}

.dual-figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  width: 100%;
  height: 622px;
  padding: 12px 14px;
  background: var(--plot);
}

.dual-figure svg { display: block; width: 100%; height: 100%; }
.dual-figure figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px 18px;
  font-size: .82em;
  margin: 0;
}

.dual-figure figcaption span { white-space: nowrap; }
.dual-geometry .negative { color: var(--negative); }
.dual-geometry .positive { color: var(--positive); }
.dual-geometry .teal { color: var(--normal); }
.dual-red-key { color: var(--violation); }

.dual-grid-frame { fill: #101a29; stroke: #35506a; }
.dual-grid { stroke: #28394d; }
.dual-axis { stroke: #80a0b7; stroke-width: 1.25; }
.dual-tick { fill: #afc0d2; font-size: 14px; }
.dual-axis-label { fill: #dcebf6; font-size: 18px; font-style: italic; }
.dual-point-dot { fill: currentColor; stroke: #0b1220; stroke-width: 1.4; }
.dual-point-dot.violated { fill: var(--violation); }
.dual-point-label { fill: currentColor; font-size: 19px; font-weight: 650; font-style: italic; paint-order: stroke; stroke: var(--plot); stroke-width: 4; }
.dual-violation { fill: none; stroke: var(--violation); stroke-width: 2.5; }
.dual-zero-vector { fill: none; stroke: #9ac4fb; stroke-width: 2; }
.dual-vector .shaft { stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.dual-vector polygon { fill: currentColor; }
.dual-vector.resultant .shaft { stroke-width: 5; }
.dual-normal-label { fill: var(--normal); font-size: 19px; font-weight: 700; font-style: italic; }
.dual-margin-band { fill: #24544f; fill-opacity: .54; }
.dual-boundary { stroke: #dcebf6; stroke-width: 2.4; }
.dual-edge { stroke: currentColor; stroke-width: 2; stroke-dasharray: 7 6; }
.dual-edge-label { fill: currentColor; font-weight: 650; font-size: 14px; }
.dual-boundary-label { fill: #e6edf7; font-size: 14px; }
.dual-right-angle, .dual-width-bracket { fill: none; stroke: #afcfdd; stroke-width: 1.6; }
.dual-cancellation { stroke: #b3cbd9; stroke-width: 1.5; stroke-dasharray: 5 4; }
.dual-width-label {
  fill: #def1fa;
  font-size: 16px;
  paint-order: stroke;
  stroke: #193638;
  stroke-width: 5;
  stroke-linejoin: round;
}

.dual-body { display: grid; align-items: center; padding: 17px 23px; background: var(--surface); }
.dual-stage { display: grid; gap: 12px; min-width: 0; }
.dual-geometry .dual-stage h3 {
  margin: 0;
  color: var(--normal);
  font: 650 1.25em/1.15 "Segoe UI", sans-serif;
  text-transform: none;
  letter-spacing: normal;
}

.dual-geometry .dual-stage p { margin: 0; font: inherit; }
.dual-stage math {
  margin: 0;
  font-size: 1.2em;
  font-family: "Cambria Math", "STIX Two Math", math;
  text-align: center;
}
.dual-stage > math { padding-block: 4px; }
.dual-vector-rows { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.dual-vector-rows math {
  padding: 8px 4px;
  border: 1px solid #3a5368;
  border-radius: 6px;
  background: #101926;
  font-size: 1.05em;
}

.dual-points-table { width: 100%; margin: 0; font-size: .95em; font-variant-numeric: tabular-nums; }
.dual-points-table :is(th, td) {
  padding: 8px 10px;
  border-bottom: 1px solid #3a5066;
  text-align: left;
}

.dual-confirm {
  display: grid;
  gap: 6px;
  padding: 12px 15px;
  border: 1px solid #337c72;
  border-radius: 7px;
  background: #122b2c;
}

.dual-stage .dual-confirm p { font-size: .88em; }
.dual-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 13px; }
.dual-controls > div, .dual-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.dual-geometry button {
  padding: .38em .72em;
  color: #eaf3fb;
  background: #223246;
  border: 1px solid #426174;
  border-radius: 6px;
  font: inherit;
  font-size: .88em;
  cursor: pointer;
}
.dual-geometry button:hover:not(:disabled), .dual-geometry button[aria-pressed="true"] {
  background: #174941;
  border-color: #64e4ce;
}
.dual-geometry :is(button, input):focus-visible { outline: 3px solid #ffcb81; outline-offset: 3px; }
.dual-geometry button:disabled { opacity: .43; cursor: default; }
.dual-counter { color: #b6c9da; font-size: .9em; white-space: nowrap; }
.dual-range, .dual-range label { display: flex; gap: 10px; align-items: center; }
.dual-range label { flex: 1; }
.dual-range input { min-width: 45px; flex: 1; accent-color: #64e4ce; }
.dual-range output { min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; }
.dual-readout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 10px; }
.dual-readout span { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; background: #0f1824; border-radius: 6px; font-size: .92em; }
.dual-status { min-height: 2.7em; padding: 8px 11px; border-left: 3px solid var(--normal); background: #122b2c; }
.dual-status[data-feasible="false"] { border-color: var(--violation); background: #30202c; color: #ffb0b9; }
.dual-print-cases { display: none; }

.dual-geometry[data-step="5"] :is(.dual-addition-values, .dual-addition-result) { animation: dual-reveal 230ms both ease-out; }
.dual-geometry[data-step="5"] .dual-addition-values { animation-delay: 170ms; }
.dual-geometry[data-step="5"] .dual-addition-result { animation-delay: 590ms; }
@keyframes dual-reveal {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .dual-geometry[data-step="5"] :is(.dual-addition-values, .dual-addition-result) { animation: none; }
}

.reveal #dual-geometry .slide-body { gap: 12px; }
.reveal #dual-geometry h2 { font-size: 46px; }
.reveal #dual-geometry .slide-body > p { font-size: 24px; }
.c34-reading .dual-geometry { margin: 16px 0; font-size: 16px; }
.c34-reading .dual-layout { grid-template-columns: 1fr; }
.c34-reading .dual-figure { height: min(460px, 92vw); }
.c34-reading .dual-body { min-height: 280px; }
.c34-reading .dual-stage { overflow-x: auto; }
.c34-reading .dual-geometry .dual-points-table { color: #e6edf7; }
.c34-reading .dual-geometry .dual-points-table :is(th, td) { background: transparent; color: inherit; }
@media (max-width: 620px) {
  .c34-reading .dual-compare, .c34-reading .dual-vector-rows { grid-template-columns: 1fr; }
  .c34-reading .dual-status { min-height: 3.7em; }
}
@media print {
  .c34-reading .dual-geometry { color: #233348; }
  .c34-reading .dual-geometry :is(.dual-figure, .dual-controls, .dual-presets, .dual-range) { display: none; }
  .c34-reading .dual-geometry :is(.dual-layout, .dual-body) { display: block; padding: 0; border: 0; background: transparent; color: inherit; }
  .c34-reading .dual-geometry .dual-stage[hidden] { display: grid !important; }
  .c34-reading .dual-geometry .dual-stage { margin: 14px 0; break-inside: avoid; }
  .c34-reading .dual-geometry .dual-stage h3 { color: inherit; }
  .c34-reading .dual-geometry .dual-points-table { color: inherit; }
  .c34-reading .dual-geometry :is(.dual-confirm, .dual-vector-rows math, .dual-readout span) { background: transparent; }
  .c34-reading .dual-geometry :is(.dual-status, .dual-readout) { display: none; }
  .c34-reading .dual-print-cases { display: table; }
}
