/* recommendation.css: the "Recommendation systems" section (#recommendation): the three steps,
   the headline numbers, the main chart, the explorer (#rec-explorer, assets/js/recommendation.js)
   and the simulation details. Namespace .rx-*. Light panels in the page's Nerfies look; the
   genre colors are those of recommendation_demo/make_figures.py. No dark-mode rules (the page
   has none). */

#recommendation {
  --rx-head: var(--ink, #363636);
  --rx-text: var(--ink-soft, #4a4a4a);
  --rx-faint: var(--ink-faint, #6b6b6b);
  --rx-line: var(--line, #dbdbdb);
  --rx-line-soft: var(--line-soft, #ededed);
  --rx-panel: #fafafa;
  --rx-card: #ffffff;
  --rx-focus: var(--link, #0e78be);
  --rx-coop: var(--c-coop, #0072b2);
  --rx-local: var(--c-local, #d55e00);
  --rx-frozen: var(--c-frozen, #882255);
  --rx-pers: var(--c-pers, #6e6e6e);
  --rx-ideal: var(--c-xstar, #e0a100);
  --rx-bad: #c62828;
  --rx-good: #2e7d32;
  --rx-outdoor: #228833;
  --rx-home: #cc6677;
  --rx-tech: #5e4fa2;
  --rx-essentials: #c9b458;
  --rx-radius: 10px;
}

/* ---- the three steps */
.rx-steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  margin: 1.25rem 0 2rem;
  padding: 0;
  list-style: none;
}
@media (min-width: 720px) {
  .rx-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.rx-step {
  position: relative;
  margin: 0;
  padding: 0.9rem 1rem 1rem 3.1rem;
  border: 1px solid var(--rx-line);
  border-radius: var(--rx-radius);
  background: var(--rx-panel);
}
.rx-step-n {
  position: absolute;
  left: 0.9rem;
  top: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--rx-head);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
}
.rx-step h3 { margin: 0 0 0.3rem; color: var(--rx-head); font-size: 1rem; font-weight: 600; }
.rx-step p { margin: 0; color: var(--rx-text); font-size: 0.92rem; line-height: 1.45; }

/* ---- headline numbers */
.rx-tiles {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  margin: 1rem 0 1.25rem;
}
@media (min-width: 640px) {
  .rx-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rx-tiles.is-two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 640px; margin-inline: auto; }
}
.rx-tile {
  display: grid;
  gap: 0.2rem;
  align-content: start;
  padding: 0.85rem 1rem 0.9rem;
  border: 1px solid var(--rx-line);
  border-top: 4px solid var(--rx-tile-c, var(--rx-head));
  border-radius: var(--rx-radius);
  background: var(--rx-card);
}
.rx-tile.is-coop { --rx-tile-c: var(--rx-coop); }
.rx-tile.is-local { --rx-tile-c: var(--rx-local); }
.rx-tile-n { color: var(--rx-head); font-size: 2rem; font-weight: 600; line-height: 1.1; }
.rx-tile-t { color: var(--rx-text); font-size: 0.92rem; line-height: 1.4; }
.rx-tile-t b { color: var(--rx-head); font-weight: 600; }

/* ---- the main chart: one, wide enough to read */
.rx-chart-main { max-width: 720px; margin: 0 auto 2.25rem; }
.rx-chart-main figcaption { margin-top: 0.5rem; }

/* ---- the explorer */
.rx {
  display: grid;
  gap: 1rem;
  min-width: 0;
  color: var(--rx-text);
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
  font-size: 1rem;
  line-height: 1.45;
  text-align: left;
}
.rx *, .rx *::before, .rx *::after { box-sizing: border-box; }
.rx-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.rx-error { margin: 0; padding: 1rem; border: 1px dashed var(--rx-line); border-radius: var(--rx-radius); font-size: 0.9rem; }

.rx-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem 1.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--rx-line);
  border-radius: var(--rx-radius);
  background: var(--rx-panel);
}
.rx-field { display: grid; gap: 0.35rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.rx-label { color: var(--rx-head); font-size: 0.8125rem; font-weight: 600; padding: 0; }
.rx-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.rx-chip, .rx-more {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  min-height: 2.25rem;
  margin: 0;
  padding: 0 0.85em;
  border: 1px solid var(--rx-line);
  border-radius: 999px;
  background: var(--rx-card);
  color: var(--rx-head);
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.rx-chip:hover, .rx-more:hover { border-color: #b5b5b5; }
.rx-chip[aria-pressed="true"] { border-color: var(--rx-head); background: var(--rx-head); color: #ffffff; }
.rx-chip:focus-visible, .rx-more:focus-visible, .rx-node:focus-visible { outline: 2px solid var(--rx-focus); outline-offset: 2px; }
.rx-hint { margin: 0; color: var(--rx-faint); font-size: 0.8125rem; font-weight: 400; }
.rx-days { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; }
.rx-day-group { display: grid; gap: 0.2rem; }
.rx-day-title { color: var(--rx-faint); font-size: 0.72rem; }

/* the controls and, beside them on wide screens, the map, which picks a region too */
.rx-pick {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}
@media (min-width: 900px) {
  .rx-pick { grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); }
  /* region, shopper and day one under the other, about as tall as the map beside them */
  .rx-pick .rx-controls { flex-direction: column; flex-wrap: nowrap; gap: 1rem; }
}
.rx-map, .rx-feeds-panel, .rx-strip-panel {
  margin: 0;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--rx-line);
  border-radius: var(--rx-radius);
  background: var(--rx-card);
  min-width: 0;
}
.rx-panel-title { margin: 0 0 0.4rem; color: var(--rx-head); font-size: 0.95rem; font-weight: 600; }
.rx-map svg { display: block; width: 100%; height: auto; }
.rx-link { stroke: var(--line-strong, #b5b5b5); stroke-width: 1.5; fill: none; }
.rx-node { cursor: pointer; }
.rx-node circle { fill: var(--rx-card); stroke: var(--rx-head); stroke-width: 1.4; transition: fill 0.15s; }
.rx-node:hover circle { fill: #f2f2f2; }
.rx-node[aria-pressed="true"] circle { fill: var(--rx-head); }
.rx-node text { fill: var(--rx-head); font-size: 10.5px; font-weight: 700; }
.rx-node[aria-pressed="true"] text { fill: #ffffff; }
.rx-node text.rx-city { fill: var(--rx-faint); font-size: 10px; font-weight: 400; }
.rx-node[aria-pressed="true"] text.rx-city { fill: var(--rx-head); font-weight: 700; }
.rx-map-note { margin: 0.4rem 0 0; color: var(--rx-faint); font-size: 0.8rem; }

.rx-feeds-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 0.6rem; }
.rx-feeds-head .rx-panel-title { margin: 0; }
.rx-feeds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: 0.9rem;
}
.rx-col { min-width: 0; }
.rx-col-head { display: flex; align-items: center; gap: 0.4rem; margin: 0; color: var(--rx-head); font-size: 0.9rem; font-weight: 600; }
.rx-key { display: inline-block; flex: none; width: 0.9rem; height: 3px; border-radius: 2px; }
.rx-gkey { display: inline-block; flex: none; width: 0.6rem; height: 0.6rem; border-radius: 2px; }
.rx-col-note { margin: 0.05rem 0 0.45rem; color: var(--rx-faint); font-size: 0.75rem; }
.rx-list { display: grid; gap: 0.3rem; margin: 0; padding: 0; list-style: none; }
.rx-item {
  display: grid;
  grid-template-columns: 1.1rem 4px minmax(0, 1fr);
  align-items: center;
  gap: 0.4rem;
  min-height: 2.1rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--rx-line-soft);
  border-radius: 6px;
  background: var(--rx-panel);
  font-size: 0.8rem;
  line-height: 1.25;
}
.rx-item.is-out { border: 2px solid var(--rx-bad); background: #fff5f5; }
.rx-rank { color: var(--rx-faint); font-variant-numeric: tabular-nums; text-align: right; }
.rx-bar { align-self: stretch; border-radius: 2px; }
.rx-name { overflow-wrap: anywhere; color: var(--rx-head); }
.rx-verdict { margin: 0.45rem 0 0; font-size: 0.78rem; font-weight: 600; }
.rx-verdict.is-good { color: var(--rx-good); }
.rx-verdict.is-bad { color: var(--rx-bad); }
.rx-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin: 0.85rem 0 0; padding: 0; list-style: none; color: var(--rx-faint); font-size: 0.78rem; }
.rx-legend li { display: inline-flex; align-items: center; gap: 0.35rem; }
.rx-legend .rx-out-key { display: inline-block; width: 0.9rem; height: 0.7rem; border: 2px solid var(--rx-bad); border-radius: 3px; background: #fff5f5; }

.rx-strip-panel svg { display: block; width: 100%; height: auto; }
.rx-strip-track { fill: var(--rx-line-soft); }
.rx-strip-row-label { fill: var(--rx-head); font-size: 11.5px; }
.rx-strip-count { fill: var(--rx-faint); font-size: 11px; }
.rx-strip-tick { fill: var(--rx-faint); font-size: 10.5px; }
.rx-strip-axis { stroke: var(--line-strong, #b5b5b5); stroke-width: 1; }
.rx-strip-day { stroke: var(--rx-head); stroke-width: 1.5; }
.rx-strip-hit { fill: transparent; cursor: pointer; }

/* ---- simulation details */
.rx-details {
  margin: 2rem 0 0;
  border: 1px solid var(--rx-line);
  border-radius: var(--rx-radius);
  background: var(--rx-card);
}
.rx-details > summary {
  padding: 0.85rem 1rem;
  color: var(--rx-head);
  font-weight: 600;
  cursor: pointer;
}
.rx-details > summary:focus-visible { outline: 2px solid var(--rx-focus); outline-offset: 2px; border-radius: var(--rx-radius); }
.rx-details-body { padding: 0 1rem 1rem; }
.rx-details-body > p { margin: 0 0 1rem; font-size: 0.92rem; }
@media (min-width: 900px) {
  .chart-row.is-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.rx-fine { margin: 0.75rem 0 0; color: var(--ink-faint, #6b6b6b); font-size: 0.85rem; }
