/* styles/filmography.css */
/* ---------- 폰트 (info와 동일) ---------- */
@font-face {
  font-family: 'Pretendard';
  src: url('../fonts/Pretendard-ExtraLight.woff2') format('woff2');
  font-weight: 200;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'Pretendard';
  src: url('../fonts/Pretendard-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'Melodrame';
  src: url('../fonts/Melodrame.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'Quentin';
  src: url('../fonts/Quentin.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

/* ---------- 공통 변수 ---------- */
:root{
  --se-aspect: 0.5625;                 /* 375/667 */
  --frame-w: min(100svw, calc(100dvh * var(--se-aspect)));
  --frame-left: calc((100svw - var(--frame-w)) / 2);

  /* 레일/아이콘/팝업 규격 */
  --rail-w: 70px;                      
  --rail-border: 1px;
  --icon-size: 25px;

  /* 레일 중앙 좌표 (공용) */
  --rail-center-x: calc(var(--frame-left) + var(--rail-w)/2 + var(--rail-border)/2);
}

/* ---------- 리셋 & 스크롤바/가로 스와이프 억제 ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }

/* 가로 스크롤/스와이프 완전 차단 */
html, body {
  overflow-x: clip;                 /* hidden 대신 clip: 실제로 스크롤 자체를 막음 */
  overscroll-behavior-x: none;      /* 가로 방향 스크롤 체이닝 방지 */
  touch-action: pan-y;              /* 터치 제스처는 세로만 허용 */
  scrollbar-gutter: stable both-edges;  /* 탭 간 가로폭 흔들림 방지 */
}
/* 구형 브라우저 폴백 */
@supports not (overflow: clip) {
  html, body { overflow-x: hidden; }
}

/* 세로 스크롤은 항상 예약(가로폭 변동 없음) */
body {
  overflow-y: scroll;
  background: #000;
  color: #222;
  font-family: 'Pretendard', sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  font-weight: 200;
  font-variation-settings: "wght" 200;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- 프레임 ---------- */
.profile-page{
  position: relative;
  width: var(--frame-w);                 /* ✅ 반드시 변수만 사용 */
  min-height: 100dvh;
  height: auto;
  background: #fafafa;
  margin: 0 auto;

  display: grid;
  grid-template-columns: var(--rail-w) 1fr;  /* ✅ rail-w와 동일 */
  overflow: visible;                     /* 팝업 잘림 방지 */
  container-type: inline-size;
  z-index: 0;
}

/* ---------- 좌측 레일 ---------- */
.left-rail{
  background: #fafafa;
  border-right: 1px solid #000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: var(--rail-w);
  padding-top: 20px;
  position: relative;
  min-height: unset;
  align-self: stretch;
}
.rail-inner{
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  position: relative;
}
.side-name{
  position: absolute;
  top: -170px; left: -15px;
  font-family: 'Quentin', cursive;
  font-size: 25px;
  color: #ACBFCD;
  line-height: 1;
  white-space: nowrap;
}
.side-profile{
  position: absolute;
  top: -125px; left: -15px;
  font-family: 'Melodrame', serif;
  font-size: 25px;
  color: #000;
  line-height: 1;
  white-space: nowrap;
}

/* ---------- 카테고리 ---------- */
#filmography-tab { padding: 40px 20px; }
.film-category{
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 8px;
}
.film-category button{
  background: none;
  border: none;
  padding: 6px 10px;
  font-size: 16px;
  font-family: 'Pretendard';
  font-weight: 200;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: border-color .2s ease, font-weight .2s ease;
}
.film-category button.active{
  border-color: #000;
  font-weight: 400;
}
@media (max-width: 480px){
  .film-category { gap: 12px; }
  .film-category button { font-size: 14px; }
}

/* ---------- 작품 리스트 ---------- */
.film-list{
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.film-item{ display: flex; gap: 16px; }
.film-poster{ width: 110px; height: auto; flex-shrink: 0; }
.film-info{
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-family: 'Pretendard';
  margin-left: 0;
}
.film-title{ font-size: 16px; font-weight: 400; margin-bottom: 4px; }
.film-period, .film-place, .film-role{
  font-size: 13px;
  font-weight: 200;
  line-height: 1.4;
}

/* ---------- 좌측 하단 아이콘 ---------- */
.fixed-icons {
  position: fixed;
  bottom: 20px;
  left: calc(var(--frame-left) + var(--rail-w)/2 - 12px);  /* 아이콘 크기에 따라 조정 */

  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
}
.fixed-icons img{
  width: var(--icon-size);
  height: auto;
  cursor: pointer;
  transition: transform .2s ease;
}
.fixed-icons img:hover{ transform: scale(1.1); }

/* ---------- 메뉴 팝업: 레일 중앙 기준 ---------- */
#menu-popup {
  display: none;
  position: fixed;
  bottom: 20px;

  /* 레일 중앙 좌표를 기준으로 */
  left: calc(var(--frame-left) + var(--rail-w)/2 + var(--rail-border)/2);
  transform: translateX(0);

  background: #fff;
  border: 1px solid #000;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.15);
  padding: 8px 0;
  z-index: 2000;
}
#menu-popup a {
  display: block;
  padding: 8px 16px;
  text-decoration: none;
  color: #000;
  font-family: 'Melodrame', serif;
  font-size: 20px;
}
#menu-popup a:hover { background: #f0f0f0; }

/* ---------- 모바일: vw 기준으로 좌표 재계산 ---------- */
@media (hover:none) and (pointer:coarse){
  :root{
    --frame-w: min(100vw, calc(100dvh * var(--se-aspect)));
    --frame-left: calc((100vw - var(--frame-w)) / 2);
    --rail-center-x: calc(var(--frame-left) + var(--rail-w)/2 + var(--rail-border)/2);
  }
  #menu-popup{
    left: var(--rail-center-x) !important;
    transform: translateX(0) !important;
    right: auto !important;
  }
  .fixed-icons{
    left: calc(var(--frame-left) + var(--rail-w)/2 - 12px); !important;
    transform: translateX(-50%) !important;
  }
}

/* === 팝업 박스 위치만 수정 (아이콘 건드리지 않음) === */
:root { 
  --popup-gap: 16px;  /* ← 아이콘-팝업 사이 간격. 크게 하고 싶으면 값만 늘려! */
}

/* PC 포함 전체 */
#menu-popup{
  left: calc(var(--frame-left) + var(--rail-w) + var(--rail-border) + var(--popup-gap)) !important;
  transform: translateX(0) !important;
  right: auto !important;
}

/* 모바일 주소창 변화 대응: vw 기준 재계산 */
@media (hover:none) and (pointer:coarse){
  :root{
    --frame-w: min(100vw, calc(100dvh * var(--se-aspect)));
    --frame-left: calc((100vw - var(--frame-w)) / 2);
  }
  #menu-popup{
    left: calc(var(--frame-left) + var(--rail-w) + var(--rail-border) + var(--popup-gap)) !important;
  }
}


/* ---------- iOS 하단 여백 ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@supports (padding-bottom: env(safe-area-inset-bottom)){
  #filmography-tab{ padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
}
