/* ============================================================
   LearnBid — Math Formula Cards
   Version  : 3.2.0
   Fix      : Proof steps — no bullets, no numbers
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

/* ══════════════════════════════════════════
   CSS VARIABLES
══════════════════════════════════════════ */
:root {
  --mf-font-main  : 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mf-font-mono  : 'JetBrains Mono', 'Fira Mono', monospace;

  --mf-card-bg    : #ffffff;
  --mf-card-border: #e5e7eb;
  --mf-card-radius: 14px;
  --mf-card-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.06);

  --mf-text-dark  : #111827;
  --mf-text-body  : #374151;
  --mf-text-muted : #9ca3af;

  /* Teal */
  --mf-teal        : #0d9488;
  --mf-teal-dark   : #0f766e;
  --mf-teal-light  : #f0fdf9;
  --mf-teal-border : #99f6e4;
  --mf-teal-mid    : #ccfbf1;

  /* Blue */
  --mf-blue        : #2563eb;
  --mf-blue-light  : #eff6ff;
  --mf-blue-border : #bfdbfe;

  /* Purple */
  --mf-purple      : #9333ea;
  --mf-purple-light: #faf5ff;
  --mf-purple-border: #e9d5ff;

  /* Orange */
  --mf-orange      : #ea580c;
  --mf-orange-light: #fff7ed;
  --mf-orange-border: #fed7aa;

  /* Red */
  --mf-red         : #e11d48;
  --mf-red-light   : #fff1f2;
  --mf-red-border  : #fecdd3;

  /* Green */
  --mf-green       : #16a34a;
  --mf-green-light : #f0fdf4;
  --mf-green-border: #bbf7d0;
}

/* ══════════════════════════════════════════
   SR-ONLY
══════════════════════════════════════════ */
.mf__sr-only {
  position   : absolute;
  width      : 1px;
  height     : 1px;
  padding    : 0;
  margin     : -1px;
  overflow   : hidden;
  clip       : rect(0,0,0,0);
  white-space: nowrap;
  border     : 0;
}

/* ══════════════════════════════════════════
   WRAPPER
══════════════════════════════════════════ */
.mf__wrapper {
  font-family: var(--mf-font-main);
  max-width  : 1080px;
  margin     : 0 auto;
  padding    : 0 16px 48px;
}

/* ══════════════════════════════════════════
   SECTION HEADER
══════════════════════════════════════════ */
.mf__section-header {
  display      : flex;
  align-items  : center;
  gap          : 14px;
  margin-bottom: 20px;
  padding      : 18px 20px;
  background   : #ffffff;
  border       : 1.5px solid var(--mf-card-border);
  border-radius: 14px;
  box-shadow   : var(--mf-card-shadow);
}

.mf__section-icon {
  width          : 46px;
  height         : 46px;
  min-width      : 46px;
  background     : linear-gradient(135deg, #0d9488, #0891b2);
  color          : #ffffff;
  border-radius  : 12px;
  display        : flex;
  align-items    : center;
  justify-content: center;
  font-size      : 1.4rem;
  font-family    : var(--mf-font-mono);
  font-weight    : 700;
  box-shadow     : 0 3px 10px rgba(13,148,136,0.28);
  flex-shrink    : 0;
}

.mf__section-title-group { flex: 1; min-width: 0; }

.mf__section-title {
  font-size     : 1.2rem;
  font-weight   : 800;
  color         : var(--mf-text-dark);
  margin        : 0 0 2px;
  letter-spacing: -0.02em;
  line-height   : 1.2;
}

.mf__section-subtitle {
  font-size  : 0.82rem;
  color      : #6b7280;
  margin     : 0;
  line-height: 1.5;
}

/* ══════════════════════════════════════════
   GRID
══════════════════════════════════════════ */
.mf__grid {
  display              : grid;
  grid-template-columns: repeat(2, 1fr);
  gap                  : 14px;
  align-items          : start;
}

.mf__cols--3 .mf__grid { grid-template-columns: repeat(3, 1fr); }
.mf__cols--1 .mf__grid { grid-template-columns: 1fr; }

@media (max-width: 900px) {
  .mf__cols--3 .mf__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .mf__grid,
  .mf__cols--1 .mf__grid,
  .mf__cols--2 .mf__grid,
  .mf__cols--3 .mf__grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
}

/* ══════════════════════════════════════════
   CARD
══════════════════════════════════════════ */
.mf__card {
  background    : var(--mf-card-bg);
  border        : 1.5px solid var(--mf-card-border);
  border-radius : var(--mf-card-radius);
  box-shadow    : var(--mf-card-shadow);
  overflow      : hidden;
  display       : flex;
  flex-direction: column;
  transition    : box-shadow 0.2s ease, transform 0.2s ease;
}

.mf__card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.10);
  transform : translateY(-2px);
}

