/* ═══════════════════════════════════════════════════════════════════════════
   media.css — the media detail page, rebuilt in the Season 2 design language.

   `md-` prefixed for the same reason as home-v2.css / profile.css: main.css is
   one flat global namespace. Loaded after home-v2.css so it can reuse the `hv-`
   tags, CTAs, capsules and accent tokens.

   The superseded `.comm-media-*` rules were deleted from main.css when this
   landed. The ids the handlers bind to (#cm-want-btn, #cm-rate-btn,
   #cm-rate-picker, #cm-rate-stars, #cm-overview, #cm-overview-toggle,
   #cm-retro-achievements) all survive — they moved inside new wrappers, they
   were not rewritten.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Same one-level-deeper rule as profile.css — the sections live inside
   #comm-media-content, which is the view wrapper's only child. */
#comm-media-content > * + * { margin-top: 30px; }
#comm-media-content > .md-hero { margin-top: 0; }
/* The lazy recs shelf renders into an always-present div; without this it
   contributes a 30px gap below the two-up even when it has nothing to show. */
#comm-media-content > #cm-recs:empty { display: none; }

/* ═══ HERO — the cover art becomes the page, the way .hv-news works ════════ */
.md-hero { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--border); isolation: isolate; }
.md-hero-bg {
  position: absolute; inset: 0; z-index: -2;
  background-size: cover; background-position: center 30%;
  filter: blur(34px) saturate(1.35); transform: scale(1.2);
}
.md-hero-bg::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(0deg, rgba(10,10,14,.97) 4%, rgba(10,10,14,.80) 44%, rgba(10,10,14,.42) 100%),
    linear-gradient(95deg, rgba(10,10,14,.90), rgba(10,10,14,.34) 70%);
}
.md-hero-glow { position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse 60% 92% at 4% 100%, var(--hv-a-26), transparent 62%); }
.md-hero-in { position: relative; display: flex; gap: 28px; padding: 30px; }

.md-poster {
  width: 186px; flex: none; border-radius: 12px; overflow: hidden; aspect-ratio: 2/3;
  position: relative; background: linear-gradient(155deg, #1f1f2b, #13131b);
  box-shadow: 0 20px 52px rgba(0,0,0,.72);
}
.md-poster img { width: 100%; height: 100%; object-fit: cover; display: block; position: relative; z-index: 1; }
.md-poster-fb { position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; text-align: center; font-size: 12px; font-weight: 650; color: var(--text-3); z-index: 0; }
/* Progress rides the poster, the way it does on .hv-cap */
.md-poster-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.18); z-index: 3; }
.md-poster-bar i { display: block; height: 100%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

.md-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.md-title { font-family: var(--font-display); font-size: 42px; font-weight: 800; letter-spacing: -.035em; line-height: 1.02; margin: 10px 0 7px; text-wrap: balance; }
.md-sub { font-size: 13.5px; color: var(--text-2); font-weight: 600; }
.md-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-top: 13px; font-size: 12.5px; color: var(--text-2); }
.md-meta-i { display: flex; align-items: center; gap: 5px; }
.md-meta-i svg { opacity: .5; flex-shrink: 0; }
.md-meta-i .src { font-size: 10px; color: var(--text-3); margin-left: 2px; }
.md-meta-i.cert { border: 1px solid var(--border-strong); padding: 1px 6px; border-radius: 4px; font-size: 11px; }
.md-meta-i.star { color: #f5a623; }
.md-meta-i.done { color: #86efac; }
.md-genres { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 13px; }
.md-genre { font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,.06); color: var(--text-2); border: 1px solid var(--border); }
.md-ov {
  font-size: 13.5px; color: var(--text-2); line-height: 1.6; margin-top: 14px; max-width: 640px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer;
}
.md-ov.expanded { display: block; -webkit-line-clamp: unset; }
.md-ov-more { font-size: 11.5px; font-weight: 700; color: var(--accent); background: none; border: none; padding: 4px 0 0; cursor: pointer; font-family: inherit; text-align: left; }

/* Actions: ONE primary. The page used to render three identical grey buttons. */
.md-acts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.md-your { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-3); margin-left: 4px; }
.md-rate-picker { display: none; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* The rating readout lives in the hero, at display scale. */
.md-rate { display: flex; align-items: center; gap: 14px; margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.10); flex-wrap: wrap; }
.md-rate-n { font-family: var(--font-display); font-size: 38px; font-weight: 800; line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; }
.md-rate-c { font-size: 12px; color: var(--text-3); }
.md-rate-who { display: flex; margin-left: auto; align-items: center; gap: 9px; }
.md-avs { display: flex; }
.md-avs img, .md-avs span {
  width: 26px; height: 26px; border-radius: 50%; margin-left: -8px; object-fit: cover;
  border: 2px solid rgba(10,10,14,.9); background: linear-gradient(135deg, #3b3b52, #252533);
  display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--text-2);
  cursor: pointer;
}
.md-avs :first-child { margin-left: 0; }
.md-rate-who-l { font-size: 12px; color: var(--text-3); }
.md-rate-who-l b { color: var(--text-2); font-weight: 650; }
.md-noratings { font-size: 13px; color: var(--text-3); margin-top: 20px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.10); }

