/* 红石联机 · 首页样式（由 public/index.html 拆出） */

:root {
  --paper: #e5e7f4;
  --ink: #2f353d;
  --ink-soft: #4a525d;
  --red: #c21c14;
  --font-ui: "MiSans", "MiSans VF", "HarmonyOS Sans SC", "PingFang SC",
    "Microsoft YaHei", system-ui, sans-serif;
  --rail-size: clamp(80px, 6.4vw, 160px);
  --rail-gap: clamp(10px, 1.15vw, 18px);
  --band-size: clamp(44px, 12vw, 56px);
  --side-margin: clamp(14px, 2.7vw, 52px);
  --side-span: calc(var(--side-margin) + var(--rail-size) * 2 + var(--rail-gap));
  --hero-pad: clamp(20px, 5vw, 56px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

::selection {
  background: rgba(194, 28, 20, 0.16);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

/* ---------- 背景：图案向下逐渐模糊、融为纯色 ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--paper);
  overflow: hidden;
  pointer-events: none;
}

.backdrop__image {
  position: absolute;
  inset: -2px;
  background: url("asset/background.webp") center center / cover no-repeat;
  filter: contrast(1.05) saturate(1.05);
}

/* 叠一层渐进式 backdrop blur：上端清晰，向下逐渐变糊 */
.backdrop__blur {
  position: absolute;
  inset: -2px;
  -webkit-backdrop-filter: blur(36px) saturate(1.04);
  backdrop-filter: blur(36px) saturate(1.04);
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 30%,
    rgba(0, 0, 0, 0.3) 52%,
    rgba(0, 0, 0, 0.78) 71%,
    rgba(0, 0, 0, 0.98) 84%,
    #000 92%
  );
  mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 30%,
    rgba(0, 0, 0, 0.3) 52%,
    rgba(0, 0, 0, 0.78) 71%,
    rgba(0, 0, 0, 0.98) 84%,
    #000 92%
  );
}

/* 再叠一层底色渐变，保证底部是毫无纹理的纯色 */
.backdrop__wash {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(229, 231, 244, 0) 46%,
    rgba(229, 231, 244, 0.26) 60%,
    rgba(229, 231, 244, 0.76) 76%,
    #e5e7f4 90%,
    #e5e7f4 100%
  );
}

/* ---------- 两侧整合包图标墙 ---------- */

.rails {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  user-select: none;
  filter: saturate(0.94) contrast(0.99);
  animation: rails-in 1.6s ease-out 0.1s both;
}

.rails__side {
  position: absolute;
  top: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--rail-gap);
  width: calc(var(--rail-size) * 2 + var(--rail-gap));
  overflow: hidden;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    transparent 1%,
    #000 8%,
    #000 62%,
    transparent 82%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    transparent 1%,
    #000 8%,
    #000 62%,
    transparent 82%
  );
}

.rails__side--left {
  left: var(--side-margin);
}

.rails__side--right {
  right: var(--side-margin);
}

.rail {
  position: relative;
  height: 100%;
  overflow: hidden;
}

.rail__track {
  display: flex;
  flex-direction: column;
  animation: rail-up var(--dur, 60s) linear infinite;
  animation-delay: var(--delay, 0s);
  will-change: transform;
}

.rails__side--right .rail__track {
  animation-name: rail-down;
}

.rail__set {
  display: flex;
  flex-direction: column;
  gap: var(--rail-gap);
  padding-bottom: var(--rail-gap);
}

.tile {
  flex: none;
  width: var(--rail-size);
  height: var(--rail-size);
  border-radius: calc(var(--rail-size) * 0.19);
  overflow: hidden;
  background: #fff;
  box-shadow:
    0 20px 34px -22px rgba(38, 48, 82, 0.56),
    0 4px 10px -3px rgba(38, 48, 82, 0.12);
}

.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

@keyframes rail-up {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(0, -50%, 0);
  }
}

