/* ==========================================================================
   全局重置 & 字体
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-color: #f6f6f4;
  --text-main: #2b2b2b;
  --text-muted: #828282;
  --border-color: #e5e5e1;
  --border-strong: #2b2b2b;
  --hover-bg: #efefeb; 
  --accent-color: #637a66;
  --shelf-color: #d1d1cc;
  --shelf-shadow-color: #e5e5e1;
  --book-bg: #ffffff;
  --book-shadow: rgba(0,0,0,0.15);
  --page-fold: rgba(0,0,0,0.06);
}

[data-theme="dark"] {
  --bg-color: #171717;
  --text-main: #d6d6d6;
  --text-muted: #7a7a7a;
  --border-color: #2e2e2e;
  --border-strong: #d6d6d6;
  --hover-bg: #222222;
  --accent-color: #84a388;
  --shelf-color: #2a2a2a;
  --shelf-shadow-color: #1a1a1a;
  --book-bg: #1e1e1e;
  --book-shadow: rgba(0,0,0,0.6);
  --page-fold: rgba(255,255,255,0.03);
}

::selection { background-color: var(--accent-color); color: var(--bg-color); }

body { 
  font-family: 'Inter', -apple-system, sans-serif; 
  background-color: var(--bg-color); 
  color: var(--text-main); 
  line-height: 1.6; 
  font-size: 15px; 
  -webkit-font-smoothing: antialiased; 
  transition: background-color 0.3s ease, color 0.3s ease; 
  padding: 40px 20px; 
  overflow-y: scroll; 
  overflow-x: hidden; 
}

.container { width: 100%; max-width: 900px; margin: 0 auto; padding: 0; }

/* ==========================================================================
   公共头部导航
   ========================================================================== */
.sys-header { 
  display: flex; justify-content: space-between; align-items: center; 
  border-bottom: 2px solid var(--border-strong); padding-bottom: 16px; margin-bottom: 40px; 
}

.sys-title { 
  font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700; 
  text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 8px;
  flex-wrap: nowrap;
  flex: 1;
  min-width: 0;
}
.sys-title a { color: var(--text-main); text-decoration: none; transition: color 0.2s ease; cursor: pointer; flex-shrink: 0; }
.sys-title a:hover { color: var(--accent-color); }
.sys-title .path-separator { color: var(--border-color); font-weight: 400; flex-shrink: 0; }

.sys-title .current-path { 
  color: var(--text-muted); 
  font-weight: 500; 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis; 
}

.header-actions { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.lang-switch {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px 8px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  text-transform: uppercase;
}
.lang-switch:hover { border-color: var(--accent-color); color: var(--accent-color); }
.lang-switch option { background-color: var(--bg-color); color: var(--text-main); }

.theme-toggle { background: transparent; border: none; cursor: pointer; color: var(--text-main); display: flex; padding: 8px; transition: color 0.2s ease; }
.theme-toggle:hover { color: var(--accent-color); }
.theme-toggle svg { width: 18px; height: 18px; }
.sun-icon { display: none; }
.moon-icon { display: block; }
[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }

/* ==========================================================================
   书架结构
   ========================================================================== */
.bookshelf-wrapper {
  width: 100%;
  overflow: hidden;
  margin-bottom: 30px; 
}

.bookshelf-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; 
  padding-bottom: 30px; 
  gap: 0;
}

.book-slot {
  display: flex;
  align-items: flex-end; 
  justify-content: center;
  padding: 30px 16px 12px 16px; 
  position: relative;
}

/* 书架顶部阴影/倒角 */
.book-slot::before {
  content: ''; position: absolute;
  bottom: 12px; left: -100vw; right: -100vw; height: 6px;
  background: linear-gradient(to top, rgba(0,0,0,0.06), transparent);
  pointer-events: none; z-index: 0;
}

/* 书架横板实体 */
.book-slot::after {
  content: ''; position: absolute;
  bottom: 0; left: -100vw; right: -100vw; height: 12px;
  background-color: var(--shelf-color);
  border-bottom: 4px solid var(--shelf-shadow-color);
  box-sizing: content-box; z-index: -1;
}

/* ==========================================================================
   书籍本体 (优化立体感版)
   ========================================================================== */
.book {
  background-color: var(--book-bg);
  border-radius: 3px 5px 5px 3px; 
  /* 增加外阴影的同时，加入极细微的混合轮廓线，防止深色书融入深色背景 */
  box-shadow: 
    6px 6px 15px var(--book-shadow), 
    0 0 0 1px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.1); 
  position: relative;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 1;
  text-decoration: none; 
  color: inherit;
}

