/* ---------- CHARTS (2 Dec; charts.js, server.py api_charts) ----------
   A dashboard of what's charting among your people and across your circle. Built from the site's own pieces: panels,
   32 px keys, the song row (with a "who liked it" column) and the grid card. Loaded after lurk-20261202.css. */

/* the page is full width, like the Lurklist (no Likes sidebar) */
html body .shell.charts-mode { grid-template-columns: minmax(0, 1fr) !important; }
html body .shell.charts-mode .side { display: none !important; }
#view-charts:not(.hidden) { display: grid; gap: 12px; min-width: 0; }
#charts-root, #view-charts .ch-body { display: grid; gap: 14px; min-width: 0; }
html body .scene--charts .section-emblem { background-position-x: 33.333%; }

/* the top bar: period keys, an active genre, who's counted, play */
#view-charts .ch-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
#view-charts .ch-win { display: inline-flex; gap: 4px; padding: 0; margin: 0; border: 0; background: none; }
html body #shell #view-charts .ch-win button { height: var(--ctl); min-height: var(--ctl); padding: 0 14px; border: 1px solid #131313; border-radius: 0; background: #f6f2e8; color: #131313;
  box-shadow: 0 2px 0 #131313; font: var(--ctl-label); letter-spacing: var(--ctl-track); cursor: pointer; transform: none; }
html body #shell #view-charts .ch-win button.on { background: #ff5b1c; color: #fff; border-color: #10100e; }
#view-charts .ch-filter:not([hidden]) { display: inline-flex; align-items: center; gap: 6px; height: var(--chip); padding: 0 4px 0 10px; border: 1px solid #10100e; background: #fffdf6;
  font: 600 11px/1 var(--body, "Chakra Petch", sans-serif); letter-spacing: .04em; }
#view-charts .ch-filter button { width: 24px; height: 24px; display: grid; place-items: center; padding: 0; border: 0; background: none; cursor: pointer; }
#view-charts .ch-scope { margin-left: auto; font: 500 12px/1.3 var(--body, "Chakra Petch", sans-serif); color: #4a4e45; }
html body #shell #view-charts .ch-play { height: var(--ctl); min-height: var(--ctl); display: inline-flex; align-items: center; gap: 6px; }

/* the No. 1 spotlight and the four numbers */
#view-charts .ch-top { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; align-items: stretch; }
html body #view-charts .ch-lead { display: grid !important; grid-template-columns: 132px minmax(0, 1fr); gap: 18px; align-items: center; margin: 0 !important; padding: 16px !important;
  background: #10100e !important; color: #f6edce; border: 2px solid #050605 !important; box-shadow: 4px 4px 0 #ff5b1c !important; }
#view-charts .ch-lead-art { position: relative; width: 132px; height: 132px; padding: 0; border: 2px solid #3a3d33; background: #1b1f19; cursor: pointer; overflow: hidden; }
#view-charts .ch-lead-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
#view-charts .ch-lead-play { position: absolute; right: 6px; bottom: 6px; width: 34px; height: 34px; display: grid; place-items: center; background: #ff5b1c; color: #fff; }
#view-charts .ch-lead-meta { display: grid; gap: 6px; min-width: 0; }
#view-charts .ch-kicker { font: 700 10px/1 var(--body, "Chakra Petch", sans-serif); letter-spacing: .16em; color: #ff8b50; }
#view-charts .ch-lead-artist { font: 700 14px/1.2 var(--body, "Chakra Petch", sans-serif); color: #ff8b50; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view-charts .ch-lead-title { font: 700 22px/1.15 var(--body, "Chakra Petch", sans-serif); color: #fff8ea; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#view-charts .ch-lead-who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font: 500 12px/1.3 var(--body, "Chakra Petch", sans-serif); color: #c9bfa3; }
#view-charts .ch-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
#view-charts .ch-stat { display: grid; align-content: center; gap: 5px; min-width: 0; padding: 12px 14px; background: #fffdf6; border: 2px solid #10100e; box-shadow: 3px 3px 0 #10100e; }
#view-charts .ch-stat span { font: 700 10px/1 var(--body, "Chakra Petch", sans-serif); letter-spacing: .14em; color: #4a4e45; }
#view-charts .ch-stat b { font: 700 28px/1 var(--body, "Chakra Petch", sans-serif); color: #10100e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view-charts .ch-stat small { font: 500 11.5px/1.3 var(--body, "Chakra Petch", sans-serif); color: #4a4e45; }

/* panels */
html body #view-charts .ch-panel { margin: 0 !important; min-width: 0; }
#view-charts .ch-panel > .ph-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
#view-charts .ch-panel > .ph-row > .ph { margin: 0; }
#view-charts .ch-note { font: 500 11.5px/1.3 var(--body, "Chakra Petch", sans-serif); color: #4a4e45; }
#view-charts .ch-panel > .ph-row > .btn { margin-left: auto; }
#view-charts .ch-none { margin: 6px 0; }
#view-charts .ch-more { margin-top: 10px; }
#view-charts .ch-invite { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px; border: 1px dashed #4a4e45; background: rgba(255, 253, 246, .6); }
#view-charts .ch-invite p { margin: 0; flex: 1 1 320px; font: 500 13px/1.45 var(--body, "Chakra Petch", sans-serif); }

