/* Final canonical-reader refinements.
   Equations use textbook-style centered display; supporting prose and formal
   infrastructure remain secondary to the mathematical statement and proof. */

.math-first-display mjx-container[display="true"],
.math-first-theorem mjx-container[display="true"],
.source-passage mjx-container[display="true"] {
  text-align: center !important;
  margin: 0.65rem auto !important;
}

.math-first-display,
.source-formula,
.source-proof-formula {
  text-align: center;
}

/* Canonical source cards read as: numbered result -> mathematical headline ->
   displayed statement -> compact equation proof -> one short explanation. */
.source-passage > h2 {
  margin-bottom: 0.35rem;
}

.source-passage > .source-formula {
  margin: 0.5rem auto 0.45rem;
}

.source-passage > p {
  max-width: 68ch;
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.formula-supplement {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.15rem 0;
}

.source-equation-proof {
  margin: 0.75rem 0 0.45rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}

.source-proof-label {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.94rem;
  margin-bottom: 0.2rem;
}

.source-proof-step {
  display: grid;
  grid-template-columns: 1.4rem minmax(0, 1fr);
  gap: 0.45rem;
  align-items: start;
}

.source-proof-index {
  padding-top: 0.65rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
}

.source-proof-equation {
  min-width: 0;
}

.source-proof-formula {
  overflow-x: auto;
  overflow-y: hidden;
}

.source-proof-lean {
  margin: -0.15rem 0 0.45rem;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

.source-proof-lean span {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.source-proof-lean code {
  font-size: 0.74rem;
}

.math-theorem-statement > p {
  max-width: 70ch;
  margin-bottom: 0.55rem;
}

.math-theorem-proof {
  margin-top: 1.5rem;
}

.math-proof-step p {
  color: var(--muted);
  font-size: 0.88rem;
}

/* Standard infrastructure should be available but not visually compete with
   Chewi's numbered result. */
.foundation-disclosure,
.math-lean-correspondence,
.implicit-prerequisite-card > details,
.source-passage + .reader-disclosure {
  box-shadow: none !important;
}

.math-lean-correspondence .table-wrap {
  margin-top: 0.4rem;
}

.math-lean-correspondence th,
.math-lean-correspondence td {
  padding: 0.55rem 0.65rem;
}

.math-first-theorem .source-anchor {
  color: var(--muted);
}

/* Avoid chat/tutorial language receiving editorial weight if older enrichers
   produce it elsewhere on the page. */
.tiny-example,
.remember-box,
.mode-explanation,
.lean-studio-intro {
  font-size: 0.86rem;
}

@media (max-width: 700px) {
  .source-proof-step {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .source-proof-index {
    display: none;
  }
}
