/* photomodal 위젯 스킨 - SUB */

/* 카드 그리드 */
.photomodal .wg_box {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(15px, calc(1.17vw + 11.25px), 30px);
}

/* 카드 - 배경색은 CSS 변수로 위젯별 조절 가능 */
.photomodal {
  --pm-card-bg: #2a2a2a;
}

.photomodal .pm_card {
  position: relative;
  overflow: hidden;
  border-radius: clamp(8px, calc(0.78vw + 5.5px), 18px);
  aspect-ratio: 3 / 4;
  cursor: pointer;
  background: var(--pm-card-bg);
}

/* 이미지 박스 */
.photomodal .pm_img_box {
  position: absolute;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.photomodal .pm_img_box .wg_img1,
.photomodal .pm_img_box .wg_img_alt {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.photomodal .pm_img_box img,
.photomodal .pm_img_box .wg_img_alt img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease, filter 0.5s ease;
}

/* hover: 이미지 확대만 (어둡게는 오버레이로 처리) */
.photomodal .pm_card:hover .pm_img_box img,
.photomodal .pm_card:hover .pm_img_box .wg_img_alt img {
  transform: scale(1.05);
}

/* 오버레이 (텍스트 가독성 + hover 어둡게) */
.photomodal .pm_overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 50%, rgba(0,0,0,0.5) 100%);
  pointer-events: none;
  z-index: 1;
  transition: background 0.5s ease;
}

/* hover 시 카드 전체(배경+이미지) 어둡게 - 오버레이로 균일하게 덮음 */
.photomodal .pm_card:hover .pm_overlay {
  background: rgba(0, 0, 0, 0.55);
}

/* 돋보기 아이콘 - hover 시에만 */
.photomodal .pm_search_icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: clamp(48px, calc(1.56vw + 43px), 68px);
  height: clamp(48px, calc(1.56vw + 43px), 68px);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
  z-index: 3;
}

.photomodal .pm_search_icon svg {
  width: 45%;
  height: 45%;
}

.photomodal .pm_card:hover .pm_search_icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* 텍스트 박스 - 좌하단 */
.photomodal .pm_txt_box {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  padding: clamp(30px, calc(0.78vw + 27.5px), 40px);
  color: #fff;
  z-index: 3;
  pointer-events: none;
}

.photomodal .pm_txt_box .wg_edit_txt {
  pointer-events: auto;
}

.photomodal .pm_txt_box .wg_txt1 {
  font-size: clamp(15px, calc(0.31vw + 14px), 19px);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
}

.photomodal .pm_txt_box .wg_txt2 {
  font-size: clamp(12px, calc(0.16vw + 11.5px), 14px);
  font-weight: 400;
  line-height: 1.4;
  opacity: 0.85;
}

/* ===== 모달 ===== */
.pm_modal {
  /* 모달 크기 - CSS 변수로 조절 */
  --pm-modal-width: 80%;
  --pm-modal-height: 85%;
  --pm-modal-max-width: 1600px;

  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2147483640;       /* 헤더/플로팅 위로 강제 */
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.pm_modal.active {
  display: flex;
  animation: pm_modal_open 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pm_modal_open {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 어두운 블러 배경 (전체 화면) */
.pm_modal_bg {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 0;
  cursor: pointer;
}

/* 모달 박스 (중앙) */
.pm_modal_inner {
  position: relative;
  z-index: 2;
  width: var(--pm-modal-width);
  height: var(--pm-modal-height);
  max-width: var(--pm-modal-max-width);
  background-color: #c5c5c5;
  border-radius: clamp(8px, calc(0.78vw + 5.5px), 18px);
  overflow: hidden;
  display: grid;
  grid-template-columns: 50% 50%;
  align-items: end;
  padding: 0;
  gap: 0;
  box-shadow: 0 25px 70px rgba(0,0,0,0.5);
  transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1), transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  transform: translateX(0);
}

/* 페이드 전환 - 다음 항목으로 (왼쪽으로 날려보내기) */
.pm_modal.pm_fading-next .pm_modal_inner {
  opacity: 0;
  transform: translateX(-80px);
}

/* 페이드 전환 - 이전 항목으로 (오른쪽으로 날려보내기) */
.pm_modal.pm_fading-prev .pm_modal_inner {
  opacity: 0;
  transform: translateX(80px);
}

/* 새 컨텐츠 들어올 때 시작 위치 */
.pm_modal.pm_entering-next .pm_modal_inner {
  opacity: 0;
  transform: translateX(80px);
  transition: none;
}

.pm_modal.pm_entering-prev .pm_modal_inner {
  opacity: 0;
  transform: translateX(-80px);
  transition: none;
}

/* 모달 내부 배경 이미지 (연하게) */
.pm_modal_inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--pm-bg);
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}

