/* ============================================
   文玩核桃网站 - 普及知识页面专用样式
   ============================================ */

/* 知识内容排版 */
.knowledge-article {
  font-size: 0.95rem;
  line-height: 2;
}

.knowledge-article h2 {
  font-family: var(--font-title);
  font-size: 1.5rem;
  color: var(--color-ink);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-gold-light);
  position: relative;
}

.knowledge-article h2::before {
  content: '◆';
  color: var(--color-primary);
  margin-right: var(--space-sm);
  font-size: 0.8em;
}

.knowledge-article h3 {
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: var(--color-ink);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  padding-left: var(--space-md);
  border-left: 3px solid var(--color-gold);
}

.knowledge-article h4 {
  font-size: 1.05rem;
  color: var(--color-ink-light);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.knowledge-article ul,
.knowledge-article ol {
  margin-bottom: var(--space-md);
}

.knowledge-article li {
  margin-bottom: 6px;
  line-height: 1.8;
}

.knowledge-article strong {
  color: var(--color-primary-dark);
}

/* 时间轴样式 (历史背景页面) */
.timeline {
  position: relative;
  padding: var(--space-lg) 0;
  margin: var(--space-xl) 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 24px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--color-primary), var(--color-gold), var(--color-primary));
}

.timeline-item {
  position: relative;
  padding-left: 60px;
  margin-bottom: var(--space-xl);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 6px;
  width: 14px;
  height: 14px;
  background: var(--color-white);
  border: 3px solid var(--color-primary);
  border-radius: 50%;
  z-index: 1;
}

.timeline-item:nth-child(even)::before {
  border-color: var(--color-gold);
}

.timeline-item__period {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--color-primary);
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.timeline-item__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: var(--space-xs);
}

.timeline-item__desc {
  font-size: 0.9rem;
  color: var(--color-text-light);
  line-height: 1.8;
}

.timeline-item__desc ul {
  padding-left: var(--space-lg);
}

/* 品种图片库 */
.gallery-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}

.gallery-sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  background: var(--color-white);
  border: 1px solid var(--color-gold-light);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.gallery-sidebar__title {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--color-ink);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-gold);
}

.gallery-sidebar__search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: var(--space-md);
  outline: none;
  transition: border-color var(--transition-fast);
}

.gallery-sidebar__search:focus {
  border-color: var(--color-primary);
}

.gallery-category {
  margin-bottom: var(--space-md);
}

.gallery-category__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-ink);
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.gallery-category__title:hover {
  background: var(--color-paper-dark);
}

.gallery-category__arrow {
  transition: transform var(--transition-fast);
  font-size: 0.7em;
}

.gallery-category--open .gallery-category__arrow {
  transform: rotate(90deg);
}

.gallery-category__list {
  display: none;
  list-style: none;
  padding: 4px 0 4px 12px;
  margin: 0;
}

.gallery-category--open .gallery-category__list {
  display: block;
}

.gallery-category__item {
  padding: 4px 8px;
  font-size: 0.8rem;
  color: var(--color-text-light);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.gallery-category__item:hover,
.gallery-category__item--active {
  color: var(--color-primary);
  background: rgba(183, 28, 28, 0.05);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-md);
}

.gallery-card {
  background: var(--color-white);
  border: 1px solid var(--color-gold-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.gallery-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--color-gold);
}

