/* Math Meteor — layered over /fivb-explorer/styles.css */

.math-meteor {
  --mm-amber: #e8a54b;
  --mm-amber-dim: #b87a2a;
  --mm-gold: #f0d4a8;
  --mm-deep: #050508;
  --mm-panel: #101018;
  --mm-panel-top: #16161f;
  --mm-border: rgba(232, 165, 75, 0.22);
  --mm-glow: rgba(255, 200, 120, 0.09);
  --mm-text: #ece8e2;
  --mm-muted: #9b958a;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 120% 80% at 100% -20%, rgba(232, 165, 75, 0.14), transparent 55%),
    radial-gradient(ellipse 90% 60% at 0% 100%, rgba(80, 60, 120, 0.12), transparent 50%),
    radial-gradient(circle at 40% 30%, #12101c, var(--mm-deep) 55%);
  color: var(--mm-text);
}

.math-meteor .page {
  position: relative;
  padding-top: 2.5rem;
  padding-bottom: 4rem;
}

/* Decorative meteor streak */
.meteor-hero {
  position: relative;
  padding-bottom: 0.25rem;
  margin-bottom: 1.75rem;
  overflow: hidden;
}

.meteor-hero::before {
  content: "";
  position: absolute;
  top: -2rem;
  right: -5%;
  width: min(420px, 90vw);
  height: 140px;
  background: linear-gradient(
    115deg,
    transparent 0%,
    transparent 35%,
    rgba(255, 200, 140, 0.06) 48%,
    rgba(232, 165, 75, 0.18) 52%,
    rgba(255, 220, 170, 0.08) 58%,
    transparent 70%
  );
  filter: blur(1px);
  pointer-events: none;
}

.meteor-hero::after {
  content: "";
  position: absolute;
  top: 1.5rem;
  right: 8%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff6e8, var(--mm-amber) 45%, #8a5520);
  box-shadow:
    0 0 20px rgba(255, 200, 120, 0.5),
    0 0 48px rgba(232, 165, 75, 0.35),
    -40px 18px 60px rgba(232, 165, 75, 0.12);
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .meteor-hero::after {
    animation: mm-pulse 4.5s ease-in-out infinite;
  }
}

@media (prefers-reduced-motion: reduce) {
  .meteor-hero::after {
    animation: none;
  }
}

@keyframes mm-pulse {
  0%,
  100% {
    opacity: 0.85;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.06);
  }
}

@media (max-width: 560px) {
  .meteor-hero::before {
    opacity: 0.65;
    right: -15%;
  }

  .meteor-hero::after {
    top: 0.35rem;
    right: 4%;
    width: 6px;
    height: 6px;
    opacity: 0.75;
  }
}

.math-meteor .eyebrow {
  color: var(--mm-amber);
  letter-spacing: 0.22em;
  font-weight: 600;
  font-size: 0.72rem;
}

.math-meteor h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5.5vw, 2.85rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.12;
  background: linear-gradient(135deg, var(--mm-gold) 0%, #fff 35%, var(--mm-amber) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 2px 24px rgba(0, 0, 0, 0.45));
}

@supports not (background-clip: text) {
  .math-meteor h1 {
    color: var(--mm-gold);
    background: none;
  }
}

.math-meteor .lede {
  color: var(--mm-muted);
  line-height: 1.65;
}

.math-meteor .lede strong {
  color: #d8d2c8;
}

.math-meteor .actions {
  flex-wrap: wrap;
  margin-top: 1.25rem;
  gap: 0.6rem;
}

.math-meteor .link {
  border-color: var(--mm-border);
  background: linear-gradient(180deg, rgba(30, 28, 38, 0.95), rgba(18, 16, 24, 0.98));
  color: var(--mm-text);
  font-size: 0.9rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease;
}

.math-meteor .link:hover {
  border-color: rgba(232, 165, 75, 0.45);
  box-shadow: 0 0 0 1px rgba(232, 165, 75, 0.12), 0 8px 28px rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}

