/* Library is six separate routed pages, never one long stacked article.
   CSS extends the shared responsive UI tokens without hiding authored content. */
.library-view{--chapter-accent:#6554ec;--chapter-tint:#f0edff}
.library-overview-banner{background:linear-gradient(110deg,#ebe9ff 0%,#f6efff 55%,#e3eaff 100%);margin-bottom:32px;min-height:235px}
.library-overview-banner>div{width:min(72%,580px)}
.library-overview-banner h1{font-size:clamp(34px,5vw,54px)}
.library-overview-banner>img{width:32%;max-width:260px;right:4%;object-fit:contain}
.library-hero-stats{display:flex;gap:7px;flex-wrap:wrap;margin-top:20px}
.library-hero-stats span{display:inline-flex;align-items:center;border-radius:999px;padding:7px 11px;background:#ffffffbd;color:#5147a3;font-weight:900;font-size:11px}
.library-heading{margin:27px 0 14px;display:flex;align-items:flex-end;justify-content:space-between}
.library-heading h2{font-size:clamp(22px,2.6vw,27px);margin:5px 0}
.library-heading p{font-size:13px;color:var(--muted);margin:0}
.library-card-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:14px}
.library-chapter-card{--chapter-accent:#6452ea;--chapter-tint:#efedff;min-width:0;display:flex;flex-direction:column;border:1px solid #e7e8f6;border-radius:22px;background:#fff;padding:23px;box-shadow:0 9px 24px #20296407;min-height:205px;transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease}
.library-chapter-card:hover{transform:translateY(-3px);border-color:var(--chapter-accent);box-shadow:0 14px 26px #35306014}
.library-chapter-card:focus-visible{outline:3px solid var(--chapter-accent);outline-offset:3px}
.tone-lilac{--chapter-accent:#6350eb;--chapter-tint:#f0eaff}
.tone-blue{--chapter-accent:#3477d5;--chapter-tint:#eaf2ff}
.tone-peach{--chapter-accent:#d96e36;--chapter-tint:#fff0e8}
.tone-mint{--chapter-accent:#169e84;--chapter-tint:#e4f7f0}
.tone-violet{--chapter-accent:#8050d6;--chapter-tint:#f0eafd}
.chapter-card-top{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.chapter-art{display:grid;place-items:center;flex:none;width:47px;height:47px;border-radius:15px;background:var(--chapter-tint,#efeaff);color:var(--chapter-accent,#6350eb)}
.chapter-art .ui-icon{width:26px;height:26px}
.chapter-no{font-size:10px;font-weight:900;letter-spacing:1.1px;color:#9196b4}
.chapter-card-type{margin-top:17px;font-size:10px;text-transform:uppercase;letter-spacing:1.2px;font-weight:900;color:var(--chapter-accent)}
.library-chapter-card h3{font-size:clamp(17px,2vw,21px);margin:6px 0;line-height:1.28}
.library-chapter-card p{color:#697395;font-size:12px;margin:0 0 19px}
.chapter-action{display:inline-flex;gap:8px;align-items:center;margin-top:auto;color:var(--chapter-accent);font-size:12px;font-weight:900}
.chapter-action .ui-icon{width:16px;height:16px;transition:transform .18s}
.library-chapter-card:hover .chapter-action .ui-icon{transform:translateX(3px)}
.library-bottom-prompt{display:flex;flex-wrap:wrap;align-items:center;gap:16px;margin:25px 0 8px;padding:20px;border-radius:20px;background:#efedff;color:var(--ink)}
.library-bottom-prompt>.chapter-art{background:#fff}
.library-bottom-prompt>div:nth-child(2){flex:1 1 185px}
.library-bottom-prompt strong{font-size:15px}
.library-bottom-prompt p{font-size:12px;color:#687092;margin:5px 0 0}
.library-bottom-actions{display:flex;gap:8px;flex-wrap:wrap}
.library-bottom-actions .btn{font-size:12px;min-height:42px}
.library-detail-banner{position:relative;display:flex;align-items:center;justify-content:space-between;gap:20px;background:var(--chapter-tint);border-radius:22px;padding:25px 22px;min-height:192px;isolation:isolate;overflow:hidden}
.library-detail-banner:after{content:"";position:absolute;right:-40px;top:-80px;width:210px;height:210px;border:34px solid #ffffff70;border-radius:50%;z-index:-1}
.library-detail-banner>div{min-width:0;max-width:680px}
.library-breadcrumb{display:flex;align-items:center;gap:8px;margin-bottom:19px;color:#767a9d;font-size:11px;font-weight:900}
.library-breadcrumb a{color:var(--chapter-accent)}
.library-breadcrumb a:hover{text-decoration:underline}
.chapter-detail-type{font-size:10px;letter-spacing:1.3px;text-transform:uppercase;color:var(--chapter-accent);font-weight:900}
.library-detail-banner h1{font-size:clamp(27px,4vw,44px);margin:8px 0 7px;letter-spacing:-1.1px}
.library-detail-banner p{font-size:13px;color:#59647e;margin:0}
.detail-hero-art{display:grid;flex:none;place-items:center;width:94px;height:94px;border:1px solid #ffffffd9;border-radius:25px;color:var(--chapter-accent);background:#ffffff98;box-shadow:0 16px 20px #3526730a;transform:rotate(-7deg)}
.detail-hero-art .ui-icon{width:48px;height:48px}
.library-chapter-nav{display:flex;overflow-x:auto;gap:8px;padding:16px 1px 5px;scrollbar-width:thin;scroll-snap-type:x proximity}
.library-chapter-pill{flex:none;display:flex;align-items:center;gap:7px;scroll-snap-align:start;min-height:41px;border:1px solid #e6e8f5;background:#fff;border-radius:12px;padding:8px 13px;font-size:12px;color:#647091;font-weight:900}
.library-chapter-pill small{font-weight:900;font-size:9px;color:#99a0b7}
.library-chapter-pill:hover{border-color:#9f95f1}
.library-chapter-pill.active{border-color:var(--purple);background:#f0eeff;color:var(--purple)}
.library-chapter-pill.active small{color:var(--purple)}
.library-detail-body{display:grid;gap:16px;margin-top:17px;align-items:start}
.library-learning-tip{border:1px solid #e5e6f4;background:#fff;border-radius:18px;padding:20px;display:grid;gap:10px}
.library-learning-tip .chapter-art{width:43px;height:43px}
.library-learning-tip p{font-size:13px;color:#4f5b7a;margin:0}
.library-learning-tip .text-link{padding-top:3px}
.library-article{min-width:0;background:#fff;border:1px solid #e6e8f5;border-radius:20px;padding:17px;box-shadow:0 8px 24px #101a4305}
.library-article .card{margin:0;border:0;padding:0;box-shadow:none;border-radius:0}
.library-article .card-header{margin-bottom:17px}
.library-article .card-header h2{font-size:clamp(20px,2.4vw,26px);line-height:1.35}
.library-article .script-box,.library-article .callout{overflow-wrap:anywhere}
.library-detail-footer{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;margin:20px 0 7px}
.library-detail-footer>.btn{flex:1 1 140px;max-width:280px;font-size:12px}
@media(min-width:620px){
 .library-card-grid-two{grid-template-columns:repeat(2,minmax(0,1fr))}
 .library-card-grid-three{grid-template-columns:repeat(3,minmax(0,1fr))}
 .library-detail-banner{padding:30px 35px}
 .library-detail-body{grid-template-columns:220px minmax(0,1fr)}
 .library-learning-tip{position:sticky;top:16px}
 .library-article{padding:26px}
}
@media(max-width:619px){
 .library-overview-banner{min-height:232px}
 .library-overview-banner>div{width:72%}
 .library-overview-banner>img{right:-15px;width:36%}
 .library-hero-stats{gap:4px;margin-top:10px}
 .library-hero-stats span{font-size:9px;padding:5px 8px}
 .library-chapter-card{min-height:175px;padding:19px}
 .library-heading{margin-top:24px}
 .library-detail-banner{padding:20px 17px;gap:9px}
 .detail-hero-art{width:57px;height:57px;border-radius:17px}
 .detail-hero-art .ui-icon{width:29px;height:29px}
 .library-detail-body{margin-top:13px}
 .library-article{padding:17px}
 .library-learning-tip{grid-template-columns:43px 1fr;column-gap:10px;align-items:center}
 .library-learning-tip .chapter-art{grid-row:1/3}
 .library-learning-tip .text-link{grid-column:1/-1}
 .library-bottom-actions{width:100%}
 .library-bottom-actions .btn{flex:1}
}
@media(max-width:350px){
 .library-overview-banner>div{width:78%}
 .library-overview-banner>img{width:32%;right:-15px}
 .library-hero-stats span:last-child{display:none}
 .library-detail-banner h1{font-size:27px}
}
/* Desktop sidebar is independently scrollable. Never let promo touch last nav item. */
@media(min-width:1000px){
 .side-nav{overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-gutter:stable}
 .side-nav .nav-list{flex:0 0 auto;padding-bottom:14px;border-bottom:1px solid var(--line)}
 .side-nav .side-bottom{flex:0 0 auto;margin-top:28px}
}
@media(min-width:1000px) and (min-height:1010px){.side-nav .side-bottom{margin-top:auto}}
/* Five intentional mobile destinations; Feedback stays a full page via saved session. */
.bottom-nav a[data-route-link="feedback"]{display:none}
.bottom-nav a[data-route-link="library"]{display:flex!important}
.bottom-nav a .ui-icon{width:21px;height:21px}
@media(min-width:1000px){.bottom-nav{display:none}}
@media(prefers-reduced-motion:reduce){.library-chapter-card,.chapter-action .ui-icon{transition:none}}

/* Mobile readability for the original authored framework flow and examples. */
@media(max-width:619px){
 .library-overview-banner h1 span{display:inline-block;white-space:nowrap}
 .library-article .framework-flow,
 .library-article .vocab-grid{grid-template-columns:minmax(0,1fr)}
 .library-article .flow-step,
 .library-article .vocab-item{min-width:0}
 .library-article .script-box{line-height:1.7}
}
/* On very short desktop viewports, never crop a promotional card inside the nav. */
@media(min-width:1000px) and (max-height:730px){
 .side-nav .side-bottom{display:none}
}
