/* Four product demos — co-composed with chapter text (may overlap). */

:root {
  --dl-gutter: max(1rem, calc((100vw - min(1120px, calc(100% - 2rem))) / 2));
  /* Full layout width (same as chrome), not the old 980px cap */
  --dl-mac-w: 100%;
  /* Cap phone zoom so widening the Mac desk does not grow the mini-app */
  --dl-phone-zoom-max: 0.72;
}

.dl-scene-demo {
  position: absolute;
  z-index: 2;
  top: calc(var(--dl-chrome-h, 64px) + 0.25rem);
  bottom: 1rem;
  left: 50%;
  right: auto;
  width: var(--dl-layout, min(1120px, calc(100% - 2rem)));
  margin: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  box-sizing: border-box;
  overflow: visible;
  container-type: size;
  transform: translate3d(-50%, 0, 0);
  transform-origin: 50% 50%;
  backface-visibility: hidden;
}

.dl-scene-demo.is-live {
  pointer-events: auto;
}

.dl-scene-demo.is-morphing {
  will-change: opacity, transform;
}

/* Mac frame — full layout width on every step */
.dl-scene-demo .dl-mac {
  width: var(--dl-mac-w);
  max-width: 100%;
  max-height: 100%;
  height: auto;
  aspect-ratio: var(--dl-mac-ar, 16 / 10.4);
  min-width: 0;
  margin: 0 auto;
  /* drop-shadow filter + scaled phone = same tear on hero cards */
  filter: none;
  box-shadow: 0 28px 56px rgba(0, 0, 0, 0.5);
}

.dl-scene-demo .dl-phone-fit {
  top: 36px;
  right: 4%;
  bottom: 4%;
  left: 78px;
}

/* Keep mini-app size stable when Mac stretches to layout width */
.dl-scene-demo .dl-phone-scale {
  zoom: min(
    calc(100cqw / 400px),
    calc(100cqh / 820px),
    var(--dl-phone-zoom-max)
  );
}

@supports not (zoom: 1) {
  .dl-scene-demo .dl-phone-fit .dl-phone-scale {
    transform: translate(-50%, -50%)
      scale(
        min(
          calc(100cqw / 400),
          calc(100cqh / 820),
          var(--dl-phone-zoom-max)
        )
      );
  }
}

/* Shared phone chrome inside Mac */
.dl-scene-demo .dl-phone {
  position: relative;
  width: 400px;
  height: 820px;
  margin: 0;
  border-radius: 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #0b0c10;
  box-shadow:
    0 0 0 9px #15161c,
    0 36px 80px -28px rgba(0, 0, 0, 0.88),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

/*
  labd frost uses filter:blur + backdrop-filter + mask — Safari can still
  paint that as horizontal tear / “битые” edges. Kill GPU filters here;
  keep a solid frosted look via gradient only.
*/
.dl-scene-demo .labd-profile__hero-frost-photo,
.dl-scene-demo .labd-artist__hero-frost-photo {
  display: none !important;
}

.dl-scene-demo .labd-profile__hero-frost-blur,
.dl-scene-demo .labd-artist__hero-frost-blur {
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  height: 46% !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(10, 12, 18, 0.35) 28%,
    rgba(8, 10, 14, 0.82) 72%,
    rgba(6, 8, 12, 0.94) 100%
  );
  filter: none !important;
}

.dl-scene-demo .labd-profile__hero-frost-scrim,
.dl-scene-demo .labd-artist__hero-frost-scrim {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  filter: none !important;
}