/* ══════════════════════════════════════════
   CARD HEADER
══════════════════════════════════════════ */
.mf__card-header {
  display        : flex;
  align-items    : center;
  justify-content: space-between;
  padding        : 12px 14px 10px;
  gap            : 8px;
  border-bottom  : 1px solid #f3f4f6;
}

.mf__card-header-left {
  display    : flex;
  align-items: center;
  gap        : 8px;
  flex       : 1;
  min-width  : 0;
}

/* ── Number badge ── */
.mf__number {
  width          : 26px;
  height         : 26px;
  min-width      : 26px;
  border-radius  : 7px;
  display        : flex;
  align-items    : center;
  justify-content: center;
  font-size      : 0.78rem;
  font-weight    : 700;
  color          : #ffffff;
  flex-shrink    : 0;
}

.mf__card--teal   .mf__number { background: #0d9488; }
.mf__card--blue   .mf__number { background: #2563eb; }
.mf__card--purple .mf__number { background: #9333ea; }
.mf__card--orange .mf__number { background: #ea580c; }
.mf__card--red    .mf__number { background: #e11d48; }
.mf__card--green  .mf__number { background: #16a34a; }

/* ── Title ── */
.mf__title {
  font-size     : 0.88rem;
  font-weight   : 600;
  color         : var(--mf-text-dark);
  margin        : 0;
  line-height   : 1.3;
  letter-spacing: -0.01em;
  flex          : 1;
  min-width     : 0;
}

/* ── Action buttons ── */
.mf__card-actions {
  display    : flex;
  align-items: center;
  gap        : 4px;
  flex-shrink: 0;
}

.mf__action-btn {
  display        : inline-flex;
  align-items    : center;
  justify-content: center;
  width          : 30px;
  height         : 30px;
  background     : transparent;
  border         : none;
  cursor         : pointer;
  color          : #d1d5db;
  border-radius  : 7px;
  transition     : color 0.18s, background 0.18s;
  padding        : 0;
}

.mf__action-btn:hover {
  color     : var(--mf-teal);
  background: var(--mf-teal-light);
}

.mf__action-btn.is-active {
  color: var(--mf-teal);
}

.mf__bookmark-btn.is-bookmarked {
  color: #f59e0b;
}

.mf__bookmark-btn.is-bookmarked svg {
  fill: #f59e0b;
}

/* ══════════════════════════════════════════
   FORMULA BOX
══════════════════════════════════════════ */
.mf__formula-box {
  padding        : 20px 16px;
  display        : flex;
  flex-direction : column;
  align-items    : center;
  justify-content: center;
  min-height     : 70px;
  position       : relative;
}

.mf__card--teal   .mf__formula-box { background: var(--mf-teal-light);   }
.mf__card--blue   .mf__formula-box { background: var(--mf-blue-light);   }
.mf__card--purple .mf__formula-box { background: var(--mf-purple-light); }
.mf__card--orange .mf__formula-box { background: var(--mf-orange-light); }
.mf__card--red    .mf__formula-box { background: var(--mf-red-light);    }
.mf__card--green  .mf__formula-box { background: var(--mf-green-light);  }

/* ── Formula text ── */
.mf__formula {
  font-family    : var(--mf-font-mono);
  font-size      : 1.18rem;
  font-weight    : 600;
  color          : var(--mf-text-dark);
  line-height    : 2;
  letter-spacing : 0.01em;
  word-break     : break-word;
  display        : flex;
  align-items    : center;
  justify-content: center;
  flex-wrap      : wrap;
  gap            : 2px;
  text-align     : center;
}

/* ── Superscripts ── */
.mf__formula sup,
.mf__sup {
  font-size     : 0.62em;
  vertical-align: super;
  line-height   : 0;
  font-family   : var(--mf-font-mono);
  font-weight   : 700;
}

/* ── Fractions ── */
.mf__frac {
  display       : inline-flex;
  flex-direction: column;
  align-items   : center;
  vertical-align: middle;
  margin        : 0 4px;
}

.mf__num {
  border-bottom: 1.5px solid currentColor;
  padding      : 0 4px 1px;
  font-size    : 0.8em;
  line-height  : 1.3;
}

.mf__den {
  padding    : 1px 4px 0;
  font-size  : 0.8em;
  line-height: 1.3;
}

/* ── Square root ── */
.mf__sqrt        { display: inline-flex; align-items: flex-end; margin: 0 3px; }
.mf__sqrt-sign   { font-size: 1.2em; line-height: 1; }
.mf__sqrt-inner  {
  border-top : 1.5px solid currentColor;
  padding    : 0 4px;
  margin-left: 1px;
  line-height: 1.5;
}

/* ── Symbols / Operators / Equals ── */
.mf__sym { font-family: var(--mf-font-mono); font-style: italic; }
.mf__op  { margin: 0 2px; }
.mf__eq  { color: #6b7280; margin: 0 2px; }

/* ── Highlight ── */
.mf__highlight                { font-weight: 700; font-style: normal; }
.mf__card--teal   .mf__highlight { color: var(--mf-teal);   }
.mf__card--blue   .mf__highlight { color: var(--mf-blue);   }
.mf__card--purple .mf__highlight { color: var(--mf-purple); }
.mf__card--orange .mf__highlight { color: var(--mf-orange); }
.mf__card--red    .mf__highlight { color: var(--mf-red);    }
.mf__card--green  .mf__highlight { color: var(--mf-green);  }

/* ══════════════════════════════════════════
   CARD FOOTER — Explanation Toggle
══════════════════════════════════════════ */
.mf__card-footer {
  border-top: 1px solid #f3f4f6;
}

/* ── Toggle button ── */
.mf__explain-toggle {
  display        : flex;
  align-items    : center;
  gap            : 5px;
  width          : 100%;
  padding        : 9px 14px;
  background     : transparent;
  border         : none;
  cursor         : pointer;
  font-family    : var(--mf-font-main);
  font-size      : 0.78rem;
  font-weight    : 600;
  color          : var(--mf-teal);
  text-align     : left;
  transition     : background 0.18s;
  border-radius  : 0 0 14px 14px;
}

.mf__explain-toggle:hover {
  background: var(--mf-teal-light);
}

.mf__explain-toggle[aria-expanded="true"] {
  border-radius: 0;
}

.mf__explain-icon  { flex-shrink: 0; }
.mf__explain-label { flex: 1; }

.mf__explain-chevron {
  flex-shrink: 0;
  transition : transform 0.22s ease;
}

.mf__explain-toggle[aria-expanded="true"] .mf__explain-chevron {
  transform: rotate(180deg);
}

/* ── Explanation panel ── */
.mf__explain-panel {
  padding       : 12px 14px 14px;
  border-top    : 1px solid #f0fdf9;
  background    : #fafafa;
  border-radius : 0 0 14px 14px;
  display       : flex;
  flex-direction: column;
  gap           : 10px;
  overflow      : hidden;
  animation     : mf-panel-open 0.22s ease forwards;
}

.mf__explain-panel[hidden] { display: none; }

@keyframes mf-panel-open {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0);    }
}

.mf__explain-text {
  font-size  : 0.84rem;
  color      : var(--mf-text-body);
  margin     : 0;
  line-height: 1.7;
}

/* ── Inline example ── */
.mf__explain-example {
  display    : flex;
  align-items: baseline;
  gap        : 6px;
  flex-wrap  : wrap;
}

.mf__explain-example-label {
  font-size     : 0.72rem;
  font-weight   : 700;
  color         : #d97706;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space   : nowrap;
}

.mf__explain-example-formula {
  font-family: var(--mf-font-mono);
  font-size  : 0.84rem;
  color      : var(--mf-text-body);
  line-height: 1.7;
}

/* ── Proof / Derivation steps ── */
.mf__explain-proof { display: flex; flex-direction: column; gap: 4px; }

.mf__label {
  font-size     : 0.6rem;
  font-weight   : 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin        : 0;
  line-height   : 1;
}

.mf__label--proof { color: #9ca3af; }

/* ✅ v3.2.0 — no numbers, no bullets, clean steps */
.mf__proof-steps {
  margin        : 0;
  padding       : 0;
  display       : flex;
  flex-direction: column;
  gap           : 4px;
  list-style    : none;  /* ✅ removes bullets/numbers */
}

.mf__proof-step {
  font-family: var(--mf-font-mono);
  font-size  : 0.8rem;
  color      : var(--mf-text-body);
  line-height: 1.7;
  padding    : 0;        /* ✅ no indent */
}

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 900px) {
  .mf__section-title { font-size: 1.05rem; }
  .mf__formula       { font-size: 1.05rem; }
}

@media (max-width: 600px) {
  .mf__wrapper        { padding: 0 10px 32px; }
  .mf__section-header { padding: 14px 16px; }
  .mf__section-icon   {
    width: 38px; height: 38px; min-width: 38px;
    font-size: 1.1rem; border-radius: 10px;
  }
  .mf__section-title  { font-size: 0.97rem; }
  .mf__formula        { font-size: 0.97rem; }
  .mf__formula-box    { padding: 16px 12px; }
  .mf__card-header    { padding: 10px 12px 8px; }
}

/* ══════════════════════════════════════════
   PRINT
══════════════════════════════════════════ */
@media print {
  .mf__action-btn,
  .mf__explain-toggle  { display: none !important; }
  .mf__explain-panel   { display: flex !important; }
  .mf__card            { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
  .mf__grid            { grid-template-columns: repeat(2,1fr) !important; }
}
