/* ==========================================================================
   RepuNEXT TV — media equipment art (homepage only, loaded after front-page.css)

   Markup:    template-parts/media-art/*.php (decorative, aria-hidden)
   Behaviour: assets/js/media-art.js adds
                .is-shown  once, when the piece first scrolls into view
                .is-live   while it is on screen (animations pause otherwise)
                .is-focus  on the camera while a Collaborate button is hovered/focused

   1. Clapperboard  – Top Picks heading     – snaps shut once ("Action!")
   2. Spotlights    – Instagram feed corners – slow cinematic light sweep
   3. Camera        – Collaborate card edge  – idle float, aims + opens iris on hover
   4. Studio rig    – Channels heading       – mic aims at the cursor, headphones swing
   Each piece uses its own kind of motion (once / sweep / hover-reactive / mouse-following).
   ========================================================================== */

.media-art { --rec: #FF4D5E; pointer-events: none; }
.media-art svg { display: block; width: 100%; height: auto; overflow: visible; }
/* Save work: nothing animates while the piece is off screen. */
.media-art:not(.is-live) *,
.media-art:not(.is-live)::before,
.media-art:not(.is-live)::after { animation-play-state: paused !important; }

/* ---------- 1. Clapperboard (Top Picks) ---------- */
.picks-title-row { display: flex; align-items: flex-end; gap: clamp(10px, 1.4vw, 18px); margin-top: 14px; }
.picks-title-row .section-title { margin-top: 0; }
.media-clapper { flex: none; width: clamp(40px, 4.4vw, 60px); margin-bottom: .3em; pointer-events: auto; }
.media-clapper__body  { fill: var(--ink); }
.media-clapper__stick { fill: var(--ink-deep); }
.media-clapper__stripe { fill: #fff; }
.media-clapper__stripe--arm { fill: var(--sq-7); }
.media-clapper__line  { fill: rgba(255,255,255,.28); }
.media-clapper__hinge { fill: var(--sq-5); }
.media-clapper__rec   { fill: var(--rec); }
.media-clapper__arm {
  transform-box: view-box; transform-origin: 9px 23px;
  transition: transform .5s cubic-bezier(.5, -0.4, .3, 1.4);
}
/* Before it is revealed: arm open, REC off. Reveal: snap shut, REC blinks 3× then stays on. */
.js .media-clapper:not(.is-shown) .media-clapper__arm { transform: rotate(-28deg); transition: none; }
.js .media-clapper:not(.is-shown) .media-clapper__rec { opacity: .2; }
.media-clapper.is-shown .media-clapper__arm { transition-delay: .45s; }
.media-clapper.is-shown .media-clapper__rec { animation: media-rec-blink .5s steps(1) .95s 3 both; }
/* Hover: lift the arm, snap it back on leave. */
.media-clapper:hover .media-clapper__arm { transform: rotate(-22deg); transition: transform .25s var(--ease-out); }
@keyframes media-rec-blink { 50% { opacity: .15; } }

/* ---------- 2. Studio spotlights (Instagram feed, top corners) ---------- */
.media-spots { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.media-spot {
  position: absolute; top: -6px;
  width: clamp(56px, 6vw, 84px);
}
.media-spot--left  { left: clamp(8px, 4vw, 64px); }
.media-spot--right { right: clamp(8px, 4vw, 64px); }
.media-spot__head {
  position: relative; display: block;
  transform-origin: 50% 6%;
  animation: media-spot-pan 11s ease-in-out infinite alternate;
}
.media-spot--left  .media-spot__head { --from: -34deg; --to: -12deg; }
.media-spot--right .media-spot__head { --from: 34deg;  --to: 10deg; animation-duration: 13.5s; animation-delay: -4s; }
@keyframes media-spot-pan { from { transform: rotate(var(--from)); } to { transform: rotate(var(--to)); } }
.media-spot__fixture { position: relative; z-index: 1; filter: drop-shadow(0 6px 12px rgba(0,0,0,.45)); }
.media-spot__metal { fill: #3A4F66; }
.media-spot__yoke  { fill: none; stroke: #4A6079; stroke-width: 5; stroke-linecap: round; }
.media-spot__can   { fill: #15263A; stroke: rgba(255,255,255,.22); stroke-width: 1.5; }
.media-spot__vent  { fill: rgba(255,255,255,.12); }
.media-spot__door  { fill: #1E3248; stroke: rgba(255,255,255,.18); stroke-width: 1; }
.media-spot__lens  { fill: #DFFBF4; }
/* Light cone: starts at the lens, fans out downwards behind the cards. */
.media-spot__beam {
  position: absolute; left: 50%; top: 72%;
  width: 46vw; max-width: 760px; height: 150vh;
  transform: translateX(-50%);
  background: linear-gradient(to bottom, rgba(82,194,166,.22), rgba(3,174,184,.09) 35%, rgba(3,174,184,0) 75%);
  clip-path: polygon(48% 0, 52% 0, 100% 100%, 0 100%);
  animation: media-spot-flicker 7s ease-in-out infinite;
}
.media-spot--right .media-spot__beam {
  background: linear-gradient(to bottom, rgba(0,138,176,.24), rgba(0,81,126,.09) 35%, rgba(0,81,126,0) 75%);
  animation-delay: -3s;
}
@keyframes media-spot-flicker { 0%, 100% { opacity: .85; } 50% { opacity: 1; } }

/* ---------- 3. Cinema camera (Collaborate card, top-right edge) ---------- */
.collab__card { position: relative; }
.media-camera {
  position: absolute; z-index: 2;
  right: clamp(16px, 5%, 56px);
  bottom: calc(100% - 14px);              /* tripod plate rests on the card's top edge */
  width: clamp(116px, 12vw, 156px);
}
.media-camera__rig { transform-box: view-box; transform-origin: 118px 120px; animation: media-camera-float 6s ease-in-out infinite alternate; transition: rotate .6s var(--ease-out); }
@keyframes media-camera-float { from { transform: translateY(0); } to { transform: translateY(-4px); } }
.media-camera__plate   { fill: var(--ink-deep); }
.media-camera__handle  { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.media-camera__monitor { fill: var(--ink); }
.media-camera__screen  { fill: #0E3550; transition: fill .4s; }
.media-camera__arm     { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.media-camera__body    { fill: var(--ink); }
.media-camera__panel   { fill: rgba(255,255,255,.14); }
.media-camera__dial    { fill: var(--sq-2); stroke: rgba(255,255,255,.25); stroke-width: 1.5; }
.media-camera__rec     { fill: var(--rec); opacity: .25; transition: opacity .3s; }
.media-camera__barrel  { fill: var(--ink-deep); }
.media-camera__hood    { fill: var(--ink-deep); stroke: var(--ink); stroke-width: 3; }
.media-camera__focus {
  fill: none; stroke: var(--sq-7); stroke-width: 3; stroke-dasharray: 2 5; opacity: .8;
  transform-box: fill-box; transform-origin: center;
  animation: media-camera-focus 18s linear infinite;
  transition: stroke .3s;
}
@keyframes media-camera-focus { to { transform: rotate(360deg); } }
.media-camera__iris  { fill: none; stroke: var(--ink-deep); stroke-width: 22; transition: stroke-width .6s var(--ease-out); }
.media-camera__glint { fill: none; stroke: rgba(255,255,255,.75); stroke-width: 2.5; stroke-linecap: round; opacity: .5; transition: opacity .4s; }
/* Hover/focus on "Suggest a Topic" / "Brand Collaborations": aim, open the iris, go live. */
.media-camera.is-focus .media-camera__rig    { rotate: -3deg; }
.media-camera.is-focus .media-camera__iris   { stroke-width: 8; }
.media-camera.is-focus .media-camera__focus  { animation-duration: 3s; stroke: var(--sq-5); }
.media-camera.is-focus .media-camera__glint  { opacity: 1; }
.media-camera.is-focus .media-camera__rec    { opacity: 1; animation: media-rec-blink 1s steps(1) infinite; }
.media-camera.is-focus .media-camera__screen { fill: var(--sq-3); }

/* ---------- 4. Studio rig: boom-arm mic + headphones (Channels heading, right side) ---------- */
.channels .section-head { position: relative; }
.media-rig {
  position: absolute; right: 0; top: -8px;
  width: clamp(210px, 24vw, 300px);
}
.media-rig__clamp  { fill: var(--ink-deep); }
.media-rig__arm path { fill: none; stroke: var(--ink); stroke-width: 3.5; stroke-linecap: round; }
.media-rig__spring { fill: none; stroke: var(--sq-4); stroke-width: 1.6; stroke-linejoin: round; }
.media-rig__joint  { fill: var(--ink-deep); stroke: var(--sq-5); stroke-width: 2; }
/* Headphones: swing like a pendulum from the elbow joint */
.media-rig__phones {
  transform-box: view-box; transform-origin: 236px 80px;
  rotate: var(--swing, 0deg);
  transition: rotate 1.1s cubic-bezier(.25, 1.6, .4, 1);   /* overshoot = pendulum feel */
  animation: media-rig-sway 7s ease-in-out infinite alternate;
}
@keyframes media-rig-sway { from { transform: rotate(-2.5deg); } to { transform: rotate(2.5deg); } }
.media-rig__hook     { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.media-rig__band     { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }
.media-rig__cup      { fill: var(--ink); }
.media-rig__cushion  { fill: var(--sq-7); }
/* Microphone: aims towards the cursor (around its shock mount) */
.media-rig__mic {
  transform-box: view-box; transform-origin: 160px 62px;
  rotate: var(--aim, 0deg);
  transition: rotate .7s var(--ease-out);
  animation: media-rig-breathe 5s ease-in-out infinite alternate;
}
@keyframes media-rig-breathe { from { transform: rotate(-1.5deg); } to { transform: rotate(1.5deg); } }
.media-rig__mount  { fill: none; stroke: var(--sq-5); stroke-width: 2.5; }
.media-rig__body   { fill: var(--ink); }
.media-rig__grille { fill: var(--sq-2); }
.media-rig__mesh   { fill: none; stroke: rgba(255,255,255,.35); stroke-width: 1.4; }
.media-rig__ring   { fill: var(--sq-5); }
.media-rig__led    { fill: var(--sq-7); animation: media-rig-led 2.4s ease-in-out infinite; }
@keyframes media-rig-led { 50% { opacity: .35; } }
.media-rig__neck   { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.media-rig__pop    { fill: rgba(3,174,184,.12); stroke: var(--ink); stroke-width: 3; }
/* While following the mouse, the idle motion steps aside. */
.media-rig.is-tracking .media-rig__mic,
.media-rig.is-tracking .media-rig__phones { animation: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .media-spot { width: 54px; }
  .media-spot__beam { width: 70vw; }
}
@media (max-width: 600px) {
  .media-camera { display: none; }                         /* no room above the card on phones */
  .media-rig { display: none; }                            /* the title uses the full width on phones */
  .media-spot { width: 44px; opacity: .85; }
  .media-spot--left  { left: 6px; }
  .media-spot--right { right: 6px; }
}

/* ---------- Reduced motion: still illustrations, final states ---------- */
@media (prefers-reduced-motion: reduce) {
  .media-art *, .media-art::before, .media-art::after { animation: none !important; transition: none !important; }
  .js .media-clapper:not(.is-shown) .media-clapper__arm { transform: none; }
  .js .media-clapper:not(.is-shown) .media-clapper__rec { opacity: 1; }
  .media-spot--left  .media-spot__head { transform: rotate(-22deg); }
  .media-spot--right .media-spot__head { transform: rotate(22deg); }
}
