/*
 * ELSOL — GOLD CAPTION READER  (caption-reader.css)  build 20261117-firebase-p0
 * cr4: 리더 = 세로 flex(고정 상단 막대 + 독립 세로 스크롤 영역). 리더 자체는 스크롤하지 않음(sticky 의존 제거).
 *      위치·크기는 CSS inset:0, 보이는 화면과 어긋나면 caption-reader.js가 visualViewport 값으로 맞춤.
 * cr3: 목록 버튼 스타일 제거, 돋보기(+) 32px(폰)/36px(600px 이상)·선 2.75px·터치 48px, 설정 접기, 처음/마지막 표시, 듀얼스크린 힌지 회피
 * 범위: .dzcr- 로 시작하는 요소만. 기존 헤더·카드·뷰어·Bio·PDF·COSMOS 스타일은 건드리지 않는다.
 * 색: 배경 기존 짙은 남흑 #050914 · 제목 #FFFFFF · 정보 #E9ECF1 · 라벨 #C8CDD5 · 금빛 #D4B46D(아이콘·테두리·선택 표시만)
 * 대비(배경 #050914 기준): #FFFFFF 19.9:1 · #E9ECF1 16.8:1 · #C8CDD5 12.5:1 · #F4EFE6 17.4:1 · #D4B46D 10.0:1 — 모두 7:1 이상.
 * COSMOS 밝은 배경의 버튼: 글자 #14161C 16.4:1 · 아이콘 #7D5F1A 5.4:1 · 테두리 #A8862F 3.1:1(비텍스트 3:1 기준).
 * 애니메이션·번쩍임 없음.
 */

/* ---------- 작품 상세 화면의 버튼(금빛 돋보기(+) 아이콘 + 글자 라벨) ---------- */
.dzcr-viewerwrap.dzcr-viewerwrap {
  display: block;
  margin: 10px 0 12px;
  padding: 0;
  position: static;
}
.dzcr-trigger.dzcr-trigger {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 48px;
  min-height: 48px;
  max-width: 100%;
  margin: 0;
  padding: 6px 18px 6px 10px;
  box-sizing: border-box;
  border: 1px solid rgba(212, 180, 109, 0.6);
  border-radius: 999px;
  background: rgba(212, 180, 109, 0.06);
  color: #F4EFE6;
  font-family: inherit;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-align: left;
  text-transform: none;
  white-space: normal;
  cursor: pointer;
  opacity: 1;
  box-shadow: none;
  transform: none;
  transition: none;
  animation: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.dzcr-trigger.dzcr-trigger:hover { background: rgba(212, 180, 109, 0.12); border-color: #D4B46D; }
.dzcr-trigger.dzcr-trigger:focus-visible { outline: 3px solid #F4EFE6; outline-offset: 2px; }
/* 돋보기(+): 폰 32px, 넓은 화면 36px. 선 두께는 vector-effect로 크기와 무관하게 2.75px — 확대 환경에서도 SVG라 선명 */
.dzcr-trigger .dzcr-icon {
  flex: 0 0 auto;
  display: block;
  width: 32px;
  height: 32px;
  color: #D4B46D;
  stroke-width: 2.75px;
  overflow: visible;
}
.dzcr-trigger .dzcr-icon * { stroke-width: 2.75px; }
@media (min-width: 600px) {
  .dzcr-trigger .dzcr-icon { width: 36px; height: 36px; }
  .dzcr-trigger.dzcr-trigger { font-size: 16px; }
}
.dzcr-trigger .dzcr-trigger-label { display: inline-flex; flex-direction: column; justify-content: center; min-width: 0; overflow-wrap: anywhere; }
.dzcr-trigger .dzcr-tl { display: block; }

/* ---------- 리더(전용 읽기 화면) ---------- */
#dzCaptionReader.dzcr-root {
  --dzcr-scale: 3;
  --dzcr-base: max(16px, 1em);
  position: fixed;
  inset: 0;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  /* 리더 자체는 스크롤하지 않는다(포커스·브라우저 스크롤 복원으로 상단 막대가 밀려 올라가지 않게). 스크롤은 .dzcr-scroll만 */
  overflow: hidden;
  overflow: clip;
  overscroll-behavior: contain;
  background: #050914;
  color: #E9ECF1;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.5;
  letter-spacing: normal;
  text-align: left;
  text-transform: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  animation: none;
  transition: none;
  transform: none;
  filter: none;
}
/* iOS: 시스템 글자 크기(손쉬운 사용 > 더 큰 텍스트)를 기준 크기에 반영 */
@supports (font: -apple-system-body) {
  #dzCaptionReader.dzcr-root { font: -apple-system-body; font-family: -apple-system, "Apple SD Gothic Neo", sans-serif; line-height: 1.5; }
}
#dzCaptionReader.dzcr-root[hidden] { display: none !important; }
#dzCaptionReader *, #dzCaptionReader *::before, #dzCaptionReader *::after {
  box-sizing: border-box;
  animation: none;
  transition: none;
}
/* 독립 세로 스크롤 영역: 설정·캡션 본문·하단 버튼. 남은 높이를 모두 쓰고(min-height:0) 그 안에서만 스크롤 */
#dzCaptionReader .dzcr-scroll {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y pinch-zoom;
}
#dzCaptionReader .dzcr-inner {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 max(16px, env(safe-area-inset-right)) max(32px, calc(env(safe-area-inset-bottom) + 16px)) max(16px, env(safe-area-inset-left));
}

