/* ==================== 平板设备 (1024px) ==================== */
@media screen and (max-width: 1024px) {
  /* 主要内容 */
  main ul {
    width: 80%;
    justify-content: center;
  }

  main ul li {
    flex: 0 0 calc(33.333% - 20px);
    box-shadow: none;
  }

  /* 背景装饰 */
  .main-bg-decoration img {
    width: 250px;
  }

  .bg-circle.circle-1 {
    width: 300px;
    height: 300px;
  }

  .bg-circle.circle-2 {
    width: 250px;
    height: 250px;
  }

  .bg-circle.circle-3 {
    width: 180px;
    height: 180px;
  }

  /* 页脚 */
  footer {
    width: 80%;
  }

  /* 回到顶部按钮 */
  .scroll-to-top {
    right: 30px;
    width: 45px;
    height: 45px;
    background: #af6805;
  }
  .card {
    pointer-events: none;
  }
  .card__content {
    padding: 0 !important;
    margin: 0;
  }
  .card__title {
    background-color: rgba(0, 0, 0, 0.5);
    margin-bottom: 0px;
    padding: 6px 12px;
    display: block;
    -webkit-line-clamp: initial;
    -webkit-box-orient: initial;
    max-width: 100%;
  }
  .card__description {
    background-color: rgba(0, 0, 0, 0.5);
    padding: 6px 12px;
    line-height: 2.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* ==================== 移动设备 (768px) ==================== */
@media (max-width: 768px) {
  /* 主要内容 */
  main ul {
    width: 85%;
    gap: 20px;
  }

  main ul li {
    flex: 0 0 calc(50% - 10px);
    max-width: none;
  }

  .card {
    aspect-ratio: 2/3;
  }

  /* 背景装饰 */
  .main-bg-decoration {
    display: none;
  }

  .bg-circle {
    opacity: 0.08;
  }

  .bg-circle.circle-1 {
    width: 200px;
    height: 200px;
    top: -50px;
    right: 5%;
  }

  .bg-circle.circle-2 {
    width: 150px;
    height: 150px;
    bottom: -30px;
    left: 3%;
  }

  .bg-circle.circle-3 {
    width: 120px;
    height: 120px;
    top: 20%;
    left: -30px;
  }

  .card__title {
    font-size: 18px;
  }

  .card__description {
    font-size: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* 页脚 */
  footer {
    width: 85%;
  }

  /* 回到顶部按钮 */
  .scroll-to-top {
    right: 20px;
    bottom: 20%;
    width: 40px;
    height: 40px;
  }

  .scroll-to-top img {
    width: 20px;
    height: 20px;
  }
}

/* ==================== 小屏设备 (480px) ==================== */
@media screen and (max-width: 480px) {
  /* 主要内容 */
  main ul {
    width: 90%;
    gap: 15px;
    padding: 15px;
  }

  main ul li {
    flex: 0 0 100%;
  }

  .card {
    aspect-ratio: 3/4;
    height: 400px;
  }

  .card__title {
    font-size: 16px;
  }

  .card__description {
    font-size: 11px;
    -webkit-line-clamp: 2;
  }

  /* 背景装饰 */
  .bg-circle.circle-1 {
    width: 150px;
    height: 150px;
  }

  .bg-circle.circle-2 {
    width: 100px;
    height: 100px;
  }

  .bg-circle.circle-3 {
    width: 80px;
    height: 80px;
  }

  /* 页脚 */
  footer {
    width: 90%;
  }

  /* 回到顶部按钮 */
  .scroll-to-top {
    right: 15px;
    bottom: 25%;
    width: 36px;
    height: 36px;
  }

  .scroll-to-top img {
    width: 18px;
    height: 18px;
  }
}

/* ==================== 安全区域适配 ==================== */
@supports (padding: max(0px)) {
  @media (max-width: 768px) {
    body {
      padding-left: env(safe-area-inset-left);
      padding-right: env(safe-area-inset-right);
    }
  }
}

/* ==================== 触控优化 ==================== */
@media (max-width: 768px) {
  /* 增加触摸目标大小 */
  .card {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .scroll-to-top {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* 禁用悬停效果对触摸的影响 */
  @media (hover: hover) {
    .card:hover {
      transform: scale(1.02);
    }
  }

  @media (hover: none) {
    .card:active {
      transform: scale(0.98);
    }
  }
}

/* ==================== 移动端禁用悬停效果 ==================== */
@media (max-width: 1024px) {
  .card {
    cursor: default;
    pointer-events: none;
  }

  .card:hover {
    transform: none;
    box-shadow: 0 0 0 5px #ffffff80;
  }

  .card:hover img {
    scale: 1;
  }

  .card:hover .card__content {
    transform: rotateX(-90deg);
  }

  .card:active {
    transform: scale(0.98);
  }

  .card__content {
    transform: rotateX(-90deg);
    transform-origin: bottom;
  }

  .card__content {
    position: relative;
    background: #f2f2f2;
    transform: none;
  }
}

/* ==================== 参考food-grid样式调整card ==================== */
@media (max-width: 1024px) {
  .card {
    height: 400px;
    aspect-ratio: 3/4;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow:
      0 8px 24px rgba(217, 119, 6, 0.3),
      0 3px 10px rgba(217, 119, 6, 0.2),
      0 1px 4px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .card__content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: end;
    z-index: 2;
  }

  .card__title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    text-shadow:
      2px 2px 4px rgba(0, 0, 0, 0.8),
      0 0 10px rgba(0, 0, 0, 0.3);
  }

  .card__description {
    font-size: 12px;
    color: #fff;
    margin: 0;
    text-shadow:
      1px 1px 3px rgba(0, 0, 0, 0.7),
      0 0 8px rgba(0, 0, 0, 0.2);
  }

  .card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .card:active {
    transform: scale(0.98);
  }
}
