/* ============================================================
   Basstion Sound - GOLD layer
   Loads AFTER app.css and the inline <style> block -> wins by cascade order.
   Adds: gold accent tier (rank / VIP / verdict), film grain + vignette,
   two-level glass depth, scroll reveal, animated stat counters.
   Base neon (pink/purple/indigo) is untouched - gold only marks STATUS.
   Rollback: drop the <link> to this file + <script src="js/gold.js">.
   ============================================================ */

:root {
  --gold: #f5c518;
  --gold-hi: #ffe27a;      /* highlight stop for gradients */
  --gold-deep: #a9761c;    /* shadow stop */
  --gold-glow: rgba(245, 197, 24, 0.35);
}

/* ---------- 1. FILM GRAIN + VIGNETTE ----------------------------------
   Wu-Tang / 36 Chambers texture: base page is sterile-clean, grain gives
   it print grit. Single inline SVG turbulence, no image request.        */

/* Texture sits ON TOP of everything (pointer-events: none, so it never
   intercepts clicks). Do NOT try to lift the UI above it by forcing
   position/z-index on containers - an earlier version did exactly that and
   turned `position: fixed` into `relative`, which dropped the chart player
   to the bottom of the document instead of floating over the page.        */
body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
}

body::before {
  /* grain */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  opacity: 0.05;
  mix-blend-mode: overlay;
}

body::after {
  /* vignette - pulls the eye to the centre column */
  background: radial-gradient(ellipse 92% 75% at 50% 42%, transparent 52%, rgba(0, 0, 0, 0.5) 100%);
  opacity: 0.6;
}

/* OBS overlays MUST stay transparent - overlay-mode only hides body's
   children, and these are pseudo-elements, so they would tint the stream
   frame. Kill them (and the reveal fade) whenever an overlay is shown.  */
body.overlay-mode::before,
body.overlay-mode::after {
  display: none !important;
}

body.overlay-mode .reveal {
  opacity: 1 !important;
  transform: none !important;
}

/* (intentionally no position/z-index overrides on containers - see above) */

/* ---------- 2. GLASS DEPTH (two tiers) --------------------------------
   Before: every card used one .glass recipe -> flat wall of sameness.
   Now: passive cards recede, "hot" cards (top-1, live, VIP, player) sit
   forward with a denser pane and an inner rim of light.                 */

/* Passive tier: a DARK pane, not a lighter one. The old white-alpha fill let
   the background orbs bleed straight through and washed cards out to purple;
   tinting toward the page ink mutes them and gives the stack real depth.   */
.glass {
  background: rgba(12, 8, 24, 0.5);
  border-color: rgba(255, 255, 255, 0.07);
}

.glass-hot,
.chart-top1,
#chart-player,
.queue-item.now {
  background:
    linear-gradient(180deg, rgba(38, 26, 62, 0.72), rgba(12, 8, 24, 0.62)) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 18px 50px -20px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(34px) saturate(190%);
  -webkit-backdrop-filter: blur(34px) saturate(190%);
}

/* ---------- 3. GOLD TIER: rank ----------------------------------------
   Charts had all three medals in pink/purple -> no podium reading.
   Gold is now reserved for #1 so the hierarchy is instant.              */

.chart-top1 {
  border-color: rgba(245, 197, 24, 0.45) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 0 34px -6px var(--gold-glow),
    0 18px 50px -20px rgba(0, 0, 0, 0.9) !important;
}

.chart-top1::after {
  /* W mark - own geometry (two nested chevrons), not the clan logo */
  content: '';
  position: absolute;
  right: -18px;
  bottom: -22px;
  width: 82px;
  height: 82px;
  pointer-events: none;
  opacity: 0.07;   /* watermark, must never fight the score digits */
  background: no-repeat center / contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M8 18 L26 78 L50 34 L74 78 L92 18 L74 18 L64 52 L50 24 L36 52 L26 18 Z' fill='%23f5c518'/%3E%3C/svg%3E");
}

/* podium colours for the 3 featured session cards */
.gold-rank-1 { color: var(--gold) !important; }
.gold-rank-1.grad-text,
.grad-text.gold-rank-1 {
  background: linear-gradient(135deg, var(--gold-hi), var(--gold), var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* top-3 session banner: gold rim + warm corner instead of a third pink block */
#featured-section {
  border-color: rgba(245, 197, 24, 0.28) !important;
  background:
    radial-gradient(80% 140% at 0% 0%, rgba(236, 72, 153, 0.26), transparent 55%),
    radial-gradient(70% 120% at 100% 0%, rgba(245, 197, 24, 0.16), transparent 60%),
    radial-gradient(80% 140% at 100% 100%, rgba(99, 102, 241, 0.24), transparent 55%),
    rgba(15, 10, 30, 0.55) !important;
}

#featured-score {
  background: linear-gradient(135deg, var(--gold-hi), var(--gold), var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

#featured-cover {
  box-shadow: 0 0 0 1px rgba(245, 197, 24, 0.3), 0 0 30px -8px var(--gold-glow);
}

/* best-score stat tile joins the gold tier */
#stat-best { color: var(--gold) !important; }

/* ---------- 4. GOLD TIER: VIP -----------------------------------------
   Was an amber star lost on a pink card. Now a gold edge + left bar:
   readable on stream at a glance.                                       */

.queue-item.vip {
  position: relative;
  box-shadow:
    inset 0 0 0 1px rgba(245, 197, 24, 0.5),
    0 0 26px -6px var(--gold-glow) !important;
}

.queue-item.vip::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-deep));
}

