/* Corrections to the public pages of the handoff: tablets and phones, legal texts, right to left isolation.
   Loaded after every stylesheet of index.html. Route stylesheets (workspace.css on /connect) load later, so rules for
   their components start with body. html[dir] (every page has dir) lifts a rule over the html[dir=rtl] rules of research.css.
   Text under 12px is raised by --type-floor (styles.css); the sizes here are those that need more than the floor.
   Long German words: hyphens only under :lang(de) (rule 7: no hyphenation for Arabic script), overflow-wrap as the last resort. */

/* Frame: utility bar ---------------------------------------------------------------------------------------- */
.motion-toggle .motion-label{font-size:inherit}
/* D16: the bar stays left to right; its Dari and Pashto strings keep their own direction. */
html[dir=rtl] .preview-bar :is(.bar-status,.quiet-button,.bandwidth-toggle,.motion-label){direction:rtl;unicode-bidi:isolate}
@media(min-width:481px) and (max-width:900px){
 /* Below 481px research.css hides the quiet button. */
 .preview-bar .quiet-button{display:inline-flex;align-items:center;gap:.3em;min-height:32px}
 .preview-bar .bandwidth-toggle{padding-block:3px;line-height:1.2;min-height:24px}
}
@media(max-width:480px){
 .preview-bar .bar-name,.motion-toggle .motion-label,.preview-bar .quiet-button{display:none}
 .preview-bar .shell{flex-wrap:nowrap;gap:10px;padding-block:5px}
 .preview-bar .shell>span.bar-identity{flex:1 1 auto;min-width:0;white-space:normal;line-height:1.25;display:flex;align-items:center;gap:6px}
 .preview-bar .bar-identity>.status-dot{flex:none}
 .preview-bar .bar-status{text-wrap:balance}
 .preview-bar .preview-actions{flex:0 0 auto;flex-wrap:nowrap;gap:8px}
 .preview-bar .bandwidth-toggle{padding:4px 7px;white-space:nowrap}
 .preview-bar .motion-toggle{min-width:28px;min-height:28px;justify-content:center}
}

/* Frame: header, bottom bar, mobile menu, footer ------------------------------------------------------------ */
.header-library svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.6}
@media(max-width:900px){
 .header-library .library-count,.mobile-dock small{min-width:18px;height:18px;padding-inline:4px;border-radius:9px;line-height:1;box-sizing:border-box}
 .site-footer .footer-bottom{padding-inline-end:56px}
 .footer-bottom a{display:inline-flex;align-items:center;gap:.3em;min-height:32px}
 html[dir] .site-footer .footer-links :is(a,button){display:block;padding-block:6px;min-width:24px}
 html{scroll-padding-bottom:calc(84px + env(safe-area-inset-bottom))}
}
@media(max-width:760px){
 .header-library svg{width:20px;height:20px}
 .mobile-dock a,.mobile-dock button{font-size:12px;line-height:1.25;padding-inline:2px;justify-content:flex-start;padding-top:9px}
 .mobile-dock a>span,.mobile-dock button>span{max-width:100%;text-align:center;overflow-wrap:break-word}
 body{padding-bottom:0}
 .site-footer{padding-bottom:calc(77px + env(safe-area-inset-bottom))}
 .site-header .mobile-nav .mobile-nav-grid a{overflow-wrap:break-word}
 .site-header .mobile-nav .mobile-nav-grid a:lang(de){hyphens:auto;-webkit-hyphens:auto}
 html[dir] .site-footer .footer-links :is(a,button){font-size:14px}
 .site-footer .footer-motto{font-size:13px}
}
@media(max-width:480px){.header-inner{min-height:64px}}
@media(max-width:380px){
 html[dir] .site-footer .footer-links :is(a,button){font-size:13px}
 .preview-bar .preview-actions{gap:6px}
 .preview-bar .bandwidth-toggle{padding-inline:5px}
}
@media(max-width:360px){.site-header .mobile-nav .mobile-nav-grid{grid-template-columns:minmax(0,1fr)}}
/* D16 keeps the frame left to right; Dari and Pashto strings inside it still need their own direction to order their parts. */
html[dir=rtl] .site-footer :is(.footer-top p:not(.footer-wordmark),.footer-links a,.footer-links button,.footer-links .eyebrow,.footer-bottom>span,.footer-bottom>a){direction:rtl;unicode-bidi:isolate;text-align:left}

