/* LAWS:
   - design only. Every rule here decides how a KEY looks and nothing about which keys exist, when
     they appear, or what a press means. ui/kbd/kbd.js names the classes; this sheet owns the paint.
   - colours come from ui/kit tokens — there is not one hex in this file, so all four looks restyle
     every board without opening it. Geometry comes from the --kb* raw tokens.
   - ONE UNIT, EVERY ROW. A key's width is `--kw` units and every row totals --kbRow of them, so a
     letter is the same size wherever it sits and whichever surface drew it. A key that is switched
     off keeps its seat (visibility, never display) — that is the whole mechanism, and the reason
     the quest board's row 3 no longer changes size with the word on screen.
   - THE TAP TARGET IS BIGGER THAN THE DRAWN KEY, by --kbBleed into the gap on every side, so the
     targets of two neighbours meet and never overlap. Ten keys do not fit a phone at 44px — iOS's
     own are about 32 — so a bigger target is the only honest answer, and it moves nothing on screen.
   History: NOTES.md */

.kbd{
  margin:var(--kbTop) auto 0; max-width:var(--kbMax);
  user-select:none; -webkit-user-select:none;
  touch-action:manipulation; -webkit-tap-highlight-color:transparent;
}
.kbr{ display:flex; gap:var(--kbGap); justify-content:center; margin-bottom:var(--kbGap); }

.kb-k{
  flex:var(--kw) 1 0; min-width:0; max-width:calc(var(--kw) * var(--kbUnit));
  height:var(--kbH); padding:0; position:relative;
  border:none; border-radius:var(--kbR); cursor:pointer; touch-action:manipulation;
  font-family:var(--fbody); font-size:var(--kbFont); font-weight:800; line-height:1;
  text-transform:lowercase;
  color:var(--ink); background:linear-gradient(180deg,var(--tileHi),var(--tileLo));
  box-shadow:inset 0 -2px 0 var(--tileEdge), var(--float-drop), inset 0 2px 0 var(--kbGloss);
  transition:transform .06s ease, box-shadow .06s ease;
}
.kb-k::before{ content:''; position:absolute; inset:calc(-1 * var(--kbBleed)); }
@media (hover:hover){ .kb-k:hover{ background:linear-gradient(180deg,var(--tileHovHi),var(--tileHovLo)); } }
.kb-k:active{ transform:translateY(var(--kbDrop));
              box-shadow:0 0 0 var(--tileEdge), inset 0 2px 0 var(--kbGloss); }

/* A SPACER HOLDS A SEAT. Two kinds, and they are the same shape on purpose: a seat that is empty in
   this key set (`.kb-sp`, built that way) and a key this exercise does not want (`[data-off]`, live
   in the markup and switched off for one step). Neither draws, neither takes a tap, and both keep
   every letter beside them exactly where it was on the previous word. */
.kb-sp{ flex:var(--kw) 1 0; min-width:0; max-width:calc(var(--kw) * var(--kbUnit)); }
.kb-k[data-off]{ visibility:hidden; pointer-events:none; }

.kb-k.fn{ font-size:var(--kbFnFont); color:var(--goldInk);
          background:linear-gradient(180deg,var(--fnHi),var(--fnLo));
          box-shadow:inset 0 -2px 0 var(--fnEdge), var(--float-drop); }
.kb-k.space{ font-size:var(--kbSpaceFont); font-weight:700; color:var(--ink); text-transform:none; }

/* the one-shot shift, lit while it is armed — and the caps class lifts the keycaps' lowercase
   transform so the uppercased letters actually SHOW uppercase. */
.kb-k.shift.on{ color:var(--kbShiftInk);
                background:linear-gradient(180deg,var(--goldL),var(--gold));
                box-shadow:inset 0 -2px 0 var(--goldD), var(--float-drop); }
/* …and LOCKED, which only the desk's board can be. A deeper gold, because caps lock is a state a
   child leaves on by accident and has to be able to see from across the table. */
.kb-k.shift.lock{ color:var(--kbShiftInk);
                  background:linear-gradient(180deg,var(--gold),var(--goldD));
                  box-shadow:inset 0 -2px 0 var(--goldD), var(--float-drop); }
.kbd.caps .kb-k{ text-transform:none; }

/* COLOUR IS A HIERARCHY, and the desk board's first cut had it backwards: `!` and `?` were the
   biggest, brightest keys on the board. Gold means "not a letter"; the quiet grey means "a key you
   press once a page" (the layer switch). And `,` and `.` are CHARACTERS she types, not function
   keys — gold so she can find them among the letters, but drawn at LETTER size, because a full stop
   set at the ⌫ size is a speck. */
.kb-k.punct{ font-size:var(--kbFont); }
.kb-k.mut{ font-size:var(--kbFnFont); color:var(--mut);
           background:linear-gradient(180deg,var(--tileLo),var(--tileEdge));
           box-shadow:inset 0 -2px 0 var(--tileEdge), var(--float-drop); }

/* the bubble above the pressed key: on a 29px key you cannot otherwise tell what you hit until you
   lift your finger, which is the whole reason phone keyboards draw one. Phones only — an iPad key is
   over 50px and Apple's own iPad board shows no preview either, so neither do we. */
#kbpop{
  position:fixed; z-index:60; display:none; pointer-events:none;
  min-width:var(--kbPopMin); padding:var(--kbPopPad); border-radius:var(--kbR); text-align:center;
  font-family:var(--fbody); font-size:var(--kbPopFont); font-weight:900; line-height:1; color:var(--ink);
  background:var(--card); border:var(--kbPopLine) solid var(--line);
  box-shadow:0 8px 18px var(--kbPopShade); transform:translate(-50%,-100%);
}

@media (max-width:560px){
  .kbd{ margin-top:var(--kbTopSm); }
  .kbr{ gap:var(--kbGapSm); margin-bottom:var(--kbGapSm); }
  .kb-k{ height:var(--kbHsm); font-size:var(--kbFontSm); border-radius:var(--kbRsm); }
  .kb-k.punct{ font-size:var(--kbFontSm); }
  .kb-k::before{ inset:calc(-1 * var(--kbBleedSm)); }
}
