/* ============================================================
   Network section — member chart, votes, Following feed and the
   published-images marquee ribbon (spec §4/§13, mockup port).

   Tokens: --glass-* are defined by web.css :root (always present);
   --nordic-* exist only under html[data-theme="nordic"], so every
   use carries a --glass or literal fallback. All classes are
   net- prefixed and built by scripts/web/network.js.
   ============================================================ */

/* The panel owns no padding: the marquee band bleeds edge-to-edge
   inside the card; .net-body carries the horizontal padding. */
.network-panel {
  padding: 0;
  overflow: clip;
}

/* ── marquee ribbon ───────────────────────────────────────── */

.net-marquee {
  position: relative;
  height: 240px;
  overflow: hidden;
  border-bottom: 1px solid var(--glass-line);
  background: var(--nordic-surface, #ffffff);
  cursor: grab;
  touch-action: pan-y; /* vertical scroll stays native; horizontal pan = drag */
}

.net-marquee:active { cursor: grabbing; }
.net-marquee.is-empty { cursor: default; height: 180px; }

.net-mq-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 1440px;
  height: 240px;
  transform-origin: top left;
}

.net-mq-item {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 190px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--glass-line);
  border-radius: 12px;
  background: var(--nordic-fill, rgb(0 0 0 / 4%));
  offset-path: var(--mq-path);
  offset-rotate: 0deg;
  transform: scale(calc(0.62 + var(--focus, 1) * 0.42));
  opacity: calc(0.45 + var(--focus, 1) * 0.55);
  will-change: offset-distance;
  user-select: none;
  -webkit-user-drag: none;
}

.net-marquee-tag {
  position: absolute;
  top: 16px;
  left: 24px;
  z-index: 5;
  margin: 0;
  padding: 3px 7px;
  border: 1px solid var(--glass-line);
  border-radius: 4px;
  background: var(--nordic-surface, #ffffff);
  color: var(--glass-label);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
}

.net-marquee-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0 24px;
  font-size: 13px;
  text-align: center;
}

/* translateX fallback when offset-path is unsupported */
.net-marquee.is-linear .net-mq-stage {
  top: 0;
  left: 0;
  width: max-content;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0;
  transform: translateX(var(--net-mq-x, 0px));
  will-change: transform;
}

.net-marquee.is-linear .net-mq-item,
.net-marquee.is-static .net-mq-item {
  position: static;
  flex: 0 0 auto;
  offset-path: none;
  transform: none;
  opacity: 1;
  will-change: auto;
}

/* prefers-reduced-motion: plain horizontally-scrollable strip */
.net-marquee.is-static {
  overflow-x: auto;
  cursor: default;
  scrollbar-width: thin;
}

.net-marquee.is-static .net-mq-stage {
  position: static;
  width: max-content;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  transform: none;
}

.net-marquee.is-static:focus-visible {
  outline: 2px solid var(--glass-ink);
  outline-offset: -2px;
}

/* ── chart header + tabs ──────────────────────────────────── */

.net-body {
  padding: 0 24px 24px;
}

.net-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 22px 24px 18px;
}

.net-head h2 {
  margin: 0;
  font-size: clamp(30px, 4.5vw, 44px);
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1;
}

.net-head .body-copy {
  margin: 8px 0 0;
  max-width: 46ch;
}

/* Segmented control. Scoped under the nordic theme so the global
   `html[data-theme="nordic"] button` border/radius cannot leak onto each
   segment (that made the tabs look glued-together boxes). */
.net-tabs,
html[data-theme="nordic"] .net-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 0;
  border-radius: 10px;
  background: var(--nordic-fill, rgb(0 0 0 / 4%));
}

