/* Styles the public poker math article and its figures using the site's shared theme. */
.math-article {
  max-width: 1376px;
  padding-top: 48px;
}
.math-article h1 { max-width: 860px; margin-bottom: 16px; text-wrap: pretty; }
.math-article > .lead { max-width: 720px; }
.math-page .nav-links [aria-current="page"] { color: var(--accent); text-decoration: underline; text-underline-offset: .35em; }
.math-layout {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: clamp(20px, 3vw, 44px);
  margin-top: 40px;
}
.math-rail {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
}
.math-jump {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 7px 10px;
  color: var(--text-2);
  border-radius: 6px;
  font-size: var(--text-base);
  line-height: var(--leading-tight);
  text-decoration: none;
}
.math-jump span:first-child { font: var(--text-sm) var(--mono); color: var(--text-3); }
.math-jump:hover,
.math-jump[aria-current="location"] { background: var(--raise); color: var(--text-1); }

.math-content { min-width: 0; }
.math-article .math-section {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  grid-template-rows: repeat(4, min-content) 1fr;
  align-items: start;
  column-gap: clamp(20px, 3vw, 48px);
  row-gap: 12px;
  margin: 0;
  padding: 38px 0;
  border-top: 1px solid var(--line-2);
  scroll-margin-top: 16px;
}
.math-section > :not(figure) { grid-column: 1; }
.math-section > .math-figure { grid-column: 2; grid-row: 1 / 6; }
.math-section > h2 { margin: 0; font-size: clamp(var(--text-title), 2.5vw, var(--text-display-38)); text-wrap: pretty; }
.math-article .math-section > p { margin: 0; }
.math-section .math-takeaway { color: var(--text-1); font-weight: 650; }
.math-article .math-note { color: var(--text-2); font-size: var(--text-card); line-height: var(--leading-base); }
.math-actions { margin-top: 10px; }

