/* ==========================================================================
   Stage — the presentation frame around the phone.
   Visual language lifted from cover board 2.1 (deep blue, wide display type).
   ========================================================================== */

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: clamp(2rem, 4vw, 5rem);
  align-items: center;
  padding: clamp(2rem, 4vw, 4.5rem) clamp(1.5rem, 5vw, 6rem);
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 78% 42%, rgba(90, 140, 255, 0.42) 0%, transparent 58%),
    radial-gradient(80% 70% at 8% 8%, rgba(120, 170, 255, 0.24) 0%, transparent 60%),
    linear-gradient(146deg, var(--stage-deep) 0%, var(--stage-mid) 52%, #123092 100%);
}

/* Concentric "emission" rings behind the device — atmosphere, not decoration. */
.stage__rings {
  position: absolute;
  top: 50%;
  left: 72%;
  width: min(1180px, 105vw);
  aspect-ratio: 1;
  translate: -50% -50%;
  pointer-events: none;
  opacity: 0.5;
}

.stage__rings circle {
  fill: none;
  stroke: rgba(180, 208, 255, 0.16);
  stroke-width: 1;
}

.stage__grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='0.32'/></svg>");
}

/* --- left rail ------------------------------------------------------------ */

.rail {
  position: relative;
  z-index: 2;
  color: var(--stage-ink);
  max-width: 30rem;
}

.rail__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.rail__mark {
  width: 42px;
  height: 42px;
  flex: none;
}

.rail__eyebrow {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--stage-ink-dim);
}

.rail__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1rem + 2.6vw, 3.4rem);
  font-weight: 600;
  letter-spacing: 0.09em;
  line-height: 1.02;
  margin-bottom: 0.5rem;
}

.rail__rule {
  height: 1px;
  background: linear-gradient(90deg, rgba(234, 240, 255, 0.6), transparent);
  margin: 1.1rem 0 1.25rem;
}

.rail__lede {
  font-size: var(--text-md);
  line-height: 1.75;
  color: #cadaff;
  margin-bottom: 0.5rem;
}

.rail__lede strong {
  color: #fff;
  font-weight: 600;
}

/* --- screen index --------------------------------------------------------- */

.index {
  margin-top: 1.75rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.4rem;
}

.index__group {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--stage-ink-dim);
  margin-top: 0.85rem;
}

.index__group:first-child {
  margin-top: 0;
}

.index__item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.7rem;
  border-radius: var(--r-sm);
  color: #d7e3ff;
  text-align: left;
  border: 1px solid transparent;
  transition:
    background var(--dur-fast) ease,
    border-color var(--dur-fast) ease;
}

/* Hover changes paint only — moving the row would drop the pointer out of it. */
.index__item:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.16);
}

.index__item[aria-current="true"] {
  background: rgba(255, 255, 255, 0.95);
  border-color: transparent;
  color: var(--stage-deep);
  font-weight: 600;
}

.index__num {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  opacity: 0.55;
  flex: none;
}

.index__zh {
  font-size: var(--text-sm);
  opacity: 0.62;
  margin-left: auto;
  white-space: nowrap;
}

.index__item[aria-current="true"] .index__zh {
  opacity: 0.7;
}

/* --- device column -------------------------------------------------------- */

.showcase {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
}

@media (max-width: 1080px) {
  .stage {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    padding-block: 2.5rem 3.5rem;
  }

  .stage__rings {
    left: 50%;
    top: 62%;
  }

  .rail {
    max-width: none;
  }
}

@media (max-width: 640px) {
  .index {
    grid-template-columns: 1fr;
  }

  .rail__lede {
    font-size: var(--text-sm);
    line-height: 1.85;
  }
}

/* --- embedded mode --------------------------------------------------------
   `?embed=1`：作品集详情页用 iframe 挂载。品牌、标题和背景说明由外层页面讲，
   这里收窄成「索引 + 设备」，免得同一段话说两遍。
   -------------------------------------------------------------------------- */

.rail__hint {
  display: none;
}

[data-embed] .stage {
  min-height: 100vh;
  grid-template-columns: minmax(200px, 250px) 1fr;
  gap: clamp(1rem, 2.5vw, 2rem);
  padding: clamp(0.9rem, 2vw, 1.75rem);
}

[data-embed] .rail__brand,
[data-embed] .rail__title,
[data-embed] .rail__rule,
[data-embed] .rail__lede {
  display: none;
}

[data-embed] .rail__hint {
  display: block;
  font-size: var(--text-sm);
  line-height: 1.7;
  color: #b6c9f2;
  margin-bottom: 0.85rem;
}

[data-embed] .index {
  margin-top: 0;
  grid-template-columns: 1fr;
  gap: 0.25rem;
}

[data-embed] .index__group {
  margin-top: 0.65rem;
}

[data-embed] .index__item {
  padding: 0.4rem 0.6rem;
}

/* The stacked breakpoint is lower here: the frame itself is only ~1000px wide,
   but the embedded rail is a bare index, so two columns still fit. */
@media (max-width: 1080px) {
  [data-embed] .stage {
    grid-template-columns: minmax(180px, 228px) 1fr;
    padding-block: clamp(0.9rem, 2vw, 1.75rem);
  }
}

@media (max-width: 700px) {
  [data-embed] .stage {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  /* 没有这行，索引那排不换行的胶囊会把栅格轨道撑到自身宽度，整台设备跟着跑出框。 */
  [data-embed] .rail,
  [data-embed] .showcase {
    min-width: 0;
  }

  /* Phone first, index below it as a single swipeable row. */
  [data-embed] .showcase {
    order: -1;
  }

  [data-embed] .rail__hint {
    display: none;
  }

  [data-embed] .index {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 0.15rem;
  }

  [data-embed] .index::-webkit-scrollbar {
    display: none;
  }

  [data-embed] .index__group {
    display: none;
  }

  [data-embed] .index__item {
    flex: none;
    width: auto;
    white-space: nowrap;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.07);
  }

  [data-embed] .index__zh {
    display: none;
  }
}
