/* ==========================================================================
   ARTIST PROFILES — profiles.css
   ========================================================================== */

.profiles{
  padding: clamp(64px, 10vw, 120px) 0;
  background: var(--clr-bg);
  position: relative;
  overflow: hidden;
}

.profiles__head{
  position: relative;
  z-index: 1;
  margin-bottom: clamp(32px, 5vw, 56px);
}
.profiles__head h2{
  font-family: var(--ff-display);
  font-size: var(--fs-h2);
  margin-top: 8px;
}
.profiles__guide{
  color: #3FD1E0;
}
.profiles__count{
  position:absolute;
  right: 0; top: -12px;
  font-family: var(--ff-display);
  font-size: clamp(2.4rem, 6vw, 4rem);
  color: var(--clr-cyan);
  opacity: 0.18;
}

/* ---- 배경 장식 ---- */
.profiles__deco{
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.profiles__deco-shape{
  position: absolute;
  width: 90px;
  opacity: 0.5;
  filter: saturate(1.35) drop-shadow(0 10px 18px rgba(36,38,59,0.08));
}
.profiles__deco-shape--1 { top: 2%;    left: 2%;    width: 72px;  transform: rotate(-14deg); }
.profiles__deco-shape--2 { top: 7%;    right: 4%;   width: 108px; transform: rotate(16deg); }
.profiles__deco-shape--3 { top: 22%;   left: -3%;   width: 88px;  transform: rotate(9deg); }
.profiles__deco-shape--4 { top: 18%;   right: -3.5%;width: 116px; transform: rotate(-18deg); }
.profiles__deco-shape--5 { top: 38%;   left: 1.5%;  width: 66px;  transform: rotate(22deg); }
.profiles__deco-shape--6 { top: 42%;   right: 2.5%; width: 96px;  transform: rotate(-11deg); }
.profiles__deco-shape--7 { top: 55%;   left: -2.5%; width: 82px;  transform: rotate(13deg); }
.profiles__deco-shape--8 { top: -3%;   left: 42%;   width: 62px;  transform: rotate(-22deg); }
.profiles__deco-shape--9 { top: 58%;   right: -3%;  width: 70px;  transform: rotate(10deg); }
.profiles__deco-shape--10{ bottom: 30%;right: 40%;  width: 58px;  transform: rotate(-7deg); }
.profiles__deco-shape--11{ bottom: 22%;left: 3%;    width: 94px;  transform: rotate(19deg); }
.profiles__deco-shape--12{ bottom: 26%;right: 5%;   width: 78px;  transform: rotate(-15deg); }
.profiles__deco-shape--13{ bottom: 4%; left: -2.5%; width: 100px; transform: rotate(-9deg); }
.profiles__deco-shape--14{ bottom: 8%; right: -3%;  width: 90px;  transform: rotate(20deg); }
.profiles__deco-shape--15{ bottom: -4%;left: 22%;   width: 70px;  transform: rotate(-12deg); }
.profiles__deco-shape--16{ bottom: -4%;right: 26%;  width: 64px;  transform: rotate(15deg); }

@media (max-width: 980px){
  .profiles__deco-shape--3,  .profiles__deco-shape--4,
  .profiles__deco-shape--6,  .profiles__deco-shape--7,
  .profiles__deco-shape--9,  .profiles__deco-shape--10,
  .profiles__deco-shape--12, .profiles__deco-shape--16{ display: none; }
}
@media (max-width: 640px){
  .profiles__deco{ display: none; }
}

/* ---- 리듬감 있는 비대칭 그리드 ---- */
.profiles__grid{
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(14px, 2vw, 26px);
}

.profile-card{
  position: relative;
  aspect-ratio: 3/3.6;
  border-radius: var(--radius-card);
  background: var(--clr-bg-soft);
  perspective: 700px;
  transform: rotate(var(--tilt, 0deg));
  transition: transform .5s cubic-bezier(.34, 1.56, .64, 1), box-shadow .5s var(--ease);
}
.profile-card:nth-child(4n+2){ --tilt: -1.4deg; margin-top: 22px; }
.profile-card:nth-child(4n+3){ --tilt: 1.1deg; margin-top: -10px; }
.profile-card:nth-child(6n){ --tilt: -0.8deg; margin-top: 14px; }

.profile-card a{
  display:block;
  width:100%; height:100%;
  position:relative;
  transform-style: preserve-3d;
  transition: transform .8s cubic-bezier(.34, 1.56, .64, 1);
  will-change: transform;
}
.profile-card.is-flipped a,
.profile-card:focus-within a{
  transform: rotateY(180deg);
}

.profile-card__face{
  position:absolute;
  inset:0;
  border-radius: var(--radius-card);
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.profile-card__face--back{
  transform: rotateY(180deg);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 18px;
  padding: 18px;
  text-align:center;
}

.profile-card__face--front img{
  width:100%; height:100%;
  object-fit: cover;
  filter: grayscale(0.1);
  transition: transform .5s var(--ease), filter .5s var(--ease);
}

/* ---- 뒷면 로고 컨테이너 ---- */
.profile-card__logo{
  position: relative;
  width: 120px;
  height: 60px;
  flex-shrink: 0;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.profile-card__logo-shape{
  position: absolute;
  top: 50%; left: 50%;
  width: 36px;
  transform: translate(-50%, -50%) translate(var(--x), var(--y)) rotate(var(--r)) scale(var(--s));
  filter: drop-shadow(0 6px 10px rgba(36,38,59,0.18));
}

/* 커스텀 로고 스타일 (JS의 style="width:XXpx"가 그대로 반영되도록 교체) */
/* 수정 후 코드 */
.profile-card__logo-shape--custom {
  position: static !important;
  transform: none !important;
  max-width: none !important;   /* 최대 너비 제한 해제 */
  max-height: none !important;  /* 최대 높이 제한 해제하여 JS 수치가 그대로 적용되도록 함 */
  height: auto !important;
  object-fit: contain !important;
}

.profile-card__back-name{
  font-family: var(--ff-display);
  font-size: 1rem;
  color: var(--clr-ink);
  letter-spacing: 0.01em;
}
.profile-card__back-role{
  font-size: 0.7rem;
  color: var(--clr-ink-soft);
  margin-top: -10px;
}
.profile-card__back-link{
  font-size: 0.68rem;
  color: var(--clr-cyan);
  letter-spacing: 0.01em;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(36,38,59,0.1);
  width: 100%;
}

.profile-card__overlay{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  padding: 14px;
  background: linear-gradient(180deg, rgba(63,209,224,0) 40%, rgba(36,38,59,0.82) 100%);
  opacity: 0;
  transition: opacity .3s var(--ease);
}
.profile-card__name{
  color: #fff;
  font-family: var(--ff-display);
  font-size: 0.95rem;
}
.profile-card__role{
  color: rgba(255,255,255,0.75);
  font-size: 0.7rem;
  margin-top: 2px;
}
.profile-card.is-flipped,
.profile-card:focus-within{
  transform: rotate(0deg) scale(1.06);
  box-shadow: 0 22px 40px rgba(36,38,59,0.24);
  z-index: 2;
}
.profile-card.is-flipped .profile-card__face--front img,
.profile-card:focus-within .profile-card__face--front img{
  transform: scale(1.06);
  filter: grayscale(0);
}
.profile-card.is-flipped .profile-card__overlay,
.profile-card:focus-within .profile-card__overlay{ opacity: 1; }

@media (max-width: 980px){
  .profiles__grid{ grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px){
  .profiles__grid{ grid-template-columns: repeat(2, 1fr); }
  .profile-card:nth-child(n){ margin-top: 0; }
  .profile-card__face--back{ gap: 12px; }
  .profile-card__logo{ width: 54px; height: 44px; }
  .profile-card__logo-shape{ width: 28px; }
  .profile-card__back-name{ font-size: 0.88rem; }
  .profile-card__back-role{ font-size: 0.62rem; }
  .profile-card__back-link{ font-size: 0.6rem; margin-top: 4px; padding-top: 8px; }
}

/* ==========================================================================
   RESPONSIVE GRID
   기존 4열 디자인을 넓은 태블릿까지 유지하고, 좁아질 때만 단계적으로 줄인다.
   ========================================================================== */
@media (min-width: 761px){
  .profiles__grid{
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (min-width: 560px) and (max-width: 760px){
  .profiles__grid{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .profile-card:nth-child(n){
    margin-top: 0;
  }
  .profile-card__face--back{
    gap: 14px;
    padding: 14px;
  }
  .profile-card__logo{
    width: min(120px, 70%);
    height: 54px;
  }
}
@media (max-width: 559px){
  .profiles__grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .profiles__head{
    margin-bottom: clamp(28px, 8vw, 40px);
  }
  .profiles__head h2{
    font-size: clamp(1.7rem, 8vw, 2.3rem);
    line-height: 1.15;
    padding-right: 0;
  }
  .profiles__guide{
    font-size: clamp(0.78rem, 3.1vw, 0.95rem);
    line-height: 1.5;
  }
  .profiles__count{
    position: static;
    margin-top: 10px;
    font-size: clamp(1.8rem, 10vw, 2.8rem);
  }
  .profile-card{
    aspect-ratio: 3 / 3.6;
  }
  .profile-card:nth-child(n){
    margin-top: 0;
  }
  .profile-card__face--back{
    gap: 10px;
    padding: 12px;
  }
  .profile-card__logo{
    width: min(100px, 72%);
    height: 42px;
  }
  .profile-card__logo-shape--custom{
    max-width: 100% !important;
    max-height: 100% !important;
  }
}
