/* Offerings «Матрица»: LED wall over a row of keys. System — design/red_mad_robot. */

:root {
  --gutter: 40px;
  --ink-2: #4d4d4d;               /* secondary text on white, 8.5:1 */
  --ink-2-dark: #c4c4c4;          /* secondary text on black, 11:1 */
  --e-out: cubic-bezier(0.16, 1, 0.3, 1);
  --e-in: cubic-bezier(0.5, 0, 0.75, 0);
  --bar-h: clamp(56px, 8svh, 72px);
  --keys-h: clamp(150px, 24svh, 230px);
  --foot-h: 40px;
  --wall-gap: 20px;               /* space between the LEDs and the keys; particles fall through it */
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--rm-white); }
body {
  font: 400 16px/1.5 var(--font-sans);
  color: var(--rm-black);
  background: var(--rm-white);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--rm-red); color: var(--rm-white); }
:focus-visible { outline: 2px solid var(--rm-black); outline-offset: 3px; }
h1, p, ul { margin: 0; padding: 0; font-weight: 400; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* One screen at the target sizes; a shorter screen or a zoomed page scrolls instead of cutting off keys. */
.page {
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column;
  padding-inline: var(--gutter);
}

/* Bar: logo only. The wordmark sits inside its 440×110 box with ~29 units of air on the left;
   the negative margin puts the visible "r" on the gutter, flush with the LEDs and the keys. */
.bar { flex: none; height: var(--bar-h); display: flex; align-items: center; }
.logo { display: block; margin-left: -10px; }
.logo img { display: block; width: 152px; height: auto; }

.main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* ── LED wall ── */
.wall { position: relative; flex: 1 1 auto; min-height: 200px; }
.wall__led { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* Without the script the thesis is still set in the pixel face; once the LEDs carry it, it stays for AT only. */
.thesis {
  position: absolute; left: 0; top: 0;
  font-family: var(--font-display);
  font-size: clamp(56px, 12svh, 184px);
  line-height: 0.88;
  color: var(--rm-red);
}
.thesis span { display: block; white-space: nowrap; }
.wall.is-lit .thesis {
  width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}

.band { display: none; }

/* ── Keys ── */
.keys { flex: none; height: var(--keys-h); }
.keys__list {
  list-style: none; height: 100%;
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--rm-black);
}
.keys__list li { min-width: 0; border-left: 1px solid var(--rm-grey-200); }
.keys__list li:first-child { border-left: 0; }

.key {
  appearance: none; border: 0; border-radius: 0; margin: 0;
  background: transparent; color: var(--rm-black);
  font: inherit; text-align: left; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  position: relative;
  width: 100%; height: 100%;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  padding: 22px 20px 18px;
  transition: color 120ms ease-out, background-color 150ms ease-out;
}
/* The press: black rises from the bottom edge. Exit is quicker than entry. */
.key::before {
  content: ""; position: absolute; inset: 0;
  background: var(--rm-black);
  transform: scaleY(0); transform-origin: 50% 100%;
  transition: transform 160ms var(--e-in);
}
.key > span { position: relative; }
.key__name {
  font-size: clamp(20px, 1.65vw, 26px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.key__buyer {
  font-size: 14px; line-height: 1.35;
  color: var(--ink-2);
  transition: color 120ms ease-out;
}
/* Badge sits on the black rule, between the wall and the key: the wave starts from it. */
.key > .key__badge {
  position: absolute; top: -16px; right: 20px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--rm-red);
  display: grid; place-items: center;
  transform: scale(0);
  transition: transform 140ms var(--e-in);
  pointer-events: none;
}
.key__badge img { width: 18px; height: 18px; display: block; filter: brightness(0) invert(1); }

.key[aria-pressed="true"]:not(.is-hot) { background-color: var(--rm-grey-100); }
.key.is-hot { color: var(--rm-white); }
.key.is-hot::before { transform: none; transition: transform 220ms var(--e-out); }
.key.is-hot .key__buyer { color: var(--ink-2-dark); }
.key.is-hot > .key__badge { transform: scale(1); transition: transform 260ms var(--e-out) 40ms; }
.key:focus-visible { outline-color: var(--rm-black); outline-offset: 3px; z-index: 1; }

/* ── Footer line ── */
.foot {
  flex: none; height: var(--foot-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  font-size: 14px; line-height: 1.3; color: var(--ink-2);
}
.foot__mid { grid-column: 2; }

/* Narrow desktop: the longest one-word names (Procurement, Engineering) still fit their key. */
@media (max-width: 1199px) {
  .key { padding: 20px 14px 16px; }
  .key__name { font-size: 18px; }
  .key > .key__badge { right: 14px; }
}

/* ── Phone and tablet: seven keys in a row do not fit, they become a list ── */
@media (max-width: 1023px) {
  :root { --gutter: 16px; --wall-gap: 12px; }
  .wall { min-height: 270px; }    /* the glyph, the ticker and the pains band fit; a shorter phone scrolls a little */
  .page { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .bar { height: 56px; }
  .logo { margin-left: -8px; }
  .logo img { width: 120px; }
  .foot { display: none; }

  .thesis { font-size: clamp(40px, 8svh, 72px); }

  /* Pains as text in a band at the bottom of the wall: LED text this small would not read. */
  .band {
    display: block;
    position: absolute; left: 0; right: 0; bottom: var(--wall-gap);
    height: 92px; padding-top: 12px;
    background: var(--rm-white);
    border-top: 1px solid var(--rm-grey-200);
    opacity: 0; visibility: hidden;
    transition: opacity 140ms ease-out, visibility 0s linear 140ms;
  }
  .wall.has-band .band {
    opacity: 1; visibility: visible;
    transition: opacity 220ms var(--e-out) 120ms, visibility 0s;
  }
  .band__pains { list-style: none; font-size: 16px; line-height: 1.35; }
  .band__pains li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .keys { height: auto; }
  .keys__list { display: block; height: auto; }
  .keys__list li { border-left: 0; border-top: 1px solid var(--rm-grey-200); }
  .keys__list li:first-child { border-top: 0; }
  .key {
    height: 52px; flex-direction: row; align-items: center; justify-content: flex-start;
    gap: 12px; padding: 0 8px 0 12px;
  }
  .key__name { font-size: 18px; line-height: 1.2; white-space: nowrap; flex: none; text-wrap: nowrap; }
  .key__buyer {
    flex: 1 1 auto; min-width: 0; font-size: 13px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .key > .key__badge { position: relative; top: auto; right: auto; flex: none; width: 28px; height: 28px; }
  .key__badge img { width: 16px; height: 16px; }
}

/* Reduced motion: no travel or scale; state still changes through colour and opacity. */
@media (prefers-reduced-motion: reduce) {
  .key::before { transform: none; opacity: 0; transition: opacity 150ms linear; }
  .key.is-hot::before { opacity: 1; transition: opacity 150ms linear; }
  .key > .key__badge { transform: none; opacity: 0; transition: opacity 150ms linear; }
  .key.is-hot > .key__badge { transform: none; opacity: 1; transition: opacity 150ms linear; }
}

/* ── Scene variants: a review switch in the bar, hidden once every direction has its pick ── */
.variants { margin-left: auto; margin-right: 16px; display: flex; border: 1px solid var(--rm-grey-200); }
.variants:empty { display: none; }
.variants__item {
  appearance: none; border: 0; border-radius: 0; margin: 0; cursor: pointer;
  background: var(--rm-white); color: var(--ink-2);
  font: inherit; font-size: 14px; line-height: 1; height: 38px; padding: 0 12px;
  border-left: 1px solid var(--rm-grey-200);
  transition: background-color 140ms ease-out, color 140ms ease-out;
}
.variants__fn { align-self: center; padding: 0 12px; font-size: 14px; color: var(--rm-black); white-space: nowrap; }
.variants__item:first-child { border-left: 0; }
.variants__item:hover { background: var(--rm-grey-100); color: var(--rm-black); }
.variants__item[aria-pressed="true"] { background: var(--rm-black); color: var(--rm-white); }
@media (max-width: 1023px) {
  .variants { margin-right: 8px; overflow-x: auto; scrollbar-width: none; }
  .variants__item { height: 34px; padding: 0 9px; font-size: 13px; white-space: nowrap; }
}
