/* ========================================
   Analogue - 手帐文具商品列表
   ======================================== */

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

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: #fafafa;
  color: #333;
}

/* ========== 顶部大标题区域 ========== */
.site-header {
  background: #D5D5D5;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 70px 20px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  min-height: 180px;
  position: relative;
}

.site-logo {
  display: block;
  text-decoration: none;
  margin-bottom: 40px;
}
.site-logo img {
  max-height: 34px;
  vertical-align: middle;
}

/* 搜索框 */
.search-box {
  position: absolute;
  right: 20px;
  top: 76px;
  display: flex;
  align-items: center;
  border: 1.5px solid #999;
  border-radius: 999px;
  padding: 9px 14px;
  background: #D9D9D9;
  width: 220px;
}

/* 手机：搜索框移到 logo 下方，导航再往下 */
@media (max-width: 768px) {
  .header-inner {
    padding: 30px 16px 12px;
    min-height: auto;
  }
  .site-logo {
    margin-bottom: 16px;
  }
  .site-logo img {
    max-height: 28px;
  }
  .search-box {
    position: static;
    width: 100%;
    margin-bottom: 14px;
    order: 2;
  }
  .main-nav {
    order: 3;
    justify-content: flex-start;
    width: calc(100vw - 100px);
  }
  .main-nav a {
    font-size: 13px;
    margin-right: 8px;
  }
}
.search-box input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: #333;
  width: 100%;
  padding-right: 6px;
}
.search-box input::placeholder {
  color: #aaa;
}
.search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
}

/* 导航链接（自然间距，随宽度自动压缩） */
.main-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  width: 100%;
  justify-content: flex-start;
}
.main-nav a {
  text-decoration: none;
  font-size: 14px;
  color: #666;
  padding: 6px 0;
  margin-right: 32px;
  position: relative;
  transition: color 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.main-nav a:last-child {
  margin-right: 0;
}

/* 搜索框换行到 logo 下方时，导航项紧凑排列 */
.site-header.nav-compact .main-nav a {
  margin-right: 15px;
}
.main-nav a:hover {
  color: #222;
}
.main-nav a.active {
  color: #222;
  font-weight: 600;
}
.main-nav a.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: #222;
}

/* 顶部提示条 */
.site-notice {
  background: #D5D5D5;
  text-align: center;
  padding: 6px 20px;
  font-size: 12px;
  color: #666;
  border-bottom: 1px solid #ccc;
}

/* ========== 主体容器 ========== */
.page-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* ========== 排序/信息栏 ========== */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 13px;
  color: #999;
}
.toolbar .count {
  color: #666;
}
.toolbar .sort-options {
  display: flex;
  gap: 16px;
}
.toolbar .sort-options span {
  cursor: pointer;
  color: #999;
  transition: color 0.2s;
}
.toolbar .sort-options span:hover {
  color: #333;
}
.toolbar .sort-options span.active {
  color: #222;
  font-weight: 600;
}

/* ========== 商品 Grid ========== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 15px;
}

@media (max-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .card-name-en {
    font-size: 11px;
  }
  .card-name-cn {
    font-size: 10px;
  }
  .card-info {
    padding: 6px 6px 8px;
  }
}

/* ========== 商品卡片 ========== */
.product-card {
  background: #fff;
  border-radius: 0;
  overflow: hidden;
  transition: box-shadow 0.25s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.product-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* 图片容器 - 1:1 背景板 */
.card-image-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: #E0E0E0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-image-wrap img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 0.3s ease, transform 0.35s ease;
  user-drag: none;
  -webkit-user-drag: none;
}
.product-card:hover .card-image-wrap img {
  transform: scale(1.08);
}
.product-card:hover .card-image-wrap img.img-fallback {
  transform: none;
}

/* 图片加载失败时显示 logo 占位 */
.card-image-wrap img.img-fallback {
  max-width: 50% !important;
  max-height: 50% !important;
  opacity: 0.5;
  object-fit: contain;
}

