.home-shell {
  --home-bg: #f7f8fb;
  --home-text: #172033;
  --home-muted: #738198;
  --home-line: rgba(23, 32, 51, 0.09);
  --home-blue: #5aa7ff;
  --home-purple: #a78bfa;
  --home-rose: #fb7185;
  --home-teal: #2dd4bf;
  width: 100%;
  max-width: 100vw;
  overflow-x: clip;
  color: var(--home-text);
  background:
    radial-gradient(circle at 12% 10%, rgba(90, 167, 255, 0.18), transparent 32%),
    radial-gradient(circle at 88% 8%, rgba(167, 139, 250, 0.14), transparent 30%),
    radial-gradient(circle at 50% 94%, rgba(45, 212, 191, 0.12), transparent 34%),
    linear-gradient(180deg, #fbfcff 0%, #f7f8fb 42%, #f4f6fb 100%);
}

@supports not (overflow: clip) {
  .home-shell {
    overflow-x: hidden;
  }
}

.home-shell :where(header, main, footer, section, div, article, aside, a) {
  min-width: 0;
}

.section-title {
  overflow-wrap: anywhere;
  word-break: break-word;
  line-break: anywhere;
  text-wrap: balance;
}

.home-shell {
  scroll-behavior: smooth;
}

.cosmic-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.cosmic-bg::before {
  content: "";
  position: absolute;
  inset: -24%;
  background:
    radial-gradient(circle at 20% 22%, rgba(90, 167, 255, 0.2), transparent 30%),
    radial-gradient(circle at 82% 16%, rgba(167, 139, 250, 0.18), transparent 30%),
    radial-gradient(circle at 42% 78%, rgba(251, 113, 133, 0.1), transparent 34%),
    radial-gradient(circle at 76% 84%, rgba(45, 212, 191, 0.11), transparent 30%);
  filter: blur(44px);
  animation: nebulaDrift 28s ease-in-out infinite alternate;
}

.cosmic-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(23, 32, 51, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 51, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, black 0%, transparent 72%);
  opacity: 0.65;
}

.glass-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.58));
  box-shadow:
    0 24px 80px rgba(31, 41, 55, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(22px);
  will-change: transform;
}

.glass-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(90, 167, 255, 0.13), transparent 28%, transparent 72%, rgba(167, 139, 250, 0.11)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), transparent 38%);
  opacity: 0.72;
}

.panel-inner {
  position: relative;
  z-index: 1;
}

.ak-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: -48%;
  width: 42%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(90, 167, 255, 0.18),
    transparent
  );
  transform: skewX(-18deg);
  opacity: 0;
  pointer-events: none;
}

.ak-card:hover::after {
  animation: scanLine 0.9s ease;
  opacity: 1;
}

.ak-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  opacity: 0.72;
  pointer-events: none;
  z-index: 2;
}

.ak-corner-tl {
  left: 14px;
  top: 14px;
  border-left: 1px solid rgba(90, 167, 255, 0.56);
  border-top: 1px solid rgba(90, 167, 255, 0.56);
}

.ak-corner-br {
  right: 14px;
  bottom: 14px;
  border-right: 1px solid rgba(167, 139, 250, 0.5);
  border-bottom: 1px solid rgba(167, 139, 250, 0.5);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid rgba(23, 32, 51, 0.08);
  background: rgba(255, 255, 255, 0.72);
  color: #506078;
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(14px);
}

.status-dot {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 999px;
  background: #2dd4bf;
  box-shadow: 0 0 0 6px rgba(45, 212, 191, 0.12), 0 0 18px rgba(45, 212, 191, 0.55);
}

.home-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 44px;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  font-size: 0.92rem;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.home-button:hover {
  transform: translateY(-2px);
}

