@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css");
/* 공동번역성서 프로젝트 - 성경 구절 스타일시트 */

/* 기본 설정 */
:root {
  --breadcrumb-height: 40px;
}
* {
  box-sizing: border-box;
}

body {
  font-family: "Pretendard Variable", Pretendard, "Noto Sans KR", -apple-system,
    BlinkMacSystemFont, "Segoe UI", system-ui, "Apple SD Gothic Neo",
    "Malgun Gothic", sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #fafafa;
  margin: 0;
  padding: 20px;
}

/* 좌측 정렬 레이아웃 */
.page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding-top: 120px; /* 고정 헤더를 위한 상단 여백 */
  padding-bottom: 50px; /* 플로팅 푸터를 위한 하단 여백 */
}

/* 고정 헤더 스타일 */
.fixed-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(205, 205, 205, 0.95);
  z-index: 900; /* 검색 패널(1001)보다 낮게 설정 */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid #b8b8b8;
  backdrop-filter: blur(5px);
}

.fixed-header-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 20px;
}

/* 브레드크럼 + 검색 레이아웃 */
.breadcrumb-row {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "breadcrumb search";
  gap: 12px;
  align-items: center;
  margin: 0;
  min-height: var(--breadcrumb-height);
}

/* 고정 헤더 내부의 브레드크럼 행 */
.fixed-header .breadcrumb-row {
  margin-bottom: 8px;
}

/* 행 내부 모든 아이템을 수직 중앙 정렬 */
.breadcrumb-row > * {
  align-self: center;
}

#bible-breadcrumb {
  grid-area: breadcrumb;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0;
  margin: 0;
}

#bible-breadcrumb ol,
#bible-breadcrumb ul {
  margin: 0;
  padding: 0;
}
#bible-breadcrumb li {
  margin: 0;
}

/* 접근성: 스크린리더 전용 텍스트 */
.screen-reader-text {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* 유틸리티: 요소 숨김 */
.hidden {
  display: none !important;
}

/* 검색 컨테이너 */
/* 브레드크럼 우측 검색 폼 */
.breadcrumb-search {
  grid-area: search;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
}

/* 검색 결과 토글 버튼(스크립트로 생성)의 높이/정렬을 브레드크럼 칩과 통일 */
.search-results-toggle-btn {
  align-items: center !important;
  height: var(--breadcrumb-height) !important;
}

/* 데스크탑에서는 검색 결과 패널 버튼 숨김 */
@media (min-width: 769px) {
  .search-results-toggle-btn {
    display: none !important;
  }
}

#verse-search-form {
  display: flex;
  gap: 8px;
  margin: 0;
}

#verse-search {
  flex: 1 1 auto; /* 남은 공간 모두 사용 */
  min-width: 0; /* 그리드/플렉스에서 overflow 방지 */
  height: 100%;
  padding: 0 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 16px;
}

#verse-search:focus {
  outline: 2px solid #0066cc;
  border-color: #0066cc;
}

#verse-search-btn {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  background: #0066cc;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.2s;
}

/* 브레드크럼 칩 높이에 검색 입력/버튼 높이를 맞춤 */
.breadcrumb-search #verse-search,
.breadcrumb-search #verse-search-btn {
  height: var(--breadcrumb-height);
}

#verse-search-btn:hover {
  background: #0052a3;
}

#verse-search-btn:focus {
  outline: 2px solid #004080;
}

.search-help-text {
  color: #666;
  font-size: 14px;
  margin: 6px 0 0;
}

/* 오디오 플레이어 */
.audio-player-container {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 0 20px;
  margin-bottom: 10px;
  box-shadow: none;
  display: flex;
  align-items: center; /* 라벨과 플레이어 수직 중앙 정렬 */
  justify-content: center; /* 전체를 가운데 정렬 */
  gap: 12px; /* 라벨-플레이어 간격 */
  flex-wrap: wrap; /* 좁은 화면에서 줄바꿈 허용 */
}

.bible-audio {
  width: 100%;
  max-width: 700px;
}

.audio-label {
  display: inline-block;
  margin-right: 0;
  font-weight: 600;
  color: #2c3e50;
}

.audio-unavailable-notice {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
  text-align: center;
}

.notice-text {
  color: #6c757d;
  margin: 0;
  font-style: italic;
}

.notice-text .icon {
  margin-right: 8px;
  font-size: 1.2em;
}

