/* Balanced Pages (Space Race Agency, SFM 2026-11-18). Scoped to html.sfm-bal (added by balance.js), so nothing changes if the script fails. */

/* Boxes moved out of a too-tall sidebar: an even row under the main content */
html.sfm-bal .sfm-bal-row{display:grid;gap:16px;align-items:start;margin:0 0 var(--theme-widget-spacing,15px);container-type:inline-size}
html.sfm-bal .sfm-bal-row>.generic_layout_container{margin:0!important;min-width:0;box-sizing:border-box;border-radius:var(--theme-widget-radius);background:var(--theme-list-background-color);padding:.9375rem}
@container (max-width:560px){html.sfm-bal .sfm-bal-row{grid-template-columns:1fr!important}}
html.sfm-bal .bd-main>.sfm-bal-row>.bd-box{margin:0!important}
/* a business sidebar taller than the screen can't be sticky (its bottom would never show) */
html.sfm-bal .bd-cols:has(>.bd-main>.sfm-bal-row)>.bd-side{position:static}

/* Empty tabs and empty boxes never show */
html.sfm-bal .sfm-bal-empty{display:none!important}
html.sfm-bal .layout_left .theiaStickySidebar>.generic_layout_container:has(>h3:only-child),
html.sfm-bal .layout_right .theiaStickySidebar>.generic_layout_container:has(>h3:only-child){display:none!important}

/* Owner-only "Add to your profile" list */
html.sfm-bal .sfm-bal-todo{text-align:left}
html.sfm-bal .sfm-bal-todo h3{margin:0 0 6px;text-wrap:balance}
html.sfm-bal .sfm-bal-todo p{margin:0 0 10px;opacity:.8;text-wrap:pretty}
html.sfm-bal .sfm-bal-todo ul{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:8px;margin:0;padding:0;list-style:none}
html.sfm-bal .sfm-bal-todo li a{display:block;padding:10px 14px;border-radius:8px;border:1px solid var(--sp-accent,#4c9aff);color:var(--sp-accent,#4c9aff);font-weight:600;text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
html.sfm-bal .sfm-bal-todo li a::before{content:"+ "}
html.sfm-bal .sfm-bal-todo li a:hover{background:var(--sp-accent,#4c9aff);color:#fff}

/* Thin profiles: one compact centered column (cover, name, then the work, then the facts) */
@media (min-width:768px){
  html.sfm-thin .layout_page_user_profile_index>.layout_top,
  html.sfm-thin .layout_page_user_profile_index>.layout_main{max-width:900px;margin-left:auto!important;margin-right:auto!important}
  html.sfm-thin .layout_page_user_profile_index>.layout_main>.layout_left{display:none!important}
  html.sfm-thin .layout_page_user_profile_index>.layout_main>.layout_middle{width:100%!important;max-width:none!important;flex:1 1 100%}
}
html.sfm-thin .layout_page_user_profile_index>.layout_main>.layout_left:not(:has(.generic_layout_container)){display:none!important}
/* profile facts as an even grid of short items; the admin-only labels are noise for visitors */
html.sfm-thin .sfm-bal-facts .user_profile_info li.profile_type,
html.sfm-thin .sfm-bal-facts .user_profile_info li.profile_level,
html.sfm-thin .sfm-bal-facts .user_profile_info li.profile_updates{display:none!important}
html.sfm-thin .sfm-bal-facts{grid-template-columns:1fr!important}
/* the signed-in member's own Explore/Post links repeat the top menu; on a short profile they only add bulk */
html.sfm-thin .sfm-bal-facts>.layout_twitterclone_dashboard_links{display:none!important}
html.sfm-thin .sfm-bal-facts .user_profile_info ul{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px 16px}
html.sfm-thin .sfm-bal-facts .user_profile_info ul[data-n="3"]{grid-template-columns:repeat(3,minmax(0,1fr))}
html.sfm-thin .sfm-bal-facts .user_profile_info ul[data-n="2"]{grid-template-columns:repeat(2,minmax(0,1fr))}
html.sfm-thin .sfm-bal-facts .user_profile_info ul[data-n="1"]{grid-template-columns:1fr}
html.sfm-thin .sfm-bal-facts .user_profile_info li{margin:0!important;border:0!important;padding:0!important;min-width:0;align-items:flex-start}
html.sfm-thin .sfm-bal-facts .user_profile_info li>div{text-wrap:balance;overflow-wrap:anywhere}
@container (max-width:560px){
  html.sfm-thin .sfm-bal-facts .user_profile_info ul{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  html.sfm-thin .sfm-bal-facts .user_profile_info ul[data-n="3"]{grid-template-columns:1fr!important}
  html.sfm-thin .sfm-bal-facts .user_profile_info ul[data-n="1"]{grid-template-columns:1fr!important}
}

/* Phones: one column, main content first (group/event pages keep Join/RSVP on top) */
@media (max-width:767px){
  html.sfm-bal body:not(#global_page_group-profile-index):not(#global_page_event-profile-index) #global_content .layout_main>.layout_middle{order:-1}
  html.sfm-bal .sfm-bal-row{grid-template-columns:1fr!important}
}
