/* ============================================================
  playlist_embed.css
  - blog_main.html 등에 include로 붙는 음악 작업(플레이리스트) 모듈 스타일
  - playlist.html의 구조/디자인(클래스)을 최대한 동일하게 재사용
  - 전역 오염 방지: .mw-embed 범위 안에서만 적용
============================================================ */

.mw-embed {
  /* playlist.html의 변수/톤을 모듈 내부에서 재현 */
  --bg-color: #ffffff;
  --accent: #172636;
  --accent-light: #2c4257;
  --text-primary: #222222;
  --text-secondary: #666666;
  --border-color: #e0e0e0;
  --light-gray: #f5f5f5;
  --progress-played: #2b7cff;
  --control-height: 40px;

  --player-pad-x-desktop: 100px;
  --player-pad-x-mobile: 60px;
  --player-pad-y: 12px;
  --player-pad-x: var(--player-pad-x-desktop);

  --max-width: 1200px;
}

.mw-embed * { box-sizing: border-box; }
.mw-embed .hidden { display: none !important; }

/* blog_main.html 전역 button:focus outline(검은 네모) 오버라이드
   - 클릭(마우스) 시에는 포커스 테두리가 보이지 않게
   - 키보드(Tab) 포커스는 focus-visible로 접근성 유지 */
.mw-embed button:focus { outline: none !important; }
.mw-embed .album-art-wrapper:focus { outline: none !important; }
.mw-embed button:focus-visible {
  outline: 3px solid rgba(23, 38, 54, 0.18) !important;
  outline-offset: 4px !important;
}

/* 앨범 커버 스트립(가로 스크롤) */
.mw-embed .mw-strip {
  display: flex;
  gap: 34px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 2px 14px 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mw-embed .mw-strip::-webkit-scrollbar { display: none; }

/* playlist.html: 앨범 카드(구조는 같고, 배치는 strip에 맞게 flex item) */
.mw-embed .album-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.3s ease;
  flex: 0 0 auto;
}

/* 커버 버튼: playlist의 .album-art-wrapper를 그대로 쓰되 "그림자/테두리 없음" */
.mw-embed .album-art-wrapper {
  width: 240px;
  height: 240px;
  cursor: pointer;
  position: relative;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: none;        /* 기존 drop-shadow 제거 */
  border: 0;           /* 버튼 테두리 제거 */
  background: transparent;
  padding: 0;
  border-radius: 16px;
}

.mw-embed .album-art-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.4s;
  display: block;
}

.mw-embed .album-art-wrapper:hover {
  transform: scale(1.05) translateY(-5px);
}

/* 앨범 제목/설명(playlist.html 동일) */
.mw-embed .album-info {
  margin-top: 20px;
  text-align: center;
}

.mw-embed .album-title {
  font-size: 1.4rem;
  color: var(--accent);
  font-weight: 700;
}

.mw-embed .album-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* 회전 */
.mw-embed .is-playing-spin {
  animation: mw_spin 8s linear infinite;
}
@keyframes mw_spin {
  100% { transform: rotate(360deg); }
}

/* 인라인 패널(오른쪽 끼워넣기) */
.mw-embed .mw-inline-panel {
  flex: 0 0 auto;
  width: 320px;
  max-width: 320px;
  align-self: flex-start;
  opacity: 0;
  transform: translateX(-72px);
  transition: opacity 260ms ease, transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  will-change: transform, opacity;
}

.mw-embed .mw-inline-panel.is-open {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .mw-embed .mw-inline-panel {
    transition: none;
    transform: none;
  }
}

.mw-embed .mw-inline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.mw-embed .mw-inline-title {
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}

.mw-embed .mw-inline-desc {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.mw-embed .mw-inline-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent);
  cursor: pointer;
  flex: 0 0 auto;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.mw-embed .mw-inline-close:hover {
  transform: translateY(-1px);
  background: rgba(23, 38, 54, 0.04);
  border-color: rgba(23, 38, 54, 0.22);
}
.mw-embed .mw-inline-close:focus {
  outline: 3px solid rgba(23, 38, 54, 0.18);
  outline-offset: 3px;
}

/* playlist.html: 트랙 리스트(아코디언) 스타일을 그대로 재사용 */
.mw-embed .track-list-container {
  width: 100%;
  max-width: 320px;
  background-color: var(--light-gray);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  max-height: 500px; /* 인라인 패널에서는 항상 열린 상태 */
  opacity: 1;
}

.mw-embed .track-list {
  list-style: none;
  padding: 10px 0;
  margin: 0;
}