/* 메인 콘텐츠 */
article {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h1 {
  color: #2c3e50;
  /* 장 제목 아래 파란 줄 제거 */
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
  font-size: 2em;
}

/* 장 제목 + 이전/다음 버튼 행 */
.chapter-title-row {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 8px;
  margin: 20px 0 30px;
}

/* 고정 헤더 내부의 장 제목 행 */
.fixed-header .chapter-title-row {
  margin: 0;
}

.chapter-title-row .chapter-title {
  text-align: center;
  border-bottom: none;
  margin: 12px 0;
  padding: 10px 0;
  color: #000000;
}

/* 고정 헤더 내부의 장 제목 */
.fixed-header .chapter-title {
  font-size: 1.5em;
  margin: 8px 0;
  padding: 5px 0;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: 1px solid #d0d7de;
  background: #ffffff;
  color: #1f2328;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    transform 0.05s ease;
  text-decoration: none;
}

.nav-btn:hover {
  background: #f6f8fa;
}

.nav-btn:active {
  transform: translateY(1px);
}

.nav-btn[aria-disabled="true"],
.nav-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.nav-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* 단락 스타일 */
p {
  margin: 1.5em 0;
  text-align: justify;
  font-size: 18px;
  line-height: 1.8;
}

/* 성경 본문 단락 - 연속 공백 문자 유지 */
.scripture-paragraph {
  margin: 1.5em 0;
  text-align: justify;
  font-size: 18px;
  line-height: 1.8;
  white-space: pre-wrap;
}

/* 절 스타일 */
span[id^="창세-"],
span[id^="출애-"],
span[id^="레위-"],
span[id^="민수-"],
span[id^="신명-"],
span[id^="여호-"],
span[id^="판관-"],
span[id^="룻기-"],
span[id^="사무상-"],
span[id^="사무하-"],
span[id^="열왕상-"],
span[id^="열왕하-"],
span[id^="역상-"],
span[id^="역하-"],
span[id^="에스-"],
span[id^="느헤-"],
span[id^="에스더-"],
span[id^="욥기-"],
span[id^="시편-"],
span[id^="잠언-"],
span[id^="전도-"],
span[id^="아가-"],
span[id^="이사-"],
span[id^="예레-"],
span[id^="애가-"],
span[id^="에제-"],
span[id^="다니-"],
span[id^="호세-"],
span[id^="요엘-"],
span[id^="아모-"],
span[id^="오바-"],
span[id^="요나-"],
span[id^="미가-"],
span[id^="나훔-"],
span[id^="하바-"],
span[id^="스바-"],
span[id^="학개-"],
span[id^="스가-"],
span[id^="말라-"],
span[id^="마태-"],
span[id^="마가-"],
span[id^="누가-"],
span[id^="요한-"],
span[id^="사도-"],
span[id^="로마-"],
span[id^="고전-"],
span[id^="고후-"],
span[id^="갈라-"],
span[id^="에베-"],
span[id^="빌립-"],
span[id^="골로-"],
span[id^="살전-"],
span[id^="살후-"],
span[id^="딤전-"],
span[id^="딤후-"],
span[id^="디도-"],
span[id^="빌레-"],
span[id^="히브-"],
span[id^="야고-"],
span[id^="베전-"],
span[id^="베후-"],
span[id^="요일-"],
span[id^="요이-"],
span[id^="요삼-"],
span[id^="유다-"],
span[id^="계시-"] {
  /* 절 ID를 가진 span 요소들 */
  position: relative;
  transition: background-color 0.3s ease;
}

/* 절 번호 스타일 */
.verse-number {
  /* font-weight: bold; */
  color: #999999;
  font-size: 0.9em;
  margin-right: 4px;
}

/* 단락 표시 스타일 */
.paragraph-marker {
  color: #999999;
  /* font-weight: bold; */
  margin-right: 4px;
  font-size: 1.1em;
}

/* 하이라이트 효과 (검색 결과용) */
.verse-highlight {
  background-color: #fff3cd !important;
  border-left: 4px solid #ffc107;
  padding-left: 8px;
  margin-left: -8px;
  border-radius: 4px;
}

/* 검색 결과 텍스트 하이라이트 */
.text-highlight {
  background-color: #ffeb3b;
  padding: 2px 4px;
  border-radius: 2px;
  font-weight: bold;
}

/* 포커스 시 강조 */
span[id]:target {
  background-color: #e3f2fd;
  border-left: 4px solid #2196f3;
  padding-left: 8px;
  margin-left: -8px;
  border-radius: 4px;
  animation: highlight-fade 3s ease-out;
}

@keyframes highlight-fade {
  0% {
    background-color: #ffeb3b;
  }

  100% {
    background-color: #e3f2fd;
  }
}

/* 데스크탑 검색 결과 패널 스타일 */
.search-results-panel {
  position: fixed;
  top: 70px;
  right: 20px;
  bottom: 60px; /* 푸터 높이 + 여백을 고려하여 하단 여백 확보 */
  width: 480px;
  max-height: calc(100vh - 70px - 60px); /* 상단 헤더와 하단 여백 제외 */
  height: auto;
  background-color: #ffffff;
  border: 1px solid #ddd;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  z-index: 1001;
}

.search-results-panel .search-results-body {
  /* JavaScript에서 동적으로 높이 계산 */
  overflow: hidden;
  padding: 0;
  box-sizing: border-box;
  position: relative;
}

.search-results-panel .search-results-list {
  padding: 8px 10px 0px 10px;
  margin-bottom: 0;
}

.search-results-panel > .search-results-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  background: #f9fafb;
  border-top: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  box-sizing: border-box;
  z-index: 2;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
  /* 모바일에서 고정 헤더 패딩 조정 */
  .page-wrap {
    padding-top: 140px;
  }

  .fixed-header-content {
    padding: 8px 10px;
  }

  .fixed-header .chapter-title {
    font-size: 1.2em;
    margin: 6px 0;
    padding: 4px 0;
  }

  body {
    padding: 10px;
  }

  article {
    padding: 16px;
  }

  h1 {
    font-size: 1.5em;
  }

  p {
    font-size: 16px;
    margin: 0.9em 0;
    line-height: 1.6;
  }

  /* 데스크탑에서 검색 폼(입력, 검색 버튼, 토글 버튼)을 항상 한 줄로 유지 */
  #verse-search-form {
    flex-direction: row;
  }

  #verse-search-btn {
    width: auto;
  }
  .breadcrumb-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "breadcrumb"
      "search";
  }

  .breadcrumb-search {
    display: none !important;
  }
  /* 특이도 강화를 위해 ID에도 숨김 적용 */
  #verse-search-form {
    display: none !important;
  }

  /* 모바일에서 브레드크럼/검색은 상단에 남기고, 실제 실행은 FAB로 접근 */
  .search-fab {
    position: fixed;
    right: 16px;
    bottom: 70px; /* 푸터를 가리지 않도록 위로 이동 */
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #ffffff;
    color: #0066cc;
    border: 1px solid #d0d7de;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
    z-index: 1100;
  }

  /* 모바일에서는 기본 검색 결과 패널 숨김(우상단 고정 패널) */
  .search-results-panel {
    display: none !important;
  }

  /* 바텀시트 내부에 있을 때만 보이도록 허용 */
  #mobile-search-results .search-results-panel {
    display: block !important;
  }

  /* 모바일: 제목/오디오/문단 여백 축소 */
  .chapter-title-row {
    margin: 10px 0 16px;
  }
  .chapter-title-row .chapter-title {
    margin: 6px 0;
    padding: 6px 0;
  }
  .scripture-paragraph {
    margin: 0.9em 0;
    line-height: 1.6;
  }
  .audio-player-container {
    padding: 16px 0 12px; /* 상단 여백 추가 */
    margin-bottom: 16px; /* 하단 여백도 약간 증가 */
  }
  .audio-unavailable-notice {
    margin: 16px 0; /* 상하단 여백 통일 */
    padding: 16px; /* 패딩 약간 축소 */
  }
}

