:root{
  --bg:#fffff4;

  /* 중심 갤러리 기준 폭 */
  --galleryW: min(1000px, 60vw);

  /* 기본 여백: 카테고리 30 / 썸네일 100 (줄어들 수 있음, 0이하 금지) */
  --gapL: clamp(10px, 3vw, 30px);
  --gapR: clamp(10px, 8vw, 100px);

  /* 양끝 5~10px 여백 */
  --edge: clamp(5px, 1vw, 10px);

  /* 카테고리 폭: 줄어들 수 있음 */
  --catW: clamp(160px, 18vw, 240px);

  /* 썸네일 폭: 줄어들 수 있음 */
  --thumbW: clamp(90px, 12vw, 130px);

  --font: 'Jost', sans-serif;
  --closeSize: 100px;                 /* X 버튼 크기 */
  --closeColor: rgba(165,165,165,.65);  /* X 버튼 색 */
}

/* 기본 */
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: var(--bg);
  font-family: var(--font);
}

/* 커서: 기본 mouse.png */
*{
  cursor: url("images/mouse.png") 0 0, auto !important;
}


/* 드래그/선택 최소화(다운로드 악용 줄이기) */
img{
  -webkit-user-drag:none;
  user-select:none;
}

/* =========================
레이아웃: 중앙 갤러리 + 좌/우 고정
========================= */

.layout{
  position:relative;
  width: 100%;
  min-height: 100vh;
  padding: 0 var(--edge);
}

/* 중앙 갤러리(실제 중앙) */
#gallery{
  width: var(--galleryW);
  margin: 50px auto 0 auto;
  padding-bottom: 120px;
}

/* =========================
카테고리(왼쪽, 고정)
- 상단 250px
- 갤러리 왼쪽에서 30px(기본) 떨어짐
- 화면이 줄면 같이 줄고, 겹치면 숨기는 대신 “더 줄어드는 방식”으로 유지
========================= */
.category{
  position:fixed;
  top:250px;

  /* 갤러리 중심 기준으로 왼쪽 배치 */
  left: calc(50% - (var(--galleryW) / 2) - var(--gapL) - var(--catW));

  width: var(--catW);
  font-size: 22px;
  line-height: 1.2;
  z-index: 200;

  padding-right:10px; /* 기존에 따로 있던 거 합침 */
}

.home-wrap{
  position: relative;
  left: 55px;
  margin-bottom: 18px;
  width: fit-content;
}

.home-btn{
  width: 54px;
  height: auto;
  display: block;
  position: relative;
  z-index: 2;
}

.home-bubble{
  position: absolute;
  left: 2px;
  bottom: 60px;
  width: 45px;
  height: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
  z-index: 3;
}

.home-wrap:hover .home-bubble{
  opacity: 1;
}

/* 카테고리 한 줄 */
.cat{
  display:flex;
  align-items:center;
  gap:14px;
  margin:0 0 10px 0;

  justify-content:flex-start;  /* ✅ 추가 */
  text-align:left;             /* ✅ 추가 */
}

/* Personal works 한줄 고정 */
.nowrap{ white-space:nowrap; }

/* one.png */
.dot{
  height: 16px;
  width:auto;
  flex: 0 0 auto;
}

.cat-text{
  display:inline-block;
}

/* 이메일만 18px */
.email{
  margin-top: 18px;
  font-size: 18px;
  line-height: 1.25;
  word-break: break-word;
}

/* sns: 양옆 배치 */
.sns-wrap{
  display:flex;
  align-items:center;
  gap: 12px;
  margin-top: 12px;
}

.sns{
  width:55px;
  height:auto;
  display:block;
}

/* =========================
갤러리 아이템 + 캡션
========================= */

