/* Final product-shell refinements. Loaded after site-shell-v2.css. */

/* Study steps (Learn / Practise / Test). Below 1100px: a bottom bar with space reserved for it, so it never
   covers the deck controls. From 1100px: topic pages show the same links in the sticky sidebar and bank/test
   pages already have them as tabs, so the floating dock is not shown. */
nav.es-study-dock{
  top:auto!important;
  left:50%!important;
  right:auto!important;
  transform:translateX(-50%);
  bottom:calc(10px + env(safe-area-inset-bottom,0px))!important;
  width:min(520px,calc(100% - 20px))!important;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:5px!important;
  padding:6px!important;
  height:auto!important;
  min-height:0!important;
  margin:0!important;
  background:rgba(255,255,255,.96)!important;
  border:1px solid var(--es-line)!important;
  border-bottom:1px solid var(--es-line)!important;
  box-shadow:var(--es-shadow-lg)!important;
  backdrop-filter:blur(14px)!important;
  -webkit-backdrop-filter:blur(14px)!important;
}
nav.es-study-dock a{min-width:0;justify-content:center;text-align:center;flex-direction:column;gap:.12rem;padding:.55rem .35rem}
body:has(.es-study-dock){padding-bottom:calc(84px + env(safe-area-inset-bottom,0px))}
body:has(.es-study-dock) #back-to-top{bottom:calc(94px + env(safe-area-inset-bottom,0px))!important}
@media(min-width:1100px){
  nav.es-study-dock{display:none!important}
  body:has(.es-study-dock){padding-bottom:0}
  body:has(.es-study-dock) #back-to-top{bottom:24px!important}
}

