/* The Math Studio five-stage bar. Self-contained (fallback colours) so the Practice studios and Learning Labs can load
   it without the rest of the studio design layer. */
/* Stage bar (also used on the Practice studios and Learning Labs) */
.ms-stagebar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px max(16px, calc((100% - 1180px) / 2 + 24px));
  background: var(--ms-paper, #fff);
  border-bottom: 1px solid var(--ms-line, #d9d3c6);
  box-shadow: 0 2px 8px rgb(29 53 87 / 6%);
  font-family: "Nunito", "Atkinson Hyperlegible", system-ui, sans-serif;
  font-size: 0.95rem;
}
.ms-stagebar__home {
  font-weight: 800;
  color: var(--ms-navy, #1d3557);
  text-decoration: none;
  white-space: nowrap;
}
.ms-stagebar__home span {
  font-weight: 600;
  color: var(--ms-muted, #5a6472);
  margin-inline-start: 6px;
}
.ms-stagebar ol {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
}
.ms-stagebar li a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--ms-ink, #1f2a37);
  text-decoration: none;
  font-weight: 700;
}
.ms-stagebar li a:hover {
  background: var(--ms-teal-soft, #e3f0ee);
}
.ms-stagebar li a[aria-current] {
  background: var(--ms-teal-ink, #23625e);
  color: #fff;
}
.ms-step {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ms-cream, #fbf7ef);
  border: 1px solid var(--ms-line, #d9d3c6);
  font-size: 0.8rem;
  color: var(--ms-navy, #1d3557);
}
.ms-stagebar li[data-visited="true"] .ms-step {
  background: var(--ms-sage-soft, #ebf2e8);
  border-color: var(--ms-sage, #8fae8b);
}
.ms-stagebar li a[aria-current] .ms-step {
  background: #fff;
  color: var(--ms-teal-ink, #23625e);
  border-color: #fff;
}
.ms-stagebar .t-es {
  display: none;
}
.ms-stagebar--lab p {
  margin: 0;
  color: var(--ms-ink, #1f2a37);
}
.ms-stagebar--lab p a {
  color: var(--ms-teal-ink, #23625e);
  font-weight: 700;
}

@media (max-width: 600px) {
  .ms-stagebar {
    gap: 6px;
    padding: 6px 10px;
  }
  .ms-stagebar__home span {
    display: none;
  }
  .ms-stagebar ol {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  /* Larger text (the studios' Comfort panel) leaves each of five columns too narrow for "Understand": the bar wraps
     to two rows rather than pushing the last stage off the screen. */
  html:is([data-comfort-size="2"], [data-comfort-size="3"]) .ms-stagebar ol {
    grid-template-columns: repeat(auto-fit, minmax(4.75rem, 1fr));
  }
  .ms-stagebar li a {
    flex-direction: column;
    gap: 2px;
    padding: 4px 2px;
    border-radius: 10px;
    font-size: 13px;
    justify-content: center;
    text-align: center;
  }
}

/* Only the Math Studio page pins the bar; the studios and labs keep their own sticky chrome. */
body.ms .ms-stagebar {
  position: sticky;
  top: 0;
}

/* Background knowledge strip under the bar on the Practice and Challenge studios. */
.ms-bgcard {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px max(16px, calc((100% - 1180px) / 2 + 24px));
  background: var(--ms-mustard-soft, #fbf1d8);
  border-bottom: 2px solid var(--ms-mustard, #d9a93a);
  font-family: "Nunito", "Atkinson Hyperlegible", system-ui, sans-serif;
  font-size: 0.95rem;
  color: var(--ms-ink, #1f2a37);
}
.ms-bgcard__icon { font-size: 1.4rem; line-height: 1; }
.ms-bgcard__text { flex: 1 1 260px; margin: 0; }
.ms-bgcard__text strong { color: var(--ms-navy, #1d3557); }
.ms-bgcard__go {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  padding: 0 16px;
  border-radius: 10px;
  background: var(--ms-navy, #1d3557);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}
.ms-bgcard__go:hover { background: var(--ms-teal-ink, #23625e); }
.ms-bgcard__go:focus-visible { outline: 3px solid var(--ms-teal, #2f7f7a); outline-offset: 2px; }