.item{
  margin: 0 0 120px 0;
  opacity:0;
  transform: translateY(60px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.item.show{
  opacity:1;
  transform:none;
}

.cap{
  font-family: var(--font);
  font-size: 20px;
  font-weight: 400;
  color:#000;
  margin: 0 0 6px 0;          /* 이미지에 딱 붙게 */
}

.item img{
  width:100%;
  height:auto;
  display:block;
}

/* =========================
오른쪽 썸네일(고정)
- 갤러리 오른쪽에서 기본 100px
- 상단 50px부터 시작
- 스크롤바 숨김
========================= */

#thumbs{
  position:fixed;
  top:50px;

  right: calc(50% - (var(--galleryW) / 2) - var(--gapR) - var(--thumbW));
  width: var(--thumbW);
  height: calc(100vh - 50px);
  z-index: 200;

  overflow:hidden;
}

.thumbs-inner{
  height:100%;
  overflow-y:auto;
  scrollbar-width:none;
}
.thumbs-inner::-webkit-scrollbar{ display:none; }

.thumbs-inner img{
  width:100%;
  height:auto;
  display:block;
  margin-bottom: 50px;
  transition: opacity .2s ease;
}
.thumbs-inner img:hover{ opacity: .7; }
.thumbs-inner img.active{
  outline: 2px solid rgba(0,0,0,.25);
  outline-offset: 4px;
}

/* =========================
Lightbox (검정 90%, 위아래 여백 느낌)
========================= */

#lightbox{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.9);
  display:none;
  align-items:center;
  justify-content:center;
  z-index: 3000;
  padding: 3vh 3vw; /* 위/아래 조금 여백 */
}

#lightboxImg{
  max-width: 100%;
  max-height: 100%;
  width:auto;
  height:auto;
  display:block;
}

/* =========================
Category Modal (Editorial/Personal) - FIXED
- 이미지 크게/중앙
- 캡션/썸네일 겹침 방지
- 썸네일바: left 80px 시작, 맨 아래 얇은 스크롤바, 썸네일과 20px 간격
- cm-hit(좌우 넘김)이 썸네일 클릭을 가로채지 않게 처리
========================= */

#categoryModal{
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(255,255,244,.95);
  z-index: 3500;
}

.cm{
  position: absolute;
  inset: 0;
}

/* 닫기 버튼 */
.cm-close{
  position: absolute;
  top: 18px;
  right: 24px;
  font-size: var(--closeSize);
  line-height: 1;
  border: 0;
  background: transparent;
  color: var(--closeColor);
  z-index: 40;
}

/* ✅ 스테이지: 아래 썸네일바 높이만큼 공간을 '항상' 확보 */
.cm-stage{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  /* 아래는 썸네일바 120px + 여유 */
  padding: 40px 20px 160px 20px;
  box-sizing: border-box;
}

