/* Homepage Sentinel row: the "Find the signal" visual. Same approach as css/together.css: a 640×440 canvas laid out in em
   (1em = 10px at full size) that scales with its container; on phones it stacks, with short straight connectors. */
.mx-visual.sg {
  display: block;
  container-type: inline-size;
}
.sg-c {
  position: relative;
  width: 64em;
  height: 44em;
  margin: 0 auto;
  font-size: min(11px, calc(100cqw / 64));
  font-family: "Plus Jakarta Sans", sans-serif;
  color: var(--ink);
}
.sg-c > *,
.sg-sigs > li {
  position: absolute;
}
.sg-c ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.sg-c svg {
  display: block;
}
.sg-title {
  left: 0;
  top: 0;
  font: 700 1.6em/1.2 "Sora", sans-serif;
  letter-spacing: -0.03em;
}

/* Connectors: grey for raw signals and the auto-closed path, orange for the incident path */
.sg-wires {
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.sg-wires path {
  stroke: #c9c4ba;
  stroke-width: 1.5;
  stroke-linecap: round;
}
.sg-wires path.sg-hot {
  stroke: #ff681b;
  stroke-width: 1.8;
}
.sg-ends circle {
  fill: #fff;
  stroke: #b9b3a8;
  stroke-width: 1.5;
}
.sg-ends circle.sg-hot {
  stroke: #ff681b;
}
.sg-dots circle {
  fill: #a39d92;
  opacity: 0;
}
.sg-dots circle.sg-hot {
  fill: #ff681b;
  filter: drop-shadow(0 0 3px rgba(255, 104, 27, 0.7));
}

/* Signals */
.sg-sigs {
  inset: 0;
}
.sg-sigs li {
  display: grid;
  grid-template-columns: 1.2em minmax(0, 1fr);
  align-items: center;
  column-gap: 0.8em;
  row-gap: 0.35em;
  width: 15.2em;
  height: 4.2em;
  padding: 0 1em;
  align-content: center;
  border-radius: 0.9em;
  background: #fff;
  border: 1px solid #ebe7df;
  box-shadow: 0 1.2em 2.4em -1.8em rgba(60, 35, 10, 0.45);
}
.sg-sigs li:nth-child(1) { left: 0; top: 3.4em; }
.sg-sigs li:nth-child(2) { left: 1.8em; top: 7.8em; }
.sg-sigs li:nth-child(3) { left: 0; top: 12.2em; }
.sg-sigs li:nth-child(4) { left: 1.8em; top: 16.6em; }
.sg-sigs li:nth-child(5) { left: 0; top: 21em; }
.sg-sigs li > i {
  width: 1.2em;
  height: 1.2em;
  border-radius: 0.3em;
}
.sg-sigs b {
  font-size: 1.15em;
  font-weight: 600;
  white-space: nowrap;
}
.sg-sigs span {
  grid-column: 2;
  height: 0.45em;
  border-radius: 1em;
  background: #eceae5;
}
.sg-sigs span:last-child {
  width: 60%;
}
.sg-r > i { background: #e8707e; }
.sg-a > i { background: #f5a623; }
.sg-g > i { background: #c4c1bb; }

.sg-data {
  left: 1.2em;
  top: 26.4em;
  display: grid;
  justify-items: center;
  gap: 0.5em;
}
.sg-dots3 {
  display: flex;
  align-items: center;
}
.sg-dots3 i,
.sg-ev i {
  display: grid;
  place-items: center;
  width: 2.8em;
  height: 2.8em;
  border-radius: 50%;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, #fff);
}
.sg-dots3 i + i,
.sg-ev i + i {
  margin-left: 1.6em;
  position: relative;
}
.sg-dots3 i + i::before,
.sg-ev i + i::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  width: 1.6em;
  height: 1px;
  background: #cfcac0;
}
.sg-dots3 svg,
.sg-ev svg {
  width: 1.4em;
  height: 1.4em;
}
.sg-data small,
.sg-ev small {
  font-size: 1.05em;
  color: var(--muted);
}

/* Panels */
.sg-panel {
  border-radius: 1.1em;
  background: #fff;
  border: 1px solid #ebe7df;
  box-shadow: 0 1.4em 2.6em -1.8em rgba(60, 35, 10, 0.45);
  overflow: hidden;
}
.sg-head {
  display: flex;
  align-items: center;
  gap: 0.7em;
  height: 2.6em;
  padding: 0 1.1em;
  background: #232427;
  color: #fff;
  font: 600 1.2em/1 "Sora", sans-serif;
  letter-spacing: -0.01em;
}
.sg-body {
  padding: 1em 1.1em 1.1em;
}
.sg-tune {
  left: 23em;
  top: 3.4em;
  width: 15.6em;
}
.sg-sl {
  margin-bottom: 0.9em;
}
.sg-sl small,
.sg-cov small {
  display: block;
  margin-bottom: 0.45em;
  font-size: 1.05em;
  font-weight: 600;
}
.sg-sl > span {
  position: relative;
  display: block;
  height: 0.4em;
  border-radius: 1em;
  background: #eceae5;
}
.sg-sl i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--v);
  border-radius: 1em;
  background: var(--c);
}
.sg-sl b {
  position: absolute;
  left: var(--v);
  top: 50%;
  width: 1.3em;
  height: 1.3em;
  margin: -0.65em 0 0 -0.65em;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 0.25em #fff, 0 0.2em 0.6em rgba(0, 0, 0, 0.18);
}
.sg-cov {
  padding-top: 0.9em;
  border-top: 1px solid #eceae5;
}
.sg-grid {
  display: grid;
  grid-template-columns: repeat(6, 1.5em);
  gap: 0.45em;
}
.sg-grid i {
  height: 1.5em;
  border-radius: 0.35em;
  background: #eceae5;
}
.sg-grid .sg-p { background: #a78bfa; }
.sg-grid .sg-a { background: #f5a623; }

.sg-sent {
  left: 41.4em;
  top: 3.4em;
  width: 22.6em;
}
.sg-waffle {
  display: grid;
  grid-template-columns: repeat(3, 0.25em);
  gap: 0.15em;
}
.sg-waffle i {
  width: 0.25em;
  height: 0.25em;
  background: #fff;
}
.sg-inc {
  display: flex;
  justify-content: space-between;
}
.sg-high,
.sg-asg {
  padding: 0.2em 0.75em;
  border-radius: 1em;
  font-size: 1em;
  font-weight: 600;
}
.sg-high {
  background: #fde7ea;
  color: #b0122e;
}
.sg-asg {
  background: #ede7fe;
  color: #5b3dc4;
}
.sg-inc-t {
  display: block;
  margin: 0.35em 0 0.6em;
  font: 700 1.3em/1.2 "Sora", sans-serif;
  letter-spacing: -0.02em;
}
.sg-ev {
  display: grid;
  justify-items: center;
  gap: 0.3em;
  padding-bottom: 0.7em;
  border-bottom: 1px solid #eceae5;
}
.sg-ev > span {
  display: flex;
}
.sg-dec {
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin-top: 0.7em;
}
.sg-dec > i {
  display: grid;
  place-items: center;
  width: 2.4em;
  height: 2.4em;
  border-radius: 50%;
  background: #eceae5;
  color: #5c5951;
}
.sg-dec svg {
  width: 1.3em;
  height: 1.3em;
}
.sg-dec b {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  font-size: 1.05em;
  font-weight: 600;
}
.sg-btn {
  padding: 0.35em 0.9em;
  border: 1.5px solid #ff681b;
  border-radius: 2em;
  color: #c2410c;
  font-size: 1.05em;
  font-weight: 700;
}

/* Small outcome cards */
.sg-card {
  display: flex;
  align-items: center;
  gap: 0.8em;
  padding: 0.8em 1em;
  border-radius: 1em;
  background: #fff;
  border: 1px solid #ebe7df;
  box-shadow: 0 1.2em 2.4em -1.8em rgba(60, 35, 10, 0.45);
}
.sg-card > i {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.6em;
  height: 2.6em;
  border-radius: 50%;
}
.sg-card svg {
  width: 1.4em;
  height: 1.4em;
}
.sg-card b {
  display: block;
  font: 700 1.15em/1.2 "Sora", sans-serif;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.sg-card small {
  display: block;
  margin-top: 0.15em;
  font-size: 0.95em;
  color: var(--muted);
  white-space: nowrap;
}
.sg-ok {
  left: 23em;
  top: 28.4em;
  min-width: 15.6em;
}
.sg-ok > i {
  background: #ddf6e8;
  color: #0a8a4a;
}
.sg-build {
  left: 41.4em;
  top: 24em;
  width: 22.6em;
}
.sg-build > i {
  background: #7c5cf0;
  color: #fff;
}

/* Data source pills, in the same style as the Stronger together chips */
.sg-pills {
  left: 0;
  right: 0;
  top: 35.4em;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6em 0.4em;
}
.sg-pills span {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.3em 0.9em 0.3em 0.35em;
  border: 1px solid #d9d4ca;
  border-radius: 2em;
  background: #fff;
  font-size: 0.95em;
  font-weight: 600;
  white-space: nowrap;
}
.sg-pills svg {
  flex: none;
  width: 1.8em;
  height: 1.8em;
  padding: 0.36em;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
}
.sg-foot {
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1em;
  margin: 0;
  font-size: 1.1em;
  color: var(--muted);
}
.sg-tag {
  padding: 0.3em 0.7em;
  border: 1px solid #cfcac0;
  border-radius: 0.5em;
  font: 600 0.85em/1 "JetBrains Mono", monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #5c5951;
}

/* Animation: JS adds .sg-on when the visual comes into view. Nothing fades in: the connectors carry flowing dots,
   the sliders ease into place then nudge gently, the coverage squares colour in one by one, the evidence and
   known-benign icons pulse in turn, and "Clear owner" glows softly. */
.sg-on .sg-grid [data-a] {
  animation: sg-colour 0.5s cubic-bezier(0.4, 0, 0.2, 1) var(--d) both;
}
.sg-on .sg-sl i {
  animation: sg-fill 1.2s cubic-bezier(0.4, 0, 0.2, 1) var(--d) both;
}
.sg-on .sg-sl b {
  animation:
    sg-knob 1.2s cubic-bezier(0.4, 0, 0.2, 1) var(--d) both,
    sg-nudge 5s cubic-bezier(0.4, 0, 0.2, 1) calc(var(--d) + 1.6s) infinite;
}
.sg-on .sg-ev i,
.sg-on .sg-ok > i {
  animation: sg-ping 3.6s cubic-bezier(0.4, 0, 0.2, 1) var(--d, 4s) infinite;
}
.sg-on .sg-btn {
  animation: sg-glow 3s cubic-bezier(0.4, 0, 0.2, 1) 4.4s infinite;
}
.sg-paused .sg-sl b,
.sg-paused .sg-ev i,
.sg-paused .sg-ok > i,
.sg-paused .sg-btn {
  animation-play-state: paused;
}
@keyframes sg-colour {
  from {
    background: #eceae5;
  }
}
@keyframes sg-ping {
  0%,
  40%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--c, #0a8a4a) 0%, transparent);
  }
  15% {
    box-shadow: 0 0 0 0.45em color-mix(in srgb, var(--c, #0a8a4a) 22%, transparent);
  }
}
@keyframes sg-fill {
  from {
    width: 12%;
  }
}
@keyframes sg-knob {
  from {
    left: 12%;
  }
}
@keyframes sg-nudge {
  0%,
  100% {
    transform: none;
  }
  50% {
    transform: translateX(-0.6em);
  }
}
@keyframes sg-glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 104, 27, 0);
  }
  50% {
    box-shadow: 0 0 0 0.4em rgba(255, 104, 27, 0.16);
  }
}

/* Phones: a simple stack with short straight connectors and dots flowing down */
@media (max-width: 760px) {
  .sg-c {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "title title"
      "sigs sigs"
      "tune tune"
      "sent sent"
      "ok build"
      "pills pills"
      "foot foot";
    gap: 0.8em;
    width: auto;
    height: auto;
    font-size: 10px;
  }
  .sg-c > *,
  .sg-sigs > li {
    position: relative;
    inset: auto !important;
    width: auto;
  }
  .sg-c .sg-wires,
  .sg-data {
    display: none;
  }
  .sg-title {
    grid-area: title;
  }
  .sg-sigs {
    grid-area: sigs;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.6em;
  }
  .sg-sigs li {
    height: auto;
    padding: 0.8em 0.9em;
    grid-template-columns: 1.1em minmax(0, 1fr);
  }
  .sg-sigs li > i {
    width: 1.1em;
    height: 1.1em;
  }
  .sg-sigs b {
    font-size: 1.1em;
    white-space: normal;
  }
  .sg-sigs span {
    display: none;
  }
  .sg-sigs li:last-child {
    grid-column: span 2;
    justify-self: center;
    width: calc(50% - 0.3em);
  }
  .sg-data {
    grid-area: data;
    justify-self: center;
  }
  .sg-tune {
    grid-area: tune;
    margin-top: 2em;
  }
  .sg-tune .sg-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.4em;
  }
  .sg-cov {
    padding: 0 0 0 1.4em;
    border: 0;
    border-left: 1px solid #eceae5;
  }
  .sg-sent {
    grid-area: sent;
    margin-top: 2em;
  }
  .sg-ok {
    grid-area: ok;
    margin-top: 2em;
  }
  .sg-build {
    grid-area: build;
    margin-top: 2em;
  }
  .sg-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.6em;
  }
  .sg-card b,
  .sg-card small {
    white-space: normal;
  }
  .sg-pills {
    grid-area: pills;
    gap: 0.5em 0.4em;
    margin-top: 0.4em;
  }
  .sg-foot {
    grid-area: foot;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
  }
  .sg-tune,
  .sg-sent,
  .sg-ok,
  .sg-build {
    overflow: visible;
  }
  .sg-tune::before,
  .sg-sent::before,
  .sg-ok::before,
  .sg-build::before {
    content: "";
    position: absolute;
    left: calc(50% - 1px);
    bottom: 100%;
    width: 2px;
    height: 2.8em;
    background: #c9c4ba;
  }
  .sg-sent::before,
  .sg-build::before {
    background: #ff681b;
    opacity: 0.6;
  }
  .sg-tune::after,
  .sg-sent::after,
  .sg-ok::after,
  .sg-build::after {
    content: "";
    position: absolute;
    left: calc(50% - 0.4em);
    bottom: calc(100% + 2.4em);
    width: 0.8em;
    height: 0.8em;
    border-radius: 50%;
    background: #a39d92;
    opacity: 0;
  }
  .sg-sent::after,
  .sg-build::after {
    background: #ff681b;
    box-shadow: 0 0 6px rgba(255, 104, 27, 0.7);
  }
  .sg-on .sg-tune::after,
  .sg-on .sg-sent::after,
  .sg-on .sg-ok::after,
  .sg-on .sg-build::after {
    animation: sg-flow 2.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  }
  .sg-on .sg-sent::after {
    animation-delay: 0.7s;
  }
  .sg-on .sg-ok::after {
    animation-delay: 1.4s;
  }
  .sg-on .sg-build::after {
    animation-delay: 1.8s;
  }
  .sg-paused .sg-tune::after,
  .sg-paused .sg-sent::after,
  .sg-paused .sg-ok::after,
  .sg-paused .sg-build::after {
    animation-play-state: paused;
  }
  /* The panels' rounded corners still need clipping on phones */
  .sg-panel .sg-head {
    border-radius: 1.1em 1.1em 0 0;
  }
}
@keyframes sg-flow {
  0% {
    opacity: 0;
    transform: none;
  }
  15% {
    opacity: 1;
  }
  70% {
    opacity: 1;
    transform: translateY(2.8em);
  }
  85%,
  100% {
    opacity: 0;
    transform: translateY(2.8em);
  }
}
@media (prefers-reduced-motion: reduce) {
  .sg-dots {
    display: none;
  }
  .sg-c *,
  .sg-c *::before,
  .sg-c *::after {
    animation: none !important;
  }
}
