/* Automation 06 ROI: bone-50 second segment (staff cost saved), the second line under the yearly figure,
   a one-line legend, a fixed table layout so the numbers never move when a slider changes, and an opaque
   mobile dock. Every rule is scoped under #roi. Shared rules come from roi.css. */

#roi .roi-sw-b,
#roi .roi-seg-b {
  background: var(--bone-50);
}

#roi .roi-legend {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

#roi .roi-legend li {
  white-space: nowrap;
}

#roi .roi-dock {
  background: var(--ink);
}

/* Desktop: this module has six sliders (2 per group), so the inputs column is taller than its groups
   would be. The groups share the spare height and centre their rows, instead of leaving one gap above the notes. */
@media (min-width: 1024px) {
  #roi .roi-group {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  #roi .roi-foot {
    margin-top: 0;
  }
}

/* Second line: under the yearly figure, before the share bar */
#roi .ra-roi-line {
  margin: 12px 0 0;
  font-size: 16.5px;
  line-height: 1.5;
  color: var(--bone-70);
  text-wrap: pretty;
}

/* ---------- Table: fixed layout, so the numbers never move sideways when a slider changes ---------- */

#roi .roi-table {
  table-layout: fixed;
}

#roi .roi-table thead th.roi-num,
#roi .roi-table td.roi-num {
  width: 22%;
  font-variant-numeric: tabular-nums;
}

#roi .roi-table td.roi-num {
  text-align: right;
}

/* Every "how" line reserves two lines, so the total row keeps its place when a sentence wraps */
#roi .roi-how {
  min-height: 3em;
}

/* ---------- 359px and narrower: the CTA may wrap; the yearly figure stays inside its card ---------- */

@media (max-width: 359px) {
  #roi .roi-cta .btn {
    white-space: normal;
    max-width: 100%;
    height: auto;
    padding-block: 0.75rem;
    text-align: center;
  }

  #roi .roi-year {
    font-size: 1.25rem;
    overflow-wrap: anywhere;
  }

  #roi .roi-big-n {
    font-size: 2.5rem;
    overflow-wrap: anywhere;
  }
}

/* Phones: the two numeric columns need room for "~1,440 hours" and the yearly header */
@media (max-width: 479px) {
  #roi .roi-table thead th.roi-num,
  #roi .roi-table td.roi-num {
    width: 30%;
    white-space: normal;
  }

  #roi .roi-table td.roi-num small {
    display: block;
    margin-left: 0;
  }
}

/* 359px and narrower: the docked total drops its unit so the figure is not clipped */
@media (max-width: 359px) {
  #roi .roi-dock-u {
    display: none;
  }
}

/* Phones and tablets: the docked total pins over the inputs as they scroll. The fine print keeps
   room under it the height of the dock, so the last lines clear it when the panel is scrolled to its end. */
@media (max-width: 1023px) {
  #roi .roi-foot {
    padding-bottom: 72px;
  }
}
