/* Original icemoon.fm rhythm consumers, mapped to the existing Drupal markup.
   The analyzer, beat timing, letters and existing player artwork are unchanged. */
:root { --ice-rhythm-mid: 0; --ice-rhythm-snare: 0; --ice-rhythm-groove: 0; }
/* The heading inherits the shared palette; its existing beat algorithm is unchanged. */
.ice-palette .ice-palette__grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.ice-palette__status,.ice-palette__note { font: 9px/1.6 var(--font-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted-foreground); }
.ice-palette__status { margin: 8px 0 12px; color: var(--primary); }
.ice-palette__note { margin: 12px 0 0; }

/* The original palette now reaches the player's previously fixed cyan accent. */
.ice-live { --ice-accent: var(--primary); }
.ice-live .ice-live__format[aria-pressed=true] { background: color-mix(in srgb,var(--ice-accent) 8%,transparent); }
.ice-live .ice-live__play { color: var(--primary-foreground); }
.ice-live__volume input, .ice-live__timeline input { accent-color: var(--ice-accent); }
html[data-ice-rhythm-active=true] .ice-live:has(> .ice-live__panel[data-audio-active=true]) {
  border-color: color-mix(in srgb,var(--primary) 25%,transparent);
  box-shadow: 0 0 calc(8px + var(--ice-rhythm-snare)*58px) color-mix(in srgb,var(--primary) 24%,transparent),
    inset 0 0 calc(3px + var(--ice-rhythm-mid)*22px + var(--ice-rhythm-snare)*18px) color-mix(in srgb,var(--primary) 16%,transparent),
    0 18px 55px rgba(0,0,0,.72);
}

/* The main player's top and side glow stops at the footer divider.
   Move only the decorative lower shadow edge out of view, keeping the
   side light straight to the join. The player box and its content stay put. */
.ice-broadcast-frame .ice-live { position: relative; isolation: isolate; }
html[data-ice-rhythm-active=true] .ice-broadcast-frame .ice-live:has(> .ice-live__panel[data-audio-active=true]) {
  box-shadow: none;
}
html[data-ice-rhythm-active=true] .ice-broadcast-frame .ice-live:has(> .ice-live__panel[data-audio-active=true])::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  inset: -1px;
  bottom: -128px;
  box-sizing: border-box;
  border: 1px solid transparent;
  clip-path: inset(-128px -128px 128px);
  box-shadow: 0 0 calc(8px + var(--ice-rhythm-snare)*58px) color-mix(in srgb,var(--primary) 24%,transparent),
    inset 0 0 calc(3px + var(--ice-rhythm-mid)*22px + var(--ice-rhythm-snare)*18px) color-mix(in srgb,var(--primary) 16%,transparent),
    0 18px 55px rgba(0,0,0,.72);
}

/* A three-sided footer glow, with a separate 1px neutral top divider.
   Extend only the shadow surface upwards, then clip it at the join. This
   removes the shadow's top edge (including its inset light) while retaining
   the original left/right/bottom geometry and all rhythm coefficients.
   128px covers the full blur reach at the existing maximum signal of 1. */
.ice-broadcast-frame .ice-broadcast-footer {
  position: relative;
  isolation: isolate;
  border-top-color: #29414A;
}
html[data-ice-rhythm-active=true] .ice-broadcast-footer {
  border-color: color-mix(in srgb,var(--primary) 25%,transparent);
  border-top-color: #29414A;
}
html[data-ice-rhythm-active=true] .ice-broadcast-footer::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  inset: -1px;
  top: -129px;
  box-sizing: border-box;
  border: 1px solid transparent;
  clip-path: inset(128px -128px -128px);
  box-shadow: 0 0 calc(8px + var(--ice-rhythm-snare)*58px) color-mix(in srgb,var(--primary) 24%,transparent),
    inset 0 0 calc(3px + var(--ice-rhythm-mid)*22px + var(--ice-rhythm-snare)*18px) color-mix(in srgb,var(--primary) 16%,transparent),
    0 18px 55px rgba(0,0,0,.72);
}

