/* MathsDaily: free resources by level — teal capsule buttons (homepage left rail and
   mobile block, library picker and level view), primary-by-year right rail and the
   red "Watch videos" header button. */
/* One calm teal for every level button, tuned for each theme (the daily puzzle keeps its colours). */
.lvl-pill,.level-view,.level-view-switch a,.vl-jump a{
  --pill-bg:rgba(145,201,176,.10);--pill-bg-hover:rgba(145,201,176,.20);--pill-border:rgba(145,201,176,.38);
  --pill-text:#DDF1E8;--pill-dot:#91C9B0;--pill-solid:#91C9B0;--pill-on:#10241B}
html[data-theme="light"] .lvl-pill,html[data-theme="light"] .level-view,html[data-theme="light"] .level-view-switch a,html[data-theme="light"] .vl-jump a{
  --pill-bg:#E6F3EE;--pill-bg-hover:#D5EBE2;--pill-border:#A9D3C1;--pill-text:#16352B;--pill-dot:#2F7D5D;--pill-solid:#2F7D5D;--pill-on:#FFFFFF}

/* Panels (desktop side rails) */
.lvl-panel{background:var(--ink-raised,#1b2434);border:1px solid var(--line,#334155);border-radius:18px;padding:16px 14px 14px}
html[data-theme="light"] .lvl-panel{background:#F0F5F4;border-color:#D3DFDC}
.lvl-title,.lvl-hub-title,.lvl-picker-title{font-family:'Fraunces',Georgia,serif;font-weight:600;line-height:1.25;color:inherit}
.lvl-title{font-size:17px;margin:0 0 4px}
.lvl-sub{font-size:11.5px;line-height:1.5;color:var(--fog,#C5CBD6);margin:0 0 12px}
html[data-theme="light"] .lvl-sub{color:#2D4450}

/* Stage groups and capsules */
.lvl-group+.lvl-group{margin-top:12px}
.lvl-group-head{margin:0 0 7px;font:700 10px/1.2 Inter,system-ui,sans-serif;letter-spacing:.7px;text-transform:uppercase;color:var(--fog-dim,#94A3B8)}
.lvl-group-head span{font-weight:600;letter-spacing:.2px;text-transform:none;margin-left:4px}
html[data-theme="light"] .lvl-group-head{color:#497083}
.lvl-pills{display:flex;flex-wrap:wrap;gap:7px}
.lvl-pill{display:inline-flex;align-items:center;gap:7px;min-height:40px;padding:0 6px 0 12px;border-radius:999px;
  background:var(--pill-bg);border:1px solid var(--pill-border);color:var(--pill-text);
  font:650 13px/1.1 Inter,system-ui,sans-serif;text-decoration:none;white-space:nowrap;
  transition:transform .15s ease,background-color .15s ease,border-color .15s ease,box-shadow .15s ease;-webkit-tap-highlight-color:transparent}
.lvl-pill::after{content:attr(data-count);display:inline-grid;place-items:center;min-width:22px;height:22px;padding:0 6px;border-radius:999px;
  background:var(--pill-dot);color:var(--pill-on);font-size:11px;font-weight:700}
html[data-theme="light"] .lvl-pill::after{background:var(--pill-solid)}
.lvl-dot{width:8px;height:8px;border-radius:50%;background:var(--pill-dot);flex:none}
.lvl-pill:hover{transform:translateY(-1px);background:var(--pill-bg-hover);border-color:var(--pill-dot);box-shadow:0 6px 16px -10px var(--pill-dot)}
.lvl-pill:active{transform:translateY(0)}
.lvl-pill:focus-visible{outline:3px solid var(--pill-dot);outline-offset:2px}
.lvl-pill[aria-current="page"]{background:var(--pill-solid);border-color:var(--pill-solid);color:var(--pill-on)}
.lvl-pill[aria-current="page"] .lvl-dot{background:var(--pill-on)}
.lvl-pill[aria-current="page"]::after{background:var(--pill-on);color:var(--pill-solid)}
.lvl-pills .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

.lvl-foot{display:grid;gap:6px;margin-top:14px}
.lvl-foot a{display:flex;justify-content:space-between;align-items:center;gap:8px;min-height:40px;padding:0 12px;border-radius:999px;
  border:1px solid var(--line,#334155);color:var(--teal,#91C9B0);font-size:12.5px;font-weight:600;text-decoration:none}
.lvl-foot a::after{content:"→"}
.lvl-foot a:hover{border-color:var(--teal,#91C9B0)}
html[data-theme="light"] .lvl-foot a{border-color:#D3DFDC;color:#2D6C50}

/* Homepage: even, tidy rows of capsules (badge right-aligned) */
.lvl-hub .lvl-pills,.lvl-panel .lvl-pills{display:grid;gap:7px;grid-template-columns:repeat(3,minmax(0,1fr))}
.lvl-hub .lvl-gcse .lvl-pills,.lvl-hub .lvl-alevel .lvl-pills{grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}
.lvl-hub .lvl-primary .lvl-dot,.lvl-hub .lvl-ks3 .lvl-dot{display:none}
.lvl-hub .lvl-pill,.lvl-panel .lvl-pill{min-width:0}
.lvl-hub .lvl-pill,.lvl-panel .lvl-pill{padding:0 5px 0 11px;gap:6px}
.lvl-hub .lvl-pill::after,.lvl-panel .lvl-pill::after{margin-left:auto}
.lvl-panel .lvl-pills{grid-template-columns:repeat(2,minmax(0,1fr))}
.lvl-panel .lvl-gcse .lvl-pills,.lvl-panel .lvl-alevel .lvl-pills{grid-template-columns:minmax(0,1fr)}
.lvl-panel .lvl-primary .lvl-dot,.lvl-panel .lvl-ks3 .lvl-dot{display:none}
@media (max-width:359px){.lvl-hub .lvl-pill{padding-left:9px;font-size:12.5px}}

/* Homepage block for phones and tablets (the desktop rail takes over at 1180px) */
.lvl-hub{margin:0 0 16px;padding:0 0 16px;border-bottom:1px solid var(--line,#334155)}
html[data-theme="light"] .lvl-hub{border-color:#D3DFDC}
.lvl-hub-title{font-size:15px;margin:0 0 10px}
@media (max-width:420px){.lvl-pill{min-height:44px;font-size:13.5px}}

@media (prefers-reduced-motion:reduce){.lvl-pill{transition:none}.lvl-pill:hover{transform:none}}

/* Library page: level picker under the intro */
.lvl-picker{margin:18px 0 6px;padding:16px;border-radius:18px;background:#1b2434;border:1px solid #334155}
html[data-theme="light"] .lvl-picker{background:#F0F5F4;border-color:#D8E3E1}
.lvl-picker-title{font-size:18px;margin:0 0 12px}
.lvl-wide{display:grid;gap:14px;grid-template-columns:repeat(auto-fit,minmax(230px,1fr))}
.lvl-wide .lvl-group+.lvl-group{margin-top:0}

/* Library page: one level's resources (?level=…), organised by type */
.level-view{margin:0 0 28px;padding:18px;border-radius:20px;background:var(--pill-bg);border:1px solid var(--pill-border)}
.level-view-kicker{margin:0;font-size:11px;font-weight:700;letter-spacing:.8px;text-transform:uppercase;color:var(--pill-text)}
.level-view h2{margin:2px 0 6px;font-size:clamp(24px,6vw,30px)}
.level-view h2:focus{outline:none}
.level-view-sub{margin:0 0 14px;line-height:1.6}
.level-view-links{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 14px}
.level-view-jump{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 6px;padding:0;list-style:none;font-size:13px}
.level-view-jump a{display:inline-flex;align-items:center;min-height:34px;padding:0 10px;border-radius:999px;border:1px solid var(--pill-border);color:var(--pill-text);text-decoration:none;font-weight:600}
.level-view-kind{margin:22px 0 10px;font-size:18px;scroll-margin-top:16px}
.level-view-kind span{font:600 12px Inter,system-ui,sans-serif;color:var(--pill-text);margin-left:6px}
.level-view-switch{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 6px;padding:0;list-style:none}
.level-view-switch a{display:inline-flex;align-items:center;min-height:36px;padding:0 12px;border-radius:999px;font-size:13px;font-weight:600;text-decoration:none;
  border:1px solid var(--pill-border);color:var(--pill-text);background:var(--pill-bg)}
.level-view-switch a:hover{border-color:var(--pill-dot)}
.level-view-switch a[aria-current="page"]{background:var(--pill-solid);border-color:var(--pill-solid);color:var(--pill-on)}
.level-view-all{margin:18px 0 0;font-weight:600}
@media (max-width:600px){.level-view{padding:14px;border-radius:16px}.level-view-links .pdf-btn{flex:1 1 100%;justify-content:center}}

/* GCSE dropdown: Foundation and Higher */
.lvl-drop{position:relative}
.lvl-drop>summary{list-style:none;cursor:pointer;user-select:none;display:flex;width:100%;box-sizing:border-box}
.lvl-drop>summary::-webkit-details-marker{display:none}
.lvl-drop>summary::after{content:"";width:7px;height:7px;margin:0 6px 3px auto;border:solid var(--pill-dot);border-width:0 2px 2px 0;transform:rotate(45deg);
  background:none;min-width:0;height:7px;padding:0;border-radius:0;transition:transform .15s ease}
html[data-theme="light"] .lvl-drop>summary::after{background:none}
.lvl-drop[open]>summary::after{transform:rotate(225deg);margin-bottom:-3px}
.lvl-drop[open]>summary{background:var(--pill-bg-hover);border-color:var(--pill-dot)}
.lvl-drop-menu{display:grid;gap:6px;margin-top:6px;padding:6px;border-radius:16px;border:1px dashed var(--line,#334155)}
html[data-theme="light"] .lvl-drop-menu{border-color:#C6DCD4}
.lvl-pills .lvl-drop,.lvl-hub .lvl-drop,.lvl-panel .lvl-drop{grid-column:1/-1}
.lvl-wide .lvl-drop{min-width:200px}
.lvl-drop-menu .lvl-pill{width:100%}

/* Right rail: primary maths by year */
.lvl-kicker{display:block;font:700 10px/1.2 Inter,system-ui,sans-serif;letter-spacing:.8px;text-transform:uppercase;color:var(--teal,#91C9B0);margin:0 0 4px}
html[data-theme="light"] .lvl-kicker{color:#2F7D5D}
.lvl-panel .lvl-years{margin-bottom:12px}
.lvl-years .lvl-pill{justify-content:center;padding:0 10px}
.lvl-years .lvl-pill::after{display:none}
.lvl-tools{display:grid;gap:7px}
.lvl-tools a{display:flex;flex-direction:column;gap:2px;padding:10px 12px;border-radius:14px;text-decoration:none;border:1px solid var(--line,#334155);background:rgba(145,201,176,.06)}
.lvl-tools a:hover{border-color:var(--teal,#91C9B0)}
.lvl-tools strong{font-size:13px;color:inherit}
.lvl-tools span{font-size:11.5px;color:var(--fog,#C5CBD6)}
html[data-theme="light"] .lvl-tools a{border-color:#D3DFDC;background:#FFFFFF}
html[data-theme="light"] .lvl-tools span{color:#2D4450}

/* The in-page "Primary maths by year" moves to the right rail on wide screens */
@media (min-width:1180px){.primary-pathways{display:none!important}}

/* Header: one-click video lessons */
.header-link.watch-videos{display:inline-flex;align-items:center;gap:7px;padding:0 15px 0 11px;min-height:38px;border-radius:999px;border:0;
  background:linear-gradient(135deg,#F0565C,#C9303A);color:#FFFFFF!important;font-weight:700;text-decoration:none;box-shadow:0 4px 14px -6px rgba(201,48,58,.7)}
html[data-theme="light"] .header-link.watch-videos,html[data-theme="light"] .top-bar .header-link.watch-videos{color:#FFFFFF!important;background:linear-gradient(135deg,#F0565C,#C9303A)!important;border:0!important}
.header-link.watch-videos:hover{filter:brightness(1.07);transform:translateY(-1px)}
.header-link.watch-videos:focus-visible{outline:3px solid #F7A1A5;outline-offset:2px}
.watch-videos .wv-icon{display:inline-grid;place-items:center;width:20px;height:20px;border-radius:50%;background:rgba(255,255,255,.22)}
.watch-videos .wv-icon::before{content:"";margin-left:2px;border-style:solid;border-width:5px 0 5px 8px;border-color:transparent transparent transparent #fff}
@media (prefers-reduced-motion:reduce){.header-link.watch-videos:hover{transform:none}}

/* Level buttons show the level name only (no resource counts). */
.lvl-pill:not(summary)::after{display:none}
.lvl-pill:not(summary){justify-content:center}

/* ---------- v42.8: finders on the printables and topic guides pages ---------- */
.lib-card[hidden],.lib-group[hidden],a.card[hidden],section.group[hidden],.finder[hidden],.finder-clear[hidden]{display:none!important}
.finder{margin:18px 0 8px;padding:16px;border-radius:18px;background:#1b2434;border:1px solid #334155}
html[data-theme="light"] .finder{background:#F0F5F4;border-color:#D3DFDC}
.finder h2{font-size:18px;margin:0 0 12px}
.finder-search{position:relative}
.finder-search input{width:100%;box-sizing:border-box;min-height:52px;padding:0 16px 0 46px;border-radius:999px;font:500 16px Inter,system-ui,sans-serif;
  background:#0f1726;border:1.5px solid #3b4a63;color:#F8FAFC;-webkit-appearance:none;appearance:none}
.finder-search input::placeholder{color:#94A3B8}
.finder-search input:focus{outline:none;border-color:#91C9B0;box-shadow:0 0 0 3px rgba(145,201,176,.3)}
html[data-theme="light"] .finder-search input{background:#FFFFFF;border-color:#B8CEC7;color:#162127}
html[data-theme="light"] .finder-search input::placeholder{color:#5B6F78}
html[data-theme="light"] .finder-search input:focus{border-color:#2F7D5D;box-shadow:0 0 0 3px rgba(47,125,93,.22)}
.finder-icon{position:absolute;left:17px;top:50%;width:16px;height:16px;margin-top:-9px;border:2px solid #91C9B0;border-radius:50%;pointer-events:none}
.finder-icon::after{content:"";position:absolute;right:-6px;bottom:-5px;width:7px;height:2px;background:#91C9B0;transform:rotate(45deg);border-radius:2px}
html[data-theme="light"] .finder-icon,html[data-theme="light"] .finder-icon::after{border-color:#2F7D5D}
html[data-theme="light"] .finder-icon::after{background:#2F7D5D}
.finder-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:10px}
.finder-select{display:flex;flex-direction:column;gap:4px;font:700 11px/1.2 Inter,system-ui,sans-serif;letter-spacing:.6px;text-transform:uppercase;color:#91C9B0}
html[data-theme="light"] .finder-select{color:#2F7D5D}
.finder-select select{min-height:48px;padding:0 40px 0 14px;border-radius:14px;font:600 15px Inter,system-ui,sans-serif;text-transform:none;letter-spacing:0;
  background:#0f1726 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2391C9B0' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center/12px 8px;
  border:1.5px solid #3b4a63;color:#F8FAFC;-webkit-appearance:none;appearance:none;cursor:pointer}
.finder-select select:focus{outline:none;border-color:#91C9B0;box-shadow:0 0 0 3px rgba(145,201,176,.3)}
html[data-theme="light"] .finder-select select{background-color:#FFFFFF;border-color:#B8CEC7;color:#162127;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%232F7D5D' stroke-width='2'/%3E%3C/svg%3E")}
.finder-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:10px;min-height:28px}
.finder-status{margin:0;font-size:13.5px;line-height:1.5}
.finder-clear{flex:none;min-height:36px;padding:0 14px;border-radius:999px;border:1.5px solid #91C9B0;background:transparent;color:#91C9B0;font:700 13px Inter,system-ui,sans-serif;cursor:pointer}
html[data-theme="light"] .finder-clear{border-color:#2F7D5D;color:#2F7D5D}
@media (max-width:460px){.finder-row{grid-template-columns:1fr}.finder{padding:14px}}

/* Video lessons button (shared) */
.video-cta{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:16px;text-decoration:none;color:#FFFFFF!important;
  background:linear-gradient(135deg,#F0565C,#C9303A);box-shadow:0 8px 20px -12px rgba(201,48,58,.8);transition:transform .15s ease,filter .15s ease}
.video-cta:hover{transform:translateY(-1px);filter:brightness(1.06)}
.video-cta:focus-visible{outline:3px solid #F7A1A5;outline-offset:3px}
.video-cta .wv-icon{flex:none;display:inline-grid;place-items:center;width:34px;height:34px;border-radius:50%;background:rgba(255,255,255,.22)}
.video-cta .wv-icon::before{content:"";margin-left:3px;border-style:solid;border-width:7px 0 7px 11px;border-color:transparent transparent transparent #fff}
.video-cta-text{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}
.video-cta-text strong{font-size:15px;color:#FFFFFF}
.video-cta-text small{font-size:12px;color:#FFE3E4}
.video-cta-go{font-size:18px;font-weight:700}
@media (prefers-reduced-motion:reduce){.video-cta{transition:none}.video-cta:hover{transform:none}}

/* Printables side panel: video, puzzle, downloads */
.quick-panel{display:grid;gap:12px}
.quick-links{display:grid;gap:8px}
.quick-links .pdf-btn{justify-content:center;margin:0}
.quick-panel .feat-note{margin:0;text-align:center}
@media (max-width:999px){.lib-layout{grid-template-areas:'header' 'main' 'aside'}.quick-aside .lib-aside-inner{margin:28px 0 0}}

/* "Every printable listed by year group" */
.lib-more{margin:30px 0;border:1px solid #334155;border-radius:16px;padding:0 16px}
html[data-theme="light"] .lib-more{border-color:#D3DFDC}
.lib-more>summary{cursor:pointer;min-height:52px;display:flex;align-items:center;font-weight:700;font-size:15px;list-style:none}
.lib-more>summary::-webkit-details-marker{display:none}
.lib-more>summary::before{content:"+";display:inline-grid;place-items:center;width:24px;height:24px;margin-right:10px;border-radius:50%;border:1.5px solid currentColor;font-size:15px}
.lib-more[open]>summary::before{content:"−"}
.lib-more[open]{padding-bottom:12px}

/* Topic guides: search, jump links, extras */
.guides-top{margin:0 0 8px}
.guides-top .finder{margin-top:8px}
.guide-jump ul{list-style:none;display:flex;flex-wrap:wrap;gap:8px;margin:14px 0 0;padding:0}
.guide-jump a{display:inline-flex;align-items:center;min-height:40px;padding:0 14px;border-radius:999px;font-weight:650;font-size:14px;text-decoration:none;
  background:rgba(145,201,176,.10);border:1px solid rgba(145,201,176,.38);color:#DDF1E8}
html[data-theme="light"] .guide-jump a{background:#E6F3EE;border-color:#A9D3C1;color:#16352B}
.guide-jump a:hover{border-color:#91C9B0}
.guides-extras{display:grid;gap:12px;margin:16px 0 0;grid-template-columns:1fr}
@media (min-width:760px){.guides-extras{grid-template-columns:minmax(0,1fr) minmax(0,1.4fr);align-items:stretch}.guides-extras .video-cta{height:100%;box-sizing:border-box}}
section.group[data-guides]{scroll-margin-top:16px}
.finder .sr-only,.lib-more .sr-only,.guides-top .sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