.mw-embed .track-item {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
  font-size: 0.95rem;
}

.mw-embed .track-item:last-child { border-bottom: none; }
.mw-embed .track-item:hover { background-color: rgba(23, 38, 54, 0.05); }

.mw-embed .track-item.playing {
  background-color: var(--accent);
  color: #f3f2f2;
}

.mw-embed .track-name { font-weight: 500; }
.mw-embed .track-duration { font-size: 0.8rem; color: #888; }
.mw-embed .track-item.playing .track-duration { color: rgba(255,255,255,0.7); }

/* ============================================================
   하단 고정 플레이어 바 (playlist.html과 동일한 클래스)
============================================================ */
.mw-embed .player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-color);
  padding: var(--player-pad-y) var(--player-pad-x);
  box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
  z-index: 1000;
}

.mw-embed .player-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.mw-embed .track-info {
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 0;
  flex: 1 1 420px;
}

.mw-embed .current-album-art {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.mw-embed .current-album-art img {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
  display: block;
}

.mw-embed .track-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  line-height: 1.2;
}

.mw-embed .track-title {
  display: block;
  white-space: nowrap;
  overflow: hidden;
}

.mw-embed .track-title .marquee-content {
  display: inline-flex;
  gap: var(--marquee-gap, 40px);
  will-change: transform;
}
.mw-embed .track-title.is-marquee .marquee-content {
  animation: mw_marquee var(--marquee-duration, 12s) linear infinite;
}
.mw-embed .track-title .marquee-item { flex: 0 0 auto; }
@keyframes mw_marquee {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-1 * var(--marquee-distance, 0px))); }
}

.mw-embed .track-artist {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mw-embed .player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  flex: 0 0 auto;
}

.mw-embed .control-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  font-size: 1.2rem;
  transition: color 0.2s, transform 0.1s;
  height: var(--control-height);
  width: var(--control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mw-embed .control-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.mw-embed .control-btn:hover { color: var(--accent-light); }

.mw-embed .play-pause-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.mw-embed .player-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 2 1 520px;
}

.mw-embed .progress-container {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.mw-embed .time-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.mw-embed .progress-bar {
  flex-grow: 1;
  min-width: 0;
  height: 6px;
  appearance: none;
  background: #e0e0e0;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.mw-embed .progress-bar::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--progress-played);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.mw-embed .progress-bar::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--progress-played);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.mw-embed .extra-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.mw-embed .volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--control-height);
}

.mw-embed .volume-bar {
  width: 110px;
  height: 6px;
  appearance: none;
  background: #e0e0e0;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.mw-embed .volume-bar::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--progress-played);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.mw-embed .volume-bar::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--progress-played);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.mw-embed .action-btn {
  text-decoration: none;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  height: var(--control-height);
  padding: 0 16px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  transition: all 0.2s;
}
.mw-embed .action-btn:hover {
  background-color: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* 본문이 플레이어에 가려지지 않게 */
body.mw-player-open { padding-bottom: 100px; }

/* 반응형: playlist.html과 동일한 2줄/1열 플레이어 */
@media (max-width: 1024px) {
  .mw-embed .player-bar { --player-pad-x: var(--player-pad-x-mobile); }
  .mw-embed .player-container {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "info controls"
      "bottom bottom";
    align-items: center;
    gap: 10px 12px;
  }
  .mw-embed .track-info { grid-area: info; flex: initial; min-width: 0; }
  .mw-embed .player-controls { grid-area: controls; justify-content: flex-end; }
  .mw-embed .player-bottom { grid-area: bottom; width: 100%; flex: initial; }
  .mw-embed .volume-bar { width: 90px; }
  .mw-embed .btn-text { display: none; }
}

@media (max-width: 480px) {
  .mw-embed .player-container {
    grid-template-columns: 1fr;
    grid-template-areas:
      "info"
      "controls"
      "bottom";
  }
  .mw-embed .player-controls { justify-content: center; }
  .mw-embed .player-bottom { flex-wrap: wrap; row-gap: 8px; }
  .mw-embed .progress-container { flex: 1 1 100%; }
  .mw-embed .extra-controls { flex: 1 1 100%; justify-content: flex-end; }
  .mw-embed .volume-control { display: none; }
}

/* 작은 화면에서 커버 크기 */
@media (max-width: 560px) {
  .mw-embed .album-art-wrapper { width: 180px; height: 180px; }
  .mw-embed .mw-inline-panel { width: 300px; max-width: 300px; }
}