.math-hand,
.math-figure {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--shell);
}
.math-hand { margin-bottom: 32px; }
.math-hand figcaption {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.math-hero-cards { display: flex; align-items: center; gap: 4px; }
.math-hero-cards > span:first-child { margin-right: 4px; font-size: var(--text-base); }
.math-board { display: flex; gap: 3px; min-height: 39px; }
.math-streets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.math-street {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 10px;
  border-radius: 6px;
  background: var(--bg);
}
.math-street h3 { margin: 0; font: 650 var(--text-body) var(--sans); }
.math-street ul,
.math-families { margin: 0; padding: 0; list-style: none; }
.math-street li {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 5px;
  font-size: var(--text-card);
}
.math-chip,
.math-pot {
  font: 500 var(--text-sm)/var(--leading-label) var(--mono);
  font-variant-numeric: tabular-nums;
}
.math-chip { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.math-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border: 2px double currentColor;
  border-radius: 50%;
}
.math-pot { align-self: start; margin-top: auto; padding-top: 3px; color: var(--text-1); }

.math-bar { display: block; border-radius: 5px; }
.math-bar .math-track { fill: var(--bg); }
.math-bar .win { fill: var(--gain); }
.math-bar .loss { fill: var(--loss); }
.math-bar .split { fill: var(--text-3); }
.math-bar .ivory { fill: var(--text-1); }
.math-bar .neutral { fill: var(--mix-5); }
.math-price { stroke: var(--text-1); stroke-width: 2; }
.math-paint { transform-origin: left; }
.math-reveal .math-paint { animation: math-grow .36s var(--ease) both; }
.math-reveal .math-price { animation: math-slide .36s var(--ease) both; }
@keyframes math-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes math-slide { from { transform: translateX(-12px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .math-reveal .math-paint,
  .math-reveal .math-price { animation: none; }
}
.math-keys {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 8px;
  font: 500 var(--text-sm)/var(--leading-label) var(--mono);
}
.math-key { display: inline-flex; align-items: baseline; gap: 5px; }
.math-key::before {
  content: "";
  align-self: center;
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 2px;
  background: var(--swatch);
}
.math-key.win { --swatch: var(--gain); }
.math-key.loss { --swatch: var(--loss); }
.math-key.split { --swatch: var(--text-3); }
.math-key.ivory { --swatch: var(--text-1); }
.math-key.neutral { --swatch: var(--mix-5); }
#odds-equation {
  margin: 14px 0 18px;
  font: 600 clamp(var(--text-display-19), 2.4vw, var(--text-display-26))/var(--leading-tight) var(--mono);
}
.math-shortcuts { margin-top: 18px; }
.math-shortcuts caption { text-align: left; font-weight: 600; line-height: var(--leading-label); }
.math-article .math-shortcuts th,
.math-article .math-shortcuts td { padding: 5px 0; font-size: var(--text-base); }
.math-article .math-shortcuts th { font-weight: 400; color: var(--text-2); }
.math-article .math-shortcuts td { text-align: right; font-family: var(--mono); }
.math-article .math-shortcuts tr:last-child > * { border: 0; }

.math-article #combos { grid-template-rows: none; }
#combos > * { grid-column: 1 / -1; }
#combos > .math-figure { grid-row: auto; }
.math-combo-row { display: block; --combo-card-width: 22px; }
.math-combo-row + .math-combo-row { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.math-combo-heading { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.math-combo-count { color: var(--text-1); font: 600 var(--text-base) var(--mono); }
.math-combo-groups { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 12px; }
.math-combo-group { display: grid; gap: 4px; min-width: 0; }
.math-combo-tag { color: var(--text-2); font-size: var(--text-sm); line-height: var(--leading-tight); }
.math-pairs { display: flex; flex-wrap: wrap; gap: 4px; }
.math-pair { display: inline-flex; gap: 2px; position: relative; }
.math-pair .card { --cw: var(--combo-card-width); }
.math-pair .card .idx { top: 2px; gap: 2px; }
.math-pair .card .idx svg { width: 11px; height: 11px; }
.math-combo-group:not([data-removal="live"]) .math-pair { opacity: .78; }
.math-combo-group:not([data-removal="live"]) .math-pair::after {
  content: "";
  position: absolute;
  inset: 54% -1px auto;
  height: 1px;
  background: var(--bg);
  transform: rotate(-12deg);
}

.math-range { position: relative; }
.math-grid {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 3px;
  aspect-ratio: 1;
}
.math-cell {
  display: grid;
  align-content: center;
  justify-content: center;
  min-width: 0;
  background: var(--raise);
  color: var(--text-2);
  font: 600 var(--text-sm)/1 var(--sans);
  border-radius: 4px;
}
.math-cell.win { background: var(--gain); }
.math-cell.loss { background: var(--loss); }
.math-cell.split { background: var(--text-3); }
.math-cell:not(.empty) { color: var(--suit-s); }
.math-cell:focus-visible { z-index: 1; outline-offset: -1px; }
.math-cell.selected { outline: 1px solid var(--accent); outline-offset: 0; z-index: 1; }
.math-cell.selected:focus-visible { outline-width: 2px; }
.math-tooltip {
  position: absolute;
  z-index: 2;
  inset: auto 6px 6px;
  width: max-content;
  max-width: calc(100% - 12px);
  padding: 7px 8px;
  color: var(--text-1);
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  font: 500 var(--text-sm)/var(--leading-label) var(--mono);
  pointer-events: none;
}
.math-tooltip[data-edge="top"] { inset: 6px 6px auto; }
.math-equity-bar { margin-top: 12px; }
.math-threshold-label { display: flex; align-items: flex-start; }
.math-threshold-label > span {
  padding: 1px 0 0 4px;
  color: var(--text-1);
  font: 600 var(--text-sm)/var(--leading-label) var(--mono);
}
#nash-caption { margin: 10px 0 0; color: var(--text-2); font-size: var(--text-base); }

.math-blocker-row + .math-blocker-row { margin-top: 17px; }
.math-blocker-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.math-blocker-heading > span { font: 600 var(--text-display-17) var(--mono); }
.math-blocker-counts { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; font: var(--text-sm) var(--mono); color: var(--text-2); }
.math-blocker-counts .math-keys { justify-content: start; margin-right: auto; }
.math-families { display: grid; gap: 6px; }
.math-families li { display: grid; align-items: center; grid-template-columns: minmax(88px, 1fr) minmax(60px, 2fr) 2ch; gap: 8px; font-size: var(--text-base); }
.math-count { font-family: var(--mono); text-align: right; }
.math-article .math-icm { table-layout: fixed; }
.math-article .math-icm th,
.math-article .math-icm td { padding: 7px 4px; }
.math-icm thead th { color: var(--text-2); }
.math-icm tbody th { font-weight: 500; }
.math-icm tbody td { font: 500 var(--text-sm)/var(--leading-label) var(--mono); }
.math-icm tbody tr:last-child > * { border: 0; }
.math-icm .math-bar { margin-top: 5px; }

@media (max-width: 1000px) {
  .math-layout { grid-template-columns: 136px minmax(0, 1fr); }
  .math-article .math-section { column-gap: 18px; grid-template-columns: minmax(0, 1fr) minmax(276px, 1.4fr); }
  .math-figure { padding: 12px; }
}
@media (max-width: 790px) {
  .math-article { padding: 24px var(--gut) 54px; }
  .math-layout { display: block; margin-top: 24px; }
  .math-rail { display: none; }
  .math-article .math-section { display: flex; flex-direction: column; gap: 10px; padding: 23px 0; }
  .math-section > .math-figure { width: 100%; margin: 3px 0; }
  .math-hand { margin-bottom: 20px; }
  .math-article .lead { font-size: var(--text-xl); }
}
@media (max-width: 540px) {
  .math-article { padding-right: 16px; padding-left: 16px; }
  .math-hand { padding: 10px; }
  .math-streets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .math-grid { gap: 1px; }
  .math-cell { font-size: var(--text-xs); border-radius: 2px; }
  .math-pairs { max-width: calc(8 * var(--combo-card-width) + 20px); }
}
