/* Your Story project content inside the shared My Work detail shell. */
.work-detail__site .story-project-intros {
  display: grid;
  gap: 0;
  max-width: var(--story-reading-width);
  margin-inline: auto;
}

.story-project-intro {
  display: grid;
  grid-template-columns: var(--story-number-width) var(--story-number-gap) minmax(0, 1fr) var(--story-qr-gap) var(--story-qr-width);
  column-gap: 0;
  row-gap: 18px;
  padding: 24px 0;
}
.story-project-intro + .story-project-intro { border-top: 1px solid #c7c0c9; }
.story-project-intro > small {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  padding: 0;
  color: #a43370;
  font: 650 13px/1 var(--work-reading);
}
.story-project-intro h3 {
  grid-column: 3 / -1;
  grid-row: 1;
  margin: 0;
  color: #a43370;
  font: 600 18px/1.3 var(--work-display);
}
.story-project-intro__copy { grid-column: 3 / -1; grid-row: 2; max-width: none; }
.story-project-intro__copy p { margin: 0 0 10px; color: #514851; font-size: 14px; line-height: 1.75; }
.story-project-intro__copy p:last-child { margin-bottom: 0; }

.story-wechat {
  display: flex;
  grid-column: 5;
  align-self: center;
  align-items: center;
  gap: 14px;
  color: #211a23;
  background: transparent;
}
.story-wechat img { width: 120px; height: 120px; object-fit: contain; background: #fff; }
.story-wechat div { display: grid; gap: 7px; }
.story-wechat strong { font-family: var(--work-display); font-size: 16px; font-weight: 620; }
.story-wechat span { color: #756c78; font-size: 12px; }

.story-miniapp-preview {
  --story-phone-width: 375px;
  --story-phone-height: 812px;
  --story-phone-scale: .65;
  --story-preview-viewport-height: auto;
  position: relative;
  display: grid;
  width: 100%;
  max-width: var(--story-reading-width);
  min-height: var(--story-preview-viewport-height);
  align-content: center;
  justify-items: center;
  box-sizing: border-box;
  margin-inline: auto;
  padding: 8px 0 0;
  scroll-snap-align: start;
}
.story-phone-stage {
  width: calc(var(--story-phone-width) * var(--story-phone-scale));
  height: calc(var(--story-phone-height) * var(--story-phone-scale));
  aspect-ratio: 375 / 812;
}
.story-phone {
  position: relative;
  width: var(--story-phone-width);
  height: var(--story-phone-height);
  max-width: var(--story-phone-width);
  max-height: var(--story-phone-height);
  overflow: hidden;
  border-radius: 40px;
  background: #f7f4ef;
  box-shadow: 0 0 0 8px #2d2b2f;
  transform: scale(var(--story-phone-scale));
  transform-origin: top left;
}
.story-phone__notch {
  position: absolute;
  z-index: 7;
  top: 0;
  left: 50%;
  width: 156px;
  height: 31px;
  border-radius: 0 0 24px 24px;
  background: #050505;
  transform: translateX(-50%);
}
.story-phone__statusbar {
  position: absolute;
  z-index: 6;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 44px;
  padding: 0 15px 0 16px;
  color: #111;
  font: 500 12px/1 var(--work-reading);
}
.story-phone__statusbar time { min-width: 34px; font-variant-numeric: tabular-nums; }
.story-phone__signals { display: flex; align-items: center; gap: 6px; height: 14px; }
.story-phone__signal {
  width: 14px;
  height: 10px;
  background: linear-gradient(to top, #111 0 100%) 0 7px/2px 3px no-repeat,
              linear-gradient(to top, #111 0 100%) 4px 5px/2px 5px no-repeat,
              linear-gradient(to top, #111 0 100%) 8px 3px/2px 7px no-repeat,
              linear-gradient(to top, #111 0 100%) 12px 0/2px 10px no-repeat;
}
.story-phone__wifi { position: relative; width: 15px; height: 11px; border-top: 2px solid #111; border-radius: 50% 50% 0 0; transform: scaleX(.95); }
.story-phone__wifi::before,
.story-phone__wifi::after { content: ""; position: absolute; left: 50%; border-top: 2px solid #111; border-radius: 50% 50% 0 0; transform: translateX(-50%); }
.story-phone__wifi::before { top: 2px; width: 9px; height: 7px; }
.story-phone__wifi::after { top: 6px; width: 3px; height: 3px; border: 0; border-radius: 50%; background: #111; }
.story-phone__battery { position: relative; width: 22px; height: 10px; border: 1.5px solid #111; border-radius: 2px; box-shadow: inset 0 0 0 2px #f7f4ef, inset 16px 0 #111; }
.story-phone__battery::after { content: ""; position: absolute; top: 2px; right: -3px; width: 2px; height: 4px; border-radius: 0 1px 1px 0; background: #111; }
.story-phone__wechatbar { position: absolute; z-index: 8; top: 50px; right: 10px; height: 32px; pointer-events: none; }
.story-phone__capsule { display: flex; align-items: center; width: 88px; height: 32px; border: 1px solid rgba(0, 0, 0, .16); border-radius: 18px; background: rgba(255, 255, 255, .94); }
.story-phone__capsule-dots { display: flex; align-items: center; justify-content: center; gap: 4px; width: 48px; height: 100%; }
.story-phone__capsule-dots i { width: 5px; height: 5px; border-radius: 50%; background: #050505; }
.story-phone__capsule-divider { width: 1px; height: 18px; background: rgba(0, 0, 0, .14); }
.story-phone__capsule-close { position: relative; width: 38px; height: 100%; }
.story-phone__capsule-close::before,
.story-phone__capsule-close::after { content: ""; position: absolute; border-radius: 50%; }
.story-phone__capsule-close::before { inset: 7px 10px; border: 2px solid #050505; }
.story-phone__capsule-close::after { top: 13px; left: 16px; width: 6px; height: 6px; background: #050505; }
.story-test-frame { position: absolute; inset: 0; width: var(--story-phone-width); height: var(--story-phone-height); overflow: hidden; background: #f7f4ef; }
.story-test-frame iframe { display: block; width: var(--story-phone-width); height: var(--story-phone-height); border: 0; background: transparent; opacity: 0; }
.story-test-frame__status { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; justify-items: center; gap: 14px; color: #756c78; background: #f7f4ef; font: 600 14px/1.4 var(--work-reading); text-align: center; }
.story-test-frame__pixel { width: 10px; height: 10px; background: #a43370; animation: story-test-loading 900ms steps(4, end) infinite; }
.story-test-frame__status button { min-width: 92px; padding: 8px 12px; border: 2px solid #5f5762; color: #211a23; background: #f1edf1; font: 600 13px/1 var(--work-reading); cursor: pointer; }
.story-phone__home-indicator { position: absolute; z-index: 9; bottom: 8px; left: 50%; width: 116px; height: 4px; border-radius: 4px; background: #111; transform: translateX(-50%); }
.story-miniapp-preview__note { position: static; justify-self: center; margin: 18px 0 0; color: #756c78; font-size: 12px; line-height: 1.2; }
.story-test-frame[data-state="ready"] iframe { opacity: 1; }
.story-test-frame[data-state="ready"] .story-test-frame__status { visibility: hidden; pointer-events: none; }
.story-test-frame[data-state="error"] .story-test-frame__pixel { animation: none; }

@keyframes story-test-loading {
  0%, 100% { opacity: .25; transform: scale(.75); }
  50% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .story-test-frame__pixel { animation: none; }
}

@media (max-width: 720px) {
  .story-project-intro { grid-template-columns: var(--story-number-width) var(--story-number-gap) minmax(0, 1fr); }
  .story-project-intro h3,
  .story-project-intro__copy { grid-column: 3 / -1; }
  .story-miniapp-preview { padding: 8px 0 0; }
  .story-wechat { grid-column: 1; align-self: start; }
}

/* Immersive mini-program chrome: the scene owns the status-bar background. */
.story-phone[data-chrome="immersive-dark"] .story-test-frame { inset: 0; width: var(--story-phone-width); height: var(--story-phone-height); background: #08090c; }
.story-phone[data-chrome="immersive-dark"] .story-phone__statusbar { color: #f7f4ef; background: transparent; }
.story-phone[data-chrome="immersive-dark"] .story-phone__signal {
  background: linear-gradient(to top, #f7f4ef 0 100%) 0 7px/2px 3px no-repeat,
              linear-gradient(to top, #f7f4ef 0 100%) 4px 5px/2px 5px no-repeat,
              linear-gradient(to top, #f7f4ef 0 100%) 8px 3px/2px 7px no-repeat,
              linear-gradient(to top, #f7f4ef 0 100%) 12px 0/2px 10px no-repeat;
}
.story-phone[data-chrome="immersive-dark"] .story-phone__wifi,
.story-phone[data-chrome="immersive-dark"] .story-phone__wifi::before { border-top-color: #f7f4ef; }
.story-phone[data-chrome="immersive-dark"] .story-phone__wifi::after { background: #f7f4ef; }
.story-phone[data-chrome="immersive-dark"] .story-phone__battery { border-color: #f7f4ef; box-shadow: inset 0 0 0 2px #08090c, inset 16px 0 #f7f4ef; }
.story-phone[data-chrome="immersive-dark"] .story-phone__battery::after { background: #f7f4ef; }
.story-phone[data-chrome="immersive-dark"] .story-phone__home-indicator { background: rgba(247, 244, 239, .72); }
