.image-nook-section {
  --section-mobile-padding: 20px;
  --card-group-padding: 20px;
  --card-group-gap: 10px;

  background-color: rgb(var(--color-background));
}
.image-nook-section .page-width {
  position: relative;
}
.image-nook--full-width {
  /* width: 40%; */
  width: 60px;
  height: 60px;
  margin: 0 auto;
}

.image-nook__card-image {
  display: flex;
  align-items: center;
  justify-content: center;
  order: 1;
  flex-shrink: 0;
}

.image-nook__text__group {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}
.image-nook__card-image img {
  width: 100%;
  height: auto;
  aspect-ratio: var(--card-group-image-aspect-ratio);
  object-fit: cover;
  border-radius: var(--card-group-image-border-radius);
}
.image-nook__card-image .empty-image-class {
  display: block;
  width: 100%;
  height: 100%;
  background-color: rgb(var(--color-image-background));
}

.image-nook-card-list{
  position: relative;
  display: flex;
}

/* 桌面端响应式布局 - 一行内自适应显示，精确计算宽度 */
@media (min-width: 960px) {
  .image-nook-card-list {
    flex-wrap: nowrap;
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
  }
  
  /* 默认设置 */
  .image-nook__card {
    flex: 1 1 auto;
    min-width: 0;
    box-sizing: border-box;
  }
  
  /* 5个卡片 - column-gap默认60px */
  .image-nook__card:nth-child(1):nth-last-child(5),
  .image-nook__card:nth-child(1):nth-last-child(5) ~ .image-nook__card {
    width: calc((100% - 60px * 4) / 5);
    flex: 0 0 auto;
  }
  
  /* 4个卡片 */
  .image-nook__card:nth-child(1):nth-last-child(4),
  .image-nook__card:nth-child(1):nth-last-child(4) ~ .image-nook__card {
    width: calc((100% - 60px * 3) / 4);
    flex: 0 0 auto;
  }
  
  /* 3个卡片 */
  .image-nook__card:nth-child(1):nth-last-child(3),
  .image-nook__card:nth-child(1):nth-last-child(3) ~ .image-nook__card {
    width: calc((100% - 60px * 2) / 3);
    flex: 0 0 auto;
  }
  
  /* 2个卡片 */
  .image-nook__card:nth-child(1):nth-last-child(2),
  .image-nook__card:nth-child(1):nth-last-child(2) ~ .image-nook__card {
    width: calc((100% - 60px * 1) / 2);
    flex: 0 0 auto;
  }
}

/* 移动端允许滑动，但隐藏滚动条 */
@media (max-width: 959px) {
  .image-nook-card-list {
    flex-wrap: nowrap;
    width: calc(100% + var(--page-padding) * 2);
    margin-inline: calc(-1 * var(--page-padding));
    padding-inline: var(--page-padding);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    scroll-padding-inline: var(--page-padding);
  }
  
  .image-nook-card-list::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }
  
  .image-nook__card {
    flex: 0 0 auto;
    min-width: 160px;
  }
}

.image-nook__card {
  display: flex;
  flex-direction: column;
  gap: 15px;
  position: relative;
  text-align: var(--card-group-content-align, center);
}

/* 支持卡片边距配置 */
.image-nook-card-list > * {
  margin: var(--card-margin, 0);
}

.image-nook__card-title {
  order: 2;
  margin-block-start: 5px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  text-transform: uppercase;
  word-break: normal;
  overflow-wrap: break-word;
  white-space: normal;
  width: 100%;
  hyphens: none;
  /* font-style: italic; */
}
.image-nook__card-text {
  order: 3;
  color: rgb(var(--color-light-text));
  font-size: 14px;
  line-height: 1.4;
  word-break: normal;
  overflow-wrap: break-word;
  white-space: normal;
  width: 100%;
}
.image-nook__card-link {
  display: flex;
  align-items: center;
  order: 4;
}
.image-nook__card-link .button--link {
  column-gap: 4px;
  text-decoration: none !important;
}
.image-nook__card-link-icon {
  display: inline-flex;
}
.image-nook__card-link-icon > svg {
  width: 10px;
  height: 10px;
}
.image-nook__card-link-icon > svg path {
  stroke: rgb(var(--color-text));
}

@media (max-width: 959px) {
  .image-nook__card{
    flex: 0 0 auto;
    min-width: 160px;
    margin: 0;
    gap: 12px;
  }
  
  .image-nook__card-image{
    max-width: 50px;
    min-width: 50px;
    flex-shrink: 0;
  }
  
  .image-nook--full-width {
    width: 50px;
    height: 50px;
    margin: auto;
  }
  
  .image-nook__text__group{
    width: 100%;
    flex: 1;
    min-width: 0;
  }
  
  .image-nook__card-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    margin-block-start: 0;
  }
  
  .image-nook__card-text{
    font-size: 12px;
    line-height: 1.4;
    word-break: normal;
    overflow-wrap: break-word;
  }
}