.q-vip-btn.active {
  background: rgba(245, 197, 24, 0.18) !important;
  border-color: rgba(245, 197, 24, 0.55) !important;
  color: var(--gold-hi) !important;
}

/* ---------- 5. GOLD TIER: top verdict ---------------------------------
   Only the highest verdicts ("Шедевр" / "Огонь") get the gold treatment,
   so the payoff of a good score actually feels like a payoff.
   Class is applied by js/gold.js after the verdict text is written.     */

.verdict-top {
  background: linear-gradient(135deg, var(--gold-hi), var(--gold) 45%, var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 18px var(--gold-glow));
  position: relative;
}

/* ---------- 6. SCROLL REVEAL ------------------------------------------
   .fade-up used to fire for every block at page load, so anything below
   the fold had already finished animating by the time you scrolled to it.
   Guarded by .gold-js on <html>: if the script fails, content stays visible. */

.gold-js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s cubic-bezier(.22, .61, .36, 1),
              transform .6s cubic-bezier(.22, .61, .36, 1);
  will-change: opacity, transform;
}

.gold-js .reveal.is-in {
  opacity: 1;
  transform: none;
}

.gold-js .reveal.d1 { transition-delay: .06s; }
.gold-js .reveal.d2 { transition-delay: .12s; }
.gold-js .reveal.d3 { transition-delay: .18s; }

/* ---------- 7. COUNTERS ------------------------------------------------ */

.counting {
  font-variant-numeric: tabular-nums;
  /* stops the tile from jittering while digits change width */
}

/* ============================================================
   9. AMPLIFIED PASS
   First pass read as "barely different" - gold only touched scores and
   VIP edges, which a viewer never sees side by side. This pass puts it
   where the eye actually lands: headline, nav, section labels, frames.
   ============================================================ */

/* --- hero headline: the single biggest "this changed" signal --------- */
header h1 .grad-text {
  background: linear-gradient(135deg, var(--gold-hi) 0%, var(--gold) 45%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 26px rgba(245, 197, 24, 0.28));
}

/* --- nav: active tab wears the gold --------------------------------- */
.nav-link.active {
  color: var(--gold) !important;
}

.nav-link.active::after {
  transform: scaleX(1) !important;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-hi), var(--gold-deep)) !important;
  height: 2px;
  box-shadow: 0 0 12px var(--gold-glow);
}

/* --- section labels: were dim grey, now the gold thread through page - */
.section-eyebrow {
  color: var(--gold) !important;
  opacity: 0.85;
}

/* --- poster frame: double rule, the 36-Chambers sleeve trick --------- */
#featured-section,
.chart-top1 {
  outline: 1px solid rgba(245, 197, 24, 0.22);
  outline-offset: -7px;
}

/* --- leader avatar gets a gold ring ---------------------------------- */
.chart-top1 .w-16 {
  box-shadow: 0 0 0 2px var(--gold), 0 0 22px -4px var(--gold-glow);
}

/* --- rank numerals: bigger, gold plate on #1 ------------------------- */
.chart-top1 > .font-display:first-of-type {
  font-size: 1.9rem;
  text-shadow: 0 0 16px var(--gold-glow);
}

/* --- VIP badge: solid gold plate instead of a washed amber chip ------ */
.queue-item [class*="bg-amber"] {
  background: linear-gradient(135deg, var(--gold-hi), var(--gold)) !important;
  color: #17120a !important;
  font-weight: 800;
  box-shadow: 0 2px 10px -2px var(--gold-glow);
}

/* --- secondary CTA picks up a gold edge ------------------------------ */
.btn-ghost,
header a[onclick*="queue"]:not(.btn-primary) {
  border-color: rgba(245, 197, 24, 0.3);
}

/* --- grain: double it, the first pass was invisible on most screens -- */
body::before {
  opacity: 0.1;
}

/* ============================================================
   10. CHART PLAYER
   The stock player was a native <audio controls> in a plain box - grey,
   OS-styled, nothing to do with the rest of the site. Rebuilt as a floating
   bar: cover initial, title, gold scrubber, time, volume. Markup is
   upgraded by js/gold.js, the underlying <audio> element is untouched.
   ============================================================ */

#chart-player {
  position: fixed !important;      /* must float over the page, never flow */
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  z-index: 9990;                   /* above content, below the grain */
  width: min(560px, 94vw);
  /* stated explicitly so the layout never depends on the base stylesheet
     (display itself stays inline-controlled by the app: flex / none)      */
  flex-direction: column !important;
  gap: 8px !important;
  padding: 12px 14px !important;
  border-radius: 20px !important;
  border: 1px solid rgba(245, 197, 24, 0.34) !important;
  background: linear-gradient(180deg, rgba(32, 22, 52, 0.96), rgba(14, 10, 24, 0.97)) !important;
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 34px -10px rgba(245, 197, 24, 0.4),
    0 22px 60px -18px rgba(0, 0, 0, 0.95) !important;
}

