/* Equation Station SA — topic learning-quality layer
   Loaded only on /topics/ and /notes/ pages by analytics-events.js.
   Purpose: reduce reading load, strengthen visual hierarchy, and keep
   Mathematics pages easy to scan without rewriting accurate content. */

:root{
  --learn-blue:var(--es-blue-700,#145daa);
  --learn-teal:#168f79;
  --learn-amber:#b98512;
  --learn-red:#c44f3b;
  --learn-ink:#172c3f;
  --learn-muted:#516779;
  --learn-line:#dce5ec;
  --learn-soft:#f7fafc;
}

/* Compact the top of long topic pages so learners reach maths faster. */
.topic-hero{padding-top:5.4rem!important;padding-bottom:3.1rem!important}
.topic-breadcrumb{margin-bottom:.85rem!important}
.grade-switch{margin-bottom:.9rem!important}
.topic-hero h1{margin-bottom:.65rem!important;font-size:clamp(2.15rem,4.6vw,3.35rem)!important}
.topic-hero-desc{max-width:660px!important;margin-bottom:1rem!important;font-size:.98rem!important;line-height:1.55!important}
.topic-tabs-bar{margin-bottom:.75rem!important}
.topic-hero-meta{gap:.45rem!important}
.topic-meta-pill{font-size:.66rem!important;padding:.28rem .66rem!important}

/* Keep reading lines short enough to scan. */
.topic-main-col p,
.slide p,
.card p,
.callout-body,
.fact-card p,
.quiz-question,
.quiz-feedback,
.content-block p,
.concept-card p,
.mistake-card p{
  max-width:72ch;
}

/* Lower paragraph density globally on teaching surfaces. */
.topic-main-col p,
.slide p,
.card p,
.fact-card p,
.callout-body,
.content-block p{
  line-height:1.55!important;
}

/* Stronger hierarchy: headings introduce maths, not decoration. */
.sec-head{margin-bottom:.85rem!important;padding-bottom:.65rem!important}
.sec-title{line-height:1.18!important}
.sec-sub{max-width:68ch!important;line-height:1.45!important;color:var(--learn-muted)!important}
.content-block-header{margin-bottom:1.2rem!important;padding-bottom:.85rem!important}
.content-block-header h2{line-height:1.2!important}

/* Worked examples should read as method steps. */
.card-example,
.worked-example,
.example-card{
  border-left:4px solid var(--learn-blue)!important;
}
.steps{display:grid!important;gap:.48rem!important}
.steps li{line-height:1.48!important}
.step,.steps li{
  break-inside:avoid;
}
.sn{
  font-family:var(--font-mono,monospace)!important;
  font-weight:700!important;
}

/* Callouts: short, purposeful, visually distinct. */
.callout{padding:.85rem 1rem!important;border-radius:10px!important}
.callout-tag{font-size:.66rem!important;letter-spacing:.07em!important;text-transform:uppercase!important}
.callout-body{font-size:.88rem!important;line-height:1.5!important}

/* Long conceptual cards should not look like essays. */
.fact-card,
.concept-card,
.mistake-card{
  padding:1rem 1.05rem!important;
}
.fact-title,
.concept-card h4,
.mistake-card h4{
  line-height:1.25!important;
}

/* Formula and maths display treatment. */
.math-display,
.formula-display{
  overflow-x:auto!important;
  overflow-y:hidden!important;
  max-width:100%!important;
  -webkit-overflow-scrolling:touch;
}
mjx-container[display="true"]{
  max-width:100%!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  padding-bottom:.08rem;
}

/* Diagrams should always be given enough room and never overflow mobile. */
.diagram,
.math-diagram,
.fin-graph-diagram,
.graph-wrap,
.figure-wrap{
  max-width:100%!important;
  overflow:hidden;
  break-inside:avoid;
}
.diagram svg,
.math-diagram svg,
.fin-graph-diagram svg,
.graph-wrap svg,
.figure-wrap svg{
  width:100%!important;
  height:auto!important;
  max-width:760px!important;
  display:block;
  margin-inline:auto;
}
.diagram figcaption,
figure figcaption{
  max-width:72ch;
  margin:.55rem auto 0!important;
  color:var(--learn-muted)!important;
  font-size:.78rem!important;
  line-height:1.45!important;
}

/* Tables are useful in maths; make them mobile-safe rather than tiny. */
.tw,
.table-wrap,
.content-block table{
  max-width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}
table{font-size:.84rem!important}
th{line-height:1.25!important}
td{line-height:1.4!important}

/* Quick checks should look like active tasks. */
.quiz-card{border-radius:12px!important}
.quiz-question{font-size:.92rem!important;line-height:1.48!important}
.quiz-options{gap:.55rem!important}
.quiz-opt{line-height:1.4!important;padding:.7rem .85rem!important}
.quiz-feedback{font-size:.82rem!important;line-height:1.5!important}

/* Details reduce page length while keeping full solutions available. */
details>summary{cursor:pointer}
details>summary:focus-visible{outline:3px solid rgba(20,93,170,.28);outline-offset:3px;border-radius:4px}

/* Sidebar should support the lesson, not compete with it. */
.topic-sidebar-premium{gap:1rem!important}
.sidebar-block-title{padding:.8rem 1rem!important;font-size:.72rem!important}
.sidebar-block-body{padding:1rem!important}
.page-nav-list li a,.all-topics-list li a{padding:.52rem .62rem!important;font-size:.79rem!important}
.sidebar-tutor-img-wrap{height:170px!important}

/* Reduce card-hover motion on learning pages. */
.content-block:hover,
.formula-block:hover,
.concept-card:hover,
.mistake-card:hover,
.resource-card-premium:hover,
.related-topic-card:hover{
  transform:none!important;
}

/* Visual cue classes available for future content edits. */
.es-method-list{
  list-style:none;
  display:grid;
  gap:.55rem;
  padding:0;
  margin:.75rem 0 1rem;
  counter-reset:method;
}
.es-method-list>li{
  counter-increment:method;
  display:grid;
  grid-template-columns:30px 1fr;
  gap:.65rem;
  align-items:start;
  padding:.68rem .75rem;
  border:1px solid var(--learn-line);
  background:#fff;
  border-radius:9px;
  font-size:.86rem;
  line-height:1.45;
}
.es-method-list>li::before{
  content:counter(method);
  display:grid;
  place-items:center;
  width:28px;height:28px;
  border-radius:7px;
  background:var(--learn-blue);
  color:#fff;
  font:700 .7rem/1 var(--font-mono,monospace);
}

.es-key-points{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:.65rem;
  margin:.8rem 0;
}
.es-key-point{
  padding:.72rem .8rem;
  border:1px solid var(--learn-line);
  border-radius:9px;
  background:var(--learn-soft);
  font-size:.83rem;
  line-height:1.45;
}
.es-key-point strong{display:block;color:var(--learn-ink);margin-bottom:.15rem}

.es-exam-tip{
  border-left:4px solid var(--learn-amber);
  background:#fff9ea;
  padding:.75rem .9rem;
  border-radius:0 9px 9px 0;
  font-size:.84rem;
  line-height:1.48;
}
.es-exam-tip strong{color:#7c5a0b}

.es-mistake{
  border-left:4px solid var(--learn-red);
  background:#fff5f2;
  padding:.75rem .9rem;
  border-radius:0 9px 9px 0;
  font-size:.84rem;
  line-height:1.48;
}

@media(max-width:768px){
  .topic-hero{padding-top:4.9rem!important;padding-bottom:2.4rem!important}
  .topic-hero h1{font-size:clamp(1.9rem,8vw,2.5rem)!important}
  .topic-hero-desc{font-size:.92rem!important;line-height:1.5!important}
  .topic-layout{padding-top:1.4rem!important;gap:1.3rem!important}
  .content-block{padding:1.05rem!important;margin-bottom:1rem!important}
  .embed-slide-area{height:min(680px,78vh)!important}
  .slide,.lesson-slide{padding:.82rem!important}
  .fact-grid,.formula-grid,.outcome-grid,.related-topics-grid{grid-template-columns:1fr!important}
  .es-key-points{grid-template-columns:1fr}
  table{font-size:.78rem!important}
}

@media(max-width:480px){
  .topic-breadcrumb{display:none!important}
  .grade-switch{margin-top:.2rem!important}
  .topic-tabs-bar a{flex:1 1 auto;justify-content:center;text-align:center;padding:.5rem .7rem!important;font-size:.75rem!important}
  .topic-meta-pill{font-size:.62rem!important}
  .quiz-opt{font-size:.82rem!important}
}

@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}
}
