/* ------------------------------------------------------------ */
/* 1. 글로벌 스타일 / 기본 리셋 */
/* ------------------------------------------------------------ */
body, html {
  overflow-x: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  box-sizing: border-box; /* 일관된 박스 모델 적용 */
}

*, *:before, *:after {
  box-sizing: inherit; /* 모든 요소가 body, html의 box-sizing을 상속하도록 */
}

/* ------------------------------------------------------------ */
/* 2. 헤더 (.site-header) 스타일 */
/* ------------------------------------------------------------ */
.site-header {
  position: relative;
  width: 100vw; /* 뷰포트 전체 너비 사용 */
  height: 800px;
  min-height: 800px;
  max-height: 800px;
  background-image: url('https://hanmaumbooks.org/wp-content/uploads/2018/03/x_0024-e1739950577814.jpg');
  background-size: cover;
  background-position: center 33% !important;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 20px; /* 헤더 내부 텍스트 왼쪽 여백 */
  text-align: left;
  color: white;
  overflow: hidden;
  margin-bottom: 0 !important; /* 헤더와 본문 사이 공백 제거 */
  /* margin-left 와 padding-left 는 100vw 사용 시 불필요할 수 있으나, 기존 스타일 유지 */
  margin-left: 0 !important;
  /* padding-left: 0 !important; /* 위에서 20px로 지정했으므로 이 줄은 주석처리 또는 삭제 */
}

/* 헤더 반응형 - 태블릿 */
@media (max-width: 1024px) {
  .site-header {
    height: 600px;
    min-height: 600px;
    max-height: 600px;
    /* width, margin, padding 은 PC 스타일 상속 또는 필요시 재정의 */
    /* padding-left: 0 !important; /* 태블릿에서 헤더 텍스트 여백 제거 시 */
  }
}

/* 헤더 반응형 - 모바일 */
@media (max-width: 767px) {
  .site-header {
    height: 400px;
    min-height: 400px;
    max-height: 400px;
    background-position: center top; /* 모바일에서는 위쪽 정렬 */
    /* padding-left: 0 !important; /* 모바일에서 헤더 텍스트 여백 제거 시 */
  }
}

/* ------------------------------------------------------------ */
/* 3. 메인 콘텐츠 영역 스타일 */
/* ------------------------------------------------------------ */

/* 3.1. 콘텐츠 영역 감싸는 부모 (#primary.content-area) - PC */
#primary.content-area {
  float: none !important; /* float 해제하여 중앙 정렬 가능하게 */
  width: 100% !important; /* 실제 너비는 max-width로 제어 */
  max-width: 1180px !important; /* 원하는 콘텐츠 최대 너비 */
  margin-top: -5px !important;  /* 헤더와의 간격 미세 조정 */
  margin-left: auto !important; /* 중앙 정렬 */
  margin-right: auto !important;/* 중앙 정렬 */
  padding-left: 15px !important; /* 내부 좌우 여백 */
  padding-right: 15px !important;/* 내부 좌우 여백 */
}

/* 3.2. 실제 글 내용 영역 (#main.site-main) - PC */
#main.site-main {
  width: 100% !important; /* #primary 내부에서 100% 너비 사용 */
  max-width: none !important; /* 최대 너비는 #primary 에서 제어하므로 해제 */
  padding-left: 0 !important;  /* #primary에 패딩이 있으므로, 여기선 0 또는 필요시 재조정 */
  padding-right: 0 !important;
  /* 테스트용 스타일 제거됨 (border, background-color) */
}

/* 3.3. 콘텐츠 영역 반응형 - 태블릿 */
@media (max-width: 1024px) {
  #primary.content-area {
    /* margin-top 은 PC 스타일 상속 */
    /* max-width 는 100vw 또는 PC 스타일 상속 (화면 너비에 맞게 자동 조절됨) */
    /* max-width: 100vw !important; /* 화면 너비 초과 방지 시 필요 */
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
}

/* 3.4. 콘텐츠 영역 반응형 - 모바일 */
@media (max-width: 767px) {
  #primary.content-area {
    /* margin-top 은 PC 스타일 상속 */
    /* max-width 는 100vw 또는 PC 스타일 상속 (화면 너비에 맞게 자동 조절됨) */
    /* max-width: 100vw !important; /* 화면 너비 초과 방지 시 필요 */
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
}

/* ------------------------------------------------------------ */
/* 4. 갤러리 스타일 */
/* ------------------------------------------------------------ */
/* ... (기존 갤러리 관련 CSS 코드를 여기에 배치하세요) ... */
.wp-block-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 한 줄에 4개씩 배치 */
    gap: 50px; /* 책 간격을 더욱 넓게 설정 */
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.wp-block-gallery .wp-block-image img {
    width: 100%; /* 부모 요소에 맞게 크기 조정 */
    max-width: 100px; /* 현재 크기의 1/3로 줄임 */
    height: auto;
 /* border-radius: 8px; /* 둥근 모서리 효과 */
    transition: transform 0.3s ease-in-out;
}

.wp-block-gallery .wp-block-image img:hover {
    transform: scale(1.05); /* 마우스 오버 시 살짝 확대 */
}

/* 갤러리 반응형 - 태블릿 */
@media (max-width: 1024px) {
    .wp-block-gallery {
        grid-template-columns: repeat(3, 1fr); /* 태블릿에서는 한 줄에 3권 */
        gap: 40px; /* 간격 조정 */
    }
    
    .wp-block-gallery .wp-block-image img {
        max-width: 90px; /* 태블릿에서는 조금 더 작은 크기로 조정 */
    }
}

/* 갤러리 반응형 - 모바일 */
@media (max-width: 767px) {
    .wp-block-gallery {
        grid-template-columns: repeat(2, 1fr); /* 모바일에서는 한 줄에 2권 */
        gap: 30px; /* 모바일에서는 간격 줄이기 */
    }
    
    .wp-block-gallery .wp-block-image img {
        max-width: 80px; /* 모바일에서는 더 작은 크기로 조정 */
    }
}
/* ------------------------------------------------------------ */