/* ============================================
   奇物图鉴
   ============================================ */

#atlas {
  background:
    /* 宣纸细密斜纹 */
    repeating-linear-gradient(45deg,
      transparent 0px, transparent 3px,
      rgba(160, 120, 70, 0.04) 3px, rgba(160, 120, 70, 0.04) 4px),
    repeating-linear-gradient(0deg,
      transparent 0px, transparent 12px,
      rgba(160, 120, 70, 0.03) 12px, rgba(160, 120, 70, 0.03) 13px),
    radial-gradient(ellipse at center,
      rgba(245, 235, 215, 0) 40%,
      rgba(140, 100, 60, 0.18) 100%),
    linear-gradient(135deg, #f3e9d0 0%, #ecdfc0 50%, #e3d4b0 100%);
  overflow: hidden;
}

/* 顶部标题区 */
.atlas-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 60px 16px;
}

.atlas-title-wrap {
  position: relative;
  display: inline-block;
  padding: 8px 60px;
}

.atlas-title-wrap::before,
.atlas-title-wrap::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 50px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-gold) 50%, transparent);
}
.atlas-title-wrap::before { left: 0; }
.atlas-title-wrap::after { right: 0; }

.atlas-title {
  font-family: var(--font-kai);
  font-size: 36px;
  color: var(--c-ink);
  letter-spacing: 16px;
  font-weight: 600;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
  background: linear-gradient(180deg, #2a2418 0%, #4a3a22 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  padding: 0 8px;
}

.atlas-subtitle {
  font-family: var(--font-kai);
  font-size: 13px;
  color: var(--c-ink-light);
  letter-spacing: 4px;
  text-align: center;
  margin-top: 6px;
}

/* 关闭按钮 */
.atlas-close {
  position: absolute;
  top: 24px;
  right: 28px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--c-gold);
  background: rgba(245, 235, 215, 0.7);
  color: var(--c-ink);
  font-size: 24px;
  cursor: pointer;
  border-radius: 50%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  font-family: serif;
  line-height: 1;
}

.atlas-close:hover {
  background: var(--c-gold-light);
  color: var(--c-paper);
  box-shadow: 0 0 10px rgba(201, 169, 110, 0.7);
  transform: rotate(90deg);
}

/* 主体容器 */
.atlas-container {
  position: relative;
  display: flex;
  height: calc(100vh - 130px);
  z-index: 5;
}

/* ===== 左侧 Tab ===== */
.atlas-tabs {
  flex: 0 0 110px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 30px 0 30px 32px;
  align-items: flex-start;
}

.atlas-tab {
  writing-mode: vertical-rl;
  text-orientation: upright;
  background: rgba(245, 235, 215, 0.6);
  color: var(--c-ink-light);
  border: 1.5px solid rgba(184, 145, 90, 0.4);
  font-family: var(--font-kai);
  font-size: 18px;
  letter-spacing: 8px;
  padding: 22px 12px;
  cursor: pointer;
  transition: all 0.35s;
  font-weight: 500;
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.05);
}

.atlas-tab:hover {
  background: rgba(245, 235, 215, 0.9);
  border-color: var(--c-gold);
  color: var(--c-ink);
  transform: translateX(2px);
}

.atlas-tab.active {
  background: var(--c-ink);
  color: var(--c-paper);
  border-color: var(--c-ink);
  box-shadow: 2px 3px 6px rgba(0, 0, 0, 0.25);
  transform: translateX(4px);
}

.atlas-tab-num {
  display: block;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--c-gold-light);
  margin-bottom: 6px;
}

.atlas-tab.active .atlas-tab-num {
  color: var(--c-gold-light);
}

/* ===== 右侧网格 ===== */
.atlas-grid-wrap {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 20px 50px 50px 30px;
  display: flex;
  align-items: center;
  cursor: grab;
  user-select: none;
  scroll-behavior: smooth;
}

.atlas-grid-wrap.dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}

.atlas-grid-wrap::-webkit-scrollbar {
  display: block;
  height: 8px;
}
.atlas-grid-wrap::-webkit-scrollbar-track {
  background: rgba(184, 145, 90, 0.15);
  border-radius: 4px;
}
.atlas-grid-wrap::-webkit-scrollbar-thumb {
  background: var(--c-gold);
  border-radius: 4px;
}
.atlas-grid-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--c-gold-dark);
}

