/* Shared reflow rules. Keep content readable instead of hiding page overflow. */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
.portal-page :is(.portal-shell,.portal-content,.portal-sidebar,.guide-section,.guide-answer-card,.roster-panel,.char-detail,.team-card){min-width:0}
.portal-page :is(h1,h2,h3,p,li,dd,a,summary,label){overflow-wrap:break-word;word-break:normal;line-break:strict}
.portal-page :is(img,video,canvas,svg){max-width:100%}
.portal-page :is(input,select,textarea){min-width:0;max-width:100%}
.portal-page :is(button,.guide-button,.detail-button){max-width:100%;white-space:normal;overflow-wrap:break-word}

/* Header branding and counters must each retain their own space at 200% text. */
.global-header .global-brand-row{flex-wrap:wrap}
.global-header .global-brand-row .brand{flex:1 1 16rem;min-width:0;max-width:100%}
.global-header .brand>div{min-width:0}
.global-header .brand-site-name{white-space:normal}
.global-header .visitor-counter{flex:0 1 auto;min-width:0;max-width:100%;margin-left:auto}
.global-header .visitor-counter>div{flex-wrap:wrap}
.global-header .global-nav>div>a,.global-header .global-nav .nav-group>summary{white-space:normal;overflow-wrap:break-word}
.global-header .global-nav .nav-submenu{max-height:65vh;max-height:65dvh;overscroll-behavior:contain}

/* Let evaluation tabs use a second row when names or text are enlarged. */
.portal-page .portal-content .evaluation-nav{grid-template-columns:repeat(auto-fit,minmax(min(100%,8rem),1fr))}
.portal-page .portal-content .evaluation-nav a{white-space:normal;padding:10px 6px;text-align:center;overflow-wrap:break-word}
.portal-page .section-nav-inner{height:auto;min-height:44px;flex-wrap:wrap;gap:8px 14px}
.section-nav .view-tabs{flex-wrap:wrap;min-width:0;height:auto}
.section-nav .view-tabs button{white-space:normal;min-height:44px}
.section-nav .quiet-button{white-space:normal;min-height:44px;flex-shrink:1}

/* Long names, actions and form controls may wrap without forcing wider pages. */
.portal-page :is(.roster-heading,.roster-manual,.roster-rank-top,.tier-toolbar,.char-detail-header,.results-heading){flex-wrap:wrap}
.roster-manual>label{flex:1 1 12rem;min-width:0}
.roster-options>label:first-child{min-width:min(100%,13rem)}
.roster-options>label{max-width:100%}
.roster-panel :is(.candidate-levels,.owned-controls){grid-template-columns:repeat(auto-fit,minmax(min(100%,7rem),1fr))}
.roster-candidates{grid-template-columns:repeat(auto-fit,minmax(min(100%,10rem),1fr))}
.roster-photo>div{flex-wrap:wrap}
.portal-page .practice-links strong span{display:inline-block;max-width:100%;white-space:normal}
.scout-schedule dl>div{grid-template-columns:minmax(0,5.5em) minmax(0,1fr)}
.scout-schedule time{white-space:normal}
.guide-table-wrap{min-width:0;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain}
.guide-table{overflow-wrap:break-word}
@media(max-width:760px){
 .global-header .global-brand-row .brand{flex-basis:12rem}
 .global-header .global-nav .nav-group>summary>span{white-space:normal}
 .global-header .global-nav .nav-label-short{white-space:nowrap;flex-shrink:0}
 .portal-page .section-nav-inner{padding-left:10px;padding-right:10px}
 .section-nav-inner>.view-tabs{flex:1 1 12rem;gap:12px}
 .section-nav-inner>.quiet-button{margin-left:0}
}
@media(prefers-reduced-motion:reduce){
 .portal-page *, .portal-page *::before,.portal-page *::after{scroll-behavior:auto!important;transition:none!important;animation:none!important}
}

/* Narrow articles also need shrinking flex/grid children and wrapping dates. */
.portal-page .portal-content .news-heading>div{min-width:0;max-width:100%}
.portal-page .portal-content .news-updated>:is(span,small,strong){white-space:normal;max-width:100%}
.video-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.video-card{min-width:0;max-width:100%;overflow-wrap:break-word}
.detail-dialog{max-height:90vh;max-height:90dvh;max-width:calc(100% - 20px)}
@media(max-width:640px){.video-grid{grid-template-columns:minmax(0,1fr)}}
@media(max-height:500px){
 .global-header .global-nav .nav-submenu{max-height:40vh;max-height:40dvh}
}

@media(max-width:640px){
 .portal-page .practice-links{grid-template-columns:repeat(auto-fit,minmax(min(100%,5rem),1fr))}
}