.home-button-primary {
  color: white;
  background: linear-gradient(135deg, #172033, #263855);
  box-shadow: 0 18px 38px rgba(23, 32, 51, 0.18);
}

.home-button-secondary {
  color: #1d2a3d;
  border: 1px solid rgba(23, 32, 51, 0.1);
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(16px);
}

.home-button-secondary:hover {
  border-color: rgba(90, 167, 255, 0.4);
  box-shadow: 0 16px 32px rgba(90, 167, 255, 0.12);
}

.section-shell {
  position: relative;
  z-index: 1;
  padding: 5.5rem 0;
}

/* ===== Safari-friendly Scroll Reveal / 兼容 Safari 的滚动浮现 =====
   这里不再依赖 animation-timeline: view()。
   JS 会给 .home-shell 添加 .reveal-ready，再由 IntersectionObserver
   给进入视口的元素添加 .is-visible。
   当前效果：轻微上浮 + 淡入 + 小幅缩放，不使用模糊。
*/
.scroll-float,
.scroll-float-item {
  opacity: 1;
  transform: none;
  transition:
    opacity 720ms ease,
    transform 720ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.reveal-ready .scroll-float:not(.is-visible),
.reveal-ready .scroll-float-item:not(.is-visible) {
  opacity: 0;
  transform: translate3d(0, 26px, 0) scale(0.98);
}

.reveal-ready .scroll-float.is-visible,
.reveal-ready .scroll-float-item.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.scroll-float-soft {
  transition-duration: 640ms;
}

.scroll-stagger > .scroll-float-item:nth-child(2) {
  transition-delay: 80ms;
}

.scroll-stagger > .scroll-float-item:nth-child(3) {
  transition-delay: 160ms;
}

.scroll-stagger > .scroll-float-item:nth-child(4) {
  transition-delay: 240ms;
}

.scroll-stagger > .scroll-float-item:nth-child(n + 5) {
  transition-delay: 320ms;
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #5f6f88;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.section-kicker::before {
  content: "";
  width: 32px;
  height: 1px;
  background: linear-gradient(90deg, rgba(90, 167, 255, 0.85), transparent);
}

.mini-stat {
  border: 1px solid rgba(23, 32, 51, 0.07);
  background: rgba(255, 255, 255, 0.58);
  border-radius: 1.25rem;
  padding: 0.95rem;
}

.article-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(90, 167, 255, 0.24);
  background: rgba(90, 167, 255, 0.08);
  color: #386491;
  border-radius: 999px;
  padding: 0.28rem 0.62rem;
  font-size: 0.76rem;
  font-weight: 700;
}

/* ===== 错位时间线 ===== */
.timeline-track {
  position: relative;
}

.timeline-line {
  position: absolute;
  left: 50%;
  top: 0.5rem;
  bottom: 0;
  width: 1px;
  background: linear-gradient(
    180deg,
    rgba(90, 167, 255, 0.5),
    rgba(167, 139, 250, 0.32) 60%,
    transparent
  );
}

.timeline-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  border: 2px solid rgba(90, 167, 255, 0.55);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 6px rgba(90, 167, 255, 0.07), 0 0 18px rgba(90, 167, 255, 0.18);
}

.timeline-dot-featured {
  width: 0.85rem;
  height: 0.85rem;
  background: #5aa7ff;
  border-color: #5aa7ff;
  box-shadow: 0 0 0 8px rgba(90, 167, 255, 0.12), 0 0 24px rgba(90, 167, 255, 0.32);
}

.timeline-m-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: #5aa7ff;
  box-shadow: 0 0 0 5px rgba(90, 167, 255, 0.1);
}

@media (min-width: 1024px) {
  .timeline-card-half {
    width: 47%;
  }
}

.memory-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 1fr;
  grid-auto-rows: 13rem;
  gap: 1rem;
}

.memory-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.75rem;
  min-height: 13rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 20px 56px rgba(31, 41, 55, 0.08);
}

.memory-card:nth-child(1) {
  grid-row: span 2;
}

.memory-card:nth-child(4) {
  grid-column: span 2;
}

.memory-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms ease;
}

.memory-card:hover img {
  transform: scale(1.055);
}

.memory-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 1rem;
  color: white;
  background: linear-gradient(180deg, transparent, rgba(15, 23, 42, 0.76));
}

.soft-appear {
  animation: softAppear 0.72s ease both;
}

.delay-1 { animation-delay: 80ms; }
.delay-2 { animation-delay: 160ms; }
.delay-3 { animation-delay: 240ms; }

@keyframes nebulaDrift {
  from {
    transform: translate3d(-2%, -1%, 0) scale(1);
  }
  to {
    transform: translate3d(2%, 1%, 0) scale(1.06);
  }
}

@keyframes scanLine {
  from {
    left: -48%;
  }
  to {
    left: 118%;
  }
}

@keyframes softAppear {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .section-shell {
    padding: 3.75rem 1rem;
  }

  .mobile-snap {
    display: flex;
    width: calc(100% + 2rem);
    max-width: calc(100% + 2rem);
    overflow-x: auto;
    gap: 1rem;
    padding: 0.25rem 1rem 1rem;
    margin-left: -1rem;
    margin-right: -1rem;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 1rem;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-snap > * {
    flex: 0 0 min(82vw, 22rem);
    min-width: 0;
    scroll-snap-align: start;
  }

  .timeline-line {
    display: none;
  }

  .timeline-m-row {
    padding-left: 1.5rem;
    border-left: 1px solid rgba(90, 167, 255, 0.25);
  }

  .memory-grid {
    display: flex;
    width: calc(100% + 2rem);
    max-width: calc(100% + 2rem);
    overflow-x: auto;
    gap: 1rem;
    padding: 0 1rem 1rem;
    margin-left: -1rem;
    margin-right: -1rem;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 1rem;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .memory-card {
    flex: 0 0 min(82vw, 22rem);
    min-width: 0;
    height: 20rem;
    scroll-snap-align: start;
  }

  .memory-card:nth-child(1),
  .memory-card:nth-child(4) {
    grid-row: auto;
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cosmic-bg::before,
  .ak-card:hover::after,
  .soft-appear {
    animation: none;
  }

  .scroll-float,
  .scroll-float-item {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .home-button:hover {
    transform: none;
  }
}
