/* ---------- 폰트 ---------- */
@font-face {
  font-family: 'Pretendard';
  src: url('../fonts/Pretendard-Light.woff2') format('woff2');
  font-weight: 200;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'Pretendard';
  src: url('../fonts/Pretendard-Medium.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;                /* 가로 스크롤/스와이프 차단 */
  overscroll-behavior-x: none;
  touch-action: pan-y;             /* 세로만 스크롤 */
  scrollbar-gutter: stable both-edges; /* 스크롤 유무와 상관없이 가로폭 고정 */
  font-family: 'Pretendard', sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 바깥 레터박스(검정) + 프레임 중앙 배치 */
body {
  background: #000;                /* 좌우 검정 여백 */
  color: #222;
  font-family: 'Pretendard', sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: scroll;              /* 스크롤바 항상 예약 → 폭 안 흔들림 */
}

/* ---------- 가운데 프레임 ---------- */
.profile-page {
  width: var(--frame-w);           /* ✅ SR 프레임 폭 적용 */
  min-height: 100dvh;
  margin: 0 auto;
  background: #fafafa;

  display: grid;
  grid-template-columns: var(--rail-w) 1fr; /* ✅ 레일 폭 통일 */
  container-type: inline-size;
  overflow: visible;               /* 팝업 잘림 방지 */
}

/* ---------- 좌측 레일 ---------- */
.left-rail {
  width: var(--rail-w);
  background: #fafafa;
  border-right: 1px solid #000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  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; white-space: nowrap; }
.side-profile{ position: absolute; top:  -80px; left: -15px; font-family: 'Melodrame', serif; font-size: 25px; color:#000;    white-space: nowrap; }

/* ---------- 본문(비디오 리스트) ---------- */
.video-list { width: 100%; padding-top: 35px; }
.category{ border-top:1px solid #bfcdd6; padding:12px; cursor:pointer; display:flex; align-items:center; gap:6px; font-size:20px; font-weight:400; }
.category:first-of-type{ border-top:none; }
.arrow-icon{ width:12px; height:auto; }
.sub-list{ display:none; padding:0 25px 0 40px; background:#fafafa; border-top:1px solid #bfcdd6; }
.sub-item{ font-family: 'Pretendard'; padding:8px 0; font-size:15px; }
.sub-item a{ font-family: 'Pretendard'; font-size:16px; font-weight:200; text-decoration:none; color:#000; }
.sub-item a:hover{ text-decoration:underline; }

/* ---------- 좌측 하단 아이콘 ---------- */
.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 하단 여백 ---------- */
@supports (padding-bottom: env(safe-area-inset-bottom)){
  #profile-tab{ padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
}
