/* ==========================================================
   v179.9.30 — RESTORE STICKY TEAM IDENTITY HEADER
   Keeps the approved sticky scorecard stack while preventing
   the team header from colliding with the live bar/tabs.
   Shared structural behavior across all themes.
   ========================================================== */
@media(max-width:900px){
  /* Sticky children must not be trapped by a clipped team-card ancestor.
     The body still owns visual clipping for the table/field content. */
  body:not(.home-page) #app #main .team-scorebook{
    overflow:visible!important;
    scroll-margin-top:calc(var(--v179930-team-head-top,130px) + var(--v179930-team-head-h,52px) + 8px)!important;
  }
  body:not(.home-page) #app #main .team-scorebook-body{
    overflow:hidden!important;
    border-radius:0 0 18px 18px!important;
  }

  /* Restore the team identity header directly beneath the sticky
     inning/score bar + workspace tabs. The top value is measured in JS. */
  body:not(.home-page) #app #main .team-scorebook .team-scorebook-head{
    position:sticky!important;
    top:var(--v179930-team-head-top,130px)!important;
    inset-block-start:var(--v179930-team-head-top,130px)!important;
    z-index:102!important;
    transform:none!important;
    overflow:visible!important;
    min-height:52px!important;
    border-radius:18px 18px 0 0!important;
    box-shadow:0 5px 12px rgba(15,23,42,.12)!important;
  }

  /* Jump/auto-center targets must clear the complete sticky stack. */
  body:not(.home-page) #app #main .unified-score-table .batter-row{
    scroll-margin-top:calc(var(--v179930-team-head-top,130px) + var(--v179930-team-head-h,52px) + 8px)!important;
  }

  /* The local MIL fallback asset is visibly cropped. Team headers now
     request MLB's full SVG first; these dimensions also give every logo
     breathing room and prevent Safari from clipping the image box. */
  body:not(.home-page) #app #main .team-scorebook .team-scorebook-head .team-scorebook-name{
    overflow:visible!important;
    min-height:44px!important;
  }
  body:not(.home-page) #app #main .team-scorebook .team-scorebook-head img.team-logo{
    width:40px!important;
    height:40px!important;
    flex:0 0 40px!important;
    max-width:40px!important;
    max-height:40px!important;
    padding:2px!important;
    box-sizing:border-box!important;
    object-fit:contain!important;
    object-position:center!important;
    overflow:visible!important;
    clip-path:none!important;
    mask:none!important;
  }

  /* Wrigley keeps the same sticky mechanics; only its visual tokens differ. */
  body[data-theme-family="wrigley"]:not(.home-page) #app #main .team-scorebook .team-scorebook-head{
    min-height:52px!important;
  }
}
