/*
 * UI kit sheet: icon buttons (.uk-btn), the tooltip (.uk-tip), the parts UIKit.handles works ([data-uk-handle]),
 * the one knob look (.uk-knob) and the first-use hint (.uk-hint). The host themes it through the --uk-* custom
 * properties below; each has a literal fallback, so the kit also works unthemed.
 *   --uk-ink, --uk-surface, --uk-surface-pressed, --uk-line   button text and icon, fill, pressed fill, edge
 *   --uk-accent, --uk-on-accent                              the primary fill and what sits on it
 *   --uk-focus                                               the keyboard focus ring
 *   --uk-tip-bg, --uk-tip-ink                                the tooltip and the hint (text at 4.5:1 or better)
 *   --uk-knob, --uk-knob-ring                                draggable knobs
 *   --uk-size, --uk-icon, --uk-radius, --uk-dur, --uk-ease   button and icon size, corners, press timing
 * Sizes: 48 px buttons with 24 px icons on phones, 56 px with 28 px icons on boards (900 px wide and up), never
 * under 44 px. No color-mix() or relative colours (classroom boards run older browsers); every :hover sits inside
 * @media (hover: hover) and (pointer: fine), so a tap never leaves a button lit.
 */

.uk-btn {
  --uk-btn-size: max(44px, var(--uk-size, 48px));
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  min-inline-size: var(--uk-btn-size);
  min-block-size: var(--uk-btn-size);
  margin: 0;
  padding: 0 18px 0 14px;
  color: var(--uk-ink, #0b1628);
  background: var(--uk-surface, #ffffff);
  border: 1px solid var(--uk-line, #bcc8d8);
  border-radius: var(--uk-radius, 12px);
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform var(--uk-dur, .14s) var(--uk-ease, cubic-bezier(.23, 1, .32, 1)),
    background-color var(--uk-dur, .14s) ease, border-color var(--uk-dur, .14s) ease;
}
.uk-btn--icon {
  inline-size: var(--uk-btn-size);
  block-size: var(--uk-btn-size);
  padding: 0;
}
.uk-btn .uk-icon {
  flex: none;
  inline-size: var(--uk-icon, 24px);
  block-size: var(--uk-icon, 24px);
  pointer-events: none;
}
.uk-btn--primary {
  color: var(--uk-on-accent, #ffffff);
  background: var(--uk-accent, #1d4f9f);
  border-color: var(--uk-accent, #1d4f9f);
}
.uk-btn[aria-pressed="true"] {
  background: var(--uk-surface-pressed, #e2e9f2);
  border-color: var(--uk-accent, #1d4f9f);
}

/* The label stays in the DOM as the accessible name; an icon-only button clips it from sight. */
.uk-btn__label { pointer-events: none; }
.uk-btn--icon .uk-btn__label {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Press: a quick, small scale on the transform only; the fill darkens on plain buttons. */
.uk-btn:active:not(:disabled) { transform: scale(.96); }
.uk-btn:not(.uk-btn--primary):active:not(:disabled) { background: var(--uk-surface-pressed, #e2e9f2); }
.uk-btn:focus-visible {
  outline: 3px solid var(--uk-focus, #1a8fcc);
  outline-offset: 2px;
}
.uk-btn:disabled {
  cursor: not-allowed;
  opacity: .45;
}
/* The display above would otherwise beat the hidden attribute. */
.uk-btn[hidden] { display: none; }

@media (hover: hover) and (pointer: fine) {
  .uk-btn:hover:not(:disabled) { border-color: var(--uk-accent, #1d4f9f); }
}

/* Boards: bigger targets and icons, read from the back row. */
@media (min-width: 900px) {
  .uk-btn {
    --uk-btn-size: max(44px, var(--uk-size, 56px));
    font-size: 17px;
  }
  .uk-btn .uk-icon {
    inline-size: var(--uk-icon, 28px);
    block-size: var(--uk-icon, 28px);
  }
}

/*
 * The tooltip: one element, fixed, placed by UIKit.tips above the button (below when there is no room) and clamped
 * into the viewport. It grows out of the button side; the close is quicker than the open; a tip opened from the
 * keyboard, or right after another, appears at once ([data-instant]).
 */
.uk-tip {
  position: fixed;
  z-index: 2147483000;
  inset: auto;
  box-sizing: border-box;
  max-inline-size: min(320px, calc(100vw - 16px));
  margin: 0;
  padding: 8px 12px;
  color: var(--uk-tip-ink, #ffffff);
  background: var(--uk-tip-bg, #0b1b33);
  border: 0;
  border-radius: 10px;
  box-shadow: 0 6px 20px -6px rgba(0, 0, 0, .45);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transform: translateY(4px) scale(.96);
  transition: opacity 90ms ease-out, transform 90ms ease-out, visibility 0s linear 90ms;
}
.uk-tip[data-side="bottom"] { transform: translateY(-4px) scale(.96); }
.uk-tip[data-open] {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity 150ms var(--uk-ease, cubic-bezier(.23, 1, .32, 1)),
    transform 150ms var(--uk-ease, cubic-bezier(.23, 1, .32, 1)), visibility 0s;
}
.uk-tip[data-instant] { transition-duration: 0s; }

@media (min-width: 900px) {
  .uk-tip {
    padding: 10px 14px;
    font-size: 18px;
  }
}

/*
 * Handles: a part UIKit.handles works takes every touch itself (no page scroll or zoom from it) and shows a grab hand
 * to a mouse. A pick list keeps scrolling, so only its double-tap zoom is off.
 */
[data-uk-handle] {
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
[data-uk-handle="pick"] { touch-action: manipulation; }
[data-uk-handle]:focus-visible {
  outline: 3px solid var(--uk-focus, #1a8fcc);
  outline-offset: 4px;
}
@media (pointer: fine) {
  [data-uk-handle]:not([data-uk-handle="pick"]) { cursor: grab; }
  [data-uk-handle][data-uk-dragging] { cursor: grabbing; }
}

/*
 * The knob: the one look of everything that can be dragged, a round grab point at least 44 px across. The host places
 * it (a transform on the knob or on the part that carries it); while a drag is in progress it grows a little under the
 * finger. A part that moves with the knob may carry .uk-follows: it follows the finger 1:1 during a drag and only
 * settles, briefly, into a snap stop (data-uk-snap). Keys move it at once.
 */
.uk-knob {
  --uk-knob-size: 44px;
  box-sizing: border-box;
  inline-size: var(--uk-knob-size);
  block-size: var(--uk-knob-size);
  background: var(--uk-knob, #ffffff);
  border: 4px solid var(--uk-knob-ring, #1d4f9f);
  border-radius: 50%;
  box-shadow: 0 2px 6px -1px rgba(0, 0, 0, .35);
  scale: 1;
  transition: scale var(--uk-dur, .14s) var(--uk-ease, cubic-bezier(.23, 1, .32, 1));
}
[data-uk-dragging] .uk-knob,
.uk-knob[data-uk-dragging] { scale: 1.12; }
[data-uk-snap] .uk-follows,
.uk-follows[data-uk-snap] { transition: transform 120ms var(--uk-ease, cubic-bezier(.23, 1, .32, 1)); }

@media (min-width: 900px) {
  .uk-knob { --uk-knob-size: 52px; }
}

/*
 * The hint: the note UIKit.hint.show puts on a part until its first touch, a hand tracing the one gesture beside the
 * sentence, in the tooltip's colours. It sits at the bottom centre of its host, which must be positioned (a stage; a
 * host stylesheet may move it off a small part), takes no touches itself and fades in once. Each gesture has a short loop: drag slides sideways, turn
 * swings on an arc, pinch spreads two fingertips, tap presses. Reduced motion keeps a still hand and the sentence.
 */
.uk-hint {
  position: absolute;
  z-index: 2;
  bottom: 12px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  inline-size: max-content;
  max-inline-size: min(300px, calc(100vw - 32px));
  margin: 0;
  padding: 8px 16px 8px 10px;
  color: var(--uk-tip-ink, #ffffff);
  background: var(--uk-tip-bg, #0b1b33);
  border-radius: 14px;
  box-shadow: 0 6px 20px -6px rgba(0, 0, 0, .45);
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0;
  text-align: start;
  white-space: normal;
  pointer-events: none;
  translate: -50% 0;
  animation: uk-hint-in 240ms var(--uk-ease, cubic-bezier(.23, 1, .32, 1)) both;
}
.uk-hint__hand {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  inline-size: 40px;
  block-size: 40px;
}
.uk-hint__hand .uk-icon {
  inline-size: 30px;
  block-size: 30px;
  animation: 1.4s ease-in-out infinite alternate;
}
.uk-hint[data-uk-gesture="drag"] .uk-hint__hand .uk-icon { animation-name: uk-hint-drag; }
.uk-hint[data-uk-gesture="turn"] .uk-hint__hand .uk-icon {
  transform-origin: 50% 130%;
  animation-name: uk-hint-turn;
}
.uk-hint[data-uk-gesture="tap"] .uk-hint__hand .uk-icon {
  animation: uk-hint-tap 1.2s var(--uk-ease, cubic-bezier(.23, 1, .32, 1)) infinite;
}
/* Pinch: two fingertips at the hand's top, apart when still, drawing together and spreading in the loop. */
.uk-hint[data-uk-gesture="pinch"] .uk-hint__hand::before,
.uk-hint[data-uk-gesture="pinch"] .uk-hint__hand::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 50%;
  inline-size: 8px;
  block-size: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: currentColor;
  translate: -13px 0;
  animation: uk-hint-pinch-left 1.4s ease-in-out infinite alternate;
}
.uk-hint[data-uk-gesture="pinch"] .uk-hint__hand::after {
  translate: 13px 0;
  animation-name: uk-hint-pinch-right;
}
.uk-hint[data-uk-gesture="pinch"] .uk-hint__hand .uk-icon { translate: 0 4px; }

@keyframes uk-hint-in { from { opacity: 0; } }
@keyframes uk-hint-drag { from { transform: translateX(-7px); } to { transform: translateX(7px); } }
@keyframes uk-hint-turn { from { transform: rotate(-28deg); } to { transform: rotate(28deg); } }
@keyframes uk-hint-tap { 0%, 55%, 100% { transform: none; } 25% { transform: scale(.82); } }
@keyframes uk-hint-pinch-left { from { translate: -4px 4px; } to { translate: -13px 0; } }
@keyframes uk-hint-pinch-right { from { translate: 4px 4px; } to { translate: 13px 0; } }

@media (min-width: 900px) {
  .uk-hint {
    gap: 12px;
    max-inline-size: min(400px, calc(100vw - 32px));
    padding: 10px 18px 10px 12px;
    font-size: 18px;
  }
  .uk-hint__hand {
    inline-size: 44px;
    block-size: 44px;
  }
  .uk-hint__hand .uk-icon {
    inline-size: 34px;
    block-size: 34px;
  }
}

/*
 * Reduced motion: no press scale, no tip movement, no knob growth or settle, a still hint hand; the colour change and
 * the fades stay.
 */
@media (prefers-reduced-motion: reduce) {
  .uk-btn:active:not(:disabled) { transform: none; }
  .uk-tip,
  .uk-tip[data-side="bottom"] { transform: none; }
  [data-uk-dragging] .uk-knob,
  .uk-knob[data-uk-dragging] { scale: 1; }
  .uk-knob,
  [data-uk-snap] .uk-follows,
  .uk-follows[data-uk-snap] { transition: none; }
  .uk-hint[data-uk-gesture] .uk-hint__hand .uk-icon,
  .uk-hint[data-uk-gesture] .uk-hint__hand::before,
  .uk-hint[data-uk-gesture] .uk-hint__hand::after { animation: none; }
}
