@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");
@import url('https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,200;1,300;1,400;1,500;1,600;1,700;1,800&display=swap');

/* =============================================================================
   leekim publishing house - 스타일시트
   ============================================================================= */

/* =============================================================================
   CSS 변수 (색상 및 기본값)
   ============================================================================= */
:root {
  /* 색상 - leekim publishing house 테마 */
  --color-bg: #F4F4F4;
  --color-text: #0055A4;
  /* 기존 001F3F 대신 강제되던 0055A4로 통일 */
  --color-accent: #0055A4;
  --color-border: #0055A4;

  /* 타이포그래피 */
  --font-family: "Spectral", "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  --font-size-base: 18px;
  --font-size-large: 1.5rem;
  --font-size-small: 0.875rem;

  /* 레이아웃 */
  --header-height: 60px;
  --container-max-width: 1200px;
  --spacing-unit: 1rem;

  /* 애니메이션 */
  --transition-speed: 0.3s;
}

/* =============================================================================
   기본 리셋 및 전역 스타일
   ============================================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: var(--header-height);
  /* 드래그 방지 */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* 이전 코드에서 !important로 덮어쓰던 것들을 기본 세팅으로 흡수 */
body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
a,
span,
li,
dt,
dd,
blockquote {
  color: var(--color-text);
}

a {
  text-decoration: none;
  transition: opacity var(--transition-speed);
}

a:hover {
  opacity: 0.7;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

/* =============================================================================
   HEADER - Fixed Header
   ============================================================================= */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 calc(var(--spacing-unit) * 1.5);
  z-index: 250;
}

/* 현재 페이지 라벨 (좌측) */
.current-page-label {
  font-weight: 500;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  user-select: none;
}

/* 로고 (중앙) */
.logo {
  grid-column: 2;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  user-select: none;
  outline: none;
}

.logo img {
  max-height: 40px;
  width: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  /* Optional: ensures clicks pass through to the link */
}

/* =============================================================================
   햄버거 메뉴 버튼
   ============================================================================= */
.menu-toggle {
  position: fixed;
  top: 16px;
  right: calc(var(--spacing-unit) * 1.5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  /* Increased by 50% from 6px */
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 300;
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--color-text);
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
  transform-origin: center;
}

/* 메뉴 열림 상태 */
.menu-open .menu-toggle .hamburger-line:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}

.menu-open .menu-toggle .hamburger-line:nth-child(2) {
  transform: translateY(-5.5px) rotate(-45deg);
}

/* =============================================================================
   OFF-CANVAS 메뉴 패널
   ============================================================================= */
.menu-overlay {
  display: none;
}

.menu-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background-color: var(--color-bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
  z-index: 280;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 calc(var(--spacing-unit) * 1.5);
  border-bottom: 1px solid var(--color-border);
}

.menu-open .menu-panel {
  opacity: 1;
  visibility: visible;
}

/* 메뉴 열림 시 헤더 내용만 Fade Out (본문은 유지) */
.logo,
.current-page-label {
  transition: opacity 0.3s ease-in-out;
}

.menu-open .logo,
.menu-open .current-page-label {
  opacity: 0;
  pointer-events: none;
}

/* 네비게이션 링크 */
.menu-nav {
  list-style: none;
  display: flex;
  gap: calc(var(--spacing-unit) * 2);
  margin: 0;
}

.menu-nav li {
  margin: 0;
}

.menu-nav a {
  font-size: 1rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.menu-footer {
  display: none;
}

/* =============================================================================
   MAIN CONTENT
   ============================================================================= */
.site-main {
  flex: 1;
  padding: calc(var(--spacing-unit) * 2);
  max-width: var(--container-max-width);
  margin: 0 auto;
  width: 100%;
}

/* =============================================================================
   FOOTER
   ============================================================================= */
.site-footer {
  padding: calc(var(--spacing-unit) * 2);
  text-align: center;
  font-size: var(--font-size-small);
  border-top: 1px solid var(--color-border);
}

/* =============================================================================
   페이지 요소
   ============================================================================= */
.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: calc(var(--spacing-unit) * 2);
  letter-spacing: -0.02em;
}