/* Sidebar copy of the study steps (written into each topic page). */
.es-study-steps{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.es-study-steps a{display:flex;flex-direction:column;align-items:center;gap:.12rem;padding:.6rem .3rem;border:1px solid var(--es-line,#dbe3eb);border-radius:9px;color:var(--es-ink,#122235)!important;font-size:.8rem;font-weight:700;text-align:center;text-decoration:none!important;line-height:1.2}
.es-study-steps a:hover{border-color:#9cc3e6;background:#eef5fb}
.es-study-steps a.is-current{background:#0c121a;border-color:#0c121a;color:#fff!important}
.es-study-steps small{font-size:.66rem;font-weight:600;opacity:.72}
.es-steps-block .sidebar-block-body{padding:.75rem!important}
@media(max-width:1099px){.es-steps-block{display:none!important}}
/* A sticky sidebar taller than the window hid its own bottom on 768px-high laptops: let it scroll inside. */
@media(min-width:1100px){
  .topic-sidebar-premium{max-height:calc(100vh - 110px);overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
}

/* Homepage should feel like a product landing page, not a brochure. */
.home-hero{
  padding:124px 0 76px!important;
  background:
    radial-gradient(circle at 82% 18%,rgba(72,150,222,.18),transparent 31%),
    linear-gradient(135deg,#0b1b2c 0%,#102b45 58%,#123a5e 100%)!important;
}
.home-hero::before{opacity:.6!important}
.home-hero-inner{grid-template-columns:minmax(0,1.18fr) minmax(320px,.82fr)!important;gap:clamp(2.4rem,5vw,5rem)!important}
.home-eyebrow{color:#9ecbf3!important}
.home-eyebrow::before{background:#65aceb!important}
.home-hero h1{font-family:'IBM Plex Serif',Georgia,serif!important;font-size:clamp(2.75rem,6vw,5.25rem)!important;max-width:830px!important}
.home-hero h1 em{color:#a8d3f8!important}
.home-lede{font-size:clamp(1rem,1.8vw,1.16rem)!important;max-width:690px!important}
.home-benefits li::before{background:rgba(112,184,247,.14)!important;color:#a8d3f8!important}
.home-hero .btn-primary{background:#fff!important;border-color:#fff!important;color:#102a43!important;box-shadow:0 10px 30px rgba(0,0,0,.18)!important}
.home-hero .btn-primary:hover{background:#e9f4fd!important;border-color:#e9f4fd!important;color:#102a43!important}
.home-hero .btn-outline{border-color:rgba(255,255,255,.3)!important;background:rgba(255,255,255,.04)!important}
.home-hero .btn-outline:hover{background:rgba(255,255,255,.1)!important}
.study-route-card{border-radius:20px!important;border:1px solid rgba(255,255,255,.18)!important;box-shadow:0 30px 80px rgba(3,13,23,.3)!important;padding:1.6rem!important}
.study-route-kicker{color:var(--es-blue)!important}
.route-num{background:var(--es-blue)!important}
.grade-jump a:hover,.grade-jump a:focus-visible{border-color:var(--es-blue)!important;box-shadow:0 8px 20px rgba(23,104,181,.12)!important}

/* Trust strip: simple evidence, not marketing noise. */
.home-trust{border-bottom:1px solid var(--es-line)!important}
.home-trust-inner{max-width:var(--es-max)!important}
.home-trust-item strong{font-family:'IBM Plex Sans',system-ui,sans-serif!important;font-weight:750!important;letter-spacing:-.015em!important}

/* Grade/topic finder becomes the main product surface. */
#topics.home-section{padding-top:4.8rem!important}
.home-section-head{max-width:780px!important}
.home-section-head h2{font-family:'IBM Plex Serif',Georgia,serif!important;letter-spacing:-.035em!important}
.home-section-tag{color:var(--es-blue)!important}
.home-grade-tabs{gap:.45rem!important}
.home-grade-tab{border-radius:10px!important;padding:.72rem 1.1rem!important;min-width:110px!important;border-color:var(--es-line)!important}
.home-grade-tab.active{background:var(--es-blue)!important;border-color:var(--es-blue)!important}
.home-paper-grid{gap:1.35rem!important}
.home-paper-card{border-radius:18px!important;border-color:var(--es-line)!important;box-shadow:0 10px 30px rgba(18,34,53,.06)!important}
.home-paper-head{background:#11283e!important;padding:1.15rem 1.25rem!important}
.home-paper-head.p2{background:#173c5c!important}
.home-paper-no{border-radius:10px!important;color:#acd6f9!important}
.home-topic-link,.home-topic-soon{min-height:64px!important;padding:.82rem 1.05rem!important}
.home-topic-link:hover,.home-topic-link:focus-visible{background:#f0f7fc!important}
.home-topic-icon{width:36px!important;height:36px!important;border-radius:10px!important;background:#e8f2fb!important;color:var(--es-blue)!important}
.home-topic-name{font-size:.91rem!important;font-weight:700!important}
.home-topic-meta{font-size:.73rem!important;line-height:1.4!important}

/* Learning method: visually connected workflow. */
.learning-flow{gap:1.15rem!important}
.learning-step{border-radius:18px!important;border-color:var(--es-line)!important;box-shadow:none!important;padding:1.45rem!important}
.learning-step-num{background:#e8f2fb!important;color:var(--es-blue)!important;border-radius:10px!important}

/* Resources are useful, but should sit behind the core learning journey. */
.home-resource-card{border-radius:16px!important;border-color:var(--es-line)!important;box-shadow:none!important;transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease!important}
.home-resource-card:hover{border-color:#afc7da!important;box-shadow:0 10px 24px rgba(18,34,53,.06)!important;transform:translateY(-2px)}
.home-resource-card .resource-label,.home-resource-card a{color:var(--es-blue)!important}

/* Teacher identity: professional trust signal, never a celebrity-style hero. */
#about{background:#eef4f8!important}
.home-about{grid-template-columns:minmax(190px,260px) 1fr!important;gap:clamp(1.6rem,4vw,3.5rem)!important;max-width:1040px!important}
.home-about-photo{width:100%!important;max-width:240px!important;aspect-ratio:4/5!important;border-radius:22px!important;box-shadow:0 18px 42px rgba(18,34,53,.13)!important;border:5px solid #fff!important}
.home-about-copy h2{font-family:'IBM Plex Serif',Georgia,serif!important;font-size:clamp(1.8rem,4vw,2.65rem)!important;letter-spacing:-.035em!important;margin:.1rem 0 .8rem!important}
.home-about-copy p{font-size:.98rem!important;max-width:700px!important}
.home-about-list li{border-radius:9px!important;background:#fff!important;border-color:#d7e2ea!important;color:var(--es-ink)!important;padding:.48rem .7rem!important}

/* Community is a support channel, not a primary conversion funnel. */
.community-bar{border-radius:18px!important;background:#11283e!important;padding:1.4rem 1.5rem!important}
.community-bar .btn-primary{background:#fff!important;border-color:#fff!important;color:#11283e!important;box-shadow:none!important}

/* Make FAQs feel like a help centre. */
.home-faq{max-width:880px!important}
.home-faq details{border-radius:12px!important;border-color:var(--es-line)!important;padding:1rem 1.1rem!important;box-shadow:none!important}

@media(max-width:900px){
  .home-hero-inner{grid-template-columns:1fr!important}
  .study-route-card{max-width:none!important}
}

@media(max-width:760px){
  .home-hero{padding:100px 0 52px!important}
  .home-about{grid-template-columns:1fr!important;text-align:left}
  .home-about-photo{width:150px!important;max-width:150px!important}
}

@media(max-width:520px){
  .home-hero h1{font-size:clamp(2.25rem,12vw,3.25rem)!important}
  .home-benefits{display:grid!important;grid-template-columns:1fr 1fr!important}
  .home-grade-tab{flex:1 1 0;min-width:0!important}
  .home-topic-link,.home-topic-soon{grid-template-columns:36px minmax(0,1fr) auto!important}
}

/* Pages without style.css (mastery tests) need the closed mobile menu hidden too. */
@media(max-width:760px){
  .nav-links:not(.open){display:none!important}
  .nav-links.open{position:absolute!important;left:0;right:0;flex-direction:column}
}

/* ---- 2026-10-20: readability fixes for the Mastery Bank (.level-section) and Test (#startScreen) templates ----
   site-shell-v2.css sets every h1-h6 to dark ink, which hid the white hero titles on these dark heroes
   (and the stats numbers once the stats strip was made dark). Nav links also kept the browser underline. */
body:has(.level-section) .hero h1,
body:has(#startScreen) .hero h1{color:#fff}
body:has(.level-section) .stats .stat-val{color:#fff!important}
body:has(.level-section) .stats .stat-lbl{color:rgba(255,255,255,.72)!important}
nav a,nav a:hover,nav a:focus{text-decoration:none!important}
/* Topic hub hero pills: light text on the dark hero (they were blue-on-navy, contrast ~2:1) */
.topic-hero-meta .topic-meta-pill{color:#d8e8f8!important;background:rgba(255,255,255,.07)!important;border-color:rgba(255,255,255,.22)!important}
/* Test pages now use the standard Primary navigation markup (same as the Mastery Bank pages) */
body:has(#startScreen) .nav-links{display:flex;align-items:center;gap:4px;margin-left:auto}
body:has(#startScreen) .nl{padding:8px 12px;border-radius:8px;color:rgba(255,255,255,.75);font-size:13.5px}
body:has(#startScreen) .nl:hover{color:#fff;background:rgba(255,255,255,.06)}
body:has(#startScreen) .nav-brand span{color:#e7c873}
body:has(#startScreen) .nav-toggle{display:none;background:none;border:none;color:#fff;font-size:22px;cursor:pointer}
body:has(#startScreen) .mobile-menu{display:none;flex-direction:column;background:#0d1b2b;padding:8px 20px 16px}
body:has(#startScreen) .mobile-menu a{padding:12px 4px;color:rgba(255,255,255,.85);font-size:14px;border-bottom:1px solid rgba(255,255,255,.05)}
body:has(#startScreen) .mobile-menu.open{display:flex}
@media(max-width:820px){body:has(#startScreen) .nav-links{display:none}body:has(#startScreen) .nav-toggle{display:block;margin-left:auto}}
/* Bank/Test: topic tabs without browser underline; readable hero badge and accent line on the dark hero */
.topic-tabs a,.tab-link{text-decoration:none!important}
body:has(.level-section) .hero-badge,body:has(#startScreen) .hero-badge{color:#cfe3f8!important;border-color:rgba(207,227,248,.35)!important;background:rgba(255,255,255,.06)!important}
body:has(#startScreen) .hero h1 em{color:#7ab8f5!important}
/* Topic hubs: the slide top bar is white (learning-quality-v3), so the quick-check badge needs dark text */
.embed-topbar .quiz-progress-badge{color:#163b5c!important;background:#eef4fb!important;border-color:#c9d9ec!important}
html.es-dark .embed-topbar .quiz-progress-badge{color:#e6eef8!important;background:rgba(255,255,255,.08)!important;border-color:rgba(255,255,255,.22)!important}
/* Topic hubs: video cards stayed cream in dark mode while their text turned light */
html.es-dark .subtopic-card{background:#141f2b!important;border-color:rgba(255,255,255,.12)!important}
html.es-dark .subtopic-card h3{color:#f1f5fb!important}
html.es-dark .subtopic-card p{color:#b9c6d6!important}
html.es-dark .subtopic-source::after{color:#5fd1b1!important}
html.es-dark .embed-topbar-label{color:#e6eef8!important}

/* Inline maths never shows a scrollbar under the formula. Several page styles gave inline formulas
   overflow-x:auto, and a 1px glyph overhang made Windows draw a grey scrollbar under almost every one.
   Wide screens: no overflow box at all. Phones: a long formula can still be swiped sideways. */
mjx-container[jax="CHTML"]:not([display="true"]){scrollbar-width:none!important;-ms-overflow-style:none}
mjx-container[jax="CHTML"]:not([display="true"])::-webkit-scrollbar{display:none!important;width:0!important;height:0!important}
@media(min-width:700px){
  mjx-container[jax="CHTML"]:not([display="true"]){overflow:visible!important;max-width:none!important}
}
mjx-container[jax="CHTML"][display="true"]{scrollbar-width:thin}

/* One logo on every page. Bank and test pages do not load style.css, so the logo's base layout lives here. */
.nav-logo{display:flex;align-items:center;text-decoration:none!important;flex:none}
.nav-logo-text{display:flex;flex-direction:column;line-height:1.1}

/* Step tabs on Mastery Bank and Test pages: the same three steps as the topic page, all visible at 320px. */
.es-step-tabs{position:sticky;top:72px;z-index:88;background:rgba(248,251,253,.96);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border-bottom:1px solid var(--es-line,#dbe3eb)}
.es-step-tabs-inner{max-width:760px;margin:0 auto;padding:8px 16px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.es-step-tab{display:flex;align-items:center;justify-content:center;gap:.45rem;min-height:40px;padding:.4rem .5rem;border:1px solid var(--es-line,#dbe3eb);border-radius:9px;background:#fff;color:var(--es-ink,#122235)!important;font:700 .78rem/1.2 'IBM Plex Sans',system-ui,sans-serif;text-align:center;text-decoration:none!important}
.es-step-tab:hover{background:#eef5fb;border-color:#aac4da}
.es-step-tab.is-active{background:#0c121a;border-color:#0c121a;color:#fff!important}
.es-step-num{display:inline-grid;place-items:center;flex:none;width:20px;height:20px;border-radius:50%;background:#e7f1fa;color:#1768b5;font-size:.68rem}
.es-step-tab.is-active .es-step-num{background:rgba(255,255,255,.16);color:#fff}
@media(max-width:760px){
  .es-step-tabs{top:64px}
  .es-step-tabs-inner{padding:6px 10px;gap:5px}
  .es-step-tab{flex-direction:column;gap:.2rem;min-height:50px;padding:.35rem .25rem;font-size:.7rem}
}

/* Bank and test pages: the nav and the step tabs stay in view together. overflow-x:clip hides sideways
   overflow like "hidden" but does not turn <body> into a scroll box, which silently disabled sticky headers. */
html,body{overflow-x:clip!important}
body:has(.es-step-tabs)>nav{position:sticky!important;top:0!important;z-index:100!important}

/* Grade banner (bank/test pages): one line on phones instead of two. */
@media(max-width:600px){.grade-banner{white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;font-size:.7rem!important;padding-left:12px!important;padding-right:12px!important}}

/* Article pages: keep their 64px bar (the global nav rule collapsed it) and the site logo style; fit 320px. */
nav.blog-nav{height:64px!important}
.blog-nav-brand-name{font-family:'IBM Plex Sans',system-ui,sans-serif!important;font-weight:750!important;letter-spacing:-.015em!important;white-space:nowrap}
.blog-nav-brand-sub{color:#8fc3f2!important;font-weight:700}
@media(max-width:480px){
  .blog-nav-inner{padding:0 12px!important}
  .blog-nav-links{gap:8px!important}
  .blog-nav-brand{gap:.5rem!important}
  .blog-nav-brand svg{width:28px!important;height:28px!important}
}
@media(max-width:400px){.blog-nav-brand-text{display:none!important}}

/* Narrow-screen overflow found by a 320px scan of every page. */
.sg-cta-btn{white-space:normal!important;max-width:100%;text-align:center}
.hero-badge{max-width:100%;white-space:normal!important;flex-wrap:wrap;justify-content:center;text-align:center}
@media(min-width:1100px){.topic-sidebar-premium>*{flex-shrink:0}}

/* Homepage hero: full-window height left big empty bands on tablets and phones; size it to its content. */
@media(max-width:1023px){#home.hero{min-height:auto!important;padding:104px 0 56px!important}}
@media(min-width:600px) and (max-width:900px){#home.hero .hero-visual{display:block!important;width:100%;max-width:440px;margin:0 auto}}

/* Guided-course deck below 1100px. The slide grows to its full height so the page is the only scroller, the
   Previous/Next row sticks to the bottom of the screen while the deck is on screen, and the Learn/Practise/Test bar
   steps aside meanwhile (topic-deck.js sets html.es-deck-in-view). Hiding the bar is simpler and more robust than
   copying the deck controls into it: one set of buttons keeps its own disabled/Finish states, focus and swipe/keyboard
   wiring. overflow:clip keeps the rounded corners without making the box a scroll container (that breaks sticky). */
@media(max-width:1099.98px){
  html body .embed-box:not(:fullscreen):not(.es-fs-fallback){overflow:visible!important;overflow:clip!important}
  html body .embed-box:not(:fullscreen):not(.es-fs-fallback) .embed-slide-area{height:auto!important;max-height:none!important;overflow:visible!important}
  html body .embed-box:not(:fullscreen):not(.es-fs-fallback) .embed-controls{position:sticky;bottom:0;z-index:30;box-shadow:0 -6px 16px rgba(18,34,53,.08);padding-bottom:calc(10px + env(safe-area-inset-bottom,0px))!important}
  nav.es-study-dock{transition:transform .2s ease,opacity .2s ease,visibility .2s}
  html.es-deck-in-view nav.es-study-dock{transform:translate(-50%,calc(100% + 24px))!important;opacity:0;visibility:hidden;pointer-events:none}
  html.es-deck-in-view #back-to-top{display:none!important}
}

/* Test pages: the name is asked only on the certificate; on phones the Previous/Next row stays in view under the
   question and its feedback (test-flow.js scrolls the feedback and the row into view after each answer). */
.name-input[hidden]{display:none!important}
@media(max-width:820px){
  body:has(#quizScreen) .quiz-nav{position:sticky;bottom:0;z-index:20;margin-top:12px!important;padding:10px 0 calc(10px + env(safe-area-inset-bottom,0px));background:linear-gradient(rgba(244,247,251,0),#f4f7fb 35%)}
  body:has(#quizScreen) .quiz-nav .btn-nav{min-height:48px}
}

/* Back-to-top never sits on top of quiz answers. */
body:has(#quizScreen.active) #back-to-top{display:none!important}

/* Menu button: the same white, 44px three-bar button on every page. Bank pages do not load style.css, so their
   button was a 16px black square on the navy bar. */
nav .hamburger{flex-direction:column;justify-content:center;align-items:center;gap:5px;min-width:44px!important;min-height:44px!important;padding:0!important;background:transparent!important;border:0!important;color:#fff!important;cursor:pointer}
nav .hamburger span{display:block!important;width:22px!important;height:2px!important;border-radius:2px;background:#fff!important}
/* Tap targets of at least 44px on the core learning path. */
.embed-nav-btn{min-height:44px!important;min-width:88px;justify-content:center;font-size:.9rem!important}
.enlarge-btn{min-width:44px!important;min-height:44px!important}
.es-topic-search-trigger{min-width:44px!important;height:44px!important}
.es-mastered-btn{min-height:44px!important;padding:.5rem .95rem!important;font-size:.8rem!important}
.es-bank-filter,.es-bank-due-first{min-height:44px!important;padding:.5rem .75rem!important;font-size:.76rem!important}
.quiz-opt,.option{min-height:44px}
.es-step-tab{min-height:44px}
.topic-tabs-bar a,.grade-switch a{min-height:44px;display:inline-flex;align-items:center;justify-content:center}

/* Very narrow phones (320–374px): make room for the 44px search and menu buttons; the logo text gives way first. */
@media(max-width:374px){
  nav .nav-inner{gap:4px!important;padding-left:10px!important;padding-right:10px!important}
  nav .nav-logo{flex:0 1 auto!important;min-width:0!important;overflow:hidden}
  nav .nav-logo-text,nav .nav-logo span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}

nav .nav-toggle{min-width:44px!important;min-height:44px!important;padding:0!important;color:#fff!important;font-size:24px!important;line-height:44px!important;text-align:center}

/* Maths on phones: worked steps sat five boxes deep (slide area, slide, card, solution panel, step row), which left
   about 150px for a line of working at 360px. Thinner side padding gives each line about 60px more. */
@media(max-width:520px){
  html body .embed-slide-area > .slide{padding-left:0!important;padding-right:0!important}
  html body .embed-slide-area .slide .card{padding-left:14px!important;padding-right:14px!important}
  html body .embed-slide-area .slide .pbody{padding-left:12px!important;padding-right:12px!important}
  html body .embed-slide-area .slide .steps li{gap:8px!important}
}
/* A "Show derivation of \(\cos(\alpha-\beta)\)" summary: as a flex row its formula was squeezed into a 50px item.
   As ordinary text the line wraps around the formula instead. */
.slide summary:has(mjx-container){display:block!important}
.slide summary:has(mjx-container)::before{margin-right:9px}
/* A formula that cannot break (one long fraction or square root) scrolls in its own box, with the site's
   "Scroll sideways" hint written straight before it; from 700px the formula fits and the hint is hidden. */
.es-math-scroll{display:block;max-width:100%;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;padding-bottom:3px}
.es-math-scroll mjx-container[jax="CHTML"]{overflow:visible!important;max-width:none!important}
.es-math-scroll-hint{display:block;margin:5px 0;font-size:12px;line-height:1.5;color:inherit}
@media(min-width:700px){.es-math-hint-static{display:none!important}}
