/* PeakFour: responsive app shell and stable icon system.
   Figma-inspired learning-product composition, without changing feature logic.
   Loaded last on BOTH FastAPI and root entrypoints. */
:root{--pf-shell-ink:#173651;--pf-shell-muted:#586f83;--pf-shell-edge:#dce8ed;--pf-shell-mint:#0da782}
*,*::before,*::after{box-sizing:border-box}
html,body{width:100%;max-width:100%;overflow-x:clip}
.app-shell{width:100%;min-width:0;max-width:100%!important;overflow:clip}
.peak-header{width:100%;min-width:0;display:flex!important;align-items:center;justify-content:space-between;gap:16px;padding-inline:clamp(14px,2vw,30px)!important;box-sizing:border-box}
.peak-header .header-voice-area[hidden]{display:none!important}
.peak-header .brand-lockup{min-width:0;max-width:calc(100% - 165px);display:flex;align-items:center;overflow:hidden}
.peak-header .peak-brand-img{width:clamp(128px,13vw,185px)!important;min-width:0;flex:none}
.peak-header .brand-tagline{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.peak-header #pf-header-profile{flex:none;display:inline-flex!important;align-items:center;justify-content:center;max-width:180px;min-width:119px;white-space:nowrap;z-index:3}
.peak-layout{display:grid!important;grid-template-columns:clamp(204px,17.5vw,252px) minmax(0,1fr)!important;width:100%;max-width:100%;min-width:0}
.peak-sidebar{min-width:0!important;max-width:100%;overflow-x:hidden}
.peak-sidebar .category-tab{display:flex!important;align-items:center!important;gap:13px!important;min-width:0!important;width:100%;text-align:left;cursor:pointer}
.peak-sidebar .category-tab[hidden]{display:none!important}
.peak-sidebar .category-tab .pf-nav-icon{display:block!important;width:21px!important;height:21px!important;min-width:21px!important;flex:0 0 21px!important;stroke:currentColor}
.peak-sidebar .tab-name{min-width:0;white-space:normal!important;overflow-wrap:anywhere;font-weight:700}
.peak-sidebar .category-tab[aria-selected="true"] .pf-nav-icon,
.peak-sidebar .category-tab.is-active .pf-nav-icon{color:#fff}
.peak-main{min-width:0!important;width:100%!important;max-width:1320px!important;padding:clamp(16px,2.5vw,34px) clamp(14px,2.6vw,38px) 48px!important;margin:0 auto!important}
.peak-main>main,.peak-main>section{min-width:0!important;max-width:100%}
.peak-main .app-footer{max-width:100%;min-width:0}
/* five Chapter groups: fit their host container without creating a body scrollbar */
#page-chunking.pf-chunking{box-sizing:border-box;max-width:100%!important;width:100%;min-width:0;padding:clamp(15px,2.3vw,30px) clamp(12px,2.1vw,28px) 45px!important;margin:0 auto!important;overflow-x:clip}
#page-chunking .pf-chunk-header{width:100%;min-width:0;border-radius:26px}
#page-chunking .pf-chunk-toolbar{display:flex;gap:14px;justify-content:space-between;align-items:flex-end;min-width:0}
#page-chunking .pf-chunk-toolbar>*{min-width:0}
#page-chunking .pf-chunk-toolbar .pf-chunk-muted{text-align:right;white-space:normal}
#page-chunking .pf-chunk-groups{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:clamp(8px,1.3vw,14px);width:100%;min-width:0;max-width:100%;margin:0 0 20px!important;padding:4px 2px 12px!important;overflow:visible!important;scroll-snap-type:none!important}
#page-chunking .pf-chunk-tab{display:flex!important;min-width:0!important;width:100%!important;flex:auto!important;min-height:122px;padding:15px 9px!important;justify-content:center;text-align:center}
#page-chunking .pf-chunk-tab-icon{flex:0 0 48px;width:48px;height:48px;display:grid;place-items:center}
#page-chunking .pf-chunk-tab-label{overflow-wrap:anywhere;line-height:1.35}
#page-chunking .pf-chunk-list,#page-chunking .pf-ch94-chapter-list,#page-chunking .pf-chunk-chapters{min-width:0;max-width:100%}
#page-chunking .pf-ch94-chapter,#page-chunking .pf-ch94-lesson{min-width:0;max-width:100%}
/* Figma educational UI-inspired spacing on grammar and other catalog surfaces */
#page-grammar,#page-discover,#page-profile{min-width:0;width:100%;max-width:100%}
#page-grammar .pf-grammar-card,#page-grammar .grammar-card{min-width:0}
/* Avoid legacy controls overflowing narrowed content */
.peak-main button,.peak-main input,.peak-main select{max-width:100%}
@media(max-width:1200px){
 .peak-layout{grid-template-columns:210px minmax(0,1fr)!important}
 .peak-main{padding-inline:18px!important}
 #page-chunking.pf-chunking{padding-inline:14px!important}
 #page-chunking .pf-chunk-groups{grid-template-columns:repeat(3,minmax(0,1fr))!important}
}
@media(max-width:850px){
 .peak-layout{display:block!important;min-height:calc(100vh - 69px)}
 .peak-main{padding:18px 14px 40px!important}
 .peak-header{height:69px!important;min-height:69px!important}
 .peak-header .brand-lockup{max-width:calc(100% - 160px)}
 .peak-header .brand-tagline{display:none!important}
 .peak-menu-toggle{display:flex!important;flex:none}
 .peak-sidebar{position:fixed!important;left:0;top:69px;height:calc(100dvh - 69px);max-width:min(280px,86vw)!important;width:min(280px,86vw)!important;z-index:80;overflow-y:auto;box-shadow:12px 4px 30px #0c26521f!important}
 .peak-sidebar{transform:translateX(-110%);transition:transform .2s ease}
 .peak-menu-open .peak-sidebar{transform:translateX(0)!important}
 .peak-sidebar .peak-sidebar-heading,.peak-sidebar .peak-sidebar-separator,.peak-sidebar .tab-name,.peak-sidebar .peak-sidebar-foot{display:block!important}
 #page-chunking .pf-chunk-groups{grid-template-columns:repeat(3,minmax(0,1fr))!important}
}
@media(max-width:560px){
 .peak-header{padding-inline:10px!important;gap:8px}
 .peak-header .peak-brand-img{width:120px!important}
 .peak-header #pf-header-profile{min-width:104px;max-width:128px;font-size:12px!important}
 .peak-main{padding-inline:10px!important}
 #page-chunking.pf-chunking{padding-inline:9px!important}
 #page-chunking .pf-chunk-header{padding:23px 20px!important}
 #page-chunking .pf-chunk-header h1{font-size:37px!important}
 #page-chunking .pf-chunk-groups{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px}
 #page-chunking .pf-chunk-tab{min-height:98px;padding:11px 7px!important;border-radius:16px!important}
 #page-chunking .pf-chunk-tab-icon{width:39px;height:39px;flex-basis:39px}
 #page-chunking .pf-chunk-tab-icon .pf-icon svg{width:23px;height:23px}
 #page-chunking .pf-chunk-toolbar{display:block}
 #page-chunking .pf-chunk-toolbar .pf-chunk-muted{text-align:left;margin-top:8px}
}
@media(prefers-reduced-motion:reduce){#page-chunking .pf-chunk-tab,.peak-sidebar{transition:none!important}}