.gallery-card__img-wrapper {
  aspect-ratio: 1;
  background: var(--color-paper-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.gallery-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-card__placeholder {
  font-size: 3rem;
  color: var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.gallery-card__placeholder span {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.gallery-card__info {
  padding: var(--space-sm) var(--space-md);
}

.gallery-card__name {
  font-family: var(--font-title);
  font-size: 0.9rem;
  color: var(--color-ink);
  font-weight: 600;
  margin-bottom: 2px;
}

.gallery-card__desc {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 品种详情弹窗 */
.variety-detail {
  text-align: left;
}

.variety-detail__img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  background: var(--color-paper-dark);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
}

.variety-detail__name {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--color-ink);
  margin-bottom: var(--space-sm);
}

.variety-detail__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.variety-detail__features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.variety-detail__feature {
  padding: var(--space-sm);
  background: var(--color-paper-dark);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.variety-detail__feature-label {
  color: var(--color-text-muted);
  font-size: 0.75rem;
  margin-bottom: 2px;
}

.variety-detail__feature-value {
  color: var(--color-ink);
  font-weight: 600;
}

.variety-detail__desc {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--color-text);
}

/* 知识误区翻牌效果 */
.myth-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
  margin: var(--space-xl) 0;
}

.myth-card {
  perspective: 1000px;
  height: 260px;
  cursor: pointer;
}

.myth-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.myth-card--flipped .myth-card__inner {
  transform: rotateY(180deg);
}

.myth-card__front,
.myth-card__back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.myth-card__front {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: var(--color-white);
  border: 2px solid var(--color-gold);
}

.myth-card__front-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
}

.myth-card__front-title {
  font-family: var(--font-title);
  font-size: 1.05rem;
  line-height: 1.5;
  font-weight: 700;
}

.myth-card__front-hint {
  font-size: 0.75rem;
  margin-top: var(--space-md);
  opacity: 0.7;
}

.myth-card__back {
  background: var(--color-white);
  border: 2px solid var(--color-gold);
  color: var(--color-text);
  transform: rotateY(180deg);
  overflow-y: auto;
}

.myth-card__back-label {
  font-size: 0.75rem;
  color: var(--color-primary);
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: var(--space-sm);
}

.myth-card__back-text {
  font-size: 0.85rem;
  line-height: 1.7;
}

/* 走色进度条 */
.color-progress {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-lg) 0;
  flex-wrap: wrap;
}

.color-progress__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.color-progress__dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--color-gold);
}

.color-progress__arrow {
  color: var(--color-gold);
  font-size: 1.2rem;
}

.color-progress__label {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

/* 响应式调整 */
@media (max-width: 1024px) {
  .gallery-layout {
    grid-template-columns: 200px 1fr;
  }
}

@media (max-width: 768px) {
  .gallery-layout {
    grid-template-columns: 1fr;
  }
  .gallery-sidebar {
    position: static;
    max-height: none;
  }
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .myth-cards {
    grid-template-columns: 1fr;
  }
  .myth-card {
    height: 240px;
  }
  .variety-detail__features {
    grid-template-columns: 1fr;
  }
  .color-progress {
    flex-direction: column;
    align-items: flex-start;
  }
  .color-progress__arrow {
    transform: rotate(90deg);
  }
}

/* ============================================
   品种卡片与配图样式
   ============================================ */

.variety-card {
  display: flex;
  gap: 20px;
  padding: 20px;
  margin-bottom: 24px;
  background: #faf8f5;
  border: 1px solid #d4c5a9;
  border-radius: 8px;
  transition: box-shadow 0.3s, transform 0.3s;
}

.variety-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.variety-card__image {
  flex-shrink: 0;
  width: 180px;
  height: 180px;
  overflow: hidden;
  border-radius: 4px;
  background: #f0ebe3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.variety-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.variety-card__info {
  flex: 1;
  min-width: 0;
}

.variety-card__info h4 {
  color: #b71c1c;
  margin-bottom: 8px;
  font-size: 18px;
  margin-top: 0;
}

.variety-card__info p {
  margin-bottom: 0.5em;
  line-height: 1.8;
}

.variety-card__info ul {
  padding-left: 1.5em;
  margin-bottom: 0;
}

.variety-card__info li {
  margin-bottom: 4px;
  line-height: 1.7;
}

.variety-figure {
  text-align: center;
  margin: 16px 0;
}

.variety-figure img {
  max-width: 300px;
  border-radius: 8px;
  border: 1px solid #d4c5a9;
}

.variety-figure figcaption {
  font-size: 13px;
  color: #666;
  margin-top: 6px;
}

/* 品种网格 - 用于小众品种等 */
.variety-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin: 1em 0;
}