/* 逼真的书槽/装订线 (光影覆层) */
.book::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: inherit;
  
  /* 在阴影(3%)后紧接一道高光(4%)，专门拯救深色封面 */
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0.45) 0%,      /* 1. 左侧边缘最高光 */
    rgba(255, 255, 255, 0.05) 2%,      /* 2. 平缓过渡 */
    rgba(0, 0, 0, 0.45) 3%,            /* 3. 书槽最深处的阴影 */
    rgba(255, 255, 255, 0.25) 4%,      /* 4. 书槽右侧的受光面高光 (深色封面立体的关键) */
    rgba(0, 0, 0, 0.05) 6%,            /* 5. 向封面柔和过渡 */
    transparent 12%,
    transparent 96%,
    rgba(0, 0, 0, 0.2) 100%            /* 6. 右侧边缘微暗，增强页边厚度感 */
  );
  
  /* 增加顶部和左侧的全局内高光，让深色书体边缘更清晰 */
  box-shadow: 
    inset 1px 1px 2px rgba(255, 255, 255, 0.3), 
    inset -1px 0 1px rgba(0, 0, 0, 0.1);
  
  pointer-events: none; /* 让鼠标点击能穿透到封面 */
  z-index: 5; 
}

.book:hover {
  transform: translateY(-12px);
  box-shadow: 
    8px 18px 25px var(--book-shadow), 
    0 0 0 1px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  z-index: 10;
}

/* ==========================================================================
   书籍尺寸格式 (高低错落的核心)
   ========================================================================== */
/* 16开教材 (标准偏大) */
.format-16mo { height: 250px; aspect-ratio: 210 / 285; }

/* 32开读物 (标准偏小) */
.format-32mo { height: 180px; aspect-ratio: 130 / 184; }

/* 方形书籍 (1:1 比例) */
.format-square { height: 220px; aspect-ratio: 1 / 1; }

/* 横版画册/相册 (横向长方形) */
.format-landscape { height: 170px; aspect-ratio: 285 / 210; }

/* ==========================================================================
   封面与内部文字
   ========================================================================== */
.book-cover-img {
  width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(10%) contrast(110%); transition: all 0.3s ease;
  position: absolute; top: 0; left: 0; z-index: 1;
}
.book:hover .book-cover-img { filter: grayscale(0%) contrast(100%); }

.book-title-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  padding: 35px 12px 12px; z-index: 10; /* 确保文字在光影之上 */
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700;
  color: #fff; text-transform: uppercase; text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* ==========================================================================
   项目详情页 (Detail.html)
   ========================================================================== */
.project-detail-container { max-width: 800px; margin: 0 auto; }
.project-title { font-family: 'JetBrains Mono', monospace; font-size: 28px; font-weight: 700; color: var(--text-main); margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.05em; }
.project-desc { font-family: 'Inter', sans-serif; font-size: 16px; color: var(--text-muted); line-height: 1.8; margin-bottom: 24px; }
.project-meta { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-muted); border-top: 1px dashed var(--border-color); padding-top: 20px; margin-top: 40px; margin-bottom: 40px; }

.project-gallery { display: flex; flex-direction: column; gap: 24px; }
.project-gallery img { width: 100%; height: auto; display: block; border: 1px solid var(--border-color); background-color: var(--hover-bg); border-radius: 2px; }

/* ==========================================================================
   全局页脚
   ========================================================================== */
.sys-footer { 
  font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-muted); 
  text-transform: uppercase; display: flex; justify-content: space-between; align-items: center;
  border-top: 2px solid var(--border-strong); padding-top: 16px; margin-top: 60px; 
}
.sys-footer a { color: var(--text-muted); text-decoration: none; transition: color 0.2s ease; }
.sys-footer a:hover { color: var(--accent-color); }

/* ==========================================================================
   移动端适配
   ========================================================================== */
@media (max-width: 650px) {
  body { padding: 24px 16px; }
  .sys-header { flex-direction: row; align-items: center; padding-bottom: 12px; gap: 16px; }
  .sys-title { font-size: 12px; }
  .header-actions { width: auto; justify-content: flex-end; }
  .sys-footer { flex-direction: column; gap: 12px; align-items: flex-start; }
  
  .book-slot { padding: 20px 10px 12px 10px; }
  
  /* 移动端等比缩小的书籍尺寸 */
  .format-16mo { height: 190px; }
  .format-32mo { height: 135px; }
  .format-square { height: 160px; }
  .format-landscape { height: 125px; }
}