.atlas-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 30px;
  padding: 16px 4px;
}

/* ===== 卡片 ===== */
.atlas-card {
  flex: 0 0 280px;
  width: 280px;
  height: 380px;
  position: relative;
  background:
    radial-gradient(circle at 20% 30%, rgba(160, 120, 70, 0.04) 1px, transparent 2px),
    radial-gradient(circle at 70% 60%, rgba(160, 120, 70, 0.05) 1px, transparent 2px),
    linear-gradient(180deg, #f8f0dc 0%, #efe2c4 100%);
  background-size: 8px 8px, 11px 11px, 100% 100%;
  border: 1.5px solid rgba(184, 145, 90, 0.55);
  border-radius: 2px;
  padding: 28px 16px 18px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow:
    inset 0 0 0 1px rgba(245, 235, 215, 0.7),
    0 3px 8px rgba(0, 0, 0, 0.12);
  opacity: 0;
  animation: cardFadeIn 0.5s ease forwards;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.atlas-card:hover {
  transform: translateY(-6px);
  border-color: var(--c-gold);
  box-shadow:
    inset 0 0 0 1px rgba(245, 235, 215, 0.7),
    0 12px 26px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(201, 169, 110, 0.5);
}

/* 登仙印章（参考图：右上角金色印章） */
.atlas-card-stamp {
  position: absolute;
  top: -12px;
  right: 18px;
  writing-mode: vertical-rl;
  text-orientation: upright;
  background: linear-gradient(180deg, #d4a553 0%, #b48535 100%);
  color: #2a2418;
  font-family: var(--font-kai);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 3px;
  padding: 7px 5px;
  box-shadow:
    1px 2px 4px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 240, 200, 0.6);
  border-radius: 1px;
  z-index: 3;
}

.atlas-card-stamp::before,
.atlas-card-stamp::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  background: #2a2418;
  border-radius: 50%;
}
.atlas-card-stamp::before { top: 3px; }
.atlas-card-stamp::after { bottom: 3px; }

/* 卡片图区 */
.atlas-card-imgwrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  position: relative;
}

.atlas-card-img {
  max-width: 92%;
  max-height: 92%;
  object-fit: contain;
  filter: drop-shadow(2px 3px 4px rgba(0, 0, 0, 0.15));
  transition: transform 0.5s ease;
}

.atlas-card:hover .atlas-card-img {
  transform: scale(1.08);
}

/* 卡片名 */
.atlas-card-name {
  font-family: var(--font-kai);
  font-size: 19px;
  color: var(--c-ink);
  letter-spacing: 6px;
  font-weight: 600;
  text-align: center;
  padding: 10px 0 4px;
  border-top: 1px solid rgba(184, 145, 90, 0.4);
  width: 80%;
  margin-top: auto;
}

/* ===== 入口按钮：图鉴 ===== */
.atlas-entry-btn {
  background: rgba(245, 235, 215, 0.85);
  border: 1px solid var(--c-gold);
  padding: 10px 32px;
  font-family: var(--font-kai);
  font-size: 14px;
  letter-spacing: 6px;
  color: var(--c-ink-light);
  cursor: pointer;
  transition: all 0.3s;
  backdrop-filter: blur(2px);
}

.atlas-entry-btn:hover {
  background: var(--c-paper-light);
  border-color: var(--c-gold-light);
  color: var(--c-ink);
  box-shadow: 0 0 16px rgba(201, 169, 110, 0.5);
  transform: translateY(-2px);
}

/* hero 中的入口动画延迟 */
#hero .atlas-entry-btn {
  opacity: 0;
  animation: fadeIn 1.2s 3.5s forwards;
}
#ending .atlas-entry-btn {
  opacity: 0;
  animation: fadeIn 1.2s 3.1s forwards;
}

/* 响应式 */
@media (max-width: 768px) {
  .atlas-tabs { flex: 0 0 80px; padding: 20px 0 20px 16px; }
  .atlas-tab { font-size: 14px; padding: 16px 8px; letter-spacing: 6px; }
  .atlas-grid-wrap { padding: 12px 18px 30px 14px; }
  .atlas-grid { gap: 18px; }
  .atlas-card { flex: 0 0 200px; width: 200px; height: 280px; }
  .atlas-card-name { font-size: 15px; letter-spacing: 4px; }
  .atlas-title { font-size: 26px; letter-spacing: 10px; }
}