.gold-js #chart-player {
  animation: cpUp .32s cubic-bezier(.22, .61, .36, 1);
}

@keyframes cpUp {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* the native widget is replaced, keep the element alive but invisible */
#chart-player audio { display: none !important; }

.cp-row { display: flex; align-items: center; gap: 11px; }

.cp-cover {
  width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 1.15rem;
  color: #17120a;
  background: linear-gradient(135deg, var(--gold-hi), var(--gold-deep));
  box-shadow: 0 0 18px -4px var(--gold-glow);
}

.cp-meta { flex: 1; min-width: 0; }
.cp-title {
  font-size: .875rem; font-weight: 700; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.cp-artist {
  font-size: .74rem; color: rgba(255, 255, 255, 0.45);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px;
}

.cp-btn {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; color: #17120a; padding: 0;
  background: linear-gradient(135deg, var(--gold-hi), var(--gold));
  box-shadow: 0 4px 16px -4px var(--gold-glow);
  transition: transform .18s var(--ease, cubic-bezier(.22,.61,.36,1)), box-shadow .18s;
}
.cp-btn:hover { transform: scale(1.07); box-shadow: 0 6px 22px -4px var(--gold-glow); }
.cp-btn:active { transform: scale(.95); }

.cp-x {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; border: 0; cursor: pointer;
  background: transparent; color: rgba(255, 255, 255, 0.4); font-size: .8rem;
  display: flex; align-items: center; justify-content: center; transition: .18s;
}
.cp-x:hover { color: #fff; background: rgba(255, 255, 255, 0.09); }

.cp-bar { display: flex; align-items: center; gap: 9px; margin-top: 9px; }

.cp-time {
  font-family: 'JetBrains Mono', monospace; font-size: .68rem;
  color: rgba(255, 255, 255, 0.42); flex-shrink: 0; font-variant-numeric: tabular-nums;
}

/* scrubber: gold fill up to the playhead, faint track after it */
input[type=range].cp-seek {
  -webkit-appearance: none; appearance: none;
  flex: 1 1 auto; width: auto; height: 4px; border-radius: 99px; outline: none; cursor: pointer;
  background: linear-gradient(90deg,
    var(--gold) 0%, var(--gold) var(--p, 0%),
    rgba(255, 255, 255, 0.1) var(--p, 0%), rgba(255, 255, 255, 0.1) 100%);
}
input[type=range].cp-seek::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--gold-hi); border: 0; cursor: pointer;
  box-shadow: 0 0 10px var(--gold-glow);
  transition: transform .15s;
}
input[type=range].cp-seek::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%; border: 0;
  background: var(--gold-hi); box-shadow: 0 0 10px var(--gold-glow);
}

input[type=range].cp-vol {
  -webkit-appearance: none; appearance: none;
  flex: 0 0 62px; width: 62px; height: 4px; border-radius: 99px; outline: none; cursor: pointer; flex-shrink: 0;
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.5) var(--v, 100%),
    rgba(255, 255, 255, 0.1) var(--v, 100%), rgba(255, 255, 255, 0.1) 100%);
}
input[type=range].cp-vol::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 10px; height: 10px; border-radius: 50%; background: #fff;
  border: 0; box-shadow: none; cursor: pointer;
}
input[type=range].cp-vol::-moz-range-thumb {
  width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 0;
}

.cp-mute {
  border: 0; background: transparent; cursor: pointer; padding: 0 2px; flex-shrink: 0;
  color: rgba(255, 255, 255, 0.45); font-size: .82rem; transition: color .18s;
}
.cp-mute:hover { color: #fff; }

/* equaliser bars - purely decorative, only animates while playing */
.cp-eq { display: flex; align-items: flex-end; gap: 2px; height: 15px; flex-shrink: 0; }
.cp-eq i {
  width: 2.5px; border-radius: 2px; height: 4px; display: block;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-deep));
  opacity: .45;
}
#chart-player.playing .cp-eq i { animation: cpEq .85s ease-in-out infinite alternate; opacity: 1; }
#chart-player.playing .cp-eq i:nth-child(2) { animation-delay: .18s }
#chart-player.playing .cp-eq i:nth-child(3) { animation-delay: .36s }
#chart-player.playing .cp-eq i:nth-child(4) { animation-delay: .1s }

@keyframes cpEq { from { height: 3px } to { height: 15px } }

@media (max-width: 480px) {
  input[type=range].cp-vol, .cp-mute { display: none; }
  #chart-player { bottom: 10px; }
}

/* ---------- 8. MOTION SAFETY -------------------------------------------
   Brother streams with an OBS capture - stray animation costs frames.   */

@media (prefers-reduced-motion: reduce) {
  .gold-js .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  body::before { display: none; }
}
