/* Formula / Content Deep-Dive Styles */

.formula-dive {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

/* ── Breadcrumb ── */
.breadcrumb {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
  letter-spacing: 0.01em;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.breadcrumb a:hover {
  color: var(--text);
}

/* ── Headings ── */
.formula-dive h1 {
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 2rem;
  line-height: 1.2;
}

.formula-dive h2 {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
}

.formula-dive h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

.formula-dive h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 1rem 0 0.4rem;
}

/* ── Sections ── */
.formula-section {
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
}

.formula-section:last-of-type {
  border-bottom: none;
}

.formula-section p {
  margin-bottom: 0.9rem;
  font-size: 0.95rem;
  line-height: 1.7;
}

.formula-section ul,
.formula-section ol {
  margin-left: 1.25rem;
  margin-bottom: 1rem;
}

.formula-section li {
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
  line-height: 1.65;
}

/* ── Formula display box ── */
.formula-box {
  background: var(--hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  margin: 1.25rem 0;
  overflow-x: auto;
}

.formula-box .katex-display {
  margin: 0;
}

/* ── Inline formula ── */
.formula-inline {
  background: var(--hover);
  border-left: 2px solid var(--text);
  padding: 0.9rem 1.25rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  overflow-x: auto;
}

.formula-inline .katex-display {
  margin: 0.25rem 0;
}

/* ── Where / definition box ── */
.where {
  background: var(--hover);
  border-radius: var(--radius);
  padding: 0.9rem 1.25rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.where ul {
  margin-left: 1rem;
  margin-bottom: 0;
}

/* ── Callout blocks (insight, example, problem, derivation) ── */
.insight,
.example-box,
.derivation,
.highlight {
  background: var(--hover);
  border-left: 2px solid var(--text);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
  line-height: 1.65;
}

.insight strong,
.example-box h4,
.derivation h3 {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  margin-top: 0;
}

.example-box ul,
.derivation ul {
  margin-left: 1.25rem;
  margin-bottom: 0;
}

/* ── Problem / bad-idea blocks ── */
.problem-box,
.bad-idea {
  background: var(--hover);
  border-left: 2px solid var(--muted);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
}

.problem-box h3,
.bad-idea h4 {
  margin-top: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.bad-idea ul {
  margin-left: 1.25rem;
}

/* ── Table ── */
.table-wrapper {
  overflow-x: auto;
  margin: 1.25rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  border-bottom: 2px solid var(--text);
}

th {
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

tbody tr:hover td {
  background: var(--hover);
}

.highlight-cell {
  font-weight: 600;
}

/* ── Gotchas ── */
.gotcha-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gotcha {
  background: var(--hover);
  border-left: 2px solid var(--muted);
  padding: 0.9rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
}

.gotcha h4 {
  margin-top: 0;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.gotcha code {
  background: var(--border);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-family: "SF Mono", Monaco, Consolas, monospace;
  font-size: 0.85em;
}

/* ── Exercises ── */
.exercises {
  border-top: 2px solid var(--text);
  padding-top: 1.5rem;
}

.exercise {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.exercise:last-child {
  border-bottom: none;
}

.exercise h4 {
  margin-top: 0;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.exercise ul {
  margin-left: 1.25rem;
  margin-bottom: 0;
}

/* ── Note text ── */
.note {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.5rem 0;
  font-style: italic;
}

/* ── Back link ── */
.formula-dive .back-link {
  margin-top: 3rem;
  display: inline-block;
}

/* ── Vocab-specific ── */
.vocab-card-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.vocab-card-grid .card {
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 1.5rem 0;
}

.vocab-card-grid .card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  margin-top: 0;
}

.vocab-card-grid .card h3 a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s;
}

.vocab-card-grid .card h3 a:hover {
  color: var(--muted);
}

.vocab-preview {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .formula-box {
    padding: 1.25rem 1rem;
  }

  table {
    font-size: 0.8rem;
  }

  th, td {
    padding: 0.5rem;
  }
}
