/* The Dancing Men (game/design-dancing-men.md, section 11), on the site's tokens; game.css is on the page before
   this file and holds the frame, the tabs, the end, the seal and the dialog. Phones first: at 360 px the table has
   16 px gutters, and from the top the tools (44 px), the poses (one row of 47 px, or two rows of four), the row
   being set with Ask at its right end (74 to 76 px), the status line's room (40 px: two lines, whether it speaks
   or not) and the tries, newest first, each in the row's own columns (34 to 36 px a try). Sunday's table at its
   fullest, five men of eight poses and six tries, is 534 px (measured in both languages): the working area is on
   a phone's screen together, and nothing is pinned. The table is a .scene, dark in both themes, so that the men's
   paper tiles show; everything round it follows the theme. The men are the art's (ink on paper, coloured by
   game.css). The marks of a reply, the dots of the notes and the cross on a pose crossed out are drawn here, each
   told by its shape and never by a colour. */

/* ---- the table ---- */

.dancing__scene { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-inline: 0; padding: 8px var(--gutter) 10px; border-block: 1px solid var(--line); background-color: var(--surface); }
.dancing__desk { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

/* The tools: Cross out, a toggle, and Name the key. Cross out wears the mark it makes; while it is on it is
   filled, and the status line says in words which place is being written. */
.dancing__tools { display: flex; justify-content: space-between; gap: var(--s-2); }
.dancing__tool { min-height: 44px; padding: 0 14px; font-size: .92rem; box-shadow: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.dancing__tool--notes::before { content: ""; flex: none; width: 11px; height: 11px; background: linear-gradient(45deg, transparent 41%, currentColor 41% 59%, transparent 59%), linear-gradient(-45deg, transparent 41%, currentColor 41% 59%, transparent 59%); }
.dancing__tool--on, .dancing__tool--on:hover { border-color: var(--text); background: var(--text); color: var(--bg); }

/* The poses: one row for four to six, rows of four for seven or eight. */
.dancing__palette { display: grid; gap: 6px; }
.dancing__palette--c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dancing__palette--c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dancing__palette--c6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.dancing__pose { position: relative; display: grid; place-items: center; min-width: 0; min-height: 47px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface-2); color: inherit; font: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: border-color .12s ease; }
.dancing__pose svg { width: 34px; border-radius: 3px; }
/* For the place selected: the pose that stands there is ringed (a second tap takes it away), and a pose crossed
   out is dimmed and wears the cross of the Cross out button on a small plate, set on the button's top left
   corner. Nothing is drawn through the man: a stroke across the tile lay along one limb or another (the kick's
   leg, an arm of arms out) and hid it. The plate stands half outside the button, where there is no drawing at
   all, and what of it reaches the tile reaches only the corner that all eight drawings leave empty; the tests
   work that out from the numbers below and the art's own coordinates. */
.dancing__pose--here { border-color: var(--gilt); box-shadow: inset 0 0 0 1px var(--gilt); }
.dancing__pose--crossed svg { opacity: .38; }
.dancing__pose--crossed::after { content: ""; position: absolute; top: -5px; left: -5px; width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(45deg, transparent 42%, var(--bg) 42% 58%, transparent 58%) center / 8px 8px no-repeat, linear-gradient(-45deg, transparent 42%, var(--bg) 42% 58%, transparent 58%) center / 8px 8px no-repeat, var(--text); box-shadow: 0 0 0 1.5px var(--bg); }

/* The row being set: a slot for each place with its notes under it, and Ask at the right end with the count. */
.dancing__set { display: flex; align-items: flex-start; gap: var(--s-2); }
.dancing__row, .dancing__cells { flex: 1 1 auto; display: grid; gap: 4px; min-width: 0; }
.dancing__row--m3, .dancing__cells--m3 { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 204px; }
.dancing__row--m4, .dancing__cells--m4 { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 272px; }
.dancing__row--m5, .dancing__cells--m5 { grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 340px; }
.dancing__slot { display: grid; gap: 3px; justify-items: center; align-content: start; min-width: 0; padding: 3px 2px 4px; border: 2px solid transparent; border-radius: 8px; background: none; color: inherit; font: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: border-color .12s ease, background-color .12s ease; }
.dancing__slot svg { width: 100%; max-width: 44px; border-radius: 4px; }
.dancing__slot--at { border-color: var(--gilt); background: var(--surface-2); }
@media (hover: hover) {
  .dancing__pose:hover { border-color: var(--text); }
  .dancing__slot:hover { background: var(--surface-2); }
}
/* The notes of a place: a dot for each pose, laid out as the palette is. Full is still open; hollow is crossed out. */
.dancing__dots { display: grid; gap: 2px; }
.dancing__dots--c4 { grid-template-columns: repeat(4, 6px); }
.dancing__dots--c5 { grid-template-columns: repeat(5, 6px); }
.dancing__dots--c6 { grid-template-columns: repeat(6, 6px); }
.dancing__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text); }
.dancing__dot--out { background: none; box-shadow: inset 0 0 0 1.5px var(--muted); }
.dancing__go { flex: 0 0 64px; display: grid; gap: 3px; justify-items: center; align-content: start; margin-left: auto; }
.dancing__ask { width: 64px; min-height: 52px; padding: 0; box-shadow: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
/* The Sinhala word on Ask is 78 px wide at the size a button's words are set, and the button is 64: it is set
   smaller, at which it is 55 px and stands inside the button's round ends. */
.lang-si .dancing__ask { font-size: .75rem; }
.dancing__count { color: var(--muted); font-size: .8rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
/* The status line keeps room for two lines, which hold its longest words in both languages at 320 px and wider
   (the place being crossed out for; in Sinhala also the row asked already): the tries under it never move when
   it speaks or falls silent. */
.dancing__status { min-height: 40px; margin: 0; font-size: .8125rem; line-height: 20px; }

/* ---- the tries: one line each, newest first, each man under the slot of his place and the marks under Ask ---- */

.dancing__tries { display: grid; gap: 4px; align-content: start; }
.dancing__try { position: relative; display: flex; align-items: center; gap: var(--s-2); border-radius: 4px; }
.dancing__try:focus { outline: none; }
.dancing__try--marked { outline: 2px solid var(--gilt); outline-offset: 1px; }
.dancing__n { position: absolute; top: 50%; left: -14px; width: 12px; margin-top: -.5em; color: var(--muted); font-size: .75rem; line-height: 1; text-align: center; font-variant-numeric: tabular-nums; }
.dancing__cells { justify-items: center; }
.dancing__cells svg { width: 30px; border-radius: 3px; }
.dancing__cells--m5 svg { width: 28px; }

/* The marks of a reply, in the text colour: a full disc for a man in the key and in his place, a ring for one in
   the key but in another place, and a short bar for a reply with no mark at all. */
.dancing__reply { display: inline-flex; flex: none; align-items: center; gap: 2px; }
.dancing__try .dancing__reply { flex: 0 0 64px; justify-content: center; margin-left: auto; }
.dancing__peg { display: inline-block; flex: none; width: 11px; height: 11px; border-radius: 50%; background: currentColor; }
.dancing__peg--there { border: 2px solid currentColor; background: none; }
.dancing__none { display: inline-block; flex: none; width: 12px; height: 3px; border-radius: 2px; background: currentColor; }

/* A newcomer's few lines, under everything on the table. */
.dancing__legend { display: grid; gap: 2px; padding-top: 2px; color: var(--muted); font-size: .8125rem; line-height: 1.45; }
.dancing__legend-mark { display: flex; align-items: center; gap: 6px; color: var(--text); }

/* ---- the name: the row drawn on a strip of the table, in the dialog or, where none can open, under the tools ---- */

.dancing__named { display: flex; justify-content: center; margin-bottom: var(--s-3); padding: var(--s-2); border-radius: var(--radius); }
.dancing__confirm--plain { padding: var(--s-4); border: 1px solid var(--gilt); border-radius: var(--radius); background: var(--bg); }
.dancing__men { display: inline-grid; grid-auto-flow: column; gap: 4px; vertical-align: middle; }
.dancing__men svg { width: 30px; border-radius: 3px; }
.dancing__men--m5 svg { width: 28px; }
.dancing__men--big svg { width: 44px; border-radius: 4px; }

/* What stands under the table: the way out of the walk-through, or whose day a key begun before midnight is. */
.dancing__after { margin: var(--s-4) var(--gutter) 0; }
.dancing__stale { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.dancing__stale-line { color: var(--muted); }

/* ---- the end: the key, the tries one by one with the rows each left, and what a guess or a wrong name
   overlooked, on the same dark table as in play ---- */

.dancing__scene--end { gap: var(--s-4); margin-inline: calc(-1 * var(--gutter)); padding-block: var(--s-4); }
.dancing__answer, .dancing__trail, .dancing__still { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-2); }
.dancing__label { margin: 0; }
.dancing__line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin: 0; }
.dancing__start, .dancing__many, .dancing__why { margin: 0; color: var(--muted); font-size: .88em; font-variant-numeric: tabular-nums; }
.dancing__steps { display: grid; gap: 6px; }
/* The try after which one row was left carries the page's rule for a selected thing; its count says so in words. */
.dancing__step { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--s-2); padding-left: 6px; border-left: 3px solid transparent; }
.dancing__step--proof { border-left-color: var(--gilt); }
.dancing__no { flex: 0 0 12px; color: var(--muted); font-size: .8rem; text-align: center; font-variant-numeric: tabular-nums; }
.dancing__left { flex: 1 1 auto; color: var(--muted); font-size: .8125rem; line-height: 1.45; text-align: right; font-variant-numeric: tabular-nums; }
.dancing__step--proof .dancing__left { color: var(--text); font-weight: 600; }
.dancing__options { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-2); }
.dancing__option { padding: 3px; border: 2px solid transparent; border-radius: 6px; }
.dancing__option--key { border-color: var(--gilt); }

/* ---- wider screens: the table gets an edge, then the desk and the tries stand side by side ---- */

@media (min-width: 600px) {
  .dancing__scene { margin-inline: var(--gutter); padding: var(--s-4) var(--s-5); border: 1px solid var(--line); border-radius: var(--radius-lg); }
  .dancing__scene--end { margin-inline: 0; }
  .dancing__desk, .dancing__tries, .dancing__legend { width: 100%; max-width: 26rem; margin-inline: auto; }
}
@media (min-width: 860px) {
  .dancing__scene { grid-template-columns: minmax(0, 26rem) minmax(0, 22rem); justify-content: center; align-items: start; column-gap: var(--s-6); padding: var(--s-5); }
  .dancing__scene--end { grid-template-columns: minmax(0, 1fr); }
  .dancing__desk, .dancing__tries { margin-inline: 0; }
  .dancing__legend { grid-column: 1 / -1; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dancing__pose, .dancing__slot { transition: none; }
}
