/* CoreKnowledge mega menu + courses drawer + brand tokens (shared; optional for other pages later).
   EVERY colour below is a CK token mapped to the live site (see README brand table; build gate: gen_home.py brand_gate). Pathway accents arrive only as --ac / --tint custom properties set by the registry. */
:root{--red-hi:#E8302F;--red2:#B91C1C;--red-edge:#8F1414;--green-text:#065F46;--green-bg:#E7F8EF;--blue-hi:#4A68EA;--hero-1:#1F3496;--hero-2:#2E48C4;--tint-blue:#EEF0FB;--red-tint:#FFF1F1;--foot:#121A4A;--foot-text:#C5CCE6;--lead:#E6E3FF;--hero-em:#CFE0FF;--focus:#1B6FEB;--btn-edge:#B9C2E6}
.sr{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* ---- header nav items with a caret (the links stay real links) ---- */
.site-head .mm-item{display:inline-flex;align-items:center;border-radius:10px;position:relative}
.site-head .mm-item>a{padding:0 2px 0 10px;min-height:44px;display:inline-flex;align-items:center}
.site-head .mm-item>a::after,.site-head nav>a::after{display:none}
.site-head .mm-item:hover,.site-head .mm-item.open{background:var(--pale)}
.mm-caret{width:26px;height:44px;min-height:44px;margin:0 2px 0 0;padding:0;border:0;background:transparent;color:var(--navy);cursor:pointer;display:grid;place-items:center;border-radius:10px}
.mm-caret svg{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round;transition:transform .18s}
.mm-item.open .mm-caret svg{transform:rotate(180deg)}
.mm{position:absolute;left:0;right:0;top:100%;z-index:40;pointer-events:none}
.mm-panel{pointer-events:auto;background:#fff;border-bottom:1px solid var(--line);box-shadow:0 30px 50px -28px rgba(27,39,102,.5);opacity:0;transform:translateY(-6px);transition:opacity .14s,transform .14s;max-height:calc(100vh - 130px);overflow:auto}
.mm-panel.show{opacity:1;transform:none}
.mm-panel[hidden]{display:none}
.site-head .mm .mm-in{display:grid;grid-template-columns:260px minmax(0,1fr);gap:32px;align-items:start;min-height:0;padding-top:24px;padding-bottom:24px;flex-wrap:initial}
.mm-side{display:flex;flex-direction:column;gap:12px;padding:24px;border-radius:16px;background:linear-gradient(160deg,var(--navy),var(--blue));color:#fff;min-height:100%}
.mm-side h3{margin:0;color:#fff;font:700 22px/1.15 var(--ff-head)}
.mm-side p{margin:0;font-size:14px;color:var(--lead)}
.mm-side .btn{margin-top:4px;align-self:flex-start}
.mm-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 16px;align-content:start}
.mrow{display:flex;align-items:center;gap:12px;padding:8px 12px;border:1.5px solid var(--line);border-radius:12px;text-decoration:none;color:var(--ink);min-height:56px;background:#fff}
.site-head .mrow{padding:8px 12px}
.mrow:hover{border-color:var(--blue);box-shadow:0 8px 18px -12px rgba(40,56,136,.5);color:var(--ink)}
.mrow .nm{flex:1;min-width:0;font-weight:700;font-size:14px;line-height:1.3;color:var(--navy)}
.mrow .nm small{display:block;color:var(--muted);font-weight:500;font-size:12px;line-height:1.3;margin-top:1px}
.ccode{display:inline-grid;place-items:center;flex:none;min-width:52px;height:32px;padding:0 10px;border-radius:9px;background:var(--navy);color:#fff;font:800 13px/1 var(--ff-body);white-space:nowrap}
.mrow.live .ccode{background:var(--ac,var(--navy))}
.st{display:inline-flex;align-items:center;gap:6px;flex:none;font:800 12px/1 var(--ff-body);padding:5px 9px;border-radius:999px;white-space:nowrap}
.st.live{background:var(--green-bg);color:var(--green-text)}
.st.live::before{content:"";width:7px;height:7px;border-radius:50%;background:var(--green)}
.st.soon,.st.notify,.st.prep{background:var(--pale);color:var(--muted);border:1px dashed var(--btn-edge)}
.st.preorder,.st.upd{background:var(--tint-blue);color:var(--blue)}
.mm-more{display:flex;align-items:center;min-height:44px;padding:0 12px;font-weight:700;font-size:14px;grid-column:1/-1}
.mm-foot{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:4px 22px;padding-top:12px;border-top:1px solid var(--line);font-size:14px}
.mm-foot a{font-weight:700;min-height:44px;display:inline-flex;align-items:center;color:var(--blue)}
.mm-books{display:flex;flex-wrap:wrap;gap:16px;align-items:flex-start;align-content:start}
.mbook{width:112px;text-decoration:none;color:var(--ink);font-size:12px;line-height:1.3}
.mbook img{width:112px;aspect-ratio:3/4.2;object-fit:cover;border-radius:6px;box-shadow:0 8px 18px -8px rgba(27,39,102,.55);margin-bottom:8px;display:block}
.mbook b{display:block;font-size:13px;color:var(--navy)}
.mbook small{display:block;font-size:12px;color:var(--muted);margin-bottom:4px}
/* ---- courses drawer (phone; also opened from the dock) ---- */
.sheet{position:fixed;inset:0;z-index:100010;background:#fff;display:none;flex-direction:column}
.sheet.on{display:flex}
.sheet-h{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px max(16px,env(safe-area-inset-left));background:#fff;border-bottom:1px solid var(--line);min-height:64px}
.sheet-h h2{margin:0;font:700 20px/1.2 var(--ff-head);color:var(--navy)}
.sheet-x{min-width:44px;min-height:44px;border-radius:12px;border:2px solid var(--navy);background:#fff;color:var(--navy);font-weight:800;font-size:15px;cursor:pointer;padding:0 14px}
.sheet-b{flex:1;overflow:auto;padding:8px max(16px,env(safe-area-inset-left)) calc(24px + env(safe-area-inset-bottom));-webkit-overflow-scrolling:touch}
.sheet details{border-bottom:1px solid var(--line)}
.sheet summary{list-style:none;display:flex;align-items:center;gap:12px;min-height:60px;cursor:pointer;font:700 18px var(--ff-head);color:var(--navy)}
.sheet summary::-webkit-details-marker{display:none}
.sheet summary small{display:block;font:500 13px var(--ff-body);color:var(--muted)}
.sheet summary::after{content:"";margin-left:auto;width:9px;height:9px;border-right:2.5px solid var(--navy);border-bottom:2.5px solid var(--navy);transform:rotate(45deg);transition:transform .15s;flex:none}
.sheet details[open] summary::after{transform:rotate(-135deg)}
.sheet .sd{display:flex;flex-direction:column;gap:8px;padding:0 0 14px}
.sheet .mrow{min-height:56px}
.sheet .sd .btn{align-self:stretch}
.sheet-f{display:flex;gap:12px;padding:12px max(16px,env(safe-area-inset-left)) calc(12px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:#fff}
.sheet-f .btn{flex:1;padding:0 8px}
.sheet-links{display:flex;flex-wrap:wrap;gap:4px 18px;padding:10px 0 0}
.sheet-links a{font-weight:700;min-height:44px;display:inline-flex;align-items:center;color:var(--blue)}
body.sheet-open{overflow:hidden}
.menubtn{display:none;width:44px;height:44px;place-items:center;border:1.5px solid var(--line);border-radius:12px;background:#fff;color:var(--navy);cursor:pointer;padding:0}
.menubtn svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round}
@media (max-width:1100px){.site-head .mm .mm-in{grid-template-columns:220px minmax(0,1fr);gap:20px}}
@media (max-width:980px){.mm,.mm-caret{display:none!important}.menubtn{display:grid}.site-head .mm-item{display:contents}}
@media (prefers-reduced-motion:reduce){.mm-panel,.mm-caret svg{transition:none}}
html[data-theme="dark"] .mm-panel,html[data-theme="dark"] .sheet,html[data-theme="dark"] .sheet-h,html[data-theme="dark"] .sheet-f,html[data-theme="dark"] .mrow{background:var(--soft)}
