/* Sagebrush Sports interface kit.
   Everything is measured in k: 1k is 1px at 1280x720, 1.5px at 1920x1080, 2px at 2560x1440. */

/* display: Luckiest Guy (Astigmatic, Apache 2.0), self-hosted */
@font-face { font-family: 'Luckiest Guy'; src: url('fonts/luckiestguy/LuckiestGuy-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: block; }
/* its outlined copies (tools/outline_font.py): the black outline and the white rim, filled behind a word */
@font-face { font-family: 'Luckiest Guy Outline'; src: url('fonts/luckiestguy/LuckiestGuy-Outline.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: block; }
@font-face { font-family: 'Luckiest Guy Rim'; src: url('fonts/luckiestguy/LuckiestGuy-Rim.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: block; }
/* reading text: Atkinson Hyperlegible Next (OFL) */
@font-face { font-family: 'SB Text'; src: url('fonts/atkinsonhyperlegiblenext/AtkinsonHyperlegibleNextwght.woff2') format('woff2'); font-weight: 200 800; font-style: normal; font-display: block; }

:root {
  --k: min(100vw / 1280, 100vh / 720);  /* a length: 1px at 1280x720 */
  --blue: #1745ff; --blue-deep: #0a26c8;
  --orange: #ff6a00; --orange-deep: #b83c00;
  --yellow: #ffd21a; --red: #ec1d22;
  --paper: #ffffff; --ink: #08080d;
  --slate: #242840; --mist: #8a8eaa;
  --snap: cubic-bezier(.25, 1.35, .45, 1);
  --glide: cubic-bezier(.3, 0, .15, 1);
  --press-down: cubic-bezier(.2, .9, .3, 1);
  --press-up: cubic-bezier(.3, 1.6, .55, 1);
  --t1: 120ms; --t2: 180ms; --t3: 240ms;
}

html, body { margin: 0; }
.chip-face { pointer-events: none; }
.chip-face img { position: absolute; left: 0; top: 0; max-width: none; border-radius: 50%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.kit-svg { display: block; overflow: visible; }
.kit-svg text { font-kerning: none; font-synthesis: none; }
.kit-word { display: block; pointer-events: none; }

/* reading text: sentence case, never outlined or slanted */
.kit-text { font-family: 'SB Text', sans-serif; font-weight: 500; color: var(--paper); font-size: calc(16 * var(--k)); line-height: 1.35; letter-spacing: 0.005em; }
.kit-text strong { font-weight: 700; }

/* ---------------------------------------------------------------- the states every button draws
   rest; focus (keyboard, mouse hover and controller alike: the plate heats, its die-cut turns yellow
   and thicker, ticks flick from its corner, 5% larger); pressed (is-pressed: the plate slides onto its
   black copy, 120 ms down, 220 ms back with one overshoot, movement only); disabled (slate, mist).
   --down is the copy's offset in the SVG's units, --down-k the same for the words over it. */
/* a button is hit on its own box: its drawing reaches past it (the halftone, the focus ticks) and over its
   neighbours */
:is(.kb, .kit-tab, .kit-tile) svg { pointer-events: none; }
.kb, .kit-tab, .kit-tile, .kc { position: relative; display: block; padding: 0; margin: 0; border: 0; background: none; cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; font: inherit; color: inherit; }
:is(.kb, .kit-tab, .kc):disabled, .kit-tile[aria-disabled="true"] { cursor: default; }
:is(.kb, .kit-tab, .kc) :is(.pl-top, .kit-top) { transition: transform 220ms var(--press-up); }
:is(.kb, .kit-tab, .kc).is-pressed .pl-top { transform: var(--down); transition: transform 120ms var(--press-down); }
:is(.kb, .kit-tab, .kc).is-pressed .kit-top { transform: var(--down-k); transition: transform 120ms var(--press-down); }
.pl-focus, .pl-cut--focus, .kit-focus { opacity: 0; }
:is(.kb, .kit-tab, .kc):is(:focus, [data-nav-focus], .is-focus) :is(.pl-focus, .pl-cut--focus) { opacity: 1; }
:is(.kb, .kit-tab, .kc):is(:focus, [data-nav-focus], .is-focus) .pl-rest { opacity: 0; }
.kb-body, .kit-tab-body, .kc-body { position: absolute; inset: 0; transition: transform var(--t2) var(--snap); }
:is(.kb-body, .kit-tab-body, .kc-body, .kb-tilt) > * { position: absolute; }
.kb-tilt { position: absolute; inset: 0; }
:is(.kb, .kit-tab, .kc):is(:focus, [data-nav-focus], .is-focus) :is(.kb-body, .kit-tab-body, .kc-body) { transform: scale(1.05); }

/* ---------------------------------------------------------------- menu button: the ticks of focus */
.kb .kb-ticks { opacity: 0; transform: scale(.3); transition: opacity var(--t1) linear, transform var(--t2) var(--snap); }
.kb:is(:focus, [data-nav-focus], .is-focus) .kb-ticks { opacity: 1; transform: none; }
.kb.is-pressed .kb-ticks { transform: scale(.85); }

/* ---------------------------------------------------------------- team tab: off sits on its copy */
.kit-tab:not(.is-on) .pl-on, .kit-tab.is-on .pl-off { opacity: 0; }
.kit-tab:not(.is-on):not(:disabled) .pl-top { transform: var(--down); }
.kit-tab:not(.is-on):not(:disabled) .kit-top { transform: var(--down-k); }

/* ---------------------------------------------------------------- roster tile */
.kit-tile { --sc: 1; }
.tile-body { position: absolute; inset: 0; transform: scale(var(--sc)); transition: transform var(--t2) var(--snap); }
.tile-body > *, .tile-top > * { position: absolute; }
.tile-top { inset: 0; transition: transform 220ms var(--press-up); }
.tile-face { transition: transform var(--t2) var(--snap); }
.kit-tile:is(:focus, [data-nav-focus], .is-focus) { --sc: 1.06; z-index: 2; }
.kit-tile:is(:focus, [data-nav-focus], .is-focus) .kit-focus { opacity: 1; }
.kit-tile:is(:focus, [data-nav-focus], .is-focus) .tile-rim { opacity: 0; }
.kit-tile.is-selected { z-index: 1; }
.kit-tile.is-selected .tile-top { transform: var(--lift); }
.kit-tile.is-selected .tile-face { transform: var(--pop); }
.kit-tile.is-pressed .tile-top { transform: var(--down-k); transition: transform 120ms var(--press-down); }
.kit-tile .tile-sel, .kit-tile.is-selected .tile-rest, .kit-tile .tile-veil { opacity: 0; }
.kit-tile.is-selected .tile-sel, .kit-tile.is-taken .tile-veil { opacity: 1; }

/* ---------------------------------------------------------------- the match HUD: never takes the pointer */
.kit-callout, .kit-score, .kit-turbo, .kit-power { pointer-events: none; }
.kit-logo-body > * { position: absolute; }
.co-body { position: absolute; inset: 0; }
.co-body > *, .co-line > * { position: absolute; }
.co-icon .co-icon-art, .co-icon svg { width: 100%; height: 100%; }
.kit-callout.is-match .co-line { will-change: transform, opacity; }
.kit-callout .co-art { overflow: hidden; }
.score-ball { transform-origin: 50% 50%; will-change: transform; }
.score-ball:not(.is-on) { transform: scale(0); }
.kit-score:not(.is-golden) .score-golden { opacity: 0; }
.kit-score .score-number { will-change: transform, opacity; }
.kit-turbo > * { position: absolute; }
.turbo-fill { background: linear-gradient(#fff35c, #ffd21a 55%, #ffb800); transform-origin: 0 50%; transition: transform var(--t2) linear; will-change: transform; }
.kit-turbo :is(.turbo-red, .turbo-ring) { opacity: 0; will-change: opacity; }
.kit-turbo .turbo-word--fire { opacity: 0; }
.kit-turbo.is-dry .turbo-red { opacity: 1; }
.kit-turbo.is-fire :is(.turbo-red, .turbo-ring, .turbo-word--fire) { opacity: 1; }
.kit-turbo.is-fire .turbo-word--turbo { opacity: 0; }
/* the power-up slot from icons.js inside the badge: the item stands on the badge's burst inside its
   ring of time. Its quiet and loud layers are both drawn; has-item crosses them: the loud one snaps up
   round the item in one beat as it lands, and glides out as it leaves while the quiet one comes back. */
.kit-power { --ic-slot-plate: transparent; --ic-slot-rim: transparent; --ic-slot-edge: var(--ink); --ic-slot-track: var(--ink); --ic-slot-track-lt: rgba(255,255,255,.18); }
.kit-power--sticker { --ic-slot-plate: var(--paper); --ic-slot-rim: var(--ink); }
.kit-power .kit-svg, .kit-power-slot { position: absolute; }
.kit-power-held { position: absolute; inset: 0; opacity: 0; transform: scale(var(--from, .82)); transition: opacity var(--t3) var(--glide), transform var(--t3) var(--glide); }
.kit-power.has-item .kit-power-held { opacity: 1; transform: none; transition: opacity var(--t1) linear, transform var(--t3) var(--snap); }
.kit-power-quiet { transition: opacity var(--t2) linear var(--t1); }
.kit-power.has-item .kit-power-quiet { opacity: 0; transition: opacity var(--t1) linear; }
.kit-power .ps[data-forever][data-state="working"] .ps-glint, .kit-power .ps[data-forever][data-state="working"] .ps-item .ic { animation: none; opacity: 0; }
.kit-power .ps[data-forever][data-state="working"] .ps-item .ic { opacity: 1; }

/* ================================================================ the calm pieces (controls.js) */
:root { --ic-font: 'Luckiest Guy', sans-serif; }   /* key caps and controller letters in the display face */
.kit-frame { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.kit-frame > svg { position: absolute; }

/* panel: an upright card with lightning corners, on its copy inside the white die-cut */
.kp { position: relative; box-sizing: border-box; padding: calc(58 * var(--k)) calc(32 * var(--k)) calc(30 * var(--k)); color: var(--paper); }
.kp--paper { color: var(--ink); }
.kp > :not(.kit-frame) { position: relative; z-index: 1; }
.kp--plain { padding: calc(28 * var(--k)) calc(32 * var(--k)); }
.kp--slim { padding: calc(10 * var(--k)) calc(14 * var(--k)) calc(10 * var(--k)) calc(24 * var(--k)); }
.kp--slim:not(.kp--plain) { padding-top: calc(40 * var(--k)); }
.kp-head { position: absolute !important; left: calc(-14 * var(--k)); top: calc(-22 * var(--k)); }
.kp-head > * { position: absolute; }
.kp-body { display: grid; gap: calc(6 * var(--k)); }
.kp .kit-text, .kp-body.kit-text { color: inherit; font-size: calc(18 * var(--k)); }

/* field: a row with a label and a control; the row lights up while its control has focus */
.kf { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: calc(24 * var(--k)); min-height: calc(58 * var(--k)); padding: calc(6 * var(--k)) calc(14 * var(--k)) calc(6 * var(--k)) calc(22 * var(--k)); }
.kf::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, #ffe36a, var(--yellow)); opacity: 0; clip-path: polygon(calc(16 * var(--k)) 0, 100% 0, calc(100% - calc(16 * var(--k))) 100%, 0 100%); }
.kf > * { position: relative; }
.kf:is(:focus-within, :has([data-nav-focus]), :has(.is-focus))::before { opacity: 1; }
.kf:is(:focus-within, :has([data-nav-focus]), :has(.is-focus)) { color: var(--ink); }
.kf-label { font: 700 calc(19 * var(--k)) / 1.2 'SB Text', sans-serif; display: block; }
.kf-hint { font: 500 calc(16 * var(--k)) / 1.3 'SB Text', sans-serif; opacity: .8; margin-top: calc(2 * var(--k)); }

/* choice, toggle, level and stepper: the chosen segments are blue, hot on focus */
.kc .kc-seg:not(.is-on) { opacity: 0; }
.kc-word { color: var(--mist); }
.kc-word.is-on, .kc:is(:focus, [data-nav-focus], .is-focus) .kc-word { color: var(--paper); }
.kc:disabled .kc-word, .kc:disabled .kc-word.is-on { color: var(--mist); }
.kl { touch-action: none; user-select: none; }
.kl .kc-body { pointer-events: none; }
.kl-seg:not(.is-on) .kl-lit { opacity: 0; }
.ks .ks-word:not(.is-on) { opacity: 0; }
.ks .ks-arrow { fill: var(--paper); }
.ks .ks-arrow.is-end { fill: var(--mist); opacity: .55; }
.ks:is(:focus, [data-nav-focus], .is-focus) .ks-arrow:not(.is-end) { fill: var(--yellow); }
.ks:disabled .ks-arrow { fill: var(--mist); opacity: .55; }

/* text input: a name in the reading face on an ink plate; the die-cut yellow while typing */
.ki { position: relative; display: block; }
.ki > svg { position: absolute; }
.ki:is(:focus-within, .is-focus) .pl-cut--focus { opacity: 1; }
.ki-input { position: absolute; left: calc(30 * var(--k)); top: 0; height: calc(52 * var(--k)); width: calc(100% - 100 * var(--k)); box-sizing: border-box; padding: 0; border: 0; outline: none; background: transparent; color: var(--paper); caret-color: var(--yellow); font: 700 calc(22 * var(--k)) 'SB Text', sans-serif; }
.ki-input::placeholder { color: var(--mist); opacity: 1; }
.ki.is-disabled .ki-input { color: var(--mist); }
.ki-count { opacity: 0; position: absolute; right: calc(38 * var(--k)); top: 0; font: 600 calc(16 * var(--k)) / calc(52 * var(--k)) 'SB Text', sans-serif; color: var(--mist); font-variant-numeric: tabular-nums; }
.ki:is(:focus-within, .is-focus) .ki-count.is-low { opacity: 1; }

/* prompt bar: glyph and word pairs on one ink plate drawn to its size */
.kpb { position: relative; display: inline-block; padding: calc(7 * var(--k)) calc(30 * var(--k)) calc(7 * var(--k)) calc(28 * var(--k)); }
.kpb-row { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: calc(26 * var(--k)); }
.kpb-item { display: inline-flex; align-items: center; gap: calc(9 * var(--k)); }
.kpb-item .kit-word { display: inline-block; }
.kpb .ic-glyph { font-size: calc(32 * var(--k)); color: var(--paper); }

/* fixed-size pieces laid out inside themselves */
.ksr, .knp, .ktag, .kst, .klr { position: relative; display: block; }
.ktag { display: inline-block; vertical-align: middle; }
.ksr > *, .knp > *, .ktag > *, .kst > *, .klr > * { position: absolute; }
.klr-state { right: calc(34 * var(--k)); top: 50%; transform: translateY(-50%); display: flex; gap: calc(8 * var(--k)); }
.klr-state > .ktag { position: relative; }
.klr--mirror .klr-state { right: auto; left: calc(34 * var(--k)); }
.kit-banner > *, .kit-badge > * { position: absolute; }
