/* ====================================================
   COM/tab_inner — 인라인 탭 스킨
   배경이미지 히어로 박스 + 좌상단 텍스트(absolute) + 우하단 탭
   탭 클릭 시 배경 페이드 전환
==================================================== */

/* 변수: 박스 패딩 */
.tab_inner .tab_area,
.tab_inner_root {
  --tab-inner-pad: clamp(20px, 3vw, 48px);
  --tab-inner-radius: 16px;
  --tab-inner-hero-h: clamp(280px, 32vw, 480px);
  --tab-inner-bg-color: var(--dynamic-bg-color, #f0473e);
  position: relative;
  width: 100%;
}

.tab_inner .tab_layout,
.tab_inner .contents-container,
.tab_inner_root .contents-container {
  width: 100%;
}

/* ─── 히어로 박스 ─────────────────────────────────── */
.tab_inner .tab_inner_hero {
  position: relative;
  width: 100%;
  height: var(--tab-inner-hero-h);
  padding: var(--tab-inner-pad);
  border-radius: var(--tab-inner-radius);
  overflow: hidden;
  box-sizing: border-box;
  background: #1a1a1a;
}

/* 배경 이미지 wrap (widget_img.php 출력을 감싸는 컨테이너) */
.tab_inner .hero_bg_wrap {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: 0;
  pointer-events: none; /* 인라인 편집 wg_edit_img 가 활성화되면 활성 wrap 만 클릭 가능 */
}
.tab_inner .hero_bg_wrap.active {
  opacity: 1;
  pointer-events: auto;
}
/* widget_img.php 가 만드는 .wg_img1 / img 가 wrap 안에서 가득 차게 */
.tab_inner .hero_bg_wrap .wg_img1,
.tab_inner .hero_bg_wrap [class^="wg_img"],
.tab_inner .hero_bg_wrap [id^="img_"] {
  position: absolute !important;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}
.tab_inner .hero_bg_wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  /* 비활성 탭: 크게 대기 */
  transform: scale(1.1);
  transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
  transform-origin: center;
}
.tab_inner .hero_bg_wrap.active img {
  transform: scale(1);
}
/* 첫 로드 시 active 탭도 1.1 → 1 등장 애니메이션 한 번 재생 */
@keyframes tabInnerZoomIn {
  from { transform: scale(1.1); }
  to   { transform: scale(1); }
}
.tab_inner .hero_bg_wrap.active img {
  animation: tabInnerZoomIn 1.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* 이미 활성화된 후 탭 전환 시(JS 가 토글) animation 이 다시 재생되지 않게 — transition 으로만 처리 */
.tab_inner .hero_bg_wrap.active.no-init-anim img {
  animation: none;
}

/* 어두운 그라디언트 오버레이로 텍스트 가독성 확보 */
.tab_inner .tab_inner_hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(0,0,0,0.55) 0%,
    rgba(0,0,0,0.25) 45%,
    rgba(0,0,0,0.45) 100%
  );
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
}