/* Long words and grid tracks that grow past the screen ----------------------------------------------------- */
@media(max-width:760px){
 main :is(h1,h2,h3,h4){overflow-wrap:break-word}
 main :is(h1,h2,h3,h4):lang(de){hyphens:auto;-webkit-hyphens:auto}
 .hero-content,.hub-hero-grid,.guide-steps{grid-template-columns:minmax(0,1fr)}
 .hero-copy,.hub-hero-grid>div,.guide-steps article{min-width:0}
 .page-hero h1,.program-process h2{text-wrap:balance}
 /* motion.css hides .hero-copy br:first-child, which also matches the break inside the em: keep that one, or the slogan runs together. */
 .hero .hero-copy h1 em br{display:inline}
 .research-tab>span:not(.number),.atlas-lenses button{min-width:0;overflow-wrap:anywhere}
 .research-tab>.number{flex:none;white-space:nowrap}
 .research-tab:lang(de),.atlas-lenses button:lang(de){hyphens:auto;-webkit-hyphens:auto}
 .directory-summary-grid h2{align-self:stretch;max-width:100%;overflow-wrap:anywhere}
 .directory-summary-grid h2:lang(de){hyphens:auto;-webkit-hyphens:auto}
}
@media(max-width:480px){
 .hero h1 em{max-width:100%}
 .hero-copy>.eyebrow{letter-spacing:.08em}
 .atlas-lenses{grid-template-columns:repeat(2,minmax(0,1fr))}
 html[lang^=de] .hub-hero h1{font-size:32px}
 .hub-connected h3{font-size:21px}
 .legal-text h2{font-size:26px;letter-spacing:-.4px}
 /* The radial "six lenses" diagram cannot hold readable labels at this width: show the six nodes as a grid. */
 .research-network{height:auto;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 .research-network .network-lines,.research-network .network-center{display:none}
 .research-network .network-node,.research-network .network-node:hover{position:static;transform:none;width:auto;min-width:0;min-height:56px;overflow-wrap:anywhere}
 .research-network .network-node-number{flex:none;white-space:nowrap}
 .research-network .network-corner-label{position:static;grid-column:1/-1;order:1}
}
@media(max-width:420px){
 /* German compounds ("Regierungsführung", "Lebensgrundlagen") do not fit half the screen width. */
 html[lang^=de] :is(.research-tabs,.atlas-lenses,.directory-summary-grid,.research-network){grid-template-columns:minmax(0,1fr)}
}
@media(max-width:380px){
 .page-hero h1{font-size:30px;letter-spacing:-.8px}
 html[lang^=de] .page-hero h1{font-size:26px}
 html[lang^=de] .research-banner h2{font-size:25px}
 html[lang^=de] .hub-connected h3{font-size:16px}
 .discovery-hero h1{font-size:33px;letter-spacing:-.5px}
 .guide-steps article{padding-inline-start:62px}
 .guide-steps h2{font-size:24px}
}

/* Running text and labels that the floor alone leaves too small --------------------------------------------- */
@media(max-width:760px){
 .hero p,.page-hero p,.discovery-hero p,.guide-steps p,.faq-layout>div>p,.knowledge-result-excerpt{font-size:15px;line-height:1.75}
 .knowledge-search-note p,.empty-state p,.pipeline-heading>p,.terrain-method-mini{font-size:14px;line-height:1.7}
 .concept-note,html[dir] .concept-note{font-size:13px;line-height:1.7}
 html[dir=rtl] .concept-note{font-size:14px}
 .research-tab{font-size:13px;line-height:1.35}
 .directory-section-heading>p,.directory-accountability-cta p,.credential-guide-grid small{font-size:14px;line-height:1.7}
 .directory-filters>label,.directory-layout-switch button,.directory-control-actions>.text-link,.directory-filter-note,.directory-result-heading>p,.relationship-network-hub>small,.directory-summary-grid h2{font-size:13px}
 .directory-filters :is(input,select),.event-filter-panel :is(input[type=search],select),.knowledge-query input{font-size:16px}
 .directory-filters input,.event-filter-panel input[type=search],.knowledge-query input,.filter-panel .field input{text-overflow:ellipsis}
 .event-filter-panel label{letter-spacing:.02em}
 .event-filter-bottom .event-recording-toggle,.event-filter-bottom>.text-link,.events-controls p,.events-controls .pill{font-size:13px}
 .event-filter-bottom>.text-link{margin:10px 0 0;margin-inline-start:auto}
 .atlas-lenses button,html[dir] .atlas-lenses button{font-size:13px;min-height:44px}
 .atlas-stat-grid article>a,html[dir] .atlas-stat-grid article>a,.portal-source-links a{font-size:12px}
 .terrain-buttons .button.small{font-size:14px;min-height:44px}
 .comparison-tray p,.comparison-tray .button{font-size:13px}
 .hub-jumps button{font-size:13px}
 body .cms-field>span,body .cms-help,body .connect-forms .connect-tabs button{font-size:13px}
 body .connect-forms .cms-check{font-size:13px;line-height:1.7}
 body .cms-field :is(input,select,textarea){font-size:16px}
 body .cms-help .text-link{display:inline;font-size:inherit;padding:0}
}
@media(max-width:480px){
 /* The meta row wraps at the floor: a gap instead of a border, so no wrapped line starts with a divider. */
 .knowledge-result-label span+span{border-inline-start:0;padding-inline-start:0}
 .knowledge-result-label{column-gap:14px;row-gap:0}
}

/* Targets too small to tap ----------------------------------------------------------------------------------- */
@media(max-width:900px){
 .preference-panel select{font-size:16px;min-height:46px}
 .preference-panel select+p{margin-top:18px}
 .breadcrumb{align-items:baseline}
 .breadcrumb a{display:inline-flex;align-items:center;min-height:32px;min-width:24px}
 .atlas-stat-grid article>a,html[dir] .atlas-stat-grid article>a,.portal-source-links a,.globe-topic a,.connection-detail>.text-link{display:inline-flex;align-items:center;gap:.3em;min-height:44px}
 .institute-subnav a{display:inline-flex;justify-content:center;min-width:44px}
 .national-trend summary{padding-block:12px}
}
@media(max-width:760px){
 .portal-hero{padding-top:22px}
 .hub-hero .breadcrumb{padding-top:8px}
}

/* Charts and diagrams drawn in viewBox units ----------------------------------------------------------------- */
.portal-chart{direction:ltr;unicode-bidi:isolate}
/* Sizes in viewBox units, chosen so the labels render at 12px or more at each width. */
@media(max-width:900px){
 .portal-chart text{font-size:21px}
 .national-trend svg text{font-size:22px}
 .map-reference-label{font-size:18px}
 .map-compass text{font-size:16px}
}
@media(max-width:480px){
 .portal-chart text{font-size:32px}
 .portal-chart .x-label{transform:translateY(12px)}
 .portal-chart .x-first{text-anchor:start}
 .portal-chart .x-last{text-anchor:end}
 .national-trend svg text{font-size:26px}
 .map-reference-label,.map-compass text{font-size:31px}
 /* The governance cards below list the same bodies; the diagram is unreadable at this width. */
 .governance-diagram{display:none}
 .portal-table-scroll table{min-width:0;table-layout:fixed}
 .portal-table-scroll td,.portal-table-scroll th{padding:14px 10px;overflow-wrap:anywhere}
 .knowledge-query{flex-wrap:wrap}
 .knowledge-query input{flex:1 1 100%}
 .knowledge-query .button{width:100%}
 .hub-jumps .shell{flex-wrap:wrap;gap:0 18px;overflow-x:visible}
 .hub-jumps button{min-height:44px;padding:10px 0}
 .transparency-nav{grid-template-columns:minmax(0,1fr)}
}
@media(max-width:380px){
 .portal-chart text{font-size:34px}
 .national-trend svg text{font-size:28px}
 .map-reference-label,.map-compass text{font-size:39px}
}
html[dir=rtl] .portal-table-scroll td[dir=ltr]{text-align:right}

/* Layout bugs at every width --------------------------------------------------------------------------------- */
.hub-map-panel>img{height:auto}
@media(max-width:900px){.program-grid{grid-template-columns:repeat(auto-fit,minmax(260px,1fr))}}
/* Events uses these blocks, but their rules live in workspace.css, which /events does not load. */
.engagement-bar{display:flex;flex-wrap:wrap;align-items:center;gap:14px 22px;margin-bottom:30px}
.recordings-panel{padding-top:32px;margin-top:35px;border-top:1px solid var(--line)}
.recordings-panel h2{margin:15px 0 20px}
.recordings-panel>p{color:var(--muted)}

/* Legal texts (Impressum, privacy, accessibility) ------------------------------------------------------------ */
.legal-text{max-width:70ch}
.legal-text h2{line-height:1.25;margin:2em 0 .6em}
.legal-text>section>h2:first-child,.legal-text>h2:first-child{margin-top:0}
.legal-text h3{line-height:1.3;margin:28px 0 10px}
.legal-text>section+section{margin-top:48px;padding-top:36px;border-top:1px solid var(--line)}
.legal-text address{font-style:normal}
.legal-text ol,.legal-text ul{padding-inline-start:1.4em}
.legal-text li+li{margin-top:10px}
.legal-text a{color:inherit;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px}
.legal-text a[href^="mailto:"]{white-space:nowrap}
/* English and German sections on Dari and Pashto pages keep Latin typography. */
html[dir=rtl] .legal-latin{--serif:Editorial,Georgia,serif;--sans:'Institute Sans',Arial,sans-serif;font-family:var(--sans);font-size:15px;line-height:1.7;text-align:left}
html[dir=rtl] .legal-latin :is(h2,h3){font-family:var(--serif);line-height:1.25;letter-spacing:0}

/* Right to left: no faux italic on Arabic script; numbers, codes and the wordmark keep their own direction ------ */
html[dir=rtl] :is(em,i,address):is(:lang(fa),:lang(ps)){font-style:normal}
.relationship-network-hub>span{direction:ltr;unicode-bidi:isolate}
.terrain-control output{direction:ltr;unicode-bidi:isolate}
html[dir=rtl] .portal-years{direction:ltr}
.people-group-grid bdi{margin-inline-start:0}
.people-group-grid>button>span:not(.people-group-index){flex:1 1 auto;min-width:0}
.pipeline-feedback:before{left:auto;inset-inline-start:-4px}
.hero-caption span{margin-left:0;margin-inline-start:10px}
