/* music.jaaaames.com: the jaaaames.com palette and type, dark only (like the main site). */

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c2128;
  --border: #21262d;
  --border-hover: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #34d399;
  --accent-dim: rgba(52, 211, 153, 0.08);
  /* chart chrome */
  --grid: #21262d;
  --axis: #30363d;
  /* categorical slots (dataviz reference, dark steps; validated on #161b22) */
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --other: #484f58;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, 'Cascadia Code', 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.5;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }
.dim, a.dim { color: var(--muted); }
a.dim:hover { color: var(--accent); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── frame ── */

.top {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: 0.9rem 16px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.brand { font-weight: 700; font-size: 0.95rem; }
.top nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.top nav a { color: var(--muted); }
.top nav a.on, .top nav a:hover { color: var(--accent); }
.search { margin-left: auto; }
input, select, button {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border-hover); border-radius: 6px; padding: 0.25rem 0.5rem;
}
input:focus, select:focus, button:focus { outline: 1px solid var(--accent); }
button { cursor: pointer; color: var(--muted); }
button:hover { color: var(--accent); }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px 3rem; display: flex; flex-direction: column; gap: 2rem; }
footer {
  max-width: 1100px; margin: 0 auto; padding: 1rem 16px 2rem; display: flex; gap: 1.5rem;
  flex-wrap: wrap; color: var(--muted); border-top: 1px solid var(--border); font-size: 0.75rem;
}
footer a { color: var(--muted); }

h1 { font-size: 1.15rem; font-weight: 700; }
h2 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.6rem; }
.sub { color: var(--muted); font-size: 0.8rem; margin-top: -1.2rem; }
main > h1 + .ranges { margin-top: -1.2rem; }
.sect-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.sect-head h2 { margin-bottom: 0.6rem; }

/* ── stats ── */

.head { display: flex; flex-direction: column; gap: 0.75rem; }
.kind { font-size: 0.75rem; }
.ext { font-size: 0.8rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.75rem 1rem; }
.stats dt { color: var(--muted); font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase; }
.stats dd { font-size: 0.95rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.now { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); box-shadow: 0 0 6px rgba(52, 211, 153, 0.6); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } }
.loved { color: var(--s8); }

/* ── range picker ── */

.ranges { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.9rem; font-size: 0.8rem; }
.ranges a { color: var(--muted); }
.ranges a.on { color: var(--accent); }
.ranges.small { font-size: 0.72rem; gap: 0.2rem 0.6rem; }
.ranges .custom { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-left: auto; }

/* ── tables ── */

table { border-collapse: collapse; width: 100%; }
td, th { padding: 0.3rem 0.5rem 0.3rem 0; vertical-align: baseline; }
tr + tr td { border-top: 1px solid var(--border); }
.plays .track { width: 50%; }
.plays .album { width: 35%; overflow-wrap: anywhere; }
.plays .when { color: var(--muted); width: 15%; }
.ranked .rank { width: 2.5rem; color: var(--muted); }
.ranked .barcell { width: 22%; }
.ranked td:first-child + td { overflow-wrap: anywhere; }
svg.bar { display: block; width: 100%; height: 6px; }
svg.bar rect { fill: var(--accent); opacity: 0.55; }

.pager { display: flex; justify-content: space-between; font-size: 0.8rem; }

details.table summary { cursor: pointer; color: var(--muted); font-size: 0.75rem; }
details.table summary:hover { color: var(--accent); }
details.table > * + * { margin-top: 0.6rem; }
.scroll { overflow-x: auto; }
table.data { font-size: 0.72rem; width: auto; }
table.data th { color: var(--muted); font-weight: 400; text-align: right; white-space: nowrap; padding-right: 0.8rem; }
table.data td { padding-right: 0.8rem; }

/* ── top-entity grid (profile) ── */

.grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.6rem; }
.grid a {
  display: flex; flex-direction: column; gap: 0.15rem; height: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem 0.8rem;
}
.grid a:hover { border-color: var(--border-hover); }
.grid .rank { color: var(--muted); font-size: 0.7rem; }
.grid .name { font-weight: 600; overflow-wrap: anywhere; }
.grid .by { color: var(--muted); font-size: 0.75rem; overflow-wrap: anywhere; }
.grid .plays { color: var(--accent); font-size: 0.72rem; margin-top: auto; padding-top: 0.3rem; }

.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; }
.cols.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ── charts ── */

.chart { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; position: relative; min-width: 0; }
.chart figcaption { font-size: 0.8rem; font-weight: 700; margin-bottom: 0.6rem; }
.chart .plot { position: relative; min-height: 160px; }
.chart svg { display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 10px; font-family: inherit; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axisline { stroke: var(--axis); stroke-width: 1; }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.75rem; margin-bottom: 0.6rem; }
.legend a, .legend span { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--text); }
.legend a:hover { color: var(--accent); }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.tip {
  position: absolute; pointer-events: none; z-index: 2; min-width: 9rem; max-width: 18rem;
  background: var(--bg); border: 1px solid var(--border-hover); border-radius: 6px;
  padding: 0.45rem 0.6rem; font-size: 0.72rem; line-height: 1.45; display: none;
}
.tip .t { color: var(--muted); margin-bottom: 0.2rem; }
.tip .r { display: flex; align-items: center; gap: 0.45rem; }
.tip .r b { font-weight: 700; min-width: 3.2rem; text-align: right; font-variant-numeric: tabular-nums; }
.tip .r em { font-style: normal; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip .k { width: 10px; height: 2px; flex-shrink: 0; }
.heat-scale { display: flex; align-items: center; gap: 0.4rem; font-size: 0.7rem; color: var(--muted); margin-top: 0.5rem; }
.heat-scale svg { width: 120px; height: 8px; }

@media (max-width: 760px) {
  .cols, .cols.three { grid-template-columns: minmax(0, 1fr); }
  .search { margin-left: 0; width: 100%; }
  .search input { width: 100%; }
  .ranges .custom { margin-left: 0; }
  .plays .album { display: none; }
  .plays .track { width: auto; }
}