/* 상단 고정 막대: 닫기 · 이전/위치/다음 — 스크롤 영역 밖이라 최초 진입부터 항상 화면 안(리더 확대 비율과 무관한 크기) */
#dzCaptionReader .dzcr-bar {
  position: relative;
  flex: 0 0 auto;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  background: #050914;
  border-bottom: 1px solid rgba(212, 180, 109, 0.45);
  /* iOS 손쉬운 사용 '더 큰 텍스트'에서도 막대가 화면 대부분을 차지하지 않게 상한(본문 캡션 크기와 무관) */
  font-size: min(1em, 22px);
}
/* 가로로 아주 낮은 화면(휴대폰 가로·분할 화면): 막대 여백만 줄인다 */
@media (max-height: 420px) {
  #dzCaptionReader .dzcr-bar { padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: 4px; }
}
#dzCaptionReader .dzcr-nav { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; margin: 0 0 0 auto; padding: 0; min-width: 0; }
#dzCaptionReader .dzcr-pos { margin: 0 4px; padding: 0; color: #E9ECF1; font-size: 1em; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

#dzCaptionReader .dzcr-btn {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid rgba(212, 180, 109, 0.6);
  border-radius: 10px;
  background: transparent;
  color: #F4EFE6;
  font: inherit;
  font-size: 1em;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: normal;
  text-align: center;
  text-transform: none;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  box-shadow: none;
  opacity: 1;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#dzCaptionReader .dzcr-btn[hidden] { display: none !important; }
#dzCaptionReader .dzcr-btn:hover { background: rgba(212, 180, 109, 0.12); border-color: #D4B46D; }
#dzCaptionReader .dzcr-btn:focus-visible,
#dzCaptionReader .dzcr-title:focus-visible { outline: 3px solid #F4EFE6; outline-offset: 2px; }
#dzCaptionReader .dzcr-title:focus:not(:focus-visible) { outline: none; }
#dzCaptionReader .dzcr-btn span[lang] + span[lang] { margin-left: 0; }
#dzCaptionReader .dzcr-bar .dzcr-btn { padding: 6px 10px; flex-direction: column; gap: 0; }
@media (max-width: 360px) {
  #dzCaptionReader .dzcr-bar { gap: 6px; padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  #dzCaptionReader .dzcr-bar .dzcr-btn { padding: 6px 8px; }
  #dzCaptionReader .dzcr-pos { margin: 0 2px; font-size: 0.9375em; }
}
/* 400%에서는 제목 배율을 조금 낮춰 한 줄에 들어가는 글자 수를 확보(본문 400%는 그대로) */
#dzCaptionReader.dzcr-root[data-dzcr-scale="400"] .dzcr-title { font-size: 1.1em; }
#dzCaptionReader .dzcr-stack { display: block; font-size: 0.9375em; line-height: 1.2; }