.math-meteor .link:focus-visible {
  outline: 2px solid var(--mm-amber);
  outline-offset: 3px;
}

.math-meteor .card {
  margin-top: 1.35rem;
  padding: 1.35rem 1.4rem 1.45rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(165deg, var(--mm-panel-top) 0%, var(--mm-panel) 40%, #0c0c12 100%);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 24px 48px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.math-meteor .card:first-of-type {
  margin-top: 0.5rem;
}

.math-meteor h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #c9c2b6;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(232, 165, 75, 0.12);
}

.math-meteor .elo-list {
  color: #c4beb4;
}

.math-meteor .elo-list li::marker {
  color: var(--mm-amber-dim);
}

/* Side-by-side: prose / pseudocode (left) · equations (right) */
.math-meteor .eq-block {
  border: 1px solid rgba(232, 165, 75, 0.12);
  border-left: 3px solid var(--mm-amber-dim);
  background: linear-gradient(180deg, rgba(12, 14, 22, 0.95), rgba(8, 9, 14, 0.98));
  border-radius: 10px;
  padding: 0;
  overflow-x: visible;
  overflow-y: visible;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.math-meteor .eq-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1rem 1.35rem;
  align-items: start;
  padding: 1rem 1.15rem 1.05rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.math-meteor .eq-row:last-child {
  border-bottom: none;
}

.math-meteor .eq-note {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 0;
}

.math-meteor .eq-step {
  flex: 0 0 auto;
  width: 1.65rem;
  height: 1.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--mm-amber);
  background: rgba(232, 165, 75, 0.1);
  border: 1px solid rgba(232, 165, 75, 0.22);
  line-height: 1;
}

.math-meteor .eq-note-body {
  min-width: 0;
}

.math-meteor .eq-note-body strong {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #b8a990;
  margin-bottom: 0.35rem;
}

.math-meteor .eq-note-body p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #c4beb4;
}

.math-meteor .eq-math {
  min-width: 0;
  padding-left: 1rem;
  margin: 0;
  border-left: 1px solid rgba(232, 165, 75, 0.15);
  overflow-x: visible;
  max-width: 100%;
}

/* KaTeX: avoid horizontal scroll panes; multi-line `aligned` blocks in HTML handle wide formulas */
.math-meteor .eq-math .katex-display {
  margin: 0.45rem 0;
  max-width: 100%;
  overflow-x: visible;
}

.math-meteor .eq-math .katex {
  max-width: 100%;
}

.math-meteor .eq-math .katex-display:first-child {
  margin-top: 0;
}

.math-meteor .eq-foot {
  margin: 0.55rem 0 0;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(232, 165, 75, 0.1);
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--mm-muted);
}

