/* ============================================================
   SkinSignal / the landing's market intelligence section
   index.html #marketIntel ("Real data. Smarter moves."): the copy on the
   left, a real market terminal on the right, in the same rhythm as the
   calling cards, rank and flex sections. js/market-intel.js draws the
   rows, the sparklines and the pictures from its sample data.

   A PRECISION INSTRUMENT. Near black ground with a restrained blue and
   gold light; one raised frame with a lit gold to
   blue top edge; hairline panels inside it; JetBrains Mono for every
   figure. GREEN AND RED ARE SEMANTIC AND LIVE ONLY HERE: gains and
   losses (#4bd68a, #ef5a61), every change carrying its sign. Nothing
   else on the page, and nothing decorative here, uses them.
   ============================================================ */

.mi {
  --mi-bg: #05080d;
  --mi-up: #4bd68a;
  --mi-down: #ef5a61;
  --mi-gold: #e4ae39;
  --mi-blue: #6a9fff;
  --mi-cream: #d9c8a0;
  --mi-ink: #f1f3f6;
  --mi-ink-2: #b9bfca;
  --mi-ink-3: #8a919e;
  --mi-line: rgba(255, 255, 255, 0.06);
  --pad: clamp(20px, 3.8vw, 76px);

  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(72px, 6.4vw, 124px) 0 clamp(64px, 5.6vw, 108px);
  background:
    radial-gradient(34% 46% at 70% 40%, rgba(61, 127, 255, var(--amb-blue, 0.08)), rgba(61, 127, 255, 0) 72%),
    radial-gradient(28% 36% at 62% 12%, rgba(228, 174, 57, var(--amb-gold, 0.07)), rgba(228, 174, 57, 0) 72%),
    var(--mi-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.mi__inner {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  align-items: center;
  gap: clamp(32px, 3.6vw, 72px);
  padding: 0 var(--pad);
}

/* ============================================================
   THE COPY
   ============================================================ */
.mi__eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 clamp(14px, 1.2vw, 20px);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: clamp(12px, 0.78vw, 14px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #c9d2e3;
}
.mi__rule { display: block; width: 36px; height: 2px; background: var(--mi-gold); }

.mi__title {
  margin: 0;
  font-family: var(--font-display);
  font-stretch: 100%;
  font-weight: 800;
  font-size: clamp(40px, 3.6vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--mi-ink);
}
.mi__line { display: block; white-space: nowrap; }
.mi__line--gold {
  color: var(--mi-gold);
  background: linear-gradient(180deg, #f6d27a 0%, #e8b544 52%, #c98a1c 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}

.mi__body {
  margin: clamp(16px, 1.4vw, 24px) 0 clamp(22px, 1.8vw, 30px);
  max-width: 540px;
  font-family: var(--font-body);
  font-size: clamp(15px, 1vw, 19px);
  line-height: 1.55;
  color: var(--mi-ink-2);
}

.mi__list {
  display: grid;
  margin: 0 0 clamp(26px, 2.2vw, 38px);
  padding: 0;
  list-style: none;
}
.mi-ben {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: clamp(12px, 0.9vw, 16px) 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.mi-ben:first-child { border-top: 0; padding-top: 0; }
.mi-ben__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: clamp(48px, 3.3vw, 60px);
  height: clamp(48px, 3.3vw, 60px);
  border: 1px solid rgba(228, 174, 57, 0.35);
  border-radius: 10px;
  background: rgba(228, 174, 57, 0.04);
}
.mi-ben__icon svg { width: 52%; height: 52%; fill: none; stroke: var(--mi-gold); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mi-ben__text {
  font-family: var(--font-body);
  font-size: clamp(13.5px, 0.86vw, 16px);
  line-height: 1.45;
  color: var(--mi-ink-2);
}
.mi-ben__text b {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: clamp(12.5px, 0.8vw, 14.5px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mi-ink);
}
.mi-ben__n { color: var(--mi-gold); letter-spacing: 0.04em; }

/* Outranks .cta--lg in css/buttons.css, which loads last. */
.mi .mi__cta {
  height: clamp(52px, 3.3vw, 62px);
  padding: 0 clamp(24px, 1.8vw, 32px);
  font-size: clamp(15px, 1vw, 18px);
}
.mi__trust {
  margin: 16px 0 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mi-ink-3);
}
.mi__trust b { font-weight: 500; color: var(--mi-ink-2); }

/* ============================================================
   THE TERMINAL
   ============================================================ */
.mi__art { position: relative; isolation: isolate; min-width: 0; }

/* Faint real item renders behind it, in thin tilted frames. */
.mi__atmo { position: absolute; inset: -12% -6% -10% -4%; z-index: -1; pointer-events: none; }
.mi__ghost {
  position: absolute;
  width: 34%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(228, 174, 57, 0.28);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(20, 26, 40, 0.8), rgba(8, 12, 20, 0.8));
  opacity: 0.4;
  overflow: hidden;
}
.mi__ghost--2 { border-color: rgba(76, 141, 255, 0.35); }
.mi__ghost-img { display: block; width: 100%; height: 100%; object-fit: contain; filter: saturate(0.8) brightness(0.75); }
.mi__ghost--1 { left: 14%; top: 0; rotate: -7deg; }
.mi__ghost--2 { left: 48%; top: -4%; rotate: -4deg; }
.mi__ghost--3 { right: 0; bottom: 0; rotate: 8deg; width: 28%; }

.mi__frame {
  position: relative;
  padding: clamp(14px, 1.1vw, 22px);
  border: 1px solid rgba(228, 174, 57, 0.32);
  border-radius: 18px;
  background:
    radial-gradient(55% 40% at 0% 0%, rgba(61, 127, 255, 0.1), rgba(61, 127, 255, 0) 70%),
    linear-gradient(180deg, #0c1320 0%, #070b13 100%);
  box-shadow:
    0 56px 110px -44px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 0 60px -28px rgba(228, 174, 57, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  font-family: var(--font-body);
}
/* The lit top edge: gold into blue. */
.mi__frame::after {
  content: "";
  position: absolute;
  top: -1px;
  left: 6%;
  right: 12%;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(246, 210, 122, 0), rgba(246, 210, 122, 0.7) 26%, rgba(106, 159, 255, 0.6) 70%, rgba(106, 159, 255, 0));
}

.mi__terminal { position: relative; }

/* ---------- The bar: wordmark, nav, sample tag, search ---------- */
.mi__bar {
  display: flex;
  align-items: center;
  gap: clamp(14px, 1.4vw, 26px);
  padding: 2px 4px clamp(12px, 1vw, 18px);
}
.mi__logo {
  display: block;
  width: auto;
  height: clamp(24px, 2.2vw, 44px);
  margin: -4px 0;
  flex: none;
}
.mi__nav { display: flex; gap: clamp(14px, 1.4vw, 26px); }
.mi__nav-item {
  position: relative;
  font-size: clamp(12px, 0.78vw, 14.5px);
  color: var(--mi-ink-3);
  white-space: nowrap;
}
.mi__nav-item.is-on { color: var(--mi-ink); }
.mi__nav-item.is-on::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 1px;
  background: rgba(106, 159, 255, 0.8);
}
.mi__tag {
  flex: none;
  padding: 4px 10px;
  border: 1px solid rgba(228, 174, 57, 0.55);
  border-radius: 6px;
  font-family: var(--font-display);
  font-stretch: 100%;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #f5d78a;
  background: rgba(228, 174, 57, 0.06);
}
.mi__search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  width: clamp(160px, 14vw, 280px);
  height: clamp(32px, 2.1vw, 40px);
  padding: 0 12px;
  border: 1px solid rgba(96, 140, 220, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  font-size: clamp(12px, 0.72vw, 13.5px);
  color: var(--mi-ink-3);
  white-space: nowrap;
  overflow: hidden;
}
.mi__search svg { width: 14px; height: 14px; flex: none; }
.mi__search span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ---------- The movers ---------- */
.mi__movers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 0.8vw, 14px);
}

.mi__panel,
.mi-idx {
  border: 1px solid rgba(96, 140, 220, 0.16);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(20, 32, 54, 0.45) 0%, rgba(12, 19, 32, 0.35) 100%);
}
.mi__panel { padding: clamp(12px, 0.9vw, 16px) clamp(12px, 1vw, 18px) 6px; }