@keyframes rail-down {
  from {
    transform: translate3d(0, -50%, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes rails-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---------- 中央标题 ---------- */

.stage {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
}

.hero {
  position: relative;
  padding: 0 var(--hero-pad);
  text-align: center;
  transform: translateY(-1vh);
}

/* 标题背后极轻的柔光，让文字从图案里浮出来 */
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(
    ellipse 34% 30% at 50% 47%,
    rgba(244, 246, 252, 0.9) 0%,
    rgba(244, 246, 252, 0.55) 46%,
    rgba(244, 246, 252, 0) 74%
  );
  pointer-events: none;
}

.hero__title {
  margin: 0;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.035em;
  animation: hero-rise 0.95s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

.hero__line {
  display: block;
  white-space: nowrap;
}

.hero__line--brand {
  padding-left: 0.035em; /* 抵消 letter-spacing 在末字后留下的空隙 */
  color: var(--red);
  font-size: clamp(3.4rem, 8.45vw, 11.5rem);
}

.hero__line--sub {
  margin-top: clamp(4px, 0.8vh, 12px);
  color: var(--ink);
  /* 以两侧图标墙之间的可用宽度定字号；14.9 ≈ 13.11em 行宽 × 1.14 留白 */
  font-size: min(
    5.8vw,
    8.5rem,
    calc((100vw - 2 * var(--side-span) - 48px) / 14.9)
  );
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.012em;
}

.hero__latin {
  margin-right: 0.12em;
}

/* ---------- 行动按钮 ---------- */

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(10px, 1.2vw, 16px);
  margin-top: clamp(22px, 3.6vh, 42px);
  animation: hero-rise 1s cubic-bezier(0.16, 1, 0.3, 1) 0.22s both;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 clamp(22px, 2vw, 30px);
  border-radius: 999px;
  font-family: inherit;
  font-size: clamp(0.98rem, 1.15vw, 1.125rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn__icon {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn--primary {
  color: #fff;
  background: var(--red);
  box-shadow:
    0 14px 26px -16px rgba(120, 22, 14, 0.72),
    0 2px 6px -2px rgba(120, 22, 14, 0.28);
}

.btn--primary:hover {
  background: #ad180f;
  transform: translateY(-1px);
  box-shadow:
    0 18px 30px -16px rgba(120, 22, 14, 0.78),
    0 3px 8px -2px rgba(120, 22, 14, 0.3);
}

.btn--primary:active {
  transform: translateY(0);
  box-shadow:
    0 8px 18px -14px rgba(120, 22, 14, 0.7),
    0 1px 3px -1px rgba(120, 22, 14, 0.24);
}

.btn--ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(47, 53, 61, 0.16);
}

.btn--ghost:hover {
  background: #fff;
  border-color: rgba(47, 53, 61, 0.28);
  transform: translateY(-1px);
}

.btn--ghost:active {
  transform: translateY(0);
  background: rgba(255, 255, 255, 0.9);
}

.btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- 移动端横向图标带（默认隐藏，≤720px 显示） ---------- */

.band {
  display: none;
}

.band__row {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 9%,
    #000 91%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 9%,
    #000 91%,
    transparent 100%
  );
}

.band__track {
  display: flex;
  width: max-content;
  animation: band-left var(--dur, 38s) linear infinite;
  animation-delay: var(--delay, 0s);
  will-change: transform;
}

.band__row--right .band__track {
  animation-name: band-right;
}

.band__set {
  display: flex;
  gap: 8px;
  padding-right: 8px;
}

.band .tile {
  width: var(--band-size);
  height: var(--band-size);
  border-radius: calc(var(--band-size) * 0.19);
}

@keyframes band-left {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-50%, 0, 0);
  }
}

@keyframes band-right {
  from {
    transform: translate3d(-50%, 0, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes hero-rise {
  from {
    opacity: 0;
    transform: translateY(24px);
    filter: blur(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* ---------- 底部字体声明（MiSans 许可要求注明） ---------- */

.credit {
  position: fixed;
  right: clamp(14px, 2.7vw, 52px);
  bottom: clamp(22px, 3.4vh, 34px);
  margin: 0;
  z-index: 2;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.08em;
  color: rgba(47, 53, 61, 0.72);
  user-select: none;
}

/* ---------- 响应式 ---------- */

/* 721–1120：每侧一列，让第二行标题拿到更大字号 */
@media (max-width: 1120px) and (min-width: 721px) {
  :root {
    --side-span: calc(var(--side-margin) + var(--rail-size));
  }

  .rails__side {
    grid-template-columns: 1fr;
    width: var(--rail-size);
  }

  .rails__side .rail:nth-child(2) {
    display: none;
  }

  .rails {
    animation-duration: 1.2s;
  }
}

/* ≤720：竖向图标墙让位给标题下方的横向图标带 */
@media (max-width: 720px) {
  .rails {
    display: none;
  }

  .band {
    position: absolute;
    top: calc(100% + clamp(18px, 3.6vh, 34px));
    left: 50%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(100vw, 560px);
    transform: translateX(-50%);
    filter: saturate(0.96) contrast(0.99);
  }

  .hero {
    transform: translateY(-1.5vh);
  }

  .hero__line--brand {
    letter-spacing: 0.03em;
  }

  .hero__line--sub {
    font-size: min(6.9vw, calc((100vw - var(--hero-pad) * 2 - 24px) / 14.9));
    letter-spacing: 0.008em;
  }

  .credit {
    right: 50%;
    transform: translateX(50%);
  }
}

/* 窄手机：两个按钮竖排，避免换行后一长一短 */
@media (max-width: 480px) {
  .hero__actions {
    flex-direction: column;
    align-items: stretch;
    width: min(100%, 300px);
    margin-inline: auto;
  }

  .btn {
    width: 100%;
    min-height: 50px;
  }
}

@media (max-width: 720px) and (max-height: 480px) {
  /* 手机横屏等极矮视口：横带会把署名顶出视口，直接让位给标题 */
  .band {
    display: none;
  }
}

@media (max-height: 620px) and (min-width: 721px) {
  :root {
    --rail-size: 64px;
  }

  .hero {
    transform: translateY(-1vh);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rails,
  .hero__title,
  .hero__actions {
    animation: none;
  }

  .rail__track {
    animation: none;
    transform: translate3d(0, -8%, 0);
  }

  .band__track {
    animation: none;
  }

  .btn {
    transition: none;
  }
}