/* ═══ PANELS + TWO-UP — the same shell as the profile / season pages ═══════ */
.md-duo { display: grid; grid-template-columns: 1fr 356px; gap: 18px; align-items: start; }
.md-col > * + * { margin-top: 18px; }
.md-card { border-radius: 14px; background: var(--hv-panel); border: 1px solid var(--border); overflow: hidden; }
.md-card-h { display: flex; align-items: baseline; gap: 9px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.md-card-t { font-family: var(--font-display); font-size: 14px; font-weight: 800; letter-spacing: -.015em; }
.md-card-n { font-size: 11.5px; color: var(--text-3); margin-left: auto; font-variant-numeric: tabular-nums; }
.md-card-b { padding: 16px; }

/* ═══ WHO'S ON THIS ═══════════════════════════════════════════════════════
   The Library's thesis, given a block: at 14 users "3 people have read this"
   works where a feed doesn't. This used to be one 13px line under the buttons. */
.md-who { display: flex; flex-direction: column; gap: 3px; }
.md-w { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; transition: .15s; cursor: pointer; }
.md-w:hover { background: rgba(255,255,255,.05); }
.md-w.me { background: var(--accent-dim); border: 1px solid var(--hv-a-28); }
.md-w-av {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none;
  background: linear-gradient(135deg, #3b3b52, #252533); display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: var(--text-2); overflow: hidden;
}
.md-w-av img { width: 100%; height: 100%; object-fit: cover; }
.md-w-b { flex: 1; min-width: 0; }
.md-w-n { font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 7px; }
.md-w-tag { font-size: 9px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; background: var(--accent-dim); color: var(--accent); border: 1px solid var(--hv-a-28); }
.md-w-s { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.md-w-r { flex: none; display: flex; align-items: center; gap: 10px; }
.md-w-bar { width: 92px; height: 5px; border-radius: 99px; background: rgba(255,255,255,.11); overflow: hidden; }
.md-w-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); box-shadow: 0 0 8px var(--hv-a-70); }
.md-w-v { font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text-2); min-width: 40px; text-align: right; }
.md-w-st { min-width: 54px; text-align: right; font-size: 11px; color: var(--text-3); }