.mi__panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 6px;
}
.mi__panel-title {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: clamp(12px, 0.78vw, 14.5px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mi-ink);
}
.mi__window {
  padding: 2px 8px;
  border: 1px solid var(--mi-line);
  border-radius: 5px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--mi-ink-3);
}

.mi__rows { margin: 0; padding: 0; list-style: none; }

.mi-row {
  display: grid;
  grid-template-columns: 3px 56px minmax(0, 1fr) clamp(64px, 5.4vw, 104px) 62px;
  align-items: center;
  gap: clamp(8px, 0.7vw, 14px);
  height: clamp(36px, 2.5vw, 48px);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.mi-row:first-child { border-top: 0; }

/* The marker tick: gold for a star item (knives, gloves), a blue whisper
   for the rest. Not CS2's rarity colours: those include red, which here
   means a loss. */
.mi-row__tick { width: 3px; height: 60%; border-radius: 2px; background: rgba(106, 159, 255, 0.55); }
.mi-row__tick--star { background: var(--mi-gold); }

/* The item's picture: Valve's own render of that skin, from Steam's CDN
   (js/market-intel.js itemSrc). Under it, the weapon type's silhouette,
   which shows only if the picture cannot load (the slot then drops
   has-img and gets its quiet tile back). */
.mi-row__thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 36px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.025);
}
.mi-row__thumb svg { width: 38px; height: 17px; fill: rgba(217, 200, 160, 0.55); }
.mi-row__thumb.has-img { background: none; }
.mi-row__thumb.has-img svg { display: none; }
.mi-row__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* Steam's renders are square with room around the gun: cover frames
     the gun itself. It is an item render, not a calling card. */
  object-fit: cover;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
}

