/**
 * Snowmotion 子页共用响应式：顶栏 + 三档断点
 * @see https://www.figma.com/design/x3PP4kfHCBIK73u6B0jRjg/Sonwmotion?node-id=358-44
 * @see https://www.figma.com/design/x3PP4kfHCBIK73u6B0jRjg/Sonwmotion?node-id=535-223
 * @see https://www.figma.com/design/x3PP4kfHCBIK73u6B0jRjg/Sonwmotion?node-id=558-464
 */

html:not(.embed-cankao) body {
  justify-content: flex-start;
}

.showcase1,
.app,
.desktop5 {
  width: 100%;
  max-width: 1440px;
  flex-shrink: 0;
  margin-left: 0;
  margin-right: 0;
}

/**
 * 顶栏 header 382:295：64px，白底 blur 40px @ 50%
 */
.subpage-header,
.showcase1__header {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px 0 50px;
  box-sizing: border-box;
  background: transparent;
  border-bottom: none;
  box-shadow: none;
}

.subpage-header__sheen,
.showcase1__header-sheen {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-bottom: 1px solid rgba(229, 232, 238, 0.8);
}

.subpage-header__back,
.showcase1__back {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 69px;
  height: 32px;
  padding: 0 8px 0 6px;
  border-radius: 4px;
  background: #f7f8fa;
  font-family: "Geist Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
  color: #142c53;
  text-decoration: none;
  transition: background 0.15s ease;
}

.subpage-header__back:hover,
.showcase1__back:hover {
  background: #eef1f6;
}

.subpage-header__back img,
.showcase1__back img {
  flex-shrink: 0;
  display: block;
}

.subpage-header__theme,
.showcase1__theme {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: default;
}

.subpage-header__theme img,
.showcase1__theme img {
  display: block;
}

.showcase1__workspace,
.desktop5__workspace {
  width: 100%;
  box-sizing: border-box;
}

.desktop5__header {
  width: 100%;
}

.desktop5__header img {
  width: 100%;
  height: 64px;
  object-fit: fill;
}

/**
 * 848–1372+：画板在视口中水平居中
 * @see https://www.figma.com/design/x3PP4kfHCBIK73u6B0jRjg/Sonwmotion?node-id=535-223
 * @see https://www.figma.com/design/x3PP4kfHCBIK73u6B0jRjg/Sonwmotion?node-id=535-89
 */
@media (min-width: 848px) {
  html:not(.embed-cankao) body {
    justify-content: center;
  }

  .showcase1,
  .app,
  .desktop5 {
    margin-left: auto;
    margin-right: auto;
  }
}

/**
 * ≥1080：顶栏与内容区左右 padding 与 Figma 1440 稿对齐
 */
@media (min-width: 1080px) {
  .subpage-header,
  .showcase1__header {
    padding: 0 40px 0 50px;
  }

  .showcase1__workspace,
  .app__body,
  .desktop5__workspace {
    padding-left: 50px;
    padding-right: 40px;
  }
}

/**
 * 540–1079：左右栏纵向堆叠；848+ 时由上方规则整体居中
 */
@media (min-width: 540px) and (max-width: 1079px) {
  .subpage-header,
  .showcase1__header {
    padding: 0 24px;
  }

  .showcase1__workspace,
  .app__body,
  .desktop5__workspace {
    flex-direction: column;
    align-items: center;
    padding: 32px 24px 40px;
    gap: 32px;
  }

  .app__body {
    display: flex;
    flex-direction: column;
    grid-template-columns: unset;
  }

  .showcase1__left,
  .col-left,
  .desktop5__left {
    width: 100%;
    max-width: 800px;
  }

  .showcase1__cankao,
  .demo-viewport,
  .desktop5__preview {
    width: 100%;
    max-width: 800px;
    height: auto;
    aspect-ratio: 800 / 450;
  }

  .showcase1__right,
  .col-right,
  .desktop5__right {
    width: 100%;
    max-width: 540px;
    padding-top: 0;
  }
  .showcase1__timeline-block,
  .showcase1__segments,
  .showcase1__progress,
  .upload-stack,
  .input-card,
  .typography-card,
  .spec-card,
  .bg-panel,
  .scale-control,
  .desktop5__timeline {
    width: 100%;
    max-width: 800px;
  }

  .showcase1__divider,
  .col-right__divider {
    width: 100%;
  }

  .col-right__actions {
    flex-wrap: wrap;
  }

  .btn-figma {
    width: auto;
    flex: 1 1 200px;
    min-width: 160px;
  }

  .demo-viewport {
    --cankao-w: min(calc(100vw - 48px), 800px);
    height: calc(var(--cankao-w) * 450 / 800);
  }

  .demo-scale--iframe {
    transform: scale(calc(var(--cankao-w) / 1920));
  }
}

