/* Killstreak pictures on the desktop lobby (js/lobby/ui/loadout.js glyphClassName).

   The same atlas the match HUD and the phone lobby draw: the studio meshes in the weapon HUD's toy look,
   /models/HUD_new/killstreaks/streak-pictures.webp, 7 x 2 cells of 160 px, colour row on top, muted row below,
   ink outline + drop shadow baked in. Column order is the live contract (js/hud/streak-pictures.js
   STREAK_PICTURE_ORDER); css/hud.css and css/lobby/mobile/primitives.css hold the same percentages.

   Design rules carried over from the phone Streaks station:
   - A picture never takes a CSS filter (no glow, no grayscale): its outline and shadow are baked, and a
     filter would re-raster it every hover. Locked = the muted row, a cold key light, a lock seal.
   - The model stands on a lit stage, not in a box: one soft key light in the class accent behind it, the
     hex mesh only inside that pool, a contact shadow under it, and the stage melting into the card below so
     the name and the spec sheet sit on the same surface as the model.
   - In a socket the model stands out of the hex unclipped, like the match gem; in a 46 px chip (clipped by
     construction) the cell's own transparent margin keeps it inside the hexagon.

   Cost: one 60 KB decode shared by every surface (and the match, same URL). Type / state changes are a
   className write; every stage layer is a static gradient. The only per-hover motion is transform/opacity. */

/* ── atlas primitive ─────────────────────────────────────────────────────── */
/* Layer 1 is the atlas cell (--ksp-x per type, --ksp-y per row). Layer 2 is the contact shadow the model
   stands on (--ksp-pad, `none` by default): it lives in the picture's own background, under the cell, so
   it costs no element, no pseudo and no stacking context, and it scales with the box like the cell does. */
.ksp {
  --ksp-x: 0%;
  --ksp-y: 0%;
  --ksp-pad: none;
  display: block;
  background-image: url("/models/HUD_new/killstreaks/streak-pictures.webp"), var(--ksp-pad);
  background-repeat: no-repeat;
  background-size: 700% 200%, 62% 14%;
  background-position: var(--ksp-x) var(--ksp-y), 50% 90%;
  pointer-events: none;
}
.ksp--rcCarBomb { --ksp-x: 0%; }
.ksp--predatorMissile { --ksp-x: 16.6667%; }
.ksp--chopperGunner { --ksp-x: 33.3333%; }
.ksp--trophySystem { --ksp-x: 50%; }
.ksp--carePackage { --ksp-x: 66.6667%; }
.ksp--healingDrone { --ksp-x: 83.3333%; }
.ksp.is-muted { --ksp-y: 100%; }

/* contact shadow under a standing model (sockets, tiles, intel); chips are too small to need one */
.ks-card__glyph.ksp,
.ks-intel__glyph.ksp,
.ks-hex__icon.ksp {
  --ksp-pad: radial-gradient(closest-side, rgba(0, 0, 0, 0.66), rgba(0, 0, 0, 0.3) 62%, transparent);
}

/* ── sockets: aperture rail + lobby quick rail ───────────────────────────── */
/* The picture is the hex's subject, standing out of it (110 % of the hex width, square). The hex
   construction already opts the icon out of the hex clip. text-shadow / colour no longer apply. */
.ks-hex__icon.ksp,
.lobby-right .loadout__rail .ks-hex__icon.ksp {
  width: calc(var(--hexw, 52px) * 1.1);
  height: calc(var(--hexw, 52px) * 1.1);
  font-size: 0;
  text-shadow: none;
}
.killstreaks-aperture .ks-hex__icon.ksp { text-shadow: none; }
.killstreaks-aperture button.ks-slot:hover .ks-hex__icon.ksp,
button.ks-slot:hover .ks-hex__icon.ksp { text-shadow: none; }
/* the hover reads on the rim already; the model just lifts a touch (compositor-only) */
.ks-hex__icon.ksp { transition: transform 220ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)); }
button.ks-slot:hover .ks-hex__icon.ksp { transform: translate(-50%, -53%) scale(1.04); }