/* ─── 좌상단 텍스트 (position: absolute, 패딩값 기준) ─── */
.tab_inner .hero_texts {
  position: absolute;
  left: var(--tab-inner-pad);
  top: var(--tab-inner-pad);
  right: var(--tab-inner-pad);
  z-index: 10;          /* 이미지(z:0) + 오버레이(z:1) 위로 */
  pointer-events: none;  /* 자식만 클릭 가능 (인라인 편집용) */
  color: #fff;
}
/* 고정 모드 (탭 클릭해도 안 바뀜): 그냥 순서대로 노출 */
.tab_inner .hero_texts.hero_texts_fixed > div {
  color: #fff;
  pointer-events: auto;  /* 텍스트 자체는 클릭 가능 (인라인 편집 모달 트리거) */
  position: relative;
  z-index: 11;
}
/* 우하단 탭 메뉴도 이미지 위로 */
.tab_inner .hero_tabs { z-index: 12 !important; }
/* wg_edit_title 호버 효과 (인라인 편집 가능 표시) */
.tab_inner .wg_edit_title {
  cursor: pointer;
  transition: outline 0.15s ease;
}
.tab_inner .wg_edit_title:hover {
  outline: 1px dashed rgba(255,255,255,0.7);
  outline-offset: 3px;
}
/* (옛 동적 모드 잔여 호환용) */
.tab_inner .hero_text {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s ease 0.05s, transform 0.45s ease 0.05s;
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  color: #fff;
}
.tab_inner .hero_text.active {
  opacity: 1;
  transform: translateY(0);
  position: relative;
}
.tab_inner .ht_title {
  font-size: clamp(24px, 3.2vw, 44px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.35);
}
.tab_inner .ht_sub2 {
  font-size: clamp(15px, 1.6vw, 20px);
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 4px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.35);
}
.tab_inner .ht_sub3 {
  font-size: clamp(13px, 1.3vw, 16px);
  font-weight: 400;
  line-height: 1.5;
  opacity: 0.9;
  margin-bottom: 2px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.tab_inner .ht_sub4 {
  font-size: clamp(12px, 1.1vw, 14px);
  font-weight: 400;
  line-height: 1.5;
  opacity: 0.85;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ─── 우하단 탭 메뉴 (레이아웃만 — 디자인은 위젯 CSS 입력 필드로 분리) ─── */
.tab_inner .hero_tabs {
  position: absolute;
  right: var(--tab-inner-pad);
  bottom: var(--tab-inner-pad);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  max-width: calc(100% - (var(--tab-inner-pad) * 2));
}
.tab_inner .hero_tabs .tab {
  /* 디자인 기본값 — 위젯 wid_css 로 덮어쓰기 가능 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  cursor: pointer;
  white-space: nowrap;
}

/* ─── 하단 콘텐츠 패널 ─────────────────────────────── */
.tab_inner .tab_panels {
  width: 100%;
  /* margin-top 은 wid_css 에서 자유롭게 — 기본값은 _notes/tab_design.css 또는 위젯 wid_css */
}
.tab_inner .tab-content {
  width: 100%;
}
.tab_inner .tab-content[hidden] { display: none !important; }
.tab_inner .tab-content .grid_cont {
  width: 100%;
  float: left;
}

/* ─── 모바일 반응형 ────────────────────────────────── */
@media (max-width: 640px) {
  .tab_inner .tab_area,
  .tab_inner_root {
    --tab-inner-pad: 16px;
    --tab-inner-radius: 12px;
    --tab-inner-hero-h: clamp(360px, 88vw, 480px);   /* 텍스트 + 탭 모두 들어가도록 키움 */
  }

  /* 히어로 박스 — 일반 블록 흐름 + float 차곡차곡 쌓기
     - height auto 로 풀고 콘텐츠 크기만큼만 차지 */
  .tab_inner .tab_inner_hero {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    display: block !important;
    padding: var(--tab-inner-pad);
    overflow: hidden;          /* float clearfix */
  }

  /* 상단 텍스트 영역 — absolute 해제, 일반 흐름 + float:left 로 위에서부터 쌓임 */
  .tab_inner .hero_texts {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    width: 100%;
    float: left;
    margin-bottom: 16px;
    z-index: 10;
  }
  .tab_inner .ht_title { font-size: clamp(20px, 6.5vw, 28px); margin-bottom: 6px; }
  .tab_inner .ht_sub2  { font-size: clamp(13px, 3.6vw, 16px); margin-bottom: 4px; }
  .tab_inner .ht_sub3  { font-size: clamp(12px, 3.2vw, 14px); line-height: 1.4; }
  .tab_inner .ht_sub4  { font-size: clamp(11px, 2.8vw, 13px); }

  /* ★ 탭 메뉴 — absolute 해제, 텍스트 다음 줄에 float:left 로 쌓임 */
  .tab_inner .hero_tabs {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    max-width: none !important;
    float: left;
    display: grid !important;
    grid-template-columns: 1fr 1fr;   /* 2칸 동일 너비 */
    gap: 8px;
    justify-content: stretch;
    z-index: 12;
  }
  .tab_inner .hero_tabs .tab {
    width: 100%;
    min-width: 0;
    padding: 12px 10px !important;
    font-size: 15px !important;
    line-height: 1.2 !important;
    min-height: 0 !important;
    height: auto !important;
    text-align: center;
    border-radius: 6px !important;
  }
  .tab_inner .hero_tabs .tab * {
    font-size: 15px !important;
    line-height: 1.2 !important;
  }
  .tab_inner .hero_tabs .tab .tab_label {
    width: 100%;
    text-align: center;
    white-space: normal;
    overflow: visible;
  }
}

@media (max-width: 380px) {
  .tab_inner .hero_tabs .tab {
    padding: 11px 8px !important;
    font-size: 14px !important;
  }
  .tab_inner .hero_tabs .tab * {
    font-size: 14px !important;
  }
}

/* 관리자 뱃지가 히어로 박스에 가려지지 않도록 */
.tab_inner .inline_tab_admin_badge { z-index: 999999 !important; }

/* 인라인 편집 가능 표시 — hover 시 점선 박스 (전역 wg_edit_txt 스타일 보강) */
.tab_inner .wg_edit_txt {
  cursor: text;
  position: relative;
  transition: outline 0.15s ease;
}
.tab_inner .wg_edit_txt:hover {
  outline: 1px dashed rgba(255,255,255,0.6);
  outline-offset: 2px;
}
.tab_inner .hero_tabs .tab .tab_label.wg_edit_txt {
  display: inline-block;
}
.tab_inner .hero_tabs .tab .tab_label.wg_edit_txt:hover {
  outline-color: rgba(255,255,255,0.9);
}