.pm_modal[data-bg-image] .pm_modal_inner::before {
  display: block;
}

.pm_modal:not([data-bg-image]) .pm_modal_inner::before {
  display: none;
}

/* X 닫기 버튼 - PC에서 크게 */
.pm_modal_close {
  position: absolute;
  top: clamp(15px, calc(0.78vw + 12.5px), 30px);
  right: clamp(15px, calc(0.78vw + 12.5px), 30px);
  width: clamp(50px, calc(2.34vw + 42.5px), 90px);
  height: clamp(50px, calc(2.34vw + 42.5px), 90px);
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2147483647;     /* 최상위 - 헤더보다 위 */
  transition: background 0.2s, transform 0.2s;
}

.pm_modal_close svg {
  width: 55%;
  height: 55%;
}

.pm_modal_close:hover {
  background: rgba(0,0,0,0.9);
  transform: scale(1.05);
}

/* 좌우 화살표 - 크게 */
.pm_modal_arr {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(50px, calc(2.73vw + 41.25px), 85px);
  height: clamp(50px, calc(2.73vw + 41.25px), 85px);
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2147483646;
  transition: background 0.2s, transform 0.2s;
}

.pm_modal_arr svg {
  width: 55%;
  height: 55%;
}

.pm_modal_arr:hover {
  background: rgba(0,0,0,0.85);
  transform: translateY(-50%) scale(1.05);
}

.pm_modal_prev { left: clamp(15px, calc(1.95vw + 8.75px), 50px); }
.pm_modal_next { right: clamp(15px, calc(1.95vw + 8.75px), 50px); }

/* 이미지 영역 - 좌측 영역 내에서 우측 끝에 정렬, 하단 붙임 */
.pm_modal_img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0;
}

.pm_modal_img_inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.pm_modal_img_inner img {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  display: block;
}

/* 텍스트 영역 - 우측 50%, 상단부터 시작 */
.pm_modal_txt {
  position: relative;
  z-index: 1;
  align-self: stretch;
  padding: clamp(40px, calc(3.13vw + 30px), 80px) clamp(20px, calc(2.34vw + 12.5px), 60px) clamp(30px, calc(2.34vw + 22.5px), 60px);
  height: 100%;
  display: flex;
  flex-direction: column;
  color: #222;
  min-height: 0;
}

/* 상단 묶음 (텍스트3, 4, 5) - 약 45% 영역, 본문 스크롤 영역은 55% */
.pm_modal_txt_head {
  flex: 0 0 45%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

/* PC 전용 - 텍스트 영역 50px 더 위로 (헤드를 줄이고 본문을 늘림) */
@media screen and (min-width: 901px) {
  .pm_modal_txt_head {
    flex: 0 0 calc(45% - 50px);
  }
  .pm_modal_txt_body {
    flex: 0 0 calc(55% + 50px);
  }
}

/* 1920px 이상 - 모달 세로 높이 축소 */
@media screen and (min-width: 1920px) {
  .pm_modal {
    --pm-modal-height: 75%;
  }
}

.pm_modal_txt3 {
  font-size: clamp(16px, calc(0.55vw + 14.25px), 23px);
  font-weight: 500;
  line-height: 1.5;
  color: #1a1a1a;
  margin-bottom: clamp(20px, calc(1.56vw + 15px), 40px);
}

/* 모달 텍스트4 - 변호사명 */
.pm_modal_txt4 {
  font-size: clamp(20px, calc(1.09vw + 16.5px), 34px);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: clamp(8px, calc(0.47vw + 6.5px), 14px);
  color: #1a1a1a;
}

/* 모달 텍스트5 - 라벨 (민사/형사 등) */
.pm_modal_txt5 {
  font-size: clamp(14px, calc(0.31vw + 13px), 18px);
  font-weight: 400;
  line-height: 1.6;
  color: #555;
  white-space: pre-line;
}

/* 구분선 - 위아래 여백 확보 */
.pm_modal_txt_line {
  width: 100%;
  height: 1px;
  background: rgba(0,0,0,0.25);
  margin: clamp(25px, calc(1.95vw + 18.75px), 50px) 0;
  flex-shrink: 0;
}

/* 모달 본문 wrapper - txt6+txt7 감싸는 스크롤 영역 (세로 55%) */
.pm_modal_txt_body {
  flex: 0 0 55%;
  min-height: 0;
  overflow-y: auto;
  padding-right: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.3) transparent;
}