.mi-row__name {
  overflow: hidden;
  font-size: clamp(12px, 0.8vw, 15px);
  color: #d9dde4;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mi-row__spark { width: 100%; height: clamp(22px, 1.45vw, 28px); }

.mi-row__chg,
.mi-idx__chg {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: clamp(11.5px, 0.76vw, 14.5px);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.mi-chg--up { color: var(--mi-up); }
.mi-chg--down { color: var(--mi-down); }

/* ---------- The sparkline ---------- */
.mi-spark { display: block; overflow: visible; }
.mi-spark__line {
  fill: none;
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.mi-spark--up .mi-spark__line { stroke: var(--mi-up); filter: drop-shadow(0 1px 2px rgba(75, 214, 138, 0.28)); }
.mi-spark--down .mi-spark__line { stroke: var(--mi-down); filter: drop-shadow(0 1px 2px rgba(239, 90, 97, 0.28)); }
.mi-spark__area { stroke: none; opacity: 0.14; }
.mi-spark--up .mi-spark__area { fill: var(--mi-up); }
.mi-spark--down .mi-spark__area { fill: var(--mi-down); }

/* ---------- The category indexes ---------- */
.mi__indexes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 0.8vw, 14px);
  margin-top: clamp(10px, 0.8vw, 14px);
}
.mi-idx { padding: clamp(12px, 0.9vw, 18px); }
.mi-idx__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  row-gap: 10px;
}
/* The category's picture: a real piece from it, on Steam's CDN. Its
   line icon sits under it and shows only if the picture cannot load. */
.mi-idx__art {
  grid-column: 1 / -1;
  position: relative;
  display: flex;
  align-items: center;
  width: clamp(56px, 4.2vw, 84px);
  height: clamp(40px, 3vw, 58px);
}
.mi-idx__art.has-img .mi-idx__icon { display: none; }
.mi-idx__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.55));
}
.mi-idx__icon {
  width: clamp(18px, 1.15vw, 22px);
  height: clamp(18px, 1.15vw, 22px);
  fill: none;
  stroke: var(--mi-cream);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 0.85;
}
.mi-idx__name { font-size: clamp(12.5px, 0.82vw, 15.5px); color: #d9dde4; }
.mi-idx__chg { font-size: clamp(11.5px, 0.74vw, 14px); }
.mi-idx__foot {
  display: flex;
  align-items: flex-end;
  gap: clamp(8px, 0.7vw, 14px);
  margin-top: 6px;
}
.mi-idx__level {
  flex: none;
  margin: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: clamp(18px, 1.3vw, 24px);
  letter-spacing: -0.01em;
  color: var(--mi-ink);
  font-variant-numeric: tabular-nums;
}
.mi-idx__spark { flex: 1 1 auto; min-width: 0; height: clamp(26px, 2vw, 38px); }

/* The sample line, inside the frame, read out. */
.mi__note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: clamp(12px, 1vw, 18px) 4px 0;
  font-family: var(--font-body);
  font-size: clamp(12px, 0.74vw, 14px);
  color: var(--mi-ink-3);
}
.mi__note svg { width: 16px; height: 16px; flex: none; color: var(--mi-ink-3); }