/* 설정: 글자 크기 · 언어 — 선택 상태는 ✓ 표시 + 굵은 금빛 테두리 + 채움(색만으로 구분하지 않음) */
#dzCaptionReader .dzcr-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin: 16px 0 8px;
  padding: 0 0 16px;
  border-bottom: 1px solid rgba(200, 205, 213, 0.25);
}
#dzCaptionReader .dzcr-group { margin: 0; padding: 0; min-width: 0; max-width: 100%; }
#dzCaptionReader .dzcr-group-label { margin: 0 0 6px; padding: 0; color: #C8CDD5; font-size: 0.9375em; font-weight: 600; }
#dzCaptionReader .dzcr-choices { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
#dzCaptionReader .dzcr-choice { padding: 8px 10px; border-radius: 8px; }
#dzCaptionReader .dzcr-check { display: inline-block; width: 1em; color: #D4B46D; font-weight: 800; visibility: hidden; }
#dzCaptionReader .dzcr-choice[aria-pressed="true"] {
  border: 2px solid #D4B46D;
  background: rgba(212, 180, 109, 0.2);
  color: #FFFFFF;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
}
#dzCaptionReader .dzcr-choice[aria-pressed="true"] .dzcr-check { visibility: visible; }

/* 캡션 본문: 기준 16px × 선택 배율. 가로 스크롤·잘림 없이 자동 줄바꿈 */
#dzCaptionReader .dzcr-body { margin: 0; padding: 0; min-width: 0; max-width: 100%; }
#dzCaptionReader .dzcr-caption {
  display: block;
  margin: 0;
  padding: 0.75em 0 0;
  min-width: 0;
  max-width: 46em;
  font-size: calc(var(--dzcr-base) * var(--dzcr-scale));
  line-height: 1.5;
  color: #E9ECF1;
  word-break: keep-all;
  overflow-wrap: anywhere;
  word-wrap: break-word;
  hyphens: manual;
}
#dzCaptionReader .dzcr-title {
  margin: 0 0 0.6em;
  padding: 0;
  color: #FFFFFF;
  font-family: inherit;
  font-size: 1.25em;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: normal;
  text-transform: none;
}
#dzCaptionReader .dzcr-line { display: block; }
#dzCaptionReader .dzcr-line + .dzcr-line { margin-top: 0.25em; }
#dzCaptionReader .dzcr-fields { margin: 0; padding: 0; }
#dzCaptionReader .dzcr-row { margin: 0 0 0.6em; padding: 0; }
#dzCaptionReader .dzcr-key {
  display: block;
  margin: 0;
  padding: 0;
  color: #C8CDD5;
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1.4;
}
#dzCaptionReader .dzcr-val {
  display: block;
  margin: 0;
  padding: 0;
  color: #E9ECF1;
  font-size: 1em;
  font-weight: 500;
  line-height: 1.45;
}
#dzCaptionReader .dzcr-notes { margin: 0.4em 0 0; padding: 0; }
#dzCaptionReader .dzcr-note { margin: 0.2em 0 0.6em; padding: 0; color: #E9ECF1; white-space: pre-line; }

#dzCaptionReader .dzcr-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 1.5em 0 0;
  padding: 16px 0 0;
  border-top: 1px solid rgba(200, 205, 213, 0.25);
}
#dzCaptionReader .dzcr-sr {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 설정 패널 접기·펼치기 */
#dzCaptionReader .dzcr-settings { flex-direction: column; flex-wrap: nowrap; gap: 10px; }
#dzCaptionReader .dzcr-settings-toggle {
  justify-content: flex-start;
  align-self: flex-start;
  gap: 8px;
  max-width: 100%;
  border-radius: 8px;
  text-align: left;
}
#dzCaptionReader .dzcr-chev { display: inline-block; width: 1em; color: #D4B46D; font-weight: 800; }
#dzCaptionReader .dzcr-settings-body { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 0; padding: 0; }
#dzCaptionReader .dzcr-settings-body[hidden] { display: none !important; }