/* 인쇄 스타일 */
@media print {
  body {
    background: white;
    color: black;
  }

  .search-container,
  .audio-player-container,
  .audio-unavailable-notice {
    display: none;
  }

  article {
    box-shadow: none;
    border: none;
  }

  .verse-number,
  .paragraph-marker {
    color: #999999;
  }

  /* 인쇄 시 푸터 숨김 */
  .page-footer {
    display: none;
  }
}

/* 푸터 스타일 - 플로팅 */
.page-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(205, 205, 205, 0.95);
  color: #2c3e50;
  padding: 8px 0;
  border-top: 1px solid #b8b8b8;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.1);
  z-index: 800;
  backdrop-filter: blur(5px);
}

.footer-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.footer-section {
  display: inline-block;
}

.footer-inline {
  white-space: nowrap;
}

.footer-separator {
  margin: 0 8px;
}

.footer-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  display: inline;
}

.footer-text a {
  color: #2c3e50;
  text-decoration: none;
  font-weight: 500;
}

.footer-text a:hover {
  text-decoration: underline;
}

.footer-text a.github-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s;
  vertical-align: middle;
  line-height: 1.4;
}

.footer-text a.github-link:hover {
  opacity: 0.7;
}

.footer-text a.github-link svg {
  display: inline-block;
  height: 1em;
  width: auto;
  vertical-align: middle;
  flex-shrink: 0;
}

/* 모바일 푸터 스타일 */
@media (max-width: 768px) {
  .page-footer {
    padding: 6px 0;
  }

  .footer-content {
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 10px;
    font-size: 10px;
  }

  .footer-text {
    font-size: 11px;
  }
}
