/* "AlphaTensor" series. The same file sits beside all three posts; change one,
 * change all three.
 *
 * Everything is written against the site's --w-* tokens, so it follows the
 * light/dark toggle. The 3D scenes read the same tokens through
 * widget-kit/stage.js and need nothing here.
 */

/* The static figures are drawn on white and stay on white in both schemes, the
 * treatment AGENTS.md prescribes for fixed-colour figures. */
img.at-figure,
.at-figure img {
  border-radius: 6px;
  background: #fff;
}

.widget-toggle-btn {
  white-space: nowrap;
}

/* The schoolbook rule as rows of buttons: c11 = a11·b11 + a12·b21. */
.at-formulas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.45rem 1.2rem;
  margin-bottom: 0.6rem;
}

.at-formulas[data-n="3"] {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.at-eq {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.at-op {
  color: var(--w-muted);
  font-weight: 700;
}

.at-chip {
  font: inherit;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  padding: 0.3rem 0.6rem;
  min-height: 2rem;
  border: 1px solid var(--w-rule);
  border-radius: 999px;
  background: var(--w-surface);
  color: var(--w-ink);
  cursor: pointer;
  white-space: nowrap;
}

.at-chip:hover {
  border-color: var(--w-accent);
}

.at-chip[aria-pressed="true"] {
  background: var(--w-accent);
  border-color: var(--w-accent);
  color: var(--w-surface);
}

.at-chip:focus-visible,
.at-cellbtn:focus-visible,
.at-num:focus-visible {
  outline: 3px solid var(--w-accent);
  outline-offset: 2px;
}

.at-chip:disabled {
  opacity: 0.45;
  cursor: default;
}

.at-readout {
  min-height: 2.9em;
  margin: 0 0 0.7rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--w-ink);
}

.at-flat {
  margin-top: 0.7rem;
}

/* Part 2: the matrices a reader types in, and the table of products. */
.at-matrices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-bottom: 0.8rem;
}

.at-matrix {
  display: grid;
  grid-template-columns: repeat(2, 3.4rem);
  gap: 0.3rem;
  padding: 0.35rem 0.5rem;
  border-left: 2px solid var(--w-ink);
  border-right: 2px solid var(--w-ink);
  border-radius: 6px;
}

.at-matrix-name {
  font-weight: 700;
  color: var(--w-muted);
}

.at-num {
  width: 100%;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: center;
  padding: 0.25rem 0.2rem;
  border: 1px solid var(--w-rule);
  border-radius: 6px;
  background: var(--w-surface);
  color: var(--w-ink);
}

.at-out {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--w-ink);
}

.at-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.at-table th,
.at-table td {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--w-rule);
  text-align: left;
  color: var(--w-ink);
}

.at-table th {
  color: var(--w-muted);
  font-weight: 600;
}

.at-table td.at-right,
.at-table th.at-right {
  text-align: right;
}

.at-scroll {
  overflow-x: auto;
}

/* Part 3: the move picker. Three small grids, one per vector, of buttons that
 * cycle 0, +1, -1. */
.at-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.2rem;
  margin-bottom: 0.7rem;
}

.at-vector {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.at-vector-name {
  font-size: 0.82rem;
  color: var(--w-muted);
}

.at-vector-grid {
  display: grid;
  grid-template-columns: repeat(2, 2.9rem);
  gap: 0.3rem;
}

.at-cellbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 2.9rem;
  height: 2.9rem;
  font: inherit;
  line-height: 1.05;
  border: 1px solid var(--w-rule);
  border-radius: 8px;
  background: var(--w-surface);
  color: var(--w-muted);
  cursor: pointer;
}

.at-cellbtn b {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.at-cellbtn small {
  font-size: 0.66rem;
}

.at-cellbtn[data-v="1"] {
  background: var(--w-c1);
  border-color: var(--w-c1);
  color: var(--w-surface);
}

.at-cellbtn[data-v="-1"] {
  background: var(--w-c3);
  border-color: var(--w-c3);
  color: var(--w-surface);
}

.at-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.6rem 0;
}