.net-tab,
html[data-theme="nordic"] .net-tab {
  min-height: 34px;
  padding: 7px 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--glass-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.net-tab:hover:not(:disabled):not([aria-selected="true"]),
html[data-theme="nordic"] .net-tab:hover:not(:disabled):not([aria-selected="true"]) {
  background: rgb(255 255 255 / 70%);
  color: var(--glass-ink);
  transform: none;
}

.net-tab[aria-selected="true"],
html[data-theme="nordic"] .net-tab[aria-selected="true"] {
  background: var(--glass-ink);
  color: #ffffff;
}

.net-tab:focus-visible {
  outline: 2px solid var(--glass-ink);
  outline-offset: 1px;
}

/* ── chart rows ───────────────────────────────────────────── */

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

.net-row {
  display: grid;
  grid-template-columns: 52px auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
  border-top: 1px solid var(--glass-line);
}

.net-row:last-child {
  border-bottom: 1px solid var(--glass-line);
}

.net-rank {
  font-size: 26px;
  font-weight: 300;
  line-height: 1;
  color: var(--glass-label);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.net-row:nth-child(-n + 3) .net-rank {
  font-weight: 800;
  color: var(--glass-ink);
}

/* Record sleeve (web.css .song-sleeve): the cover is the play button.
   Every row paints one — image or gradient — so titles stay on one column. */
.net-sleeve {
  --sleeve: 52px;
}

.net-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.net-title {
  display: block;
  overflow: hidden;
  color: var(--glass-ink);
  font-size: 16px;
  font-weight: 620;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.net-title:hover { text-decoration: underline; }

.net-by {
  font-size: 13px;
  color: var(--glass-label);
}

.net-handle {
  color: inherit;
  text-decoration: none;
}

.net-handle:hover {
  color: var(--glass-ink);
  text-decoration: underline;
}

.net-date {
  font-size: 12px;
  color: var(--glass-label);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.net-heart.net-heart {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: transparent;
  color: var(--glass-ink);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}

.net-heart svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.net-heart:hover:not(:disabled) {
  border-color: var(--glass-ink);
  transform: none;
}

.net-heart.is-on {
  border-color: var(--glass-ink);
  background: var(--glass-ink);
  color: #ffffff;
}

.net-heart.is-on svg { fill: #ffffff; }

.net-heart[aria-busy="true"] { opacity: 0.7; }

.net-heart:focus-visible,
.net-more:focus-visible,
.net-retry:focus-visible {
  outline: 2px solid var(--glass-ink);
  outline-offset: 2px;
}

.net-title:focus-visible,
.net-handle:focus-visible {
  outline: 2px solid var(--glass-ink);
  outline-offset: 1px;
}

/* ── status / pager ───────────────────────────────────────── */

.net-status {
  margin: 0;
  padding: 18px 0;
  font-size: 13px;
  text-align: center;
}

.net-foot {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 6px 0;
}

.net-more,
.net-retry {
  min-width: 140px;
}

/* ── responsive ───────────────────────────────────────────── */

@media (max-width: 640px) {
  .net-body { padding: 0 18px 18px; }
  .net-head { padding: 16px 18px 14px; }
  .net-head h2 { font-size: 30px; }
  .net-marquee { height: 200px; }
  .net-marquee.is-empty { height: 140px; }
  .net-mq-item { width: 150px; }
  .net-tabs,
  html[data-theme="nordic"] .net-tabs { max-width: 100%; overflow-x: auto; }
  .net-tab,
  html[data-theme="nordic"] .net-tab { padding: 7px 12px; }
  .net-row {
    grid-template-columns: 34px auto minmax(0, 1fr) auto;
    gap: 12px;
  }
  .net-sleeve { --sleeve: 44px; }
  .net-rank { font-size: 19px; }
  .net-date { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .net-heart,
  .net-tab {
    transition: none;
  }
}

/* Route shell: while a network hash route (#network, #u/:handle, #settings)
   is active the studio scroll sections hide and only the mounted network
   panel renders — a page switch inside the existing shell. */
#studioMain.network-route > :not([data-network-panel]) {
  display: none;
}
