/* ONE button system for the whole site (the home, the ground, the sheets and cards, the games). Loaded last on
   index.html and play.html. A button is "kb" plus one face (kb-sun, kb-paper, kb-ig, kb-tt) and at most one size
   (kb-xs, kb-sm, kb-lg, kb-hero, kb-round). The look is the series': a chunky ink outline, a solid lip in a darker
   tone of the face along the bottom, a soft highlight on top, a short ink drop under it. A press moves the face down
   onto its lip with a small squash. Icons are inline SVG (class "ki") next to the label. */
:root {
  --kb-ink: #24170f;
  --kb-sun: #fed577; --kb-sun-lip: #e39a1e;
  --kb-paper: #fff8e8; --kb-paper-lip: #e3cf9f;
  --kb-ig: linear-gradient(120deg, #f58529 0%, #dd2a7b 52%, #8134af 100%); --kb-ig-lip: #5a1a7e;
  --kb-tt: #18181d; --kb-tt-lip: #000;
}
.kb {
  --face: var(--kb-paper); --lip: var(--kb-paper-lip); --fg: var(--kb-ink); --hi: rgba(255,255,255,0.75); --gloss: rgba(255,255,255,0.45);
  --lipH: 5px; --drop: 3px; --r: 16px; --edge: 0 0 0 0 transparent;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 52px; padding: 0 16px var(--lipH);
  font-family: var(--body); font-weight: 900; font-size: 16px; line-height: 1.1; color: var(--fg); text-decoration: none; text-align: center;
  background: linear-gradient(180deg, var(--gloss) 0, rgba(255,255,255,0) 52%) no-repeat, var(--face);
  border: 2.5px solid var(--kb-ink); border-radius: var(--r);
  box-shadow: var(--edge), inset 0 calc(-1 * var(--lipH)) 0 var(--lip), inset 0 2px 0 var(--hi), 0 var(--drop) 0 var(--kb-ink);
  transform: translateY(0); transform-origin: 50% 100%;
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, padding 0.08s ease-out, filter 0.15s;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none;
}
.kb .ki { width: 1.3em; height: 1.3em; flex: none; display: block; overflow: visible; }
/* the press: down onto the lip, a little wider and shorter, the drop gone */
.kb:active:not(:disabled), .kb.is-pressed {
  transform: translateY(var(--drop)) scale(1.015, 0.965);
  padding-bottom: 2px;
  box-shadow: var(--edge), inset 0 -2px 0 var(--lip), inset 0 2px 0 var(--hi), 0 0 0 var(--kb-ink);
}
@media (hover: hover) and (pointer: fine) {
  .kb:hover:not(:disabled):not(:active) { filter: brightness(1.05) saturate(1.06); transform: translateY(-1px);
    box-shadow: var(--edge), inset 0 calc(-1 * var(--lipH)) 0 var(--lip), inset 0 2px 0 var(--hi), 0 calc(var(--drop) + 1px) 0 var(--kb-ink); }
}
.kb:focus { outline: none; }
.kb:focus-visible { outline: 3px solid #fff; outline-offset: 2px;
  box-shadow: var(--edge), inset 0 calc(-1 * var(--lipH)) 0 var(--lip), inset 0 2px 0 var(--hi), 0 var(--drop) 0 var(--kb-ink), 0 0 0 7px var(--kb-ink); }
.kb:disabled, .kb[aria-disabled="true"] { cursor: default; filter: grayscale(0.75); opacity: 0.6; transform: none;
  box-shadow: var(--edge), inset 0 -3px 0 var(--lip), 0 2px 0 var(--kb-ink); }

/* faces */
.kb-sun { --face: var(--kb-sun); --lip: var(--kb-sun-lip); --fg: var(--kb-ink); }
.kb-paper { --face: var(--kb-paper); --lip: var(--kb-paper-lip); --fg: var(--kb-ink); }
.kb-ig { --face: var(--kb-ig); --lip: var(--kb-ig-lip); --fg: #fff; --hi: rgba(255,255,255,0.5); --gloss: rgba(255,255,255,0.3); text-shadow: 0 1.5px 0 rgba(36,23,15,0.85); }
.kb-tt { --face: var(--kb-tt); --lip: var(--kb-tt-lip); --fg: #fff; --hi: rgba(255,255,255,0.22); --gloss: rgba(255,255,255,0.14);
  --edge: inset 3px 0 0 #25f4ee, inset -3px 0 0 #fe2c55; }
.kb-ig .ki, .kb-tt .ki { filter: drop-shadow(0 1.5px 0 rgba(36,23,15,0.8)); }

/* sizes */
.kb-xs { --lipH: 3px; --drop: 2px; --r: 10px; min-height: 30px; padding: 0 9px var(--lipH); gap: 4px; font-size: 12.5px; border-width: 2px; }
.kb-sm { --lipH: 4px; --drop: 3px; --r: 13px; min-height: 44px; padding: 0 13px var(--lipH); font-size: 15px; }
.kb-lg { --lipH: 6px; --drop: 4px; --r: 18px; min-height: 60px; font-family: var(--head); font-weight: 400; font-size: 21px; border-width: 3px; }
.kb-round { --lipH: 4px; --drop: 3px; --r: 50%; width: 44px; min-height: 44px; height: 44px; padding: 0 0 var(--lipH); flex: none; }
.kb-round .ki { width: 20px; height: 20px; }
.kb-xs:active:not(:disabled), .kb-round:active:not(:disabled) { padding-bottom: 1px; }

/* the hero: "שחקו עכשיו", the one thing to do on the home and on the ground */
.kb-hero { --lipH: 7px; --drop: 4px; --r: 20px; min-height: 74px; width: 100%; justify-content: flex-start; gap: 12px; padding: 0 12px var(--lipH) 14px;
  border-width: 3px; overflow: hidden; text-align: start; }
.kb-hero .kh-ic { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--kb-ink); color: var(--kb-sun);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.5), 0 0 0 3px rgba(255,255,255,0.55); animation: kbBeat 2.4s ease-in-out infinite; }
.kb-hero .kh-ic .ki { width: 24px; height: 24px; margin-inline-start: -3px; } /* the triangle points left on an RTL page, its weight sits right */
.kb-hero .kh-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.08; }
.kb-hero .kh-t small { font-size: 13px; font-weight: 900; letter-spacing: 0.2px; opacity: 0.8; }
.kb-hero .kh-t b { font-family: var(--head); font-weight: 400; font-size: 23px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-hero .kh-t b.long { font-size: 19px; white-space: normal; line-height: 1.05; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.kb-hero .kh-go { flex: none; width: 26px; display: grid; place-items: center; color: var(--kb-ink); animation: kbNudge 1.6s ease-in-out infinite; }
.kb-hero .kh-go .ki { width: 26px; height: 26px; }
.kb-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(100deg, transparent 32%, rgba(255,255,255,0.6) 46%, transparent 60%); transform: translateX(-130%); animation: kbShine 3.4s ease-in-out infinite 1.2s; }
.kb-hero:active .kh-ic, .kb-hero:active .kh-go { animation: none; }
@keyframes kbBeat { 0%, 70%, 100% { transform: scale(1) rotate(0); } 78% { transform: scale(1.1) rotate(-6deg); } 86% { transform: scale(0.97) rotate(3deg); } }
@keyframes kbNudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-4px); } }
@keyframes kbShine { 45%, 100% { transform: translateX(130%); } }

/* a tab: the icon over its word (the dock) */
.kb-tab { flex-direction: column; gap: 1px; min-height: 58px; padding: 3px 2px var(--lipH); font-size: 13.5px; font-weight: 900; --r: 14px; }
.kb-tab .ki { width: 24px; height: 24px; }

@media (prefers-reduced-motion: reduce) { .kb { transition: none; } .kb-hero .kh-ic, .kb-hero .kh-go, .kb-hero::after { animation: none !important; } }