/* ✅ 미디어: 이미지+캡션을 세로로 */
.cm-media{
  width: min(1000px, 94vw);
  max-height: calc(100vh - 40px - 160px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ✅ 이미지: 작아지는 문제 핵심 해결 (세로 공간 최대 활용) */
.cm-img{
  width: 100%;
  height: auto;
  max-height: calc(100vh - 40px - 160px - 40px); /* 캡션 공간 */
  object-fit: contain;
  display: block;
}

.cm-caption{
  margin-top: 10px;
  font-size: 20px;
  line-height: 1.25;
  text-align: center;
  width: 100%;
}

/* ✅ 좌/우 클릭 영역: 썸네일바 영역은 절대 덮지 않게 */
.cm-hit{
  position: absolute;
  top: 0;
  bottom: 120px;   /* 썸네일바 영역은 제외 */
  z-index: 10;
}

.cm-hit.left{
  left: 0;
  right: calc(50% - 150px);
}

.cm-hit.right{
  left: calc(50% + 150px);
  right: 0;
}

/* ✅ 하단 썸네일 바 */
.cm-thumbs{
  position: fixed;
  left: 80px;     /* ✅ 첫 썸네일 시작 여백 */
  right: 0;
  bottom: 0;

  height: 120px;  /* 100(썸네일) + 20(스크롤바 간격) */
  display: flex;
  align-items: flex-end;
  gap: 50px;

  overflow-x: auto;
  overflow-y: hidden;

  padding: 0 20px 20px 0; /* ✅ 아래 20px = 스크롤바와 썸네일 간격 */
  box-sizing: border-box;

  scrollbar-width: thin;
  z-index: 30;     /* ✅ cm-hit보다 위 */
}

.cm-thumbs::-webkit-scrollbar{ height: 8px; }
.cm-thumbs::-webkit-scrollbar-track{ background: transparent; }
.cm-thumbs::-webkit-scrollbar-thumb{
  background: rgba(0,0,0,.25);
  border-radius: 999px;
}

.cm-thumbs img{
  height: 100px;
  width: auto;
  display: block;
  transition: opacity .2s ease;
}
.cm-thumbs img:hover{ opacity: .7; }
.cm-thumbs img.active{
  outline: 2px solid rgba(0,0,0,.25);
  outline-offset: 4px;
}
/* =========================
Book viewer (코믹스 페이지 넘김)
- 검정 90%
- 가로 1000px 고정(이상 커지지 않음, 작아지면 줄어듦)
- 좌/우 클릭으로 넘김
- esc / 바깥 클릭 닫힘
========================= */
#bookModal{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.9);
  display:none;
  z-index: 3700;
}

.book-close{
  position:fixed;
  top: 18px;
  right: 18px;
  font-size: var(--closeSize);
  line-height: 1;
  border:0;
  background:transparent;
  color: rgba(210,210,210,.95);
  z-index: 2;
}

.book-stage{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 3vh 3vw;
}

#bookImg{
  width: min(1500px, 94vw);
  max-width: 1500px;
  height:auto;
  display:block;
}

.book-hit{
  position:absolute;
  top:0;
  bottom:0;
  width: 35vw;
  min-width: 70px;
  z-index: 1;
}
.book-hit.left{ left:0; }
.book-hit.right{ right:0; }

/* =========================
Me popup (w500 / 내부스크롤 / px좌표 핫스팟)
========================= */

#meModal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  z-index: 3800;
}

#meModal .me-card{
  position: fixed;
  left: 400px;
  top: 60px;
  width: 500px;                          
  height: min(1417px, calc(100vh - 120px)); /* ✅ 화면 작을 때 바닥 접근 가능 */
  background: var(--bg);
  border-radius: 14px;
  box-shadow: 0 12px 48px rgba(0,0,0,.25);
  overflow: hidden;
}

#meModal .me-titlebar{
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: rgba(255,255,244,.95);
  border-bottom: 1px solid rgba(0,0,0,.08);
  cursor: grab;
  user-select: none;
}
#meModal .me-titlebar:active{ cursor: grabbing; }

#meModal .me-close{
  font-size: 22px;
  border: 0;
  background: transparent;
  color: #000;
}

#meModal .me-scroll{
  height: calc(100% - 48px);
  overflow-y: auto;
  overflow-x: hidden;
}

/* ✅ 기준 영역: 폭 500 고정 (핫스팟 px 좌표 기준) */
#meModal .me-wrap{
  position: relative;
  width: 500px;
}

#meModal #meImg{
  width: 500px;
  height: auto;
  display: block;
  position: relative;
  z-index: 1;
}

/* ✅ 핫스팟 공통 */
#meModal .hot{
  position: absolute;
  z-index: 5;
  display: block;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
}

/* ✅ 네가 준 px좌표 그대로 */
#meModal .hot-ig{ left:65px; top:500px; width:110px; height:100px; }
#meModal .hot-it{ left:195px; top:500px; width:110px; height:100px; }
#meModal .hot-be{ left:330px; top:500px; width:110px; height:100px; }
#meModal .hot-mail{ left:75px; top:420px; width:370px; height:50px; }

/* 토스트 */
#meModal .toast{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,.85);
  color: #fff;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 10;
}
#meModal .toast.show{
  opacity: 1;
  transform: translate(-50%, calc(-50% - 6px));
}
/* =========================
모바일
- 카테고리/썸네일 숨김
- 햄버거 고정
========================= */