/* Neutral horizontal dividers inside the main Broadcast player. */
.ice-broadcast-frame .ice-live__heading,
.ice-broadcast-frame .ice-live__now-playing { border-bottom-color: #29414A; }
.ice-broadcast-frame .ice-live__settings { border-top-color: #29414A; }

/* The two original music-reactive icons: subtle lift, scale and light. */
.ice-broadcast-credit > svg, .ice-broadcast-certification > svg {
  transform-origin: center;
  transition: color 160ms ease, opacity 80ms linear, filter 80ms ease-out, transform 80ms ease-out;
}
html[data-ice-rhythm-active=true] :is(.ice-broadcast-credit > svg,.ice-broadcast-certification > svg) {
  color: var(--primary);
  opacity: calc(.62 + var(--ice-rhythm-mid)*.38);
  filter: drop-shadow(0 0 calc(1px + var(--ice-rhythm-snare)*5px) color-mix(in srgb,var(--primary) 52%,transparent));
  transform: translateY(calc(var(--ice-rhythm-snare)*-1px)) scale(calc(1 + var(--ice-rhythm-groove)*.1));
}
.ice-broadcast-emblem { transform-origin: center; transition: color 160ms ease, opacity 80ms linear, filter 80ms ease-out, transform 80ms ease-out; }
html[data-ice-rhythm-active=true] .ice-broadcast-emblem {
  color: var(--primary); opacity: calc(.68 + var(--ice-rhythm-mid)*.32);
  filter: drop-shadow(0 0 calc(2px + var(--ice-rhythm-snare)*7px) color-mix(in srgb,var(--primary) 58%,transparent));
  transform: translateY(calc(var(--ice-rhythm-snare)*-1px)) scale(calc(1 + var(--ice-rhythm-groove)*.1));
}
.mobile-nav-button__icon, .ice-stream-tab__broadcast svg { transition: color 180ms ease, filter 90ms ease-out, transform 90ms ease-out, box-shadow 90ms ease-out; }
html[data-ice-rhythm-active=true] .mobile-nav-button__icon {
  color: var(--primary);
  border-color: color-mix(in srgb,var(--primary) calc(38% + var(--ice-rhythm-snare)*42%),rgba(255,255,255,.12));
  background: color-mix(in srgb,var(--primary) calc(7% + var(--ice-rhythm-mid)*8%),rgba(1,2,3,.94));
  box-shadow: 0 0 calc(7px + var(--ice-rhythm-snare)*24px) color-mix(in srgb,var(--primary) 34%,transparent);
  transform: scale(calc(1 + var(--ice-rhythm-groove)*.08));
}
html[data-ice-rhythm-active=true] .mobile-nav-button__icon svg { fill: color-mix(in srgb,var(--primary) 18%,transparent); }
html[data-ice-rhythm-active=true] .ice-stream-tab__broadcast svg {
  filter: drop-shadow(0 0 calc(3px + var(--ice-rhythm-snare)*10px) color-mix(in srgb,var(--primary) 72%,transparent));
  transform: scale(calc(1 + var(--ice-rhythm-groove)*.2));
}

/* Keep the image clear. Restore the artwork and 24-band light behind it,
   with only the original ambient 0.045 tint above the lettering. */
.ice-rhythm-logo__artwork {
  position: absolute; z-index: 0; inset: -42% -10%; pointer-events: none;
  background-image: linear-gradient(rgba(10,156,188,.96),rgba(10,156,188,.78)),url('../assets/001-iwa-original.jpg');
  background-position: center; background-size: cover; background-blend-mode: multiply;
  filter: grayscale(.35) brightness(.48) contrast(1.55); opacity: 0;
  transform-origin: center;
  animation: ice-rhythm-artwork-drift var(--logo-drift-duration) ease-in-out infinite alternate;
  animation-play-state: paused;
  transition: opacity 900ms ease,filter 900ms ease;
}
.ice-rhythm-logo__spectrum { position:absolute; z-index:0; inset:8% 1.5%; width:auto; height:auto; opacity:0; }
.ice-rhythm-logo__tint {
  position:absolute; z-index:2; inset:0; pointer-events:none;
  background:radial-gradient(ellipse at 50% 50%,color-mix(in srgb,var(--primary) 48%,transparent),transparent 58%),
    linear-gradient(90deg,transparent 8%,color-mix(in srgb,var(--primary) 24%,transparent) 50%,transparent 92%);
  mix-blend-mode:screen; opacity:0; transition:opacity 1350ms ease-out;
}
.ice-conductor-logo { transition:box-shadow 500ms ease; }
html[data-ice-rhythm-active=true] .ice-conductor-logo {
  box-shadow:0 0 calc(8px + var(--ice-rhythm-snare)*58px) color-mix(in srgb,var(--primary) 24%,transparent),
    inset 0 0 calc(3px + var(--ice-rhythm-mid)*22px + var(--ice-rhythm-snare)*18px) color-mix(in srgb,var(--primary) 16%,transparent);
  transition:box-shadow 72ms linear;
}
html[data-ice-rhythm-active=true] .ice-conductor-logo__light {
  background:radial-gradient(ellipse at 50% 50%,color-mix(in srgb,var(--primary) 18%,transparent),color-mix(in srgb,var(--primary) 5.5%,transparent) 58%,transparent 88%);
}
html[data-ice-rhythm-active=true] .ice-rhythm-logo__artwork {
  opacity:calc(.12 + var(--ice-rhythm-mid)*.075 + var(--ice-rhythm-snare)*.11 + var(--ice-rhythm-groove)*.055);
  filter:grayscale(.15) brightness(.58) contrast(1.65); animation-play-state:running;
}
html[data-ice-rhythm-active=true] .ice-rhythm-logo__spectrum { opacity:calc(.1 + var(--ice-rhythm-mid)*.18 + var(--ice-rhythm-snare)*.3 + var(--ice-rhythm-groove)*.12); }
html[data-ice-rhythm-active=true] .ice-rhythm-logo__tint { opacity:.045; }
@keyframes ice-rhythm-artwork-drift {
  from { transform:translate3d(var(--logo-drift-from-x),var(--logo-drift-from-y),0) rotate(var(--logo-drift-from-turn)) scale(1.08); }
  to { transform:translate3d(var(--logo-drift-to-x),var(--logo-drift-to-y),0) rotate(var(--logo-drift-to-turn)) scale(1.08); }
}
@media(prefers-reduced-motion:reduce) {
  .ice-rhythm-logo__artwork { animation:none; }
  .ice-rhythm-logo__artwork,.ice-rhythm-logo__spectrum,.ice-rhythm-logo__tint { opacity:0!important; transition:none; }
  .ice-broadcast-credit > svg,.ice-broadcast-certification > svg,.ice-broadcast-emblem,.mobile-nav-button__icon,.ice-stream-tab__broadcast svg { transition:none; transform:none!important; filter:none!important; }
  .ice-conductor-logo { transition:none; }
}