.dl-scene-demo .labd-header,
.dl-scene-demo .labd-compose,
.dl-scene-demo .labd-dock,
.dl-scene-demo .labd-artist-player__bar,
.dl-scene-demo .labd-profile__score-card,
.dl-scene-demo .labd-profile__stat,
.dl-scene-demo .labd-score-status,
.dl-scene-demo .labd-profile__stat-chip,
.dl-scene-demo .labd-artist__stat,
.dl-scene-demo .labd-artist__follow,
.dl-scene-demo .labd-profile__photo-edit {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.dl-scene-demo .dl-phone__notch {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 8;
  width: 28%;
  height: 22px;
  transform: translateX(-50%);
  border-radius: 14px;
  background: #050506;
  pointer-events: none;
}

.dl-scene-demo .dl-phone__screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #07080d;
  color: var(--labd-fg, #f3f5f8);
  font-family: var(--labd-font, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif);
}

.dl-scene-demo .dl-phone__screen .labd-app {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dl-scene-demo .dl-phone__screen .labd-header {
  position: absolute !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  flex: 0 0 auto;
}

.dl-scene-demo .dl-phone__screen .labd-view {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  height: 100%;
}

.dl-scene-demo .dl-phone__screen .labd-view--scroll,
.dl-scene-demo .labd-view--scroll {
  overflow: hidden !important;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  pointer-events: none;
}

.dl-scene-demo .dl-phone *::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.dl-scene-demo .dl-phone__screen .labd-feed {
  position: absolute;
  inset: 0;
  overflow: hidden;
  height: 100%;
}

.dl-scene-demo .dl-phone__screen .labd-feed__slide {
  position: absolute;
  inset: 0;
}

.dl-scene-demo .dl-phone__screen.labd--compose-on .labd-compose,
.dl-scene-demo .dl-phone__screen .labd-compose {
  display: flex;
  position: absolute !important;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  pointer-events: none;
}

/* Feed switch transition */
.dl-scene-demo .labd-feed__slide.is-switching .labd-feed__cover,
.dl-scene-demo .labd-feed__slide.is-switching .labd-feed__meta {
  opacity: 0.35;
  transition: opacity 0.35s ease;
}

.dl-scene-demo .labd-feed__cover,
.dl-scene-demo .labd-feed__meta {
  transition: opacity 0.35s ease;
}

/* Feedback sheets — real labd bottom-sheet inside phone frame */
.dl-scene-demo .labd-comments,
.dl-scene-demo .labd-review {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  /* kill labd fixed + compose offset inside scaled phone */
  bottom: 0 !important;
}

.dl-scene-demo .labd-comments[hidden],
.dl-scene-demo .labd-review[hidden] {
  display: none !important;
}

.dl-scene-demo .labd-comments--open,
.dl-scene-demo .labd-review--open {
  pointer-events: auto;
}

.dl-scene-demo .labd-comments__sheet,
.dl-scene-demo .labd-review__sheet {
  max-width: none;
  width: 100%;
}

.dl-scene-demo .labd-comments__composer.is-pressed,
.dl-scene-demo .labd-review__submit.is-pressed,
.dl-scene-demo .labd-review__token.is-pressed {
  transform: scale(0.97);
  filter: brightness(1.08);
}

.dl-scene-demo .labd-comments__card.is-new {
  animation: dl-comment-in 0.45s ease;
}

@keyframes dl-comment-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Score level-up */
.dl-scene-demo .labd-profile__score-card.is-level-up {
  box-shadow: 0 0 0 1px rgba(111, 168, 255, 0.55), 0 0 28px rgba(111, 168, 255, 0.35);
  transform: scale(1.03);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.dl-scene-demo .labd-profile__score-card-value {
  transition: transform 0.25s ease;
}

.dl-scene-demo .labd-profile__score-card.is-level-up .labd-profile__score-card-value {
  transform: scale(1.12);
  color: #73b8ff;
}

.dl-scene-demo .labd-profile {
  padding-bottom: 88px;
}

.dl-scene-demo .labd-profile__hero-frame,
.dl-scene-demo .labd-artist__hero-frame,
.dl-scene-demo .labd-profile__hero-meta,
.dl-scene-demo .labd-artist__hero-meta {
  transform: none;
  will-change: auto;
  backface-visibility: visible;
}

.dl-scene-demo .labd-profile__hero-photo,
.dl-scene-demo .labd-artist__hero-photo,
.dl-scene-demo .labd-artist__hero-frost-photo {
  transform: none;
}

.dl-scene-demo .labd-profile__hero-photo:not([hidden]),
.dl-scene-demo .labd-artist__hero-photo:not([hidden]),
.dl-scene-demo .labd-profile__hero-frost-photo:not([hidden]),
.dl-scene-demo .labd-artist__hero-frost-photo:not([hidden]) {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Artist public profile + bottom player (real labd chrome) */
.dl-scene-demo .labd-artist {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.dl-scene-demo .labd-artist__scene {
  flex: 0 0 auto;
}

.dl-scene-demo .labd-artist__catalog {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 12px 16px 96px;
}

.dl-scene-demo .labd-artist__tracks {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dl-scene-demo .labd-artist__listens {
  display: block !important;
  margin: 0.35rem 0 0;
  color: rgba(243, 245, 248, 0.7);
  font-size: 0.85rem;
}

.dl-scene-demo .labd-artist__follow {
  display: inline-flex !important;
}

/* body.labd--artist-listening rules don't apply inside phone — mirror them */
.dl-scene-demo .dl-phone__screen.labd--artist-listening .labd-artist-player {
  display: flex !important;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 18;
  padding: 0 12px 12px;
  pointer-events: none;
}

.dl-scene-demo .dl-phone__screen.labd--artist-listening .labd-artist-player__bar {
  pointer-events: none;
}

.dl-scene-demo .labd-artist-player.is-playing .labd-artist-player__seek-fill {
  transition: width 0.05s linear;
}

.dl-scene-demo .labd-artist__hero.is-listening {
  width: min(86%, 280px);
  margin: 18px auto 0;
}

@media (max-width: 900px) {
  .dl-scene-demo {
    left: 50%;
    width: min(92vw, 400px);
    top: 34%;
    bottom: 1.5%;
    transform: translateX(-50%);
    overflow: visible;
  }

  .dl-chapter,
  .dl-chapter--right {
    left: 1rem;
    right: 1rem;
    max-width: none;
    text-align: left;
    top: 12%;
  }

  .dl-chapter--right {
    text-align: left;
  }

  .dl-scene-demo .dl-mac {
    aspect-ratio: 400 / 820;
    width: min(100%, 340px);
    filter: none;
  }

  .dl-scene-demo .dl-mac__lid {
    padding: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }

  .dl-scene-demo .dl-mac__screen {
    border-radius: 42px;
    overflow: hidden;
  }

  .dl-scene-demo .dl-mac__wallpaper,
  .dl-scene-demo .dl-os,
  .dl-scene-demo .dl-os__desk,
  .dl-scene-demo .dl-os-toast {
    display: none;
  }

  .dl-scene-demo .dl-phone-fit {
    inset: 0;
  }
}

html.dl-reduced .dl-scene-demo {
  position: relative;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  width: min(var(--dl-layout, 1120px), 92vw);
  margin: 2rem auto;
  opacity: 1 !important;
  transform: none !important;
}