.pm_modal_txt_body::-webkit-scrollbar { width: 6px; }
.pm_modal_txt_body::-webkit-scrollbar-track { background: transparent; }
.pm_modal_txt_body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.3); border-radius: 3px; }
.pm_modal_txt_body::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.5); }

/* 모달 텍스트6 - 주요경력 */
.pm_modal_txt6,
.pm_modal_txt7 {
  font-size: clamp(14px, calc(0.31vw + 13px), 18px);
  font-weight: 400;
  line-height: 1.7;
  color: #444;
}

.pm_modal_txt6:not(:empty) + .pm_modal_txt7:not(:empty) {
  margin-top: clamp(20px, calc(1.17vw + 16.25px), 35px);
}

/* ===== 반응형 ===== */
@media screen and (max-width: 1280px) {
  .photomodal .wg_box { grid-template-columns: repeat(3, 1fr); }
}

@media screen and (max-width: 900px) {
  .photomodal .wg_box { grid-template-columns: repeat(2, 1fr); }
  /* 모바일 카드 이미지 비율 PC와 동일 (3/4) */
  .photomodal .pm_card { aspect-ratio: 3 / 4; }

  .pm_modal {
    --pm-modal-width: 92%;
    --pm-modal-height: 90%;
  }
  /* 모달 내부: 상단 50% (이미지+텍스트 중첩) / 하단 50% (학력·경력) */
  .pm_modal_inner {
    grid-template-columns: 1fr;
    grid-template-rows: 50% 50%;
    padding: 0;
    gap: 0;
  }

  /* 상단 50% 영역 = 이미지 좌측으로 통째 이동 (좌측은 모달 밖으로 잘림 OK) */
  .pm_modal_img {
    position: relative;
    padding: 0;
    align-items: stretch;
    justify-content: flex-start;
    overflow: hidden;
  }
  /* 이미지 박스 자체를 모달 폭만큼 크게 두고 좌측으로 통째로 이동 */
  .pm_modal_img_inner {
    width: 72%;                  /* 조금 더 축소 */
    height: 100%;
    margin: 0;
    margin-left: -15%;           /* 통째로 좌측으로 이동 */
    align-items: stretch;
    justify-content: flex-start;
  }
  .pm_modal_img_inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top; /* 인물 사진은 상단 보존 */
  }

  /* 하단 50% 영역 = 학력 및 경력 본문 (일반 흐름)
     ★ position: static 으로 풀어서, 자식 pm_modal_txt_head 의 absolute 가
        조상인 pm_modal_inner 기준으로 잡히도록 (= 모달 전체의 상단 50% 영역에 위치) */
  .pm_modal_inner > .pm_modal_txt {
    position: static !important;
    padding: 22px 24px 24px;
    overflow-y: auto;
    z-index: 1;
    background: #fff;
  }

  /* ★ 텍스트 헤드(슬로건/이름/라벨 = txt3/4/5) — pm_modal_inner 기준 absolute
       이미지 영역(상단 50%) 의 우측 중상단에 위치하여 이미지와 겹침
       그라데이션은 우측 절반에만 (인물 손/팔 영역 침범 방지) */
  .pm_modal_inner .pm_modal_txt > .pm_modal_txt_head {
    position: absolute !important;
    right: 0;
    top: 12%;
    height: auto;
    width: 55%;
    padding: 0 16px 0 24px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    pointer-events: auto;
    z-index: 10;
    background: linear-gradient(to right,
        rgba(197,197,197,0) 0%,
        rgba(197,197,197,0) 45%,
        rgba(197,197,197,0.7) 65%,
        rgba(197,197,197,0.95) 80%,
        rgba(197,197,197,1) 100%);
  }
  .pm_modal_txt3 { font-size: 14px; margin-bottom: 8px; line-height: 1.4; }
  .pm_modal_txt4 { font-size: 18px; margin-bottom: 6px; line-height: 1.3; }
  .pm_modal_txt5 { font-size: 13px; line-height: 1.5; color: #444; }

  /* ★ 갈색 라벨 배지(대표변호사/형사 전문 등) 크기 축소 */
  .pm_modal_txt5 * {
    font-size: 12px !important;
    line-height: 1.5 !important;
    padding: 3px 8px !important;
  }
  .pm_modal_txt5 img,
  .pm_modal_txt5 svg,
  .pm_modal_txt5 i {
    padding: 0 !important;
  }

  /* 구분선 숨김 */
  .pm_modal_txt_line {
    display: none;
  }

  /* 학력 및 경력 본문 — pm_modal_txt 안의 일반 흐름, 별도 absolute 제거 */
  .pm_modal_txt_body {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    flex: 1 1 auto;
    padding: 0;
    overflow-y: visible;
    background: transparent;
  }
  /* 학력/경력 본문 — 좌우 배열 → 상하 배열, 폰트 조정 */
  .pm_modal_txt6,
  .pm_modal_txt7 {
    display: block;
    width: 100%;
    font-size: 15px;
    line-height: 1.65;
  }
  .pm_modal_txt6 *,
  .pm_modal_txt7 * {
    font-size: 15px !important;
    line-height: 1.65 !important;
  }
  /* .pm_section — 모바일에서 좌우 배열 → 상하 배열 강제 */
  .pm_modal_txt6 .pm_section,
  .pm_modal_txt7 .pm_section {
    display: block !important;
    flex-direction: column !important;
    gap: 0 !important;
    width: 100% !important;
    margin-bottom: 18px !important;
  }
  .pm_modal_txt6 .pm_section_list,
  .pm_modal_txt7 .pm_section_list {
    flex: none !important;
    width: 100% !important;
  }

  /* 헤더(학력 및 경력 / 주요활동 등) — 19px, 줄바꿈 후 본문이 아래로 */
  .pm_modal_txt6 strong, .pm_modal_txt6 b, .pm_modal_txt6 h3, .pm_modal_txt6 h4,
  .pm_modal_txt7 strong, .pm_modal_txt7 b, .pm_modal_txt7 h3, .pm_modal_txt7 h4,
  .pm_modal_txt6 .pm_section_title,
  .pm_modal_txt7 .pm_section_title {
    font-size: 19px !important;
    font-weight: 700;
    display: block !important;
    width: auto !important;
    max-width: 100% !important;
    margin: 0 0 10px 0 !important;
    padding: 0 !important;
  }
  /* wr_content 안에 좌측 제목 컬럼이 grid/inline width 로 폭을 잡고 있는 경우 강제 축소 */
  .pm_modal_txt6 > div:first-child,
  .pm_modal_txt7 > div:first-child,
  .pm_modal_txt6 td:first-child,
  .pm_modal_txt7 td:first-child,
  .pm_modal_txt6 th,
  .pm_modal_txt7 th {
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
  }
  /* 헤더 다음 ul/li/p 등 본문 — 헤더 아래로 떨어지게
     ★ .dot 유틸리티가 이미 도트(::before) 를 그리므로 list-style 만 제거 */
  .pm_modal_txt6 ul, .pm_modal_txt7 ul,
  .pm_modal_txt6 ol, .pm_modal_txt7 ol {
    display: block !important;
    width: 100% !important;
    margin: 0 0 14px 0 !important;
    padding-left: 0 !important;
    list-style: none !important;
  }
  .pm_modal_txt6 li, .pm_modal_txt7 li {
    display: block !important;
    width: 100% !important;
    padding: 2px 0 2px 18px !important;   /* 좌측 18px = .dot 의 ::before 도트 자리 */
  }
  /* table/grid/flex 형태로 들어온 경우 모두 강제로 세로 블록 흐름 */
  .pm_modal_txt6 table, .pm_modal_txt7 table,
  .pm_modal_txt6 tbody, .pm_modal_txt7 tbody { display: block !important; width: 100%; }
  .pm_modal_txt6 tr, .pm_modal_txt7 tr { display: block !important; width: 100%; }
  .pm_modal_txt6 th, .pm_modal_txt7 th,
  .pm_modal_txt6 td, .pm_modal_txt7 td { display: block !important; width: 100% !important; padding: 2px 0 !important; }
  .pm_modal_txt6 [style*="grid"], .pm_modal_txt7 [style*="grid"],
  .pm_modal_txt6 [style*="flex"],  .pm_modal_txt7 [style*="flex"] {
    display: block !important;
    grid-template-columns: none !important;
    flex-direction: column !important;
  }
  /* 모달 본문에 헤더-내용 사이 간격 */
  .pm_modal_txt6 { margin-bottom: 18px; }
}

@media screen and (max-width: 480px) {
  .pm_modal {
    --pm-modal-width: 96%;
    --pm-modal-height: 94%;
  }
  .photomodal .wg_box { grid-template-columns: 1fr; gap: 12px; }
  .photomodal .pm_card { aspect-ratio: 3 / 4; }
  .pm_modal_close { top: 8px; right: 8px; }
  .pm_modal_prev { left: 8px; }
  .pm_modal_next { right: 8px; }
}