/* Clutchness step: stacked definitions (no long single-line footnote) */
.math-meteor .eq-math--clutch .eq-foot--clutch {
  margin-top: 0.75rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(232, 165, 75, 0.14);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.math-meteor .eq-clutch-block {
  min-width: 0;
}

.math-meteor .eq-clutch-k {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(232, 165, 75, 0.75);
  margin-bottom: 0.35rem;
}

.math-meteor .eq-clutch-k code {
  font-size: 0.88em;
  text-transform: none;
  letter-spacing: 0;
}

.math-meteor .eq-clutch-rounds {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #b8b0a4;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.2rem 0.65rem;
}

@media (min-width: 420px) {
  .math-meteor .eq-clutch-rounds {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.math-meteor .eq-clutch-tournament {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: #b8b0a4;
}

.math-meteor .eq-clutch-tournament strong {
  color: #d8d0c4;
  font-weight: 600;
}

@media (max-width: 720px) {
  .math-meteor .eq-row {
    grid-template-columns: 1fr;
    gap: 0.65rem;
    padding: 0.95rem 1rem;
  }

  .math-meteor .eq-math {
    border-left: none;
    padding-left: 0;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(232, 165, 75, 0.12);
  }
}

.math-meteor .muted {
  color: var(--mm-muted) !important;
  font-size: 0.85rem;
}

.math-meteor a:not(.link) {
  color: var(--mm-amber);
  text-decoration: underline;
  text-decoration-color: rgba(232, 165, 75, 0.35);
  text-underline-offset: 0.2em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.math-meteor a:not(.link):hover {
  color: var(--mm-gold);
  text-decoration-color: rgba(240, 212, 168, 0.55);
}

.math-meteor code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 0.12em 0.38em;
  border-radius: 6px;
  background: rgba(232, 165, 75, 0.08);
  border: 1px solid rgba(232, 165, 75, 0.15);
  color: #e8dcc8;
}

.math-meteor .lede--tight-top {
  margin-top: 1.1rem;
}

/* --- Score lines (match outcome detail) --- */
.math-meteor .mm-score-lines {
  margin-top: 1.75rem;
  padding: 1.25rem 1.2rem 1.35rem;
  border-radius: 12px;
  border: 1px solid rgba(232, 165, 75, 0.14);
  background:
    linear-gradient(165deg, rgba(18, 16, 28, 0.65) 0%, rgba(10, 10, 16, 0.92) 100%),
    radial-gradient(120% 80% at 100% 0%, rgba(232, 165, 75, 0.06), transparent 55%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.math-meteor .mm-score-lines__title {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c9b8a0;
}

.math-meteor .mm-score-lines__intro {
  margin: 0 0 1.15rem;
  max-width: 62ch;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--mm-muted);
}

.math-meteor .mm-score-lines__intro code {
  font-size: 0.9em;
}

.math-meteor .mm-score-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: mm-score;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.math-meteor .mm-score-step {
  counter-increment: mm-score;
  display: grid;
  grid-template-columns: 2.1rem minmax(0, 1fr) minmax(132px, 210px);
  gap: 0.75rem 1.1rem;
  align-items: center;
  padding: 1rem 1rem 1.05rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.2);
}

.math-meteor .mm-score-step__idx {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 0.15rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  color: rgba(232, 165, 75, 0.7);
  font-variant-numeric: tabular-nums;
}

.math-meteor .mm-score-step__idx::before {
  content: counter(mm-score);
}

.math-meteor .mm-score-step__body {
  min-width: 0;
}

.math-meteor .mm-score-step__body p {
  margin: 0.45rem 0 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: #c4beb4;
}

.math-meteor .mm-score-step__body p em {
  color: #d8d0c4;
  font-style: italic;
}

.math-meteor .mm-score-step__label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mm-amber);
}

.math-meteor .mm-score-fig {
  margin: 0;
  padding: 0.35rem 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.5rem;
  border-radius: 8px;
  background: rgba(232, 165, 75, 0.04);
  border: 1px solid rgba(232, 165, 75, 0.1);
}

.math-meteor .mm-score-fig svg {
  width: 100%;
  max-width: 220px;
  height: auto;
  display: block;
}

.math-meteor .mm-score-fig--bars {
  background: rgba(0, 0, 0, 0.25);
}

@media (max-width: 720px) {
  .math-meteor .mm-score-step {
    grid-template-columns: 2rem 1fr;
    grid-template-rows: auto auto;
    gap: 0.55rem 0.65rem;
    padding: 0.95rem 0.9rem;
  }

  .math-meteor .mm-score-step__idx {
    grid-row: 1 / span 2;
    align-self: start;
    padding-top: 0.35rem;
  }

  .math-meteor .mm-score-step__body {
    grid-column: 2;
  }

  .math-meteor .mm-score-fig {
    grid-column: 2;
    max-width: 280px;
    margin-inline: 0;
  }
}

@media (max-width: 480px) {
  .math-meteor .mm-score-lines {
    padding: 1rem 0.85rem 1.1rem;
    margin-inline: -0.15rem;
  }
}

.math-meteor .mm-score-lines__note {
  margin: 1.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(232, 165, 75, 0.12);
  max-width: 62ch;
  font-size: 0.88rem;
  line-height: 1.58;
}

.math-meteor .mm-score-lines__note strong {
  color: #c9c2b6;
  font-weight: 600;
}
