/* Audio Magic Lab: am01 (loaded only where used; split from components/demos in task 0056). */

/* =====================================================================
   AM-01 × Lindy Studio, wall-mounted at true proportions (docs/reference/AM01-PROTOTYPE.md §1.2):
   bar length 6.5 S · bar height 0.62 S · screen S square, standing proud and centred on the bar.
   The stage is a window onto the wall; the camera follows the screen along a bar wider than the view.
   Layers (docs/LAYERS.md): bar-face.jpg, screen-glass.png + CSS light and shadow that move with the screen.
   JS sets --x (screen along the bar), --cam (camera), --lx (light offset, -1..1), --p (presence).
   ===================================================================== */
.am01 { --S: min(300px, calc((min(100vw, 1280px) - 2 * var(--gutter)) / 6.62)); position: relative;   /* the whole 6.5 S bar fits the width (C37) */
   isolation: isolate; overflow: hidden; overflow: clip; }
.am01__stage { position: relative; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.am01__view {
  position: relative;
  height: calc(var(--S) * 1.9);
  max-width: calc(var(--S) * 6.62); margin-inline: auto;
  overflow: visible;
}
/* from afar the room dims a touch, so the screen reads as a lit picture */
.am01__view::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse 55% 80% at 50% 50%, rgba(60, 40, 30, 0), rgba(60, 40, 30, .12));
  opacity: calc(1 - var(--p, 0)); transition: opacity .6s var(--ease);
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 40%, transparent 100%); mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 40%, transparent 100%);
}
.am01__world {
  position: absolute; left: 0; top: 50%;
  width: calc(var(--S) * 6.5); height: var(--S);
  margin-top: calc(var(--S) * -.5);
  transform: translate3d(var(--cam, 0px), 0, 0);
  will-change: transform;
}
/* the bar: Louis's wood layer, with light from the upper left and its own soft shadow on the wall */
.am01__bar {
  position: absolute; left: 0; right: 0; top: 50%;
  height: calc(var(--S) * .62); margin-top: calc(var(--S) * -.31);
  border-radius: 2px; overflow: hidden;
  background: #C6925F;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 -1px 0 rgba(90, 60, 30, .18) inset;
}
.am01__bar-face { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.am01__bar-shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, .1) 0, rgba(80, 50, 20, .1) 100%),
    linear-gradient(90deg, rgba(255, 248, 235, .16), rgba(255, 248, 235, 0) 40%, rgba(60, 35, 15, .08));
  box-shadow: inset -1px -1px 3px rgba(0,0,0,0.2), inset 1px 1px 3px rgba(255,255,255,0.3);
}
.am01__bar-shadow {
  position: absolute; left: 1.5%; right: -1%; top: 50%;
  height: calc(var(--S) * .62); margin-top: calc(var(--S) * -.22);
  border-radius: 12px;
  background: rgba(50, 30, 15, .26);
  filter: blur(calc(var(--S) * .08));
  transform: translate3d(calc(var(--S) * .05), calc(var(--S) * .09), 0);
}
/* the sled carries the screen, its cast shadow on the wall and its contact shadow on the bar */
.am01__sled {
  position: absolute; left: 0; top: 0;
  width: var(--S); height: var(--S);
  transform: translate3d(var(--x, 0px), 0, 0);
  will-change: transform;
}
.am01__cast {
  position: absolute; inset: 4%; border-radius: 10px;
  background: rgba(35, 20, 10, .42);
  filter: blur(calc(var(--S) * .08));
  transform: translate3d(calc(var(--S) * (.07 + var(--lx, 0) * .05)), calc(var(--S) * .1), 0) scale(1.02);
}
.am01__contact {
  position: absolute; left: -6%; right: -6%; top: 19%; bottom: 19%;
  background: radial-gradient(ellipse 60% 55% at calc(50% + var(--lx, 0) * 6%) 58%, rgba(40, 22, 8, .5), rgba(40, 22, 8, 0) 70%);
  mix-blend-mode: multiply;
}
.am01__screen {
  position: absolute; inset: 0;
  border-radius: 4px;
  background: #0A0A0A;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .8), 1px 1px 0 rgba(255, 255, 255, .06) inset;
  cursor: grab; touch-action: pan-y; outline: none;
}
.am01.is-dragging .am01__screen { cursor: grabbing; }
.am01__screen:focus-visible { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--focus); }
/* Louis's glass layer on top of the display, plus a sheen that slides as the screen moves under the light */
.am01__glass { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; mix-blend-mode: screen; opacity: .32; display: block; max-width: none; }
.am01__sheen {
  position: absolute; inset: 0; pointer-events: none; border-radius: 4px;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .11) 42%, rgba(255, 255, 255, 0) 55%);
  background-size: 260% 100%;
  background-position: calc(50% + var(--lx, 0) * 40%) 0;
}
.am01__display {
  --D: calc(var(--S) * .877);                      /* the glass: 0.877 S (bezel ≈ 6% per side) */
  position: absolute; inset: 6.15%;
  overflow: hidden;
  background: #000;
  isolation: isolate;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;   /* the prototype's UI face */
}
.am01__flow { position: absolute; inset: 0; transition: filter .2s ease; }
.am01.is-fast .am01__flow { filter: brightness(.45) blur(1.5px); }
/* fast travel: the covers streak (PRD 4.2) */
.am01__cover {
  position: absolute; left: 50%; top: 50%;
  width: var(--D); height: var(--D);
  margin: calc(var(--D) * -.5) 0 0 calc(var(--D) * -.5);
  background: #1a1a1a center / cover no-repeat;
  border-radius: calc(var(--D) * .03 * var(--p, 0));   /* squircle-ish corners only when browsing */
  backface-visibility: hidden;
  will-change: transform, filter;
}
/* artist and title ride under the centre cover; controls sit to the right, as in the prototype */
.am01__meta {
  position: absolute; left: 50%; z-index: 2000;
  top: calc(50% + var(--A, 0px) / 2 + var(--D) * .03);
  width: var(--A, 0px); transform: translateX(-50%);
  display: flex; align-items: center; gap: calc(var(--D) * .03);
  color: #fff;
  opacity: calc((var(--p, 0) - .5) * 2.4);
  pointer-events: none;
}
.am01.is-near .am01__meta { pointer-events: auto; }
.am01__lines { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: calc(var(--D) * .008); }
.am01__artist, .am01__title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am01__artist { font-size: calc(var(--D) * .05); font-weight: 600; line-height: 1.15; }
.am01__title { font-size: calc(var(--D) * .042); font-weight: 400; line-height: 1.15; color: #8a8a8a; }
.am01.is-playing.is-here .am01__title { color: var(--accent-now, #bbb); }
.am01__controls { display: flex; align-items: center; gap: calc(var(--D) * .012); }
.am01__ctl { position: relative; width: calc(var(--D) * .085); height: calc(var(--D) * .085); border: 0; padding: 0; background: none; color: #fff; cursor: pointer; opacity: .55; border-radius: 50%; }
.am01__ctl--play { opacity: 1; }
.am01__ctl:hover { opacity: 1; background: rgba(255, 255, 255, .08); }
.am01__ctl i { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.am01.is-playing.is-here .ic-play { width: calc(var(--D) * .032); height: calc(var(--D) * .04); border: 0; border-left: calc(var(--D) * .011) solid; border-right: calc(var(--D) * .011) solid; margin-left: 0; }
.am01__progress { position: absolute; left: 0; right: 0; bottom: calc(var(--D) * -.035); height: 2px; background: rgba(255, 255, 255, .14); opacity: 0; transition: opacity .6s var(--ease); }
.am01__progress i { position: absolute; inset: 0; background: rgba(255, 255, 255, .75); transform-origin: left; transform: scaleX(0); animation: am01-progress 42s linear infinite; animation-play-state: paused; }
.am01.is-playing.is-here .am01__progress { opacity: 1; }
.am01.is-playing .am01__progress i { animation-play-state: running; }
@keyframes am01-progress { to { transform: scaleX(1); } }
.am01__halo {
  position: absolute; left: calc(var(--S) * -.9); top: calc(var(--S) * -.6); width: calc(var(--S) * 2.8); height: calc(var(--S) * 2.2);
  pointer-events: none; border-radius: 50%;
  background: radial-gradient(closest-side, var(--amb, #F6C9A0), transparent 70%);
  opacity: 0; transition: opacity 1.4s var(--ease), background .8s var(--ease);
}
.am01.is-playing .am01__halo { opacity: .5; animation: am01-breathe 3.2s ease-in-out infinite alternate; }
@keyframes am01-breathe { from { opacity: .32; } to { opacity: .58; } }
.am01__hint {
  margin: var(--s-2) auto 0;
  text-align: center;
  font: italic 500 var(--fs-value)/1.4 var(--serif);
  color: var(--ink-soft);
  transition: opacity 1.2s var(--ease), transform 1.2s var(--ease);
  position: relative; z-index: 1;
}
.am01.is-used .am01__hint, .am01.is-played .am01__hint { opacity: 0; transform: translateY(6px); }
.am01__fallback { display: none; max-width: 960px; margin: 0 auto; }
html:not(.js) .am01__stage { display: none; }
html:not(.js) .am01__fallback { display: block; }
@media (hover: none), (pointer: coarse) {
  .am01__ctl { pointer-events: none; }
}
.am01__flow { list-style: none; margin: 0; padding: 0; }
.am01__cover { display: block; }
/* the controls appear with the cover flow */
.am01__controls { transition: opacity .25s var(--ease); }
.am01:not([data-preset="browse"]) .am01__controls { opacity: 0; pointer-events: none; }
/* the motor at work: the UI dims a touch while the screen glides by itself (PRD 4.2) */
.am01.is-ghost .am01__flow { filter: brightness(.82); }
/* the playing album breathes, in its own colour (CSS only: no frames while it plays) */
.am01__cover.is-playing::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 calc(var(--D) * .08) calc(var(--D) * .01) var(--accent); opacity: .0; animation: cover-breathe 3.4s ease-in-out infinite alternate; }
@keyframes cover-breathe { from { opacity: .15; } to { opacity: .6; } }

/* tiny screens: the proportion wins (C12, C37); the on-screen text would be unreadable, so the cover flow carries it alone */
@media (max-width: 600px) { .am01__meta { display: none; } .am01 .am01__hint { font-size: var(--fs-small); } }
@media (max-width: 600px) {
  .am01 { --S: calc((100vw - 16px) / 6.62); padding-inline: 8px; }
}
@media (pointer: coarse) {
  .am01__screen::before { content: ''; position: absolute; inset: -18px -20px; border-radius: 12px; }
}


/* the drag cue: rides under the screen while it shows itself; gone the moment a hand takes over (2026-10-03) */
.am01__drag { position: absolute; left: 50%; top: calc(100% + var(--S) * .14); transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  font: 500 11px/1 var(--sans); letter-spacing: .24em; text-transform: uppercase; color: var(--ink-strong); transition: opacity .4s var(--ease); }
.am01__drag i { display: inline-block; font-style: normal; }
.am01:not(.is-taken) .am01__drag i { animation: drag-l 1.7s var(--ease) infinite; }   /* only while it is showing: the demo can sleep */
.am01:not(.is-taken) .am01__drag i + i { animation-name: drag-r; }
@keyframes drag-l { 50% { transform: translateX(-4px); } }
@keyframes drag-r { 50% { transform: translateX(4px); } }
.am01.is-taken .am01__drag, .am01.is-dragging .am01__drag { opacity: 0; }
.am01.is-dragged .am01__drag { display: none; }
@media (prefers-reduced-motion: reduce) { .am01__drag i { animation: none; } }
