/* VE-GLOBAL-01: opt-in text wrapper, shared by every public CMAT page.
   Inline fragments follow the actual text width without changing line breaks,
   layout, cursor, heading pseudo-elements or existing motion transforms.
   Only the small decorative background repaints during the transition. */
/* Neutralize legacy rules for generic spans (e.g. Preparatoria number badges). */
span.cmat-title-underline {
  display: inline;
  min-height: 0;
  border-radius: 0;
  background-color: transparent;
  color: inherit;
  font: inherit;
}
@media (hover: hover) and (pointer: fine) {
  span.cmat-title-underline {
    background-image: linear-gradient(#D9A63A, #D9A63A);
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: 0% 2px;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    transition: background-size 350ms cubic-bezier(.22, 1, .36, 1);
  }
  :is(h1, h2, h3, h4, h5, h6):hover .cmat-title-underline {
    background-size: 100% 2px;
  }
  /* The narrow Hero already owns a curved underline. Reuse it, never stack lines. */
  @media (max-width: 767px) {
    #inicio h1 .cmat-title-underline { background-image: none; }
    #inicio h1::after {
      /* Preserve its original 9px outer height (6px content + 3px border). */
      height: 7px;
      border-top-width: 2px;
      border-top-color: #D9A63A;
      clip-path: inset(0 50% 0 50%);
      transition: clip-path 350ms cubic-bezier(.22, 1, .36, 1);
    }
    #inicio h1:hover::after { clip-path: inset(0); }
  }
  @media (prefers-reduced-motion: reduce) {
    span.cmat-title-underline,
    #inicio h1::after { transition: none; }
  }
}
/* home.css colors generic Hero spans gold; the new wrapper inherits its title. */
#inicio h1 > .cmat-title-underline { color: inherit; }
/* Keep Preparatoria's approved `text-wrap: pretty` line distribution intact.
   The inline block shrinks to its text, or to the available width when wrapped. */
.prepa-areas h3 > span.cmat-title-underline { display: inline-block; }