/* who liked it: faces, a count, and whether you have it */
#view-charts .ch-faces { display: inline-flex; align-items: center; flex: none; }
#view-charts .ch-face { width: 24px; height: 24px; padding: 0; margin: 0 0 0 -6px; border: 2px solid #fffdf6; background: #10100e; cursor: pointer; overflow: hidden; flex: none; }
#view-charts .ch-face:first-child { margin-left: 0; }
#view-charts .ch-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
#view-charts .ch-lead .ch-face { border-color: #10100e; }
#view-charts .ch-have { font: 700 9.5px/1 var(--body, "Chakra Petch", sans-serif); letter-spacing: .08em; color: #0b7d8c; border: 1px solid currentColor; padding: 3px 5px; white-space: nowrap; flex: none; }
#view-charts .ch-lead .ch-have { color: #4fd6e6; }
#view-charts .ch-mv { font: 700 9.5px/1 var(--body, "Chakra Petch", sans-serif); font-style: normal; letter-spacing: .03em; }
#view-charts .ch-mv.up, #view-charts .ch-trend.up { color: #1f8a4c; }
#view-charts .ch-mv.down, #view-charts .ch-trend.down { color: #b0402a; }
#view-charts .ch-mv.new, #view-charts .ch-trend.new { color: #e2500f; }
#view-charts .ch-mv.same, #view-charts .ch-trend.same { color: #8a8d80; }

/* chart rows: the site's song row with one more column (who liked it) between the title and the buttons */
@media (min-width: 761px) {
  html body #shell#shell #view-charts .rows:not(.grid) .row.dense.dense.ch-row:not(.compact) {
    grid-template-columns: 34px 40px minmax(0, 1fr) 310px 138px 34px 30px 30px !important;
    grid-template-areas: "num art body who side sim crate more" !important; }
  html body #shell#shell #view-charts .rows:not(.grid) .row.dense.dense.ch-row:not(.compact).current {
    grid-template-areas: "num art body who side sim crate more" "num art body who side sim crate more" !important; }
  #view-charts .ch-row > .ch-who { grid-area: who; display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; align-self: center; }
  #view-charts .ch-row > .ch-who .ch-pos { display: none; }
  #view-charts .ch-row > .ch-who .ch-n { font: 600 11.5px/1.2 var(--body, "Chakra Petch", sans-serif); color: #2a2d26; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html body #shell #view-charts .ch-row > .r-num.ch-rank { display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
  html body #shell #view-charts .ch-row > .r-num.ch-rank b { font: 700 16px/1 var(--body, "Chakra Petch", sans-serif); color: #10100e; }
}

/* (3 Dec, production pass) tablets and small laptops: a fixed 310px "who" column left the title ~10px wide at 768, with
   the genre tag spilling over the faces. Title and who share what's left 3:2 instead (≈310px for who again near 1200),
   and IN YOUR LIKES steps aside there: the filled orange ♥ already says it. */
@media (min-width: 761px) and (max-width: 1199px) {
  html body #shell#shell #view-charts .rows:not(.grid) .row.dense.dense.ch-row:not(.compact) {
    grid-template-columns: 34px 40px minmax(0, 3fr) minmax(0, 2fr) 138px 34px 30px 30px !important; }
  #view-charts .ch-row > .ch-who .ch-have { display: none; }
}

/* cover cards (Put me on, Fresh drops): the grid view's card, a little smaller */
html body #shell #view-charts .rows.grid.ch-cards { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)) !important; gap: 14px !important; }
#view-charts .ch-cards .c-art { position: relative; }
html body #shell#shell #view-charts .rows.grid.ch-cards > .card.ch-off { display: none !important; } /* whole rows only (charts.js fitRows) */
#view-charts .ch-badge { position: absolute; left: 6px; bottom: 6px; z-index: 2; max-width: calc(100% - 52px); padding: 4px 6px; background: #10100e; color: #fff8ea;
  font: 700 9.5px/1 var(--body, "Chakra Petch", sans-serif); letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }

/* artists and genres side by side */
#view-charts .ch-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
#view-charts .ch-alist { list-style: none; margin: 0; padding: 0; }
#view-charts .ch-alist li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto 78px; align-items: center; gap: 10px; min-height: 44px; padding: 4px 0; border-bottom: 1px dashed rgba(74, 78, 69, .35); }
#view-charts .ch-ar { font: 700 14px/1 var(--body, "Chakra Petch", sans-serif); color: #e2500f; text-align: center; }
#view-charts .ch-aname { display: grid; min-width: 0; }
#view-charts .ch-artist { justify-self: start; max-width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; font: 700 14px/1.25 var(--body, "Chakra Petch", sans-serif); color: #10100e;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view-charts .ch-artist:hover { color: #e2500f; text-decoration: underline; }
#view-charts .ch-aname small { font: 500 11px/1.3 var(--body, "Chakra Petch", sans-serif); color: #4a4e45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view-charts .ch-astat { font: 500 11.5px/1.2 var(--body, "Chakra Petch", sans-serif); color: #2a2d26; white-space: nowrap; }
#view-charts .ch-trend { font: 700 10px/1 var(--body, "Chakra Petch", sans-serif); letter-spacing: .03em; text-align: right; white-space: nowrap; }
#view-charts .ch-glist { display: grid; gap: 6px; }
html body #shell #view-charts .ch-g { display: grid; grid-template-columns: 132px minmax(0, 1fr) 46px 56px; align-items: center; gap: 10px; width: 100%; height: var(--ctl); min-height: var(--ctl); padding: 0 8px;
  border: 1px solid transparent; border-left: 4px solid var(--gc, #ff5b1c); background: rgba(255, 253, 246, .7); cursor: pointer; text-align: left; border-radius: 0; box-shadow: none; transform: none; }
html body #shell #view-charts .ch-g:hover, html body #shell #view-charts .ch-g.on { border-color: #10100e; border-left-color: var(--gc, #ff5b1c); background: #fffdf6; }
#view-charts .ch-gname { font: 700 11px/1 var(--body, "Chakra Petch", sans-serif); letter-spacing: .05em; text-transform: uppercase; color: #10100e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view-charts .ch-gbar { height: 10px; background: rgba(16, 16, 14, .08); }
#view-charts .ch-gbar i { display: block; height: 100%; background: var(--gc, #ff5b1c); }
#view-charts .ch-gshare { font: 600 11.5px/1 var(--body, "Chakra Petch", sans-serif); font-variant-numeric: tabular-nums; text-align: right; color: #10100e; }

/* common ground */
#view-charts .ch-cg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
#view-charts .ch-cg-card { min-width: 0; padding: 12px; border: 2px solid #10100e; background: #fffdf6; box-shadow: 3px 3px 0 #10100e; }
#view-charts .ch-cg-card h3, #view-charts .ch-sub { margin: 0 0 8px; font: 700 10.5px/1.2 var(--body, "Chakra Petch", sans-serif); letter-spacing: .14em; color: #4a4e45; }
#view-charts .ch-sub { margin: 16px 0 8px; }
#view-charts .ch-sub small { letter-spacing: .02em; font-weight: 500; text-transform: none; margin-left: 6px; }
#view-charts .ch-cg-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#view-charts .ch-cg-card li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 34px; }
#view-charts .ch-cg-card li .ch-face { width: 30px; height: 30px; }
#view-charts .ch-cg-card li > span:not(.ch-faces) { display: grid; min-width: 0; }
#view-charts .ch-cg-card li b { font: 700 13px/1.25 var(--body, "Chakra Petch", sans-serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view-charts .ch-cg-card li small { font: 500 11px/1.3 var(--body, "Chakra Petch", sans-serif); color: #4a4e45; }
#view-charts .ch-cg-card li em { font: 700 18px/1 var(--body, "Chakra Petch", sans-serif); font-style: normal; color: #e2500f; }

/* phones: one column; chart rows keep the phone row (♥ and ⋯ where Likes has them) with rank + who on a line under the title */
@media (max-width: 760px) {
  #view-charts .ch-top, #view-charts .ch-pair, #view-charts .ch-cg { grid-template-columns: minmax(0, 1fr); }
  html body #view-charts .ch-lead { grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 12px !important; }
  #view-charts .ch-lead-art { width: 96px; height: 96px; }
  #view-charts .ch-lead-title { font-size: 18px; }
  #view-charts .ch-stat b { font-size: 22px; }
  #view-charts .ch-scope { margin-left: 0; flex: 1 1 100%; order: 3; }
  html body #shell#shell#shell #view-charts .rows:not(.grid) > .row.ch-row { grid-template-areas: "art body heart more" "art who heart more" !important; grid-template-rows: auto auto !important; }
  #view-charts .ch-row > .ch-who { grid-area: who; display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; margin-top: 4px; }
  #view-charts .ch-row > .ch-who .ch-pos { display: inline-flex; align-items: center; gap: 4px; font: 700 11px/1 var(--body, "Chakra Petch", sans-serif); color: #10100e; flex: none; }
  #view-charts .ch-row > .ch-who .ch-face { width: 20px; height: 20px; }
  #view-charts .ch-row > .ch-who .ch-n { font: 500 11px/1.2 var(--body, "Chakra Petch", sans-serif); color: #4a4e45; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #view-charts .ch-row > .ch-who .ch-have { display: none; }
  html body #shell #view-charts .rows.grid.ch-cards { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  #view-charts .ch-alist li { grid-template-columns: 22px minmax(0, 1fr) auto; }
  #view-charts .ch-alist li .ch-astat { display: none; }
  html body #shell #view-charts .ch-g { grid-template-columns: 104px minmax(0, 1fr) 42px 50px; height: var(--ctl); }
  /* the bottom tab bar holds six keys now */
  html body .hdr .nav.nav { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
}
