/* The workshop's pixel buttons, shared by the stitching page and the gallery (loaded after tokens.css).
   Their focus ring is the page's accent (--accent), the workshop's orange where a page has none. */
/* ---------- the workshop's buttons: chunky pixels, cut corners and a thick bottom edge that goes in when pressed ----------
   .px-btn (cream), .px-btn.main (meadow green), .small; the icon inside is coloured by the button (icons/*.svg) */
.px-btn {
  --face: #fffbe9; --text: #3f3a2c; --edge: #8b7f66; --lip: #e3d6b1;          /* lip: the thick bottom edge */
  --ico-fill: #d9c79c; --ico-front: #efe2bf; --ico-thread: #5f7d4a;
  --rise: 3px; --lift: var(--rise); --cut: 1px;   /* pressed, the lip goes in and the face comes down: the same size */
  display: inline-flex; align-items: center; gap: 7px;
  padding: calc(var(--pad-y, 9px) + var(--rise) - var(--lift)) 16px calc(var(--pad-y, 9px) - 2px + var(--lift));
  border: 0; border-radius: 0; background: var(--face); color: var(--text);
  font: 700 13px/1.2 var(--sans); letter-spacing: .02em; text-decoration: none; white-space: nowrap; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--edge), inset 0 calc(-1 * var(--lift)) 0 var(--lip);   /* a hairline edge, in a soft brown */
  /* a step at each corner, like a pixel drawing's */
  clip-path: polygon(0 calc(2 * var(--cut)), var(--cut) calc(2 * var(--cut)), var(--cut) var(--cut), calc(2 * var(--cut)) var(--cut), calc(2 * var(--cut)) 0,
    calc(100% - 2 * var(--cut)) 0, calc(100% - 2 * var(--cut)) var(--cut), calc(100% - var(--cut)) var(--cut), calc(100% - var(--cut)) calc(2 * var(--cut)), 100% calc(2 * var(--cut)),
    100% calc(100% - 2 * var(--cut)), calc(100% - var(--cut)) calc(100% - 2 * var(--cut)), calc(100% - var(--cut)) calc(100% - var(--cut)), calc(100% - 2 * var(--cut)) calc(100% - var(--cut)), calc(100% - 2 * var(--cut)) 100%,
    calc(2 * var(--cut)) 100%, calc(2 * var(--cut)) calc(100% - var(--cut)), var(--cut) calc(100% - var(--cut)), var(--cut) calc(100% - 2 * var(--cut)), 0 calc(100% - 2 * var(--cut)));
  transition: padding .06s, box-shadow .06s, filter .15s;
  -webkit-tap-highlight-color: transparent;
}
.px-btn.danger { --face: #c4452b; --text: #fffbe9; --edge: #5e1e12; --lip: #9c3420; }   /* a step that can't be undone */
/* a toggle that is on is green and stays as tall as the others (never pressed in) */
.px-btn:is(.main, [aria-pressed="true"]) { --face: #5f7d4a; --text: #fffbe9; --edge: #3f5530; --lip: #4a6339; --ico-fill: #4f6d3c; --ico-front: #6f8f58; --ico-thread: #ffe38a; }
.px-btn.small { --pad-y: 7px; --rise: 3px; padding-left: 12px; padding-right: 12px; font-size: 12.5px; }
.px-btn:hover { filter: brightness(1.04); }
.px-btn:active { --lift: 1px; }
/* the cut corners would clip an outline: the focus ring goes inside the edge instead */
.px-btn:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--edge), inset 0 0 0 3px var(--accent, #e8590c), inset 0 calc(-1 * var(--lift)) 0 var(--lip); }
.px-ico, .px-glyph { flex: none; display: block; image-rendering: pixelated; }
.px-glyph .t { fill: var(--accent, #e8590c); }        /* the glyphs are in the text's colour (icons/*.svg), their thread in the accent */
.px-ico .o { fill: var(--edge); }
.px-btn:is(.main, .danger, [aria-pressed="true"]) .px-ico .o { fill: var(--text); }
.px-ico .f { fill: var(--ico-fill); }
.px-ico .F { fill: var(--ico-front); }
.px-ico .t { fill: var(--ico-thread); }
:root[data-theme="dark"] .px-btn { --face: #3a352c; --text: #f3e9cc; --edge: #0f0d0a; --lip: #25211b; --ico-fill: #8c7a55; --ico-front: #b19c70; --ico-thread: #9cc27f; }
:root[data-theme="dark"] .px-btn:is(.main, [aria-pressed="true"]) { --face: #55703f; --text: #fffbe9; --edge: #10170b; --lip: #3e5430; --ico-fill: #3e5430; --ico-front: #6f8f58; --ico-thread: #ffe38a; }
:root[data-theme="dark"] .px-btn.danger { --face: #b23d25; --text: #fffbe9; --edge: #2a0c06; --lip: #862c1a; }
:root[data-theme="dark"] .px-btn .px-ico .o { fill: var(--text); }
@media (prefers-reduced-motion: reduce) { .px-btn { transition: none; } }