/* 展示图：直接填充裁切成正方形 */
.card-image-wrap img.img-display {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-card:hover .card-image-wrap img.img-display {
  transform: none;
}

/* 商品信息区 */
.card-info {
  padding: 10px 10px 12px;
}
.card-name {
  font-size: 15px;
  color: #333;
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-name-en {
  font-weight: 700;
  color: #555;
  font-size: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.card-name-cn {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-date {
  font-size: 12px;
  color: #999;
}

/* 价格 */
.card-price {
  font-size: 17px;
  font-weight: 700;
  color: #ff5000;
}
.card-price .unit {
  font-size: 13px;
}

/* ========== 空状态 ========== */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: #bbb;
  font-size: 14px;
}

/* ========== 标签筛选栏 ========== */
.tag-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tag-filter-label {
  font-size: 13px;
  color: #999;
  flex-shrink: 0;
}
.tag-filter-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tag-filter-item {
  padding: 4px 12px;
  font-size: 12px;
  color: #666;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.tag-filter-item:hover {
  border-color: #999;
  color: #333;
}
.tag-filter-item.active {
  background: #444;
  color: #fff;
  border-color: #444;
}

/* ========================================
   商品详情弹窗
   ======================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
}
.modal-overlay.active {
  display: flex;
}

.modal-wrap {
  background: #fff;
  width: 1200px;
  max-width: 94vw;
  max-height: 90vh;
  border-radius: 0;
  overflow-y: auto;
  position: relative;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity:0; transform:translateY(20px); }
  to   { opacity:1; transform:translateY(0); }
}

.modal-close {
  position: absolute;
  top: 4px;
  right: 8px;
  background: none;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  z-index: 10;
}
.modal-close:hover {
  color: #333;
}

.modal-body {
  display: flex;
  gap: 32px;
  padding: 40px;
}

.modal-img-wrap {
  width: min(55vw, 800px);
  height: min(55vw, 800px);
  flex-shrink: 0;
  background: #E0E0E0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* 窄屏：文字移到图片下方，图片占满宽度 */
@media (max-width: 900px) {
  .modal-body {
    flex-direction: column;
    padding: 28px;
    gap: 16px;
  }
  .modal-img-wrap {
    width: 100%;
    height: calc(94vw - 56px);
  }
}

.modal-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-drag: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
/* 透明遮罩：盖在原图上方，拦截手机长按保存，不影响两侧箭头 */
.modal-img-mask {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  background: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.modal-img.img-fallback {
  max-width: 60% !important;
  max-height: 60% !important;
  opacity: 0.4;
}

/* 水印：logo 覆盖在图片上，10% 透明度 */
.modal-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 35%;
  max-width: 200px;
  height: auto;
  opacity: 0.05;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  z-index: 3;
}

/* 左右切换箭头 */
.modal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  background: none;
  color: rgba(0,0,0,0.65);
  font-size: 40px;
  line-height: 44px;
  text-align: center;
  cursor: pointer;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.25s ease, color 0.2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  pointer-events: none;
}
.modal-img-wrap:hover .modal-arrow {
  opacity: 1;
  pointer-events: auto;
}
.modal-arrow:hover {
  color: rgba(0,0,0,0.9);
}
.modal-arrow-left  { left:   6px; }
.modal-arrow-right { right:  6px; }

/* 图片页码指示器 */
.modal-counter {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: auto;
  transform: none;
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  z-index: 5;
  pointer-events: none;
}

.modal-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* 宽屏：文字区与图片同高，详情下对齐 */
@media (min-width: 901px) {
  .modal-body .modal-info {
    height: min(55vw, 800px);
  }
  .modal-body .modal-info .meta {
    margin-top: auto;
  }
}
.modal-info h2 {
  font-size: 20px;
  color: #222;
  margin-bottom: 4px;
}
.modal-name-en {
  font-size: 35px;
  font-weight: 700;
  color: #222;
  margin-bottom: 2px;
}
.modal-name-cn {
  font-size: 19px;
  color: #555;
  margin-bottom: 8px;
}
.modal-info .meta {
  font-size: 13px;
  color: #666;
  line-height: 2;
  word-break: break-all;
}
.modal-info .meta .label {
  color: #999;
}
.modal-info .meta a {
  word-break: break-all;
  color: #999;
  text-decoration: none;
}
.modal-info .meta a:hover {
  color: #666;
}
.modal-info .modal-divider {
  border: 0;
  border-top: 1px solid #eee;
  margin: 0 0 16px 0;
  background: transparent;
  height: 0;
}
.modal-info .desc {
  margin-top: 12px;
  font-size: 13px;
  color: #555;
  line-height: 1.8;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

/* body 锁定滚动 */
body.modal-open {
  overflow: hidden;
}