/**
 * 848–1079：Figma Desktop - 7（535:223）描述区在视频下方全宽 800px
 * @see https://www.figma.com/design/x3PP4kfHCBIK73u6B0jRjg/Sonwmotion?node-id=535-223
 */
@media (min-width: 848px) and (max-width: 1079px) {
  .showcase1__workspace {
    align-items: stretch;
    padding-top: 40px;
    padding-bottom: 48px;
    gap: 48px;
  }

  .showcase1__left,
  .showcase1__right {
    align-self: center;
    width: 100%;
    max-width: 800px;
  }

  .showcase1__right {
    box-sizing: border-box;
  }

  .showcase1__title {
    margin: 0;
    font-family: "Geist Sans", ui-sans-serif, system-ui, sans-serif;
    font-size: 20px;
    font-weight: 500;
    line-height: 28px;
    color: #101423;
  }

  .showcase1__divider {
    width: 500px;
    max-width: 100%;
    height: 1px;
    margin: 16px 0;
    border: none;
    background: #e5e8ee;
  }

  .showcase1__desc-label {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 400;
    line-height: 28px;
    color: #797c86;
  }

  .showcase1__desc-body {
    width: 100%;
    max-width: 800px;
    margin: 0;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    color: #101423;
    white-space: pre-line;
  }
}

/**
 * ≤847：Figma 375 窄屏稿（558:464）— 单列、12px 边距、紧凑时间线与描述
 * @see https://www.figma.com/design/x3PP4kfHCBIK73u6B0jRjg/Sonwmotion?node-id=558-464
 */
@media (max-width: 847px) {
  .showcase1 {
    min-height: 0;
  }

  .showcase1__header {
    padding: 0 16px;
  }

  .showcase1__theme {
    display: none;
  }

  .showcase1__workspace {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 12px 32px;
    gap: 16px;
  }

  .showcase1__left,
  .showcase1__right {
    width: 100%;
    max-width: none;
    padding-top: 0;
  }

  .showcase1__cankao {
    width: 100%;
    max-width: none;
    height: auto;
    aspect-ratio: 800 / 450;
    border-radius: 8px;
  }

  .showcase1__timeline-block {
    width: 100%;
    max-width: none;
    height: 40px;
    margin-top: 16px;
  }

  .showcase1__segments {
    width: 100%;
    max-width: none;
    height: 40px;
  }

  .showcase1__segment {
    height: 40px;
  }

  .showcase1__segment-label {
    top: 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
  }

  .showcase1__playhead {
    height: 40px;
  }

  .showcase1__playhead-cap {
    height: 40px;
  }

  .showcase1__progress {
    display: block;
    width: 100%;
    max-width: none;
    height: 12px;
    margin-top: 12px;
  }

  .showcase1__title {
    margin: 0;
    font-family: "Geist Sans", ui-sans-serif, system-ui, sans-serif;
    font-size: 20px;
    font-weight: 500;
    line-height: 28px;
    color: #101423;
  }

  .showcase1__divider {
    width: 100%;
    max-width: none;
    height: 1px;
    margin: 12px 0;
    border: none;
    background: #e5e8ee;
  }

  .showcase1__desc-label {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 400;
    line-height: 28px;
    color: #797c86;
  }

  .showcase1__desc-body {
    width: 100%;
    max-width: none;
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 24px;
    color: #101423;
    white-space: pre-line;
  }
}

/**
 * 375–539：工作台页紧凑边距
 */
@media (min-width: 375px) and (max-width: 539px) {
  .subpage-header,
  .showcase1__header {
    padding: 0 16px;
  }

  .app__body,
  .desktop5__workspace {
    padding: 24px 16px 32px;
    gap: 24px;
  }

  .col-right,
  .desktop5__right {
    max-width: 100%;
  }

  .col-right__actions {
    flex-direction: column;
    gap: 12px;
  }

  .btn-figma {
    width: 100%;
    flex: none;
  }

  .demo-viewport {
    --cankao-w: min(calc(100vw - 32px), 800px);
    height: calc(var(--cankao-w) * 450 / 800);
  }
}