.sort-nav {
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-unit);
  margin-bottom: var(--spacing-unit);
  padding-right: var(--spacing-unit);
}

.sort-btn {
  background: none;
  border: none;
  font-family: var(--font-family);
  font-size: 1rem;
  color: #999;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition-speed);
}

.sort-btn:hover,
.sort-btn.active {
  color: var(--color-text);
}

.sort-btn.active {
  font-weight: 700;
  border-bottom: 2px solid var(--color-text);
}

/* =============================================================================
   BOOKS GALLERY
   ============================================================================= */
.books-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: none;
}

.book-card {
  display: flex;
  flex-direction: column;
  padding: var(--spacing-unit);
  transition: background-color var(--transition-speed);
}

.book-card:hover {
  background-color: #F4F4F4;
  /* hover시 미세한 배경 변화 */
}

.book-cover {
  aspect-ratio: 2 / 3;
  background-color: transparent;
  overflow: hidden;
  margin-bottom: var(--spacing-unit);
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-cover img {
  max-width: 90%;
  max-height: 90%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform var(--transition-speed);
}

.book-card:hover .book-cover img {
  transform: scale(1.05);
}

.book-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: var(--font-size-small);
  text-align: center;
  padding: var(--spacing-unit);
  border: 1px dashed #ccc;
}

.book-info {
  flex: 1;
}

.book-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.book-author {
  font-size: var(--font-size-small);
  opacity: 0.8;
  margin-bottom: 0.25rem;
}

.book-year {
  font-size: var(--font-size-small);
  opacity: 0.6;
}

/* =============================================================================
   ABOUT / CONTACT
   ============================================================================= */
.page-content {
  max-width: 700px;
}

.page-content p {
  margin-bottom: var(--spacing-unit);
}

.page-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: calc(var(--spacing-unit) * 2);
  margin-bottom: var(--spacing-unit);
}

/* =============================================================================
   책 상세 페이지
   ============================================================================= */
.book-detail {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: calc(var(--spacing-unit) * 3);
  max-width: 900px;
  /* 상세 페이지에서는 텍스트 선택 허용 */
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
  caret-color: transparent;
}

.book-detail-cover {
  position: sticky;
  top: calc(var(--header-height) + var(--spacing-unit) * 2);
  align-self: start;
}

.book-detail-cover img {
  width: 100%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.book-detail-info {
  display: flex;
  flex-direction: column;
}

.book-detail-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.book-detail-author {
  font-size: 1.25rem;
  opacity: 0.8;
  margin-bottom: calc(var(--spacing-unit) * 2);
}

.book-detail-subtitle {
  font-size: 1.1rem;
  opacity: 0.7;
  font-style: italic;
  margin-bottom: calc(var(--spacing-unit) * 0.5);
}

.book-detail-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  margin-bottom: calc(var(--spacing-unit) * 2);
  padding: var(--spacing-unit);
  background-color: rgba(0, 85, 164, 0.05);
  /* 0055A4의 연한 버전 */
}

.book-detail-meta dt {
  font-weight: 600;
}

.book-detail-section {
  margin-bottom: calc(var(--spacing-unit) * 2);
}

.book-detail-section h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--spacing-unit);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.book-detail-section blockquote {
  border-left: 3px solid var(--color-text);
  padding-left: var(--spacing-unit);
  font-style: italic;
  opacity: 0.9;
}

.back-link {
  display: inline-block;
  margin-top: calc(var(--spacing-unit) * 2);
  font-weight: 500;
}

/* =============================================================================
   Media Queries
   ============================================================================= */
@media (max-width: 900px) {
  .books-gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  :root {
    --font-size-base: 16px;
  }

  .books-gallery {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-title {
    font-size: 1.5rem;
  }

  .menu-nav a {
    font-size: 0.875rem;
  }

  .book-detail {
    grid-template-columns: 1fr;
  }

  .book-detail-cover {
    position: static;
    max-width: 200px;
    margin: 0 auto;
  }

  .book-detail-title {
    font-size: 1.5rem;
  }
}