.mi__caption {
  margin: 14px 0 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
  color: var(--mi-ink-3);
}

/* ============================================================
   MOTION, only when asked for (js/market-intel.js arms it)
   The copy and the terminal rise into place once, the rows follow a
   step apart and each line draws once. Nothing loops.
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .mi.is-armed .mi__copy,
  .mi.is-armed .mi__art {
    opacity: 0;
    translate: 0 var(--reveal-rise, 12px);
  }
  .mi.is-armed .mi-row,
  .mi.is-armed .mi-idx { opacity: 0; }
  /* Each line draws once, left to right, as a wipe. Not a dash offset:
     the index cards stretch their sparkline (non-scaling stroke), and a
     dash measured in path length then stops short of the end. */
  .mi.is-armed .mi-spark { clip-path: inset(-6px 100% -6px -6px); }

  .mi.is-in .mi__copy,
  .mi.is-in .mi__art {
    opacity: 1;
    translate: 0 0;
    transition: opacity var(--reveal-fade, 550ms) ease, translate var(--reveal-dur, 650ms) var(--ease);
  }
  .mi.is-in .mi__art { transition-delay: 90ms; }
  .mi.is-in .mi-row,
  .mi.is-in .mi-idx {
    opacity: 1;
    transition: opacity var(--reveal-fade-sm, 420ms) ease;
    transition-delay: calc(260ms + var(--r, 0) * 55ms);
  }
  .mi.is-in .mi-idx { transition-delay: calc(520ms + var(--r, 0) * 70ms); }
  .mi.is-in .mi-spark {
    clip-path: inset(-6px -6px -6px -6px);
    transition: clip-path 900ms cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: calc(360ms + var(--r, 0) * 55ms);
  }
  .mi.is-in .mi-idx .mi-spark { transition-delay: calc(620ms + var(--r, 0) * 70ms); }
}

/* ============================================================
   NARROWER SCREENS
   ============================================================ */
/* STACKED below 1250: the copy first, the terminal under it, full width. */
@media (max-width: 1249px) {
  .mi__inner { grid-template-columns: minmax(0, 1fr); gap: 44px; }
  .mi__copy { max-width: 660px; }
}

@media (max-width: 819px) {
  .mi__nav,
  .mi__search { display: none; }
  .mi__tag { margin-left: auto; }
  .mi__movers { grid-template-columns: minmax(0, 1fr); }
  .mi__indexes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mi__line { white-space: normal; }
  .mi__ghost { width: 50%; }
}

/* PHONES: no mover sparklines, and the name gets the room they leave,
   taking a second line rather than being cut. Scoped under .mi so it
   outranks the narrow panel rule below. */
@media (max-width: 539px) {
  .mi .mi-row { grid-template-columns: 3px 40px minmax(0, 1fr) 56px; gap: 10px; height: auto; min-height: 44px; padding: 5px 0; }
  .mi .mi-row__thumb { width: 40px; height: 28px; }
  .mi-row__spark { display: none; }
  .mi-row__name { white-space: normal; line-height: 1.25; }
  .mi-ben__icon { width: 42px; height: 42px; }
  .mi .mi__cta { width: 100%; }
}

/* A movers panel that is still narrow (a stacked terminal at the edge of
   a breakpoint) tightens before a name is cut. */
.mi__panel { container: mi-panel / inline-size; }
@container mi-panel (max-width: 400px) {
  .mi-row { grid-template-columns: 3px 36px minmax(0, 1fr) 56px 50px; gap: 8px; }
  .mi-row__thumb { width: 36px; height: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .mi__copy, .mi__art, .mi-row, .mi-idx, .mi-spark { transition: none; }
}