/* 햄버거 크기/색 조절용 */
:root{
  --hamSize: 44px;                      /* 햄버거 글자 크기 */
  --hamTop: 12px;                       /* 위 여백 */
  --hamLeft: 14px;                      /* 왼쪽 여백 */
  --hamColor: rgba(140,140,140,.92);    /* 햄버거 색 */
}

.hamburger{
  display:none !important;
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 14px;
  font-size: var(--hamSize);
  line-height: 1;
  border: 0;
  background: transparent;
  color: var(--hamColor);
  padding: 0;
  margin: 0;
  z-index: 6000;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
}
.mobile-panel{
  position: fixed;
  inset: 0;
  background: rgba(255,255,244,.96);
  display: none;
  z-index: 5900;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mobile-card{
  width: 100%;
  min-height: 100vh;
  padding: 120px 26px 60px 26px;
  font-family: var(--font);
}

.mobile-title{
  font-size: 24px;
  margin-bottom: 10px;
}

.mobile-email{
  font-size: 20px;
  margin-bottom: 18px;
  word-break: break-word;
}

.mobile-sns{
  display:flex;
  flex-wrap:wrap;
  gap: 14px;
  align-items:center;
  margin-bottom: 28px;
}

.mobile-sns a{
  display:block;
}

.mobile-sns img{
  width: 62px;
  height:auto;
  display:block;
}

.mobile-comics-toggle{
  display:block;
  border:0;
  background:transparent;
  padding:0;
  margin: 0 0 18px 0;
  font-family: var(--font);
  font-size: 28px;   /* 터치하기 쉬운 크기 */
  line-height: 1.2;
  color:#000;
  text-align:left;
}

.mobile-comics-list{
  display:none;
}

.mobile-comics-list.show{
  display:block;
}

.mobile-comics-list img{
  width: min(92vw, 700px);
  height:auto;
  display:block;
  margin: 0 0 28px 0;
}

@media (max-width: 900px){
  .category,
  #thumbs{
    display:none !important;
  }

  #gallery{
    width: 95vw;
    margin: 50px auto 0 auto;
  }

  .hamburger{
    display:block !important;
  }
}

/* =========================
Comics overlay (카테고리 고정, 오른쪽 영역만 새창처럼)
========================= */

#comicsModal{
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;              /* ✅ 기본값: JS가 열 때 덮어씀 */
  background: var(--bg);
  display: none;                 /* JS가 block으로 바꿈 */
  overflow-y: auto;              /* ✅ 스크롤 */
  z-index: 3600;

  padding: 50px var(--edge) 80px var(--edge);
  box-sizing: border-box;
}

/* 닫기 버튼 */
.comics-close{
  position: fixed;
  top: 18px;
  right: 18px;
  font-size: var(--closeSize);
  line-height: 1;
  border: 0;
  background: transparent;
  color: var(--closeColor);
  z-index: 3601;
}

/* 리스트 컨테이너 */
.comics-inner{
  width: 100%;
}

/* 커버 리스트 */
#comicsList img{
  width: min(700px, 92vw);
  max-width: 700px;
  height: auto;
  display: block;
  margin: 0 auto 50px auto;     /* ✅ 간격 50px */
}

/* ✅ Comics 열릴 때 바깥 스크롤 잠금 */
html.no-scroll, body.no-scroll{
  overflow: hidden !important;
}
/* ✅ Comics hover toast (Me보다 약간 크게) */
#comicsToast{
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-50%, -100%);
  opacity: 0;
  pointer-events: none;
  z-index: 99999;
  transition: opacity .15s ease, transform .15s ease;
}

#comicsToast img{
  width: 80px;   /* 필요하면 여기서 크기 조절 */
  height: auto;
  display: block;
}

#comicsToast.show{
  opacity: 1;
  transform: translate(-50%, calc(-100% - 6px));
}
