/* ═══════════════════════════════════════════════════
   detail.css — 软件详情页 (1:1 对齐 prototype)
   全局 token / header / .page 由 site.css 提供
   ═══════════════════════════════════════════════════ */

.detail-page {
  position: relative;
  z-index: 1;
  padding: 0 0 64px;
}

.detail-hero {
  position: relative;
  z-index: 1;
  overflow: hidden;
  margin: 0 0 28px;
  border-bottom: 1px solid var(--line-soft);
  background:
    radial-gradient(900px 360px at 0% 0%, color-mix(in srgb, var(--detail-brand) 22%, transparent), transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--detail-soft) 80%, #fff) 0%, var(--paper) 100%);
}

.detail-hero-inner {
  display: grid;
  gap: 28px;
  padding: 48px 0 44px;
  opacity: 0;
  transform: translateY(18px);
  animation: rise .7s var(--ease) .05s forwards;
}

.back-link {
  display: none;
  align-items: center;
  gap: 6px;
  width: fit-content;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  transition: color .2s;
}

.back-link:hover { color: var(--ink); }

.detail-identity {
  display: flex;
  gap: 24px;
  align-items: center;
}

.detail-icon {
  position: relative;
  flex-shrink: 0;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: var(--detail-brand);
  color: #fff;
  box-shadow:
    0 16px 36px color-mix(in srgb, var(--detail-brand) 30%, transparent),
    inset 0 1px 0 rgba(255,255,255,.22);
}

.detail-icon img {
  position: absolute;
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.detail-icon .icon-fallback {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1;
  opacity: .92;
}

.detail-title h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 900;
  letter-spacing: -.03em;
}

.detail-author {
  margin-top: 10px;
  color: var(--detail-brand);
  font-size: 14px;
  font-weight: 600;
}

.detail-summary {
  margin: 8px 0 0;
  max-width: 36em;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

.detail-type {
  display: none;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.detail-actions .download {
  min-width: 168px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  border: 0;
  border-radius: 8px;
  background: var(--detail-brand, var(--accent));
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .2s, box-shadow .2s, transform .2s;
}

.detail-actions .download:hover {
  color: #fff;
  filter: brightness(.94);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--detail-brand, var(--accent)) 35%, transparent);
}

.detail-actions .download.is-disabled {
  opacity: .55;
  pointer-events: none;
}

.detail-actions .share {
  height: 48px;
  min-width: 108px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.7);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.detail-actions .share:hover {
  border-color: var(--ink);
  background: #fff;
}

.detail-content {
  display: grid;
  gap: 18px;
}

.detail-content > * {
  min-width: 0;
}

.panel {
  padding: 28px 30px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--surface);
}

.panel h2 {
  margin-bottom: 16px;
  font-size: 20px;
}

.panel p {
  margin: 0;
  max-width: 680px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.85;
}

.rich-text {
  max-width: 680px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.85;
}

.rich-text p { margin: 0 0 12px; }
.rich-text p:last-child { margin-bottom: 0; }
.rich-text ul,
.rich-text ol { margin: 0 0 12px; padding-left: 1.3em; }
.rich-text a { color: var(--detail-brand, var(--accent)); font-weight: 600; }
.rich-text h2,
.rich-text h3,
.rich-text h4 {
  margin: 16px 0 8px;
  color: var(--ink);
  font-size: 16px;
}

.official {
  display: inline-flex;
  margin-top: 14px;
  color: var(--detail-brand, var(--accent));
  font-size: 13px;
  font-weight: 600;
}

.official:hover { text-decoration: underline; }

.screenshot-gallery {
  --shot-h: 250px;
  --shot-gap: 12px;
  position: relative;
  min-width: 0;
}

.screenshot-viewport {
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  min-width: 0;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}

.screenshot-viewport::-webkit-scrollbar {
  display: none;
}

.screenshot-rail {
  display: flex;
  align-items: stretch;
  gap: var(--shot-gap);
  width: max-content;
  height: var(--shot-h);
}

.shot {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: stretch;
  height: var(--shot-h);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: #e8eef3;
  color: inherit;
  font: inherit;
  cursor: zoom-in;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--line) 70%, transparent);
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}

.shot:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--line) 80%, transparent),
    0 10px 22px rgba(17, 20, 24, .1);
}

.shot:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.shot img {
  display: block;
  height: 100%;
  width: auto;
  max-width: none;
  object-fit: contain;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
}

.shot.is-placeholder {
  width: calc(var(--shot-h) * 1.62);
  flex-direction: column;
  cursor: default;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: none;
}

.shot.is-placeholder:hover {
  transform: none;
  box-shadow: none;
}

.shot-arrow {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #1b1d21;
  box-shadow:
    0 4px 14px rgba(17, 20, 24, .16),
    0 0 0 1px rgba(17, 20, 24, .05);
  cursor: pointer;
  transition: background .18s, color .18s, box-shadow .18s, transform .18s var(--ease), opacity .18s;
}

.shot-arrow svg {
  width: 18px;
  height: 18px;
}

.shot-arrow:not(:disabled):hover {
  background: #f7f8fa;
  transform: scale(1.05);
}

