/* ==========================================================================
   《百年孤独》布恩迪亚家族图谱 - 人物生平档案侧滑抽屉样式 (drawer.css)
   基于 ANTIGRAVITY_PROMPT 官方素材包 06_detail_panel 标准重构
   ========================================================================== */

/* 侧滑人物抽屉 (Slide Drawer - 深绿古典漆面金饰质感) */
.character-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background-color: rgba(5, 18, 15, 0.94);
  background-image: 
    radial-gradient(circle at 100% 0%, rgba(31, 61, 54, 0.5) 0%, transparent 60%),
    linear-gradient(180deg, rgba(6, 20, 17, 0.96) 0%, rgba(4, 14, 12, 0.98) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid rgba(201, 169, 97, 0.45);
  box-shadow: none;
  visibility: hidden;
  pointer-events: none;
  z-index: 50;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
  display: flex;
  flex-direction: column;
  color: var(--text-light);
}

.character-drawer.drawer-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.75);
}

/* 抽屉头部 (左侧返回 | 中间标题 | 右侧关闭) */
.drawer-header {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(201, 169, 97, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(5, 18, 15, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
  min-height: 54px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.drawer-header-center {
  flex: 1;
  text-align: center;
  min-width: 0;
  padding: 0 4px;
}

.drawer-header-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.drawer-nav-btn {
  background: rgba(16, 46, 38, 0.6);
  border: 1px solid rgba(201, 169, 97, 0.35);
  color: var(--gold);
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font-serif);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  user-select: none;
}

.drawer-nav-btn:hover {
  background: rgba(31, 61, 54, 0.85);
  border-color: var(--gold);
  color: #fff;
}

.drawer-back-btn {
  color: var(--gold);
}

.drawer-nav-arrow {
  font-size: 16px;
  line-height: 1;
}

.drawer-nav-icon {
  font-size: 12px;
}

/* 抽屉滚动内容区域 */
.drawer-body-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* 顶部肖像大画廊 (带有黄花修饰与金框) */
.drawer-hero-gallery {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.drawer-hero-photo-wrap {
  width: 100%;
  max-width: 340px;
  height: 230px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  border: 2px solid rgba(201, 169, 97, 0.55);
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.7),
    inset 0 0 20px rgba(0, 0, 0, 0.6);
  cursor: zoom-in;
  background: #0b1f1a;
}

.drawer-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.drawer-hero-photo-wrap:hover .drawer-hero-img {
  transform: scale(1.03);
}

.drawer-hero-meta {
  width: 100%;
  text-align: center;
}

.drawer-hero-stage-title {
  font-family: var(--font-serif);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--gold);
}

.drawer-hero-stage-desc {
  font-family: var(--font-body);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}

.drawer-hero-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.drawer-dot-btn {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(201, 169, 97, 0.3);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;
}

.drawer-dot-btn.active {
  background: var(--gold);
  transform: scale(1.3);
  box-shadow: 0 0 6px rgba(201, 169, 97, 0.7);
}

.drawer-hero-hint {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 4px;
  opacity: 0.75;
}

/* 人物标题与名言 */
.drawer-meta-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(201, 169, 97, 0.2);
}

.drawer-char-name {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 0.6px;
  margin: 0;
}

.drawer-char-es {
  font-family: var(--font-serif);
  font-size: 12.5px;
  color: var(--gold);
  font-style: italic;
  letter-spacing: 0.5px;
}

/* 官方素材规范：暗绿带金边名言引用框 */
.drawer-quote-italic {
  background: rgba(31, 61, 54, 0.45);
  border: 1px solid rgba(201, 169, 97, 0.35);
  border-radius: 4px;
  padding: 12px 16px;
  margin: 10px 0 4px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 13.5px;
  color: var(--paper-light);
  line-height: 1.6;
  text-align: center;
  width: 100%;
}

/* 人物图像专属 Section (小长方体多时期与历史图像列阵) */
.dossier-image-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(16, 46, 38, 0.35);
  border: 1px solid rgba(201, 169, 97, 0.3);
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(201, 169, 97, 0.1);
}

.dossier-photo-count {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-left: 2px;
}

