/* movelist.css — notation history table. Design tokens from style.css (:root). */

#move-list {
  margin-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-3);
  max-height: 18rem;
  overflow-y: auto;
}

.movelist-block.collapsed #move-list {
  display: none;
}

/* Toggle button — reset UA styles so it looks like the old .eval-label,
   then apply flex to push the chevron to the right. */
.movelist-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.movelist-toggle:hover {
  color: var(--text-secondary);
}

.movelist-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Chevron — rotated when expanded (default), points right when collapsed. */
.movelist-chevron {
  display: inline-block;
  transform: rotate(0deg);
  transition: transform var(--motion-fast) var(--ease-out);
}

.movelist-block.collapsed .movelist-chevron {
  transform: rotate(-90deg);
}

@media (prefers-reduced-motion: reduce) {
  .movelist-chevron {
    transition: none;
  }
}

.movelist-empty {
  color: var(--muted);
  font-size: 0.85rem;
  padding: var(--space-2) 0;
}

.movelist-table {
  display: flex;
  flex-direction: column;
  font-variant-numeric: tabular-nums;
}

.movelist-row {
  display: grid;
  grid-template-columns: 2.25rem 1fr 1fr;
  align-items: center;
  gap: var(--space-1);
}

.movelist-row:nth-child(odd) {
  background: color-mix(in oklch, var(--surface-raised) 35%, transparent);
}

.movelist-num {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
  padding-right: var(--space-2);
}

.movelist-move {
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-width: 0;
}

button.movelist-move:hover {
  background: var(--surface-raised);
}

button.movelist-move:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Current ply: an accent ring + raised surface, while KEEPING the quality text color
   (so a current blunder still reads red). .is-current wins color only if it sets it —
   it deliberately does not, so the .q-* color shows through. */
.movelist-move.is-current {
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 2px var(--accent);
  font-weight: 600;
}

/* Non-interactive placeholder cells (empty white slot, or leading "…" for a
   black-to-move start). */
.movelist-ellipsis,
.movelist-empty-cell {
  color: var(--muted);
  cursor: default;
}

/* ---- Mobile hit-boxes — WCAG 2.2 AA (SC 2.5.8) ----
   Rows are flush (no gap), so the spacing exception does not apply:
   each control itself must be ≥24px tall. Desktop density unchanged. */
@media (max-width: 820px) {
  .movelist-toggle {
    min-height: 24px;
  }

  .movelist-move {
    min-height: 24px;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }
}