.shot-arrow:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.shot-arrow:disabled {
  background: #eceff3;
  color: #9aa3ad;
  box-shadow: 0 1px 4px rgba(17, 20, 24, .08);
  cursor: default;
  transform: none;
}

.screenshot-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
}

.screenshot-nav.prev { left: 6px; }
.screenshot-nav.next { right: 6px; }

.screenshot-nav[hidden] { display: none !important; }

.screenshot-nav:not(:disabled):hover {
  transform: translateY(-50%) scale(1.05);
}

.screenshot-nav:disabled {
  transform: translateY(-50%);
}

body.is-lightbox-open {
  overflow: hidden;
}

.shot-lightbox[hidden] { display: none !important; }

.shot-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  align-items: center;
  padding: 56px 0 32px;
  background: rgba(18, 20, 24, .42);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  animation: fade-in .22s var(--ease);
}

.shot-lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  z-index: 2;
}

.shot-lightbox-nav {
  justify-self: center;
  width: 44px;
  height: 44px;
}

.shot-lightbox-nav[hidden] { display: none !important; }

.shot-lightbox-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-width: 0;
  min-height: 0;
}

.shot-lightbox-main img {
  display: block;
  max-width: min(100%, 1120px);
  max-height: calc(100vh - 168px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 28px 64px rgba(8, 10, 14, .38);
  background: rgba(255, 255, 255, .06);
}

.shot-lightbox-meta {
  text-align: center;
  color: #fff;
}

.shot-lightbox-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.shot-lightbox-count {
  margin-top: 4px;
  color: rgba(255, 255, 255, .72);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.window-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 12px;
  background: #eef1f4;
  border-bottom: 1px solid #dde2e7;
}

.window-bar i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c5cbd2;
}

.window-title {
  margin-left: 6px;
  color: #7a828c;
  font-size: 10px;
  font-weight: 500;
}

.window-body {
  display: grid;
  grid-template-columns: 42px 1fr;
  flex: 1;
  min-height: 0;
  height: auto;
  background: #fbfcfd;
}

.window-side {
  padding-top: 18px;
  background: var(--shot-soft, #f1f1f1);
}

.window-side span {
  display: block;
  width: 14px;
  height: 4px;
  margin: 0 auto 10px;
  border-radius: 2px;
  background: var(--shot-brand, #333);
  opacity: .75;
}

.window-content { padding: 18px 16px; }

.window-content strong {
  display: block;
  width: 46%;
  height: 9px;
  margin-bottom: 14px;
  border-radius: 2px;
  background: #3a424c;
}

.window-content em {
  display: block;
  width: 78%;
  height: 5px;
  margin-bottom: 10px;
  border-radius: 2px;
  background: #d3d9e0;
  font-style: normal;
}

.window-content em:nth-child(3) { width: 62%; }
.window-content em:nth-child(4) { width: 88%; }

.info {
  border-top: 2px solid var(--ink);
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}

.info-row span { color: var(--muted); }
.info-row strong { font-weight: 600; font-variant-numeric: tabular-nums; }

@media (max-width: 820px) {
  .detail-page { padding: 0 0 calc(48px + env(safe-area-inset-bottom, 0px)); }
  .detail-hero { margin-bottom: 16px; }
  .detail-hero-inner {
    gap: 20px;
    padding: 28px 0 26px;
  }
  .detail-identity {
    gap: 14px;
    align-items: flex-start;
  }
  .detail-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
  }
  .detail-icon img { width: 38px; height: 38px; }
  .detail-icon .icon-fallback { font-size: 13px; }
  .detail-title h1 {
    font-size: 28px;
    letter-spacing: -.02em;
  }
  .detail-author,
  .detail-type { font-size: 12px; }
  .detail-actions {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 10px;
  }
  .detail-actions .download,
  .detail-actions .share {
    width: 100%;
    min-width: 0;
    height: 46px;
    font-size: 13px;
  }
  .detail-actions .download { font-size: 16px; }
  .detail-content { gap: 12px; }
  .panel {
    padding: 20px 16px;
    border-radius: 12px;
  }
  .panel h2 {
    margin-bottom: 12px;
    font-size: 17px;
  }
  .panel p { font-size: 13px; line-height: 1.75; }
  .screenshot-gallery {
    --shot-h: 180px;
    --shot-gap: 10px;
  }
  .screenshot-nav {
    width: 36px;
    height: 36px;
  }
  .screenshot-nav svg { width: 16px; height: 16px; }
  .shot-lightbox {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    padding: 52px 0 24px;
  }
  .shot-lightbox-close {
    top: 12px;
    right: 12px;
  }
  .shot-lightbox-nav {
    width: 36px;
    height: 36px;
  }
  .shot-lightbox-main img {
    max-height: calc(100vh - 148px);
    border-radius: 10px;
  }
  .window-body { height: auto; }
  .info-row {
    padding: 12px 0;
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .detail-identity { gap: 12px; }
  .detail-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
  }
  .detail-icon img { width: 34px; height: 34px; }
  .detail-title h1 { font-size: 24px; }
  .detail-actions { grid-template-columns: 1fr; }
  .screenshot-gallery { --shot-h: 160px; }
}
