/* V24: stable four-stage hero calculation. Preserve all stage texts and values.
   Prevent geometry changes from multiline formulas; use opacity-only crossfades. */
#demo .hx-compute-stage{height:365px}
#demo .hx-wave{
  inset:0;display:grid;grid-template-rows:36px minmax(0,1fr);
  gap:9px;align-items:center;justify-items:center;align-content:center;
  opacity:0;visibility:hidden;filter:none!important;transform:none!important;
  transition:opacity .38s ease,visibility 0s .38s;
  pointer-events:none;
}
#demo[data-phase="engine"][data-wave="1"] .hx-wave[data-wave="1"],
#demo[data-phase="engine"][data-wave="2"] .hx-wave[data-wave="2"],
#demo[data-phase="engine"][data-wave="3"] .hx-wave[data-wave="3"],
#demo[data-phase="engine"][data-wave="4"] .hx-wave[data-wave="4"]{
  opacity:1;visibility:visible;filter:none!important;transform:none!important;
  transition:opacity .38s ease,visibility 0s;pointer-events:auto;
}
#demo .hx-wave-cap{margin:0;height:36px;display:flex;flex-direction:column;align-items:center;justify-content:center}
#demo .hx-equations{
  width:100%;max-width:540px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  grid-template-rows:repeat(2,145px);gap:10px;transform:none!important;
}
#demo .hx-wave .hx-eq,
#demo[data-phase="engine"] .hx-wave .hx-eq{
  height:145px;min-height:0;box-sizing:border-box;display:flex;flex-direction:column;
  align-items:center;justify-content:center;text-align:center;
  opacity:1;transform:none!important;transition:none!important;
}
#demo .hx-wave .hx-eq code{
  min-height:0;font-size:clamp(12px,1.07vw,15.5px);line-height:1.25;
  overflow-wrap:anywhere;text-wrap:balance;
}
#demo .hx-wave .hx-eq small{margin-bottom:5px}
#demo .hx-wave .hx-eq strong{line-height:1.15;margin-top:6px}
/* Every stage keeps the same card rectangle at tablet and phone widths. */
@media(max-width:1100px){
  #demo .hx-compute-stage{height:340px}
  #demo .hx-equations{grid-template-rows:repeat(2,130px);gap:8px}
  #demo .hx-wave .hx-eq,#demo[data-phase="engine"] .hx-wave .hx-eq{height:130px}
  #demo .hx-wave .hx-eq code{font-size:12px;line-height:1.25}
}
@media(max-width:700px){
  #demo .hx-compute-stage{height:300px;flex:1;min-height:300px}
  #demo .hx-wave{grid-template-rows:30px minmax(0,1fr);gap:7px}
  #demo .hx-wave-cap{height:30px}
  #demo .hx-equations{grid-template-rows:repeat(2,120px);gap:8px}
  #demo .hx-wave .hx-eq,#demo[data-phase="engine"] .hx-wave .hx-eq{height:120px;padding:8px 7px}
  #demo .hx-wave .hx-eq code{font-size:11px;line-height:1.22}
  #demo .hx-wave .hx-eq strong{font-size:13px;line-height:1.2;margin-top:4px}
  #demo .hx-wave .hx-eq small{margin-bottom:3px}
}
@media(max-width:350px){
  #demo .hx-wave .hx-eq code{font-size:10px;line-height:1.2}
}
@media(prefers-reduced-motion:reduce){
  #demo .hx-wave{transition:none!important}
}

/* Flatten the formula cards only: prevents the 3D backdrop slicing through cards. */
#demo .hx-math-universe,#demo .hx-compute-stage,#demo .hx-equations,#demo .hx-wave{transform-style:flat!important}
#demo .hx-math-holo{z-index:0!important}
#demo .hx-compute-stage{z-index:10!important}
#demo .hx-math-universe::before{z-index:0!important}
#demo .hx-wave .hx-eq{z-index:2}

/* Prevent visual movement of the entire demonstration when pointer position changes. */
#demo .hx-world{transform:none!important;transition:transform 0s!important}

/* V26: all four formula states must share one fixed grid track.
   Grid auto tracks were content-sized: wave 1 = 458px, 2 = 383px, 3–4 = 540px. */
#demo .hx-wave{grid-template-columns:minmax(0,1fr)!important}
#demo .hx-wave .hx-equations{width:100%!important;max-width:540px!important;justify-self:center!important}