.dossier-photo-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

/* 小长方体卡片 */
.dossier-photo-tile {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  background: rgba(11, 33, 27, 0.6);
  border: 1px solid rgba(201, 169, 97, 0.25);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  min-height: 52px;
}

.dossier-photo-tile:hover {
  background: rgba(31, 61, 54, 0.7);
  border-color: rgba(201, 169, 97, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.dossier-photo-tile.active {
  background: linear-gradient(135deg, rgba(31, 61, 54, 0.85) 0%, rgba(16, 46, 38, 0.95) 100%);
  border-color: var(--gold);
  box-shadow: 
    0 0 12px rgba(201, 169, 97, 0.35),
    inset 0 0 0 1px rgba(201, 169, 97, 0.4);
}

/* 小长方体左侧微型缩略图 */
.tile-thumb-wrap {
  width: 40px;
  height: 40px;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(201, 169, 97, 0.4);
  background: #061411;
  flex-shrink: 0;
  position: relative;
}

.tile-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.dossier-photo-tile:hover .tile-thumb-img,
.dossier-photo-tile.active .tile-thumb-img {
  transform: scale(1.06);
}

/* 小长方体右侧文案 */
.tile-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.tile-stage-tag {
  font-family: var(--font-serif);
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.2;
  letter-spacing: 0.4px;
}

.tile-title-text {
  font-family: var(--font-body);
  font-size: 11.5px;
  color: var(--text-light);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.9;
}

.dossier-photo-tile.active .tile-title-text {
  color: #fff;
  opacity: 1;
}

/* 激活态指示点 */
.tile-active-indicator {
  display: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
  flex-shrink: 0;
  margin-right: 2px;
}

.dossier-photo-tile.active .tile-active-indicator {
  display: block;
}

/* 档案分栏选项卡导航 (人物介绍 | 人生轨迹 | 重要关系) */
.dossier-tabs-nav {
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(201, 169, 97, 0.25);
  gap: 16px;
  padding: 0 2px;
  overflow-x: auto;
}

.dossier-tab-btn {
  background: transparent;
  border: none;
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 4px;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: color 0.2s;
}

.dossier-tab-btn:hover {
  color: var(--text-light);
}

.dossier-tab-btn.active {
  color: var(--gold);
  font-weight: 700;
}

.dossier-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(201, 169, 97, 0.5);
}

/* 选项卡内容区 */
.dossier-tab-pane {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.dossier-tab-pane.active {
  display: flex;
}

.dossier-pane-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dossier-section-title {
  font-family: var(--font-serif);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dossier-section-subtitle {
  font-family: var(--font-serif);
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-light);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 6px;
}

.drawer-prose-text {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-light);
  text-align: justify;
}

.drawer-prose-box {
  background: rgba(16, 46, 38, 0.4);
  border: 1px solid rgba(201, 169, 97, 0.25);
  border-radius: 4px;
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--text-light);
  line-height: 1.65;
}

/* 官方素材规范：暗底金线特征胶囊 (Key Traits) */
.dossier-traits-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.dossier-trait-pill {
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--gold);
  background: rgba(16, 46, 38, 0.6);
  border: 1px solid rgba(201, 169, 97, 0.4);
  padding: 3px 10px;
  border-radius: 4px;
}

/* 官方素材规范：重要关系紧凑行 (Important Relationships) */
.dossier-rel-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dossier-rel-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(16, 46, 38, 0.4);
  border: 1px solid rgba(201, 169, 97, 0.25);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dossier-rel-item:hover {
  background: rgba(31, 61, 54, 0.7);
  border-color: var(--gold);
  transform: translateX(3px);
}

.dossier-rel-avatar {
  width: 38px;
  height: 44px;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid rgba(201, 169, 97, 0.4);
  flex-shrink: 0;
  background: #0b1f1a;
}

.dossier-rel-info {
  flex: 1;
  min-width: 0;
}

.dossier-rel-name {
  font-family: var(--font-serif);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-light);
  line-height: 1.2;
}