.variety-grid .variety-card {
  flex-direction: column;
  margin-bottom: 0;
}

.variety-grid .variety-card__image {
  width: 100%;
  height: 160px;
}

/* ============================================
   排版间距优化
   ============================================ */

.knowledge-article h2 {
  margin-top: 2.5em;
  margin-bottom: 1em;
  padding-bottom: 0.5em;
  border-bottom: 2px solid var(--color-primary, #b71c1c);
}

.knowledge-article h2:first-child {
  margin-top: 1em;
}

.knowledge-article h3 {
  margin-top: 2em;
  margin-bottom: 0.8em;
}

.knowledge-article h4 {
  margin-top: 1.5em;
  margin-bottom: 0.6em;
}

.knowledge-article p {
  margin-bottom: 1em;
  line-height: 1.8;
}

.knowledge-article ul,
.knowledge-article ol {
  margin-bottom: 1em;
  padding-left: 2em;
}

.knowledge-article li {
  margin-bottom: 0.5em;
}

.knowledge-article .table-wrapper {
  margin: 1.5em 0;
  overflow-x: auto;
}

/* 表格样式统一 */
.knowledge-article .table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.knowledge-article .table-wrapper thead th {
  background: #c9a96e;
  color: #fff;
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  border: 1px solid #b8943f;
}

.knowledge-article .table-wrapper tbody td {
  padding: 8px 14px;
  border: 1px solid #d4c5a9;
}

.knowledge-article .table-wrapper tbody tr:nth-child(even) {
  background: #faf8f5;
}

.knowledge-article .table-wrapper tbody tr:hover {
  background: #f5efe3;
}

/* 响应式 - 品种卡片 */
@media (max-width: 768px) {
  .variety-card {
    flex-direction: column;
  }
  .variety-card__image {
    width: 100%;
    height: 200px;
  }
  .variety-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   品种图片统一尺寸与点击放大样式
   ============================================ */

/* 品种展示图片统一显示尺寸 480×320 */
.variety-card__image img,
.variety-figure img,
.variety-grid .variety-card__image img,
.gallery-card__img,
.variety-detail__img {
  max-width: 480px;
  width: 100%;
  height: auto;
  cursor: pointer;
  border-radius: 8px;
  transition: transform 0.2s;
}

.variety-card__image img:hover,
.variety-figure img:hover,
.variety-grid .variety-card__image img:hover,
.gallery-card__img:hover,
.variety-detail__img:hover {
  transform: scale(1.02);
}

/* variety-card__image 容器适配 */
.variety-card__image {
  width: auto;
  max-width: 480px;
  height: auto;
  aspect-ratio: auto;
}

/* ============================================
   灯箱（Lightbox）样式
   ============================================ */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-overlay--active {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  position: relative;
  max-width: 800px;
  max-height: 600px;
  width: 90vw;
  height: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.lightbox-overlay--active .lightbox-content {
  transform: scale(1);
}

.lightbox-content img {
  width: 100%;
  max-width: 800px;
  max-height: 600px;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  line-height: 1;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-close::before {
  content: '✕';
}

/* 手机端灯箱适配 + 品种图片适配 */
@media (max-width: 768px) {
  .variety-card__image {
    width: 100%;
    max-width: 480px;
    height: auto;
  }
  .variety-card__image img {
    max-width: 100%;
  }
  .lightbox-content {
    max-width: 95vw;
  }
  .lightbox-content img {
    max-width: 95vw;
    max-height: 70vh;
  }
  .lightbox-close {
    top: -44px;
    right: -4px;
    width: 40px;
    height: 40px;
    font-size: 22px;
  }
}
