/* Load after styles.css/body.css. Only dg-* components are owned here.
   Final geometry and all text remain visible without JS or reduced motion.
   Existing motion.js observes the root's reveal class and adds seen. */
.dg-figure, .dg-timeline {
  --dg-ember: #ae3817;
  --dg-bright: #ff8759;
  --dg-ink: #20211f;
  --dg-cream: #f8f4ea;
  --dg-rule: #cbc5b9;
  color: var(--dg-ink);
  font-family: inherit;
  font-feature-settings: "palt";
}
.dg-figure *, .dg-figure *::before, .dg-figure *::after,
.dg-timeline *, .dg-timeline *::before, .dg-timeline *::after { box-sizing: border-box; }
/* Override global reveal.waiting: never fade or translate a text-bearing diagram. */
.dg-figure.reveal, .dg-timeline.reveal {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}
.dg-figure { margin: 38px 0 46px; min-width: 0; }
.dg-caption {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 9px; margin: 0 0 22px; padding-top: 18px;
  border-top: 1px solid var(--dg-rule);
}
.dg-eyebrow {
  color: var(--dg-ember); font: 700 11px/1.5 var(--mono, monospace);
  letter-spacing: .12em;
}
.dg-title { font-size: 21px; font-weight: 750; line-height: 1.55; }
.dg-label { display: block; font-size: 18px; font-weight: 700; line-height: 1.55; overflow-wrap: anywhere; }
.dg-icon { display: block; width: 32px; height: 32px; flex: none; }
.dg-lane { padding: 24px 25px; }
.dg-lane-title { margin: 0 0 24px; font-size: 19px; font-weight: 750; line-height: 1.65; }
.dg-manual { border: 1px solid var(--dg-rule); background: #ebe7de; }
.dg-manual-track, .dg-auto-track, .dg-outputs {
  list-style: none; margin: 0; padding: 0;
}
.dg-manual-track { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; }
.dg-manual-node { position: relative; display: grid; justify-items: center; gap: 13px; text-align: center; }
.dg-manual-node .dg-icon { color: #686259; }
.dg-link {
  position: absolute; width: 34px; height: 16px; right: -37px; top: 10px;
  color: var(--dg-ember); overflow: visible;
}
.dg-link path, .dg-return-line path, .dg-branch-lines path {
  stroke: currentColor; stroke-width: 1.6; vector-effect: non-scaling-stroke;
  stroke-linecap: square; stroke-linejoin: round;
}
.dg-draw { stroke-dasharray: 1; stroke-dashoffset: 0; }
.dg-return { position: relative; padding-top: 33px; text-align: center; }
.dg-return-line { position: absolute; width: 100%; height: 32px; top: 4px; left: 0; color: #81786a; overflow: visible; }
.dg-return-label {
  position: relative; display: inline-block; margin-top: -9px; padding: 0 10px;
  background: #ebe7de; color: #615b52; font-size: 17px; font-weight: 600; line-height: 1.6;
}
.dg-autonomous { margin-top: 12px; background: #20211f; color: var(--dg-cream); border-top: 3px solid #ff612d; }
.dg-autonomous .dg-lane-title { color: var(--dg-cream); }
.dg-auto-track { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 25px; }
.dg-auto-node { position: relative; padding-bottom: 13px; border-bottom: 1px solid #625341; }
.dg-node-index { display: block; color: var(--dg-bright); margin-bottom: 12px; font: 600 12px/1.3 var(--mono, monospace); }
.dg-auto-node .dg-label { font-size: 17px; }
.dg-auto-node .dg-link { width: 20px; right: -23px; top: 32px; color: var(--dg-bright); }
.dg-delivery {
  display: flex; align-items: center; gap: 13px; margin-top: 24px;
  padding: 16px 18px; background: #30302a; border-left: 2px solid var(--dg-bright);
}
.dg-delivery .dg-icon { width: 26px; height: 26px; color: var(--dg-bright); }
/* One-source diagram: a single source box, a shared branching bus, open output rows. */
.dg-media { padding: 0 0 24px; border-bottom: 1px solid var(--dg-rule); }
.dg-branch-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1.75fr);
  align-items: center;
}
.dg-source {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 26px 20px; text-align: center; border: 1px solid #a79e8d;
  background: var(--dg-cream); box-shadow: 5px 5px 0 #dad3c5;
}
.dg-source .dg-icon { color: var(--dg-ember); width: 40px; height: 40px; }
.dg-source-label { font-size: 20px; font-weight: 750; line-height: 1.65; overflow-wrap: anywhere; }
.dg-branch-lines { width: 100%; height: 100%; min-height: 360px; color: var(--dg-ember); }
.dg-outputs { display: grid; grid-template-rows: repeat(4, 1fr); min-width: 0; }
.dg-output {
  display: flex; align-items: center; gap: 17px; position: relative;
  padding: 20px 0 20px 18px; min-width: 0; border-bottom: 1px solid var(--dg-rule);
  border-left: 2px solid var(--dg-ember);
}
.dg-output:first-child { border-top: 1px solid var(--dg-rule); }
.dg-output .dg-icon { color: var(--dg-ember); }
.dg-output-copy { flex: 1; min-width: 0; }
.dg-output .dg-label { font-size: 19px; }
.dg-output-detail { display: block; margin-top: 6px; color: #666052; font-size: 17px; line-height: 1.65; overflow-wrap: anywhere; }
.dg-output-index { align-self: flex-start; color: #746c5e; font: 500 10px/1.5 var(--mono, monospace); }
/* Timeline: full original lines in normal document flow; the left rail is purely ornamental. */
.dg-timeline { list-style: none; margin: 42px 0 52px; padding: 0; }
.dg-stage { position: relative; display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 23px; padding-bottom: 34px; }
.dg-stage:last-child { padding-bottom: 0; }
.dg-stage-marker {
  display: grid; place-items: center; width: 48px; height: 48px;
  background: #20211f; border: 1px solid #20211f; color: #ffac82;
  font: 600 17px/1 var(--mono, monospace); position: relative; z-index: 1;
}
.dg-stage:first-child .dg-stage-marker { background: #ad3917; border-color: #ad3917; color: #fff6ed; }
.dg-stage-rail { position: absolute; left: 23px; top: 48px; bottom: 0; width: 1px; background: #ae3817; transform-origin: top; }
.dg-stage-copy { min-width: 0; padding-top: 3px; }
.dg-stage-title { margin: 0 0 16px; font-size: 21px; line-height: 1.8; font-weight: 750; white-space: pre-wrap; overflow-wrap: anywhere; }
.dg-stage-description { margin: 0; font-size: 18px; line-height: 1.95; white-space: pre-wrap; overflow-wrap: anywhere; color: #514d45; }
.dg-stage-title strong, .dg-stage-description strong { color: #913411; font-weight: 800; }
@media (prefers-reduced-motion: no-preference) {
  .dg-figure.seen .dg-draw {
    animation: dg-draw .6s cubic-bezier(.22,.8,.25,1) var(--dg-delay, 0ms) backwards;
  }
  .dg-timeline.seen .dg-stage-rail {
    animation: dg-rail .65s cubic-bezier(.22,.8,.25,1) var(--dg-delay, 0ms) backwards;
  }
}
@keyframes dg-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes dg-rail { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@media (max-width: 640px) {
  .dg-figure { margin-block: 30px 36px; }
  .dg-caption { margin-bottom: 18px; }
  .dg-title { font-size: 20px; }
  .dg-lane { padding: 20px 16px; }
  .dg-lane-title { font-size: 18px; margin-bottom: 20px; }
  .dg-manual-track { gap: 19px; }
  .dg-manual-node .dg-label { font-size: 17px; }
  .dg-manual-node .dg-link { width: 15px; right: -17px; }
  .dg-return-label { font-size: 17px; padding-inline: 5px; }
  .dg-auto-track { grid-template-columns: 1fr; gap: 20px; }
  .dg-auto-node { display: flex; align-items: baseline; gap: 16px; padding: 0 0 10px; }
  .dg-node-index { width: 24px; margin: 0; flex: none; }
  .dg-auto-node .dg-label { font-size: 18px; }
  .dg-auto-node .dg-link { width: 18px; height: 12px; top: auto; right: auto; left: 3px; bottom: -17px; transform: rotate(90deg); }
  .dg-delivery { margin-top: 18px; padding: 13px 12px; gap: 10px; }
  .dg-delivery .dg-label { font-size: 17px; }
  .dg-branch-layout { grid-template-columns: 25px minmax(0, 1fr); gap: 0; align-items: stretch; }
  .dg-source { grid-column: 1 / -1; flex-direction: row; justify-content: center; gap: 14px; padding: 17px 12px; box-shadow: 3px 3px 0 #dad3c5; }
  .dg-source .dg-icon { width: 30px; height: 30px; }
  .dg-source-label { font-size: 19px; text-align: left; }
  .dg-branch-lines { display: none; }
  .dg-outputs { grid-column: 2; grid-row: 2; margin-top: 18px; position: relative; }
  .dg-output { padding: 17px 0 17px 12px; gap: 11px; }
  .dg-output::before { content: ""; position: absolute; left: -15px; top: -1px; bottom: -1px; width: 1px; background: var(--dg-ember); transform-origin: top; }
  .dg-output:first-child::before { top: -19px; }
  .dg-output:last-child::before { bottom: 50%; }
  .dg-output::after { content: ""; position: absolute; left: -15px; top: 50%; width: 14px; height: 1px; background: var(--dg-ember); transform-origin: left; }
  .dg-output .dg-icon { width: 25px; height: 25px; }
  .dg-output .dg-label { font-size: 18px; }
  .dg-output-detail { font-size: 17px; }
  .dg-output-index { display: none; }
  .dg-timeline { margin-block: 32px 40px; }
  .dg-stage { grid-template-columns: 32px minmax(0, 1fr); gap: 14px; padding-bottom: 30px; }
  .dg-stage-marker { width: 32px; height: 38px; font-size: 13px; }
  .dg-stage-rail { left: 15px; top: 38px; }
  .dg-stage-copy { padding-top: 0; }
  .dg-stage-title { font-size: 19px; line-height: 1.8; margin-bottom: 12px; }
  .dg-stage-description { font-size: 17px; line-height: 1.95; }
}
@media (max-width: 640px) and (prefers-reduced-motion: no-preference) {
  .dg-media.seen .dg-output::before { animation: dg-rail .5s ease-out backwards; }
  .dg-media.seen .dg-output::after { animation: dg-branch .4s ease-out .2s backwards; }
  .dg-media.seen .dg-output:nth-child(2)::before { animation-delay: .2s; }
  .dg-media.seen .dg-output:nth-child(2)::after { animation-delay: .4s; }
  .dg-media.seen .dg-output:nth-child(3)::before { animation-delay: .4s; }
  .dg-media.seen .dg-output:nth-child(3)::after { animation-delay: .6s; }
  .dg-media.seen .dg-output:nth-child(4)::before { animation-delay: .6s; }
  .dg-media.seen .dg-output:nth-child(4)::after { animation-delay: .8s; }
}
@keyframes dg-branch { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
  .dg-figure .dg-draw, .dg-timeline .dg-stage-rail { animation: none !important; }
  .dg-media .dg-output::before, .dg-media .dg-output::after {
    animation: none !important; transform: none !important;
  }
}
@media print {
  .dg-figure .dg-draw, .dg-timeline .dg-stage-rail { animation: none !important; }
  .dg-stage, .dg-lane, .dg-output { break-inside: avoid; }
}