/* ═══ RATINGS PANEL ═══════════════════════════════════════════════════════ */
.md-dist { display: flex; flex-direction: column; gap: 5px; }
.md-dist-r { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.md-dist-k { width: 22px; flex: none; font-weight: 700; }
.md-dist-w { flex: 1; height: 7px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; }
.md-dist-w i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #f59e0b, #f5c518); }
.md-dist-n { width: 14px; text-align: right; flex: none; }

/* ═══ COUNTS TOWARD ═══════════════════════════════════════════════════════
   Was an 8px-margin chip row under the subtitle, and it's the only thing on the
   page connecting media to scoring — which is what the site is for. */
.md-chips { display: flex; flex-direction: column; gap: 8px; }
.md-chip {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  background: var(--hv-panel-2); border: 1px solid var(--border); transition: .16s; cursor: pointer;
  text-decoration: none; color: inherit;
}
.md-chip:hover { transform: translateY(-2px); border-color: var(--hv-a-55); }
.md-chip-i { width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center; font-size: 17px; background: var(--accent-dim); border: 1px solid var(--hv-a-28); overflow: hidden; }
.md-chip-i img { width: 22px; height: 22px; object-fit: contain; }
.md-chip-b { flex: 1; min-width: 0; }
.md-chip-l { font-size: 9px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; color: var(--text-3); }
.md-chip-n { font-size: 12.5px; font-weight: 650; margin-top: 2px; }
.md-chip-p { flex: none; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 4px; background: var(--accent-dim); color: var(--accent); border: 1px solid var(--hv-a-28); }

/* ═══ REVIEWS — cards, not feed rows ══════════════════════════════════════ */
.md-rev { display: flex; flex-direction: column; gap: 11px; }
.md-r { display: flex; gap: 12px; padding: 14px; border-radius: 11px; background: var(--hv-panel-2); border: 1px solid var(--border); transition: .16s; }
.md-r:hover { border-color: var(--hv-a-55); }
.md-r-av {
  width: 34px; height: 34px; border-radius: 50%; flex: none; object-fit: cover; overflow: hidden;
  background: linear-gradient(135deg, #3b3b52, #252533); display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: var(--text-2); cursor: pointer;
}
.md-r-av img { width: 100%; height: 100%; object-fit: cover; }
.md-r-b { flex: 1; min-width: 0; }
.md-r-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.md-r-n { font-size: 12.5px; font-weight: 650; cursor: pointer; }
.md-r-lv { font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,.06); color: var(--text-3); border: 1px solid var(--border); }
.md-r-st { margin-left: auto; font-size: 11.5px; }
.md-r-t { font-size: 13.5px; color: var(--text); line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.md-r-d { font-size: 10.5px; color: var(--text-3); margin-top: 7px; }
.md-r-spoil { font-size: 12.5px; color: var(--text-3); font-style: italic; }
/* The nudge to write one — dashed, so it never reads as somebody's post. */
.md-r-prompt { border-style: dashed; background: none; cursor: pointer; align-items: center; }
.md-r-prompt:hover { border-color: var(--hv-a-55); }
.md-r-prompt span { font-size: 13px; color: var(--text-3); }
.md-r-prompt b { color: var(--accent); font-weight: 650; }

/* ═══ TYPE SLOT — issues / episodes / tracks / achievements ════════════════
   The page already built four different bodies for six types; they just
   rendered as bare tables, so a comic page and a Groove page looked like
   different products. One shell around each of them is most of the work. */
.md-runs { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.md-run {
  aspect-ratio: 1; border-radius: 8px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; background: var(--hv-panel-2); border: 1px solid var(--border);
  font-size: 11px; font-weight: 700; color: var(--text-3); transition: .15s; text-align: center; padding: 2px;
}
.md-run.all { border-color: var(--hv-a-28); color: var(--text-2); }
.md-run.read { background: var(--accent-dim); border-color: var(--hv-a-28); color: var(--accent); }
.md-run.read.all { background: linear-gradient(150deg, var(--hv-a-32), var(--hv-a-16)); border-color: var(--hv-a-55); color: #fff; }
.md-run-w { font-size: 8px; font-weight: 700; letter-spacing: .04em; opacity: .75; }
.md-key { display: flex; align-items: center; gap: 14px; margin-top: 14px; font-size: 11px; color: var(--text-3); flex-wrap: wrap; }
.md-key span { display: flex; align-items: center; gap: 6px; }
.md-key i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.md-key i.a { background: var(--accent-dim); border: 1px solid var(--hv-a-28); }
.md-key i.b { background: linear-gradient(150deg, var(--hv-a-32), var(--hv-a-16)); border: 1px solid var(--hv-a-55); }

/* Standings / leaderboard tables, re-housed. Groove keeps its per-difficulty
   grouping; Retro keeps its RA-points ordering. */
/* Tables scroll inside their own container rather than widening the panel — the
   Groove leaderboard is six columns, which at 390px otherwise squashes to
   unreadable or pushes the page into a horizontal scroll. */
.md-tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.md-tbl-wrap::-webkit-scrollbar { height: 6px; }
.md-tbl-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 99px; }
.md-tbl { width: 100%; min-width: 330px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.md-tbl th { text-align: left; padding: 4px 7px; font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); }
.md-tbl td { padding: 6px 7px; font-size: 12.5px; border-top: 1px solid var(--border); }
.md-tbl tr:first-child td { border-top: none; }
.md-tbl .rk { color: var(--text-3); font-size: 11px; width: 22px; }
.md-tbl .sc { font-weight: 700; }
.md-tbl .dim { color: var(--text-3); font-size: 11px; }
.md-diff { margin-top: 14px; }
.md-diff:first-child { margin-top: 0; }
.md-diff-h { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; padding: 3px 8px; background: var(--accent-dim); border: 1px solid var(--hv-a-28); border-radius: 5px; display: inline-block; }

.md-empty { padding: 22px; text-align: center; color: var(--text-3); font-size: 13px; }

/* _renderHeatmap ships its own .prof-ov-section wrapper and an "Activity"
   header; inside a panel that header just repeats the card title. */
.md-card .prof-ov-section { padding: 0; border-bottom: none; }
.md-card .prof-ov-section .hm-head { display: none; }

@media (max-width: 1180px) { .md-duo { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .md-hero-in { flex-direction: column; padding: 20px 16px; gap: 18px; }
  .md-poster { width: 132px; }
  .md-title { font-size: 29px; }
  .md-rate-who { margin-left: 0; flex: 1 1 100%; }
  .md-card-h { padding: 12px; }
  .md-card-b { padding: 12px; }
  .md-w-bar { width: 56px; }
  .md-w-st { display: none; }
}
