/* Jigsaw. */

/* Read by play.js: the board's ground, which shows where two hollows meet; a cut, a dark line with
   a light one along it; and the lifted piece's shadow. As in the prototype the owner played. */
.jg {
  display: grid; gap: 0.625rem; padding: 0.5rem 0 0.25rem;
  --jg-ground: #8C857A; --jg-cut: rgba(26, 25, 23, 0.5); --jg-cut-light: rgba(250, 248, 242, 0.85); --jg-shadow: rgba(26, 25, 23, 0.32);
}

/* While the board loads, about the room it will take (game.css): the board fills the column, or
   the room left under the bar on a short screen, whichever is smaller, with the note and the row of
   buttons under it (125px). Measured on the drawn boards (2026-11-26): 569px at 375 by 812, 539 at
   375 by 667, 469 at 360 by 600, 440 at 320 by 568 and 672 at 1280 by 800; the board starts 128px
   down the page, and the desktop column holds a board at most 816px tall with its row. */
#board { --board-wait: min(calc(125vw + 101px), calc(100svh - 128px), 816px); }

/* The canvas reaches 14px into each 18px side gutter: it holds the frame and a margin round it,
   where a piece out of place sticks out by a tab. A drag on it never scrolls the page. */
.jg-board { display: flex; justify-content: center; margin: 0 -14px; }
/* where game.css gives the board 10px a side, on the narrowest phones: 4px still clear of the edge */
@media (max-width: 22.5rem) {
  .jg-board { margin: 0 -6px; }
}
.jg-canvas {
  display: block; touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.jg-canvas:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
/* Room for two lines, so that the buttons under it stay put as its words change (the board is sized
   with it). */
.jg-note { margin: 0; min-height: 3em; line-height: 1.5; text-align: center; font-size: 0.9375rem; color: var(--stone); }

/* Peek, Shuffle and Hint, as Mahjong's own row; Peek is dark while it is held. */
.jg-actions { display: flex; flex-wrap: wrap; gap: 0.625rem; }
.jg-actions .btn { flex: 1 1 auto; padding: 0 0.5rem; }
.jg-actions .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
/* Held down, Peek never scrolls the page, and never selects its word: on a phone that would end
   the press. */
.jg-peek { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

/* The page of every picture by category (docs/superpowers/specs/2026-11-26-jigsaw-categories-design.md):
   its heading, a row of links to the categories, and a card for each picture, two to a row on a phone
   375px wide and one at 320px, so that a card's three 44px size links always fit side by side. */
.specials-page .sp-title { padding: 1.25rem var(--gutter) 0; font: 500 1.75rem/1.15 var(--serif); }
.specials-page .sp-title + .lead { padding-top: 0.5rem; }
.jg-cats { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 1rem var(--gutter) 0; }
.jg-cats a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.875rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--sheet); font: 600 0.9375rem/1 var(--sans); text-decoration: none; }
.jg-cats a:hover { border-color: var(--ink); }
.jg-cat { padding: 1.5rem var(--gutter) 0; scroll-margin-top: 1rem; }
.jg-cat h3 { font: 500 1.5rem/1.15 var(--serif); margin-bottom: 0.75rem; }
.jg-cat .sp-season { margin-left: 0.375rem; padding: 0.25rem 0.5rem; border-radius: 999px; background: var(--ink); color: var(--paper); font: 600 0.78125rem/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; vertical-align: 0.25rem; white-space: nowrap; }
.jg-cat .sp-season[hidden] { display: none; }
.jg-cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.75rem; }
.jg-card { margin: 0; display: grid; gap: 0.5rem; }
.jg-thumb { display: block; border-radius: 6px; overflow: hidden; background: var(--rule); }
.jg-thumb img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; }
.jg-card figcaption { display: grid; gap: 0.375rem; }
.jg-card-name { font: 600 0.9375rem/1.3 var(--sans); }
.jg-sizes { display: grid; grid-template-columns: repeat(3, minmax(44px, 1fr)); gap: 0.375rem; }
.jg-pieces { grid-column: 1 / -1; font: 600 0.78125rem/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--stone); }
.jg-sizes .sp { position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid var(--rule); border-radius: 8px; background: var(--sheet); font: 600 0.9375rem/1 var(--sans); text-decoration: none; font-variant-numeric: tabular-nums; }
.jg-sizes .sp:hover { border-color: var(--ink); }
/* solved: the game's ink around it and a tick; played to the end unsolved: a dashed edge, as on the levels page */
.jg-sizes .sp.done { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
.jg-sizes .sp.ended { border-style: dashed; border-color: var(--stone); }
.jg-sizes .sp-state .ic { position: absolute; top: 2px; right: 2px; width: 0.75rem; height: 0.75rem; color: var(--c); stroke-width: 3; }