/* a filled socket face: the key light pools lower so it reads as the floor the model stands on */
.ks-slot.is-filled .ks-hex__face,
.killstreaks-aperture .ks-slot.is-filled .ks-hex__face {
  background:
    radial-gradient(64% 46% at 50% 70%, rgba(var(--amber-rgb), 0.3), transparent 76%),
    radial-gradient(80% 80% at 50% 30%, rgba(var(--amber-rgb), 0.12), transparent 70%),
    linear-gradient(180deg, #131820, #080c11);
}

/* ── quick-equip chips (bottom-right picker) ─────────────────────────────── */
/* The chip clips to its hexagon by construction; the square cell overfills it slightly and its own
   transparent margin keeps the model inside. Hover keeps the existing scale; the glow filter goes. */
.lo-chip__glyph.ksp {
  width: 108%;
  height: auto;
  aspect-ratio: 1;
  font-size: 0;
}
.lo-chip.is-equipped .lo-chip__glyph.ksp,
.lo-chip:hover .lo-chip__glyph.ksp,
.lo-chip:focus-visible .lo-chip__glyph.ksp {
  filter: none;
}
/* the chip's face takes the stage light instead: accent pool low behind the model */
.lo-chip:not(.is-locked)::before {
  background:
    radial-gradient(70% 58% at 50% 66%, rgba(var(--accent-rgb), 0.16), transparent 78%),
    linear-gradient(180deg, #101720, #080c11);
}
.lo-chip.is-equipped::before {
  background:
    radial-gradient(70% 58% at 50% 66%, rgba(var(--accent-rgb), 0.36), transparent 78%),
    linear-gradient(180deg, #131a22, #080c11);
}
/* locked: the muted row is the dimming; the hatch stays as the gate texture */
.lo-chip.is-locked .lo-chip__glyph.ksp { opacity: 0.8; }

/* ── arsenal tiles (full Killstreaks view) ───────────────────────────────── */
/* The tile is an inline-size container so the model can be as big as the art bed allows on any baked
   --ks-card-h (96..180 px) without out-growing a narrow column. */
html .killstreaks-aperture .ks-card {
  container-type: inline-size;
}
html .killstreaks-aperture .ks-card__glyph.ksp {
  --ksp-s: min(calc((var(--ks-card-h, 96px) - var(--ks-card-body-h, 44px)) * 1.04), 76cqw);
  left: 50%;
  width: var(--ksp-s);
  height: var(--ksp-s);
  margin-left: calc(var(--ksp-s) / -2);
  font-size: 0;
  filter: none;
}
html .killstreaks-aperture .ks-card:hover .ks-card__glyph.ksp,
html .killstreaks-aperture .ks-card:focus-visible .ks-card__glyph.ksp {
  filter: none;
  transform: translateY(-52%) scale(1.06);
}
/* floor pad picks up the class accent; brighter when the tile is the live one */
html .killstreaks-aperture .ks-card__glyph.ksp {
  --ksp-pad: radial-gradient(closest-side, rgba(0, 0, 0, 0.6), rgba(var(--accent-rgb), 0.12) 66%, transparent);
}
html .killstreaks-aperture .ks-card.is-equipped .ks-card__glyph.ksp,
html .killstreaks-aperture .ks-card:hover .ks-card__glyph.ksp,
html .killstreaks-aperture .ks-card:focus-visible .ks-card__glyph.ksp {
  --ksp-pad: radial-gradient(closest-side, rgba(0, 0, 0, 0.62), rgba(var(--accent-rgb), 0.32) 64%, transparent);
}
/* locked tiles: no grayscale filter over the face (the muted row is already the locked picture); the
   bed and the copy go cold by colour alone */
html .killstreaks-aperture .ks-card.is-locked .ks-card__face { filter: none; }
html .killstreaks-aperture .ks-card.is-locked .ks-card__art { --bloom: 0.04; }
html .killstreaks-aperture .ks-card.is-locked .ks-card__name { color: #8d97a1; }
html .killstreaks-aperture .ks-card.is-locked .ks-card__cost { color: #6f7a85; }
html .killstreaks-aperture .ks-card.is-locked .ks-card__glyph.ksp { --ksp-pad: radial-gradient(closest-side, rgba(0, 0, 0, 0.5), transparent); }
html .killstreaks-aperture .ks-card.is-locked:hover .ks-card__glyph.ksp { transform: translateY(-50%); }

/* ── intel spec plate: the model on a lit stage that melts into the copy ──── */
.killstreaks-aperture .ks-intel[data-category="defensive"] {
  --accent: var(--def, #4ecb70);
  --accent-rgb: var(--def-rgb, 78, 203, 112);
}
/* solid class bar on top; a locked plate does not wear its class colour on the rim */
.killstreaks-aperture .ks-intel::before { background: var(--accent); }
.killstreaks-aperture .ks-intel[data-locked="true"]::before { background: #3a4048; }

/* Stage = the well. One accent key light behind the model over a slightly lifted floor; the bottom third
   fades into the plate's own colour so the class line and the name start on the same surface. */
html .killstreaks-aperture .ks-intel__well {
  isolation: isolate;
  background:
    radial-gradient(60% 62% at 50% 50%, rgba(var(--accent-rgb), 0.24), rgba(var(--accent-rgb), 0.06) 58%, transparent 80%),
    linear-gradient(180deg, #0c1015, #090d12 70%, #070b0f);
  transition: background 220ms;
}
html .killstreaks-aperture .ks-intel__well::after {
  position: absolute;
  z-index: 0;
  right: 0;
  bottom: 0;
  left: 0;
  height: 30%;
  background: linear-gradient(180deg, rgba(7, 11, 15, 0), #070b0f);
  content: "";
  pointer-events: none;
}
/* The square art bed becomes the hex mesh, only inside the key light's pool (masked out toward the
   edges). It stays the inscribed square frame.css sizes, so nothing in the layout contract moves. */
html .killstreaks-aperture .ks-intel__art {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 17.32'%3E%3Cg fill='none' stroke='%23c4d4e3' stroke-opacity='.16' stroke-width='.4' stroke-linejoin='round'%3E%3Cpath d='M10 0L5 8.66L-5 8.66L-10 0L-5 -8.66L5 -8.66Z'/%3E%3Cpath d='M10 17.32L5 25.98L-5 25.98L-10 17.32L-5 8.66L5 8.66Z'/%3E%3Cpath d='M40 0L35 8.66L25 8.66L20 0L25 -8.66L35 -8.66Z'/%3E%3Cpath d='M40 17.32L35 25.98L25 25.98L20 17.32L25 8.66L35 8.66Z'/%3E%3Cpath d='M25 8.66L20 17.32L10 17.32L5 8.66L10 0L20 0Z'/%3E%3C/g%3E%3C/svg%3E") center / 46px 26.5px;
  -webkit-mask-image: radial-gradient(closest-side, #000 30%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 30%, transparent 100%);
}
/* the model: inscribed in the stage (the well is a size container), above the fade */
html .killstreaks-aperture .ks-intel__glyph.ksp {
  position: relative;
  z-index: 1;
  width: min(94cqw, 94cqh, 220px);
  height: min(94cqw, 94cqh, 220px);
  font-size: 0;
  filter: none;
}
html .killstreaks-aperture .ks-intel__glyph.ksp {
  --ksp-pad: radial-gradient(closest-side, rgba(0, 0, 0, 0.66), rgba(var(--accent-rgb), 0.22) 64%, transparent);
}

/* locked: the key light goes cold, the muted model dims, a lock seal sits on it */
html .killstreaks-aperture .ks-intel[data-locked="true"] .ks-intel__well {
  background:
    radial-gradient(60% 62% at 50% 50%, rgba(150, 162, 176, 0.12), transparent 80%),
    linear-gradient(180deg, #0c1015, #090d12 70%, #070b0f);
}
html .killstreaks-aperture .ks-intel[data-locked="true"] .ks-intel__glyph.ksp { opacity: 0.6; }
html .killstreaks-aperture .ks-intel[data-locked="true"] .ks-intel__glyph.ksp {
  --ksp-pad: radial-gradient(closest-side, rgba(0, 0, 0, 0.6), transparent);
}
.killstreaks-aperture .ks-intel__seal {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(8, 10, 13, 0.86);
  box-shadow: inset 0 0 0 1.5px rgba(227, 165, 156, 0.55), 0 4px 0 rgba(0, 0, 0, 0.5);
  color: #e3a59c;
  font-size: 14px;
  transform: translate(-50%, -50%);
}
.killstreaks-aperture .ks-intel[data-locked="true"] .ks-intel__seal { display: grid; }

/* Key tab: flush in the plate's top-left corner under the class bar, chamfered like the tiles, so it is
   part of the plate rather than a sticker on it. Shown only when the streak sits in a socket. */
.killstreaks-aperture .ks-intel__slot {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 12px 0 10px;
  background: var(--amber);
  clip-path: polygon(-1px -1px, calc(100% + 1px) -1px, calc(100% + 1px) calc(100% - 8px), calc(100% - 8px) calc(100% + 1px), -1px calc(100% + 1px));
  color: #14100a;
}
.killstreaks-aperture .ks-intel__slot[hidden] { display: none; }
.killstreaks-aperture .ks-intel__slot small {
  font: 800 9px/1 "Saira Condensed", Rajdhani, sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.72;
}
.killstreaks-aperture .ks-intel__slot b {
  font: 800 16px/1 "Saira Condensed", Rajdhani, sans-serif;
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .ks-hex__icon.ksp,
  html .killstreaks-aperture .ks-card__glyph.ksp { transition: none; }
  button.ks-slot:hover .ks-hex__icon.ksp { transform: translate(-50%, -50%); }
}