.dossier-rel-sub {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dossier-rel-arrow {
  color: var(--gold);
  font-size: 16px;
  font-weight: bold;
}

/* 命运结局与象征信物 */
.drawer-fate-box {
  background: rgba(16, 46, 38, 0.5);
  border: 1px solid rgba(201, 169, 97, 0.35);
  padding: 12px 14px;
  border-radius: 4px;
  font-size: 12.5px;
  color: var(--text-light);
  line-height: 1.6;
  display: flex;
  gap: 8px;
}

.drawer-symbols-box {
  background: rgba(16, 46, 38, 0.4);
  border: 1px solid rgba(201, 169, 97, 0.25);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 12.5px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 重大历史要事 */
.drawer-events-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-event-card {
  background: rgba(16, 46, 38, 0.4);
  border: 1px solid rgba(201, 169, 97, 0.25);
  border-radius: 4px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-light);
}

.drawer-event-index {
  color: var(--gold);
  font-weight: 800;
  font-size: 11px;
  flex-shrink: 0;
  margin-top: 1px;
}

.drawer-event-text {
  flex: 1;
}

/* 抽屉背景遮罩 */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  z-index: 45;
  transition: opacity 0.3s;
}

.drawer-backdrop.hidden {
  display: none;
}

/* 全屏高清写真画廊 (Lightbox) */
.fullscreen-photo-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-photo-modal.hidden {
  display: none !important;
}

.fullscreen-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 14, 12, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.fullscreen-content-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 16px 80px 16px;
  box-sizing: border-box;
}

.fullscreen-top-bar {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1015;
  pointer-events: none;
}

.fullscreen-zoom-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(6, 20, 17, 0.85);
  border: 1px solid rgba(201, 169, 97, 0.45);
  padding: 4px 10px;
  border-radius: 24px;
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

.fullscreen-tool-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(16, 46, 38, 0.6);
  color: var(--text-light);
  border: 1px solid rgba(201, 169, 97, 0.3);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.fullscreen-tool-btn:hover {
  background: var(--gold);
  color: #0b1f1a;
  border-color: var(--gold);
}

.fullscreen-close-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(16, 46, 38, 0.7);
  color: var(--gold);
  border: 1px solid rgba(201, 169, 97, 0.4);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s;
}

.fullscreen-close-btn:hover {
  background: var(--gold);
  color: #0b1f1a;
}

.fullscreen-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(6, 20, 17, 0.75);
  color: var(--gold);
  border: 1px solid rgba(201, 169, 97, 0.45);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1008;
  transition: all 0.2s;
}

.fullscreen-nav-btn:hover {
  background: var(--gold);
  color: #0b1f1a;
  transform: translateY(-50%) scale(1.08);
}

.fullscreen-nav-btn.prev { left: 20px; }
.fullscreen-nav-btn.next { right: 20px; }

.fullscreen-image-container {
  width: 100%;
  height: 100%;
  max-width: 96vw;
  max-height: 82vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  touch-action: none;
}

.fullscreen-photo-img {
  max-width: 92vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 16px 56px rgba(0, 0, 0, 0.95);
  border: 2px solid rgba(201, 169, 97, 0.55);
  cursor: grab;
}

.fullscreen-footer-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 12px));
  background: linear-gradient(180deg, transparent 0%, rgba(4, 14, 12, 0.95) 45%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 1008;
  pointer-events: none;
}

.fullscreen-photo-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
}

.fullscreen-photo-desc {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-light);
  max-width: 600px;
  line-height: 1.45;
}

.fullscreen-counter {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.fullscreen-zoom-hint {
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  background: rgba(6, 20, 17, 0.7);
  border: 1px solid rgba(201, 169, 97, 0.35);
  padding: 3px 12px;
  border-radius: 14px;
  margin-top: 4px;
}

/* 移动端抽屉全屏适配 */
@media (max-width: 768px) {
  .character-drawer {
    max-width: 100%;
    top: max(54px, calc(env(safe-area-inset-top, 0px) + 8px));
    border-top: 1px solid rgba(201, 169, 97, 0.45);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
  }

  .character-drawer.drawer-open {
    box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.75);
  }

  .drawer-header {
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    padding: 10px 14px;
  }
}
