/* Formula Reference page v2 */
.formulas-page {
  max-width: 780px;
}

.formulas-intro {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

.formula-section h2 {
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
}

/* Each formula card — full width, stacked */
.formula-item {
  padding: 1.25rem;
  margin-bottom: 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  border-left: 4px solid var(--accent);
}

.formula-item:last-child {
  margin-bottom: 0;
}

.formula-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
}

/* Visual formula (KaTeX rendered) */
.formula-visual {
  text-align: center;
  padding: 1rem 0.5rem;
  margin-bottom: 0.75rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
  min-height: 2.5rem;
}

/* Override KaTeX font size */
.formula-visual .katex {
  font-size: 1.2rem;
}

/* "Write:" line */
.formula-write {
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
  background: rgba(67, 97, 238, 0.06);
  border-radius: var(--radius);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.92rem;
  line-height: 1.6;
  border: 1px dashed var(--accent);
  color: var(--text);
}

.write-label {
  font-weight: 600;
  color: var(--accent);
  margin-right: 0.35rem;
}

.formula-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Synthetic division example table */
.synth-example-item {
  padding-bottom: 1.25rem;
}

.synth-steps {
  margin-bottom: 1rem;
}

.synth-step-text {
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  line-height: 1.5;
}

.synth-table {
  border-collapse: collapse;
  font-family: 'Cambria Math', 'Times New Roman', serif;
  font-size: 1.1rem;
  margin: 0.75rem auto;
  min-width: 300px;
}

.synth-table td {
  padding: 0.5rem 1rem;
  text-align: center;
  min-width: 3rem;
}

.synth-table .synth-c {
  border-right: 2px solid var(--text);
  font-weight: 700;
}

.synth-table .synth-mults td {
  color: var(--accent);
  font-size: 0.95rem;
}

.synth-table .synth-result td {
  border-top: 2px solid var(--text);
  font-weight: 700;
}

.synth-table .synth-remainder {
  color: var(--correct);
  border-left: 2px solid var(--text);
}

/* Remove old grid — now single column */
.formula-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Responsive */
@media (max-width: 600px) {
  .formula-visual .katex { font-size: 1rem; }
  .formula-write { font-size: 0.85rem; }
  .synth-table td { padding: 0.35rem 0.5rem; }
}