/* 처음·마지막 작품: 버튼은 남겨 두고(포커스 유지) 흐리게 + 점선 테두리로 표시(색만으로 구분하지 않음) */
#dzCaptionReader .dzcr-btn[aria-disabled="true"] {
  opacity: 0.45;
  border-style: dashed;
  cursor: default;
}
#dzCaptionReader .dzcr-btn[aria-disabled="true"]:hover { background: transparent; border-color: rgba(212, 180, 109, 0.6); }

/* 듀얼스크린·폴더블 힌지: 화면이 좌우 두 구역이면 리더를 왼쪽 구역에만, 위아래 두 구역이면 위 구역에만 둔다(힌지에 글자가 걸치지 않게) */
@media (horizontal-viewport-segments: 2) {
  #dzCaptionReader.dzcr-root { right: calc(100vw - env(viewport-segment-right 0 0, 100vw)); }
}
@media (vertical-viewport-segments: 2) {
  #dzCaptionReader.dzcr-root { bottom: calc(100vh - env(viewport-segment-bottom 0 0, 100vh)); }
}

@media (prefers-reduced-motion: reduce) {
  #dzCaptionReader, .dzcr-trigger { scroll-behavior: auto; }
}
@media (forced-colors: active) {
  #dzCaptionReader .dzcr-choice[aria-pressed="true"] { outline: 2px solid CanvasText; }
}

/* COSMOS(밝은 배경) — 버튼만 어두운 글자·짙은 금빛 테두리로(대비 확보). 리더 화면은 세 서비스 모두 같은 어두운 화면. */
.dzcr-viewerwrap-cosmos .dzcr-trigger.dzcr-trigger {
  color: #14161C;
  background: rgba(168, 134, 47, 0.07);
  border-color: #A8862F;
}
.dzcr-viewerwrap-cosmos .dzcr-trigger.dzcr-trigger:hover { background: rgba(168, 134, 47, 0.14); border-color: #7D5F1A; }
.dzcr-viewerwrap-cosmos .dzcr-trigger.dzcr-trigger:focus-visible { outline-color: #14161C; }
.dzcr-viewerwrap-cosmos .dzcr-trigger .dzcr-icon { color: #7D5F1A; }

/* cr5 — Collection inquiry lives inside the independently magnified caption.
   At 100–400% all text reflows vertically; existing gallery CSS is unchanged. */
#dzCaptionReader .dzcr-mail {
  margin: 1.15em 0 0; padding: .8em 0 0;
  min-width: 0; max-width: 100%;
  border-top: 1px solid rgba(212,180,109,.45);
}
#dzCaptionReader .dzcr-mail[hidden],
#dzCaptionReader .dzcr-mail-panel[hidden] { display: none !important; }
#dzCaptionReader .dzcr-mail-trigger {
  display: inline-flex; max-width: 100%; width: auto;
  padding: .55em .8em; min-height: 44px;
  border-radius: 999px; color: #F1D398;
  font-size: 1em; line-height: 1.4;
}
#dzCaptionReader .dzcr-mail-panel {
  display: flex; flex-direction: column; align-items: stretch;
  gap: .32em; min-width: 0; max-width: 100%;
  margin: .5em 0 0; padding: .4em 0;
  font-size: 1em; line-height: 1.45;
}
#dzCaptionReader .dzcr-mail-option {
  display: flex; align-items: center; justify-content: flex-start;
  box-sizing: border-box; min-height: 44px;
  min-width: 0; max-width: 100%; width: 100%;
  margin: 0; padding: .45em .6em;
  border: 1px solid rgba(212,180,109,.62);
  border-radius: .35em; background: rgba(212,180,109,.055);
  color: #F4EFE6; font: inherit; font-size: 1em; font-weight: 600;
  line-height: 1.4; text-align: left; text-decoration: none;
  white-space: normal; overflow-wrap: anywhere; word-break: normal;
}
#dzCaptionReader .dzcr-mail-option:hover { background: rgba(212,180,109,.14); }
#dzCaptionReader .dzcr-mail-option:focus-visible {
  outline: 3px solid #F4EFE6; outline-offset: 2px;
}
#dzCaptionReader .dzcr-mail-address {
  margin: .25em 0 .4em; padding: 0; min-width: 0;
  font-size: .82em; color: #D4B46D;
  overflow-wrap: anywhere; word-break: break-word; user-select: text;
}
