/* ==========================================================================
   Macmatou 内嵌商店窗口 · 对标 Linear 升级（2026-07 追加）
   - 仅新增本文件 + index.html 一行 <link>；不修改既有 css/*.css。
   - 不覆盖窗口 box-shadow / border / border-radius / background（阴影原样保留）。
   - 不动 hero、页面背景(grain+渐变)、页脚、内测提示文案。
   - 全屏(is-store-window-fullscreen) 与 ≤768px 窄屏沿用既有规则（本段已避让）。
   - 本文件在 index.html 中于 store-window.css 之后加载，靠加载顺序 + 特异性生效，
     不使用 !important，最大限度避免误伤。回滚：删除 index.html 中本文件的 <link> 行。
   ========================================================================== */

/* —— 阶段1：窗口尺寸 = 宽度优先（2026-07 修订）——
   仅桌面(≥769px) + 非全屏

   旧做法：aspect-ratio:16/10 + 高度由视口高度决定 → 宽度 = 高度 × 1.6。
   问题：要摸到 1280 宽需要 1280÷1.6+220 = 1020px 可视高度，而 MacBook Air 13"
   只有约 770px、Pro 14" 约 852px、外接 1080p 屏约 950px —— 没有常见笔记本够得到。
   实测结果是白窗恒定只占屏宽 56–67%，左右白白空掉 500–750px，内容区被压到
   518–678px，两栏应用卡因此折行、高度不齐。

   新做法：宽度只看屏幕宽，高度独立取值，两者解耦。
   1440 屏上内容区从 678px → 约 1020px（+50%），且四种常见分辨率下整窗都能落在首屏内。
   代价：比例从 16:10 变为约 2.2–2.9:1 的宽扁展示带（与「橱窗」定位一致）。 */
@media (min-width: 769px) {
  .mm-store-shell-wrap { width: 100%; max-width: min(1280px, calc(100vw - 96px)); }
  .app-store-window-shell:not(.is-store-window-fullscreen) {
    aspect-ratio: auto;
    width: 100%;
    max-width: min(1280px, calc(100vw - 96px));
    /* 285px = 实测窗口上方占位（导航 + hero + 内测提示行）约 262–271px，再留约 20px 呼吸。
       旧公式只扣 220px，四种分辨率下白窗无一例外溢出首屏 38–69px。
       字号收敛后 hero 从约 200px 降到 130px，这里同步把窗口放高。
       上限 780px：内容收敛后首页栈总高约 770px，大屏可一屏装完、窗口内不再滚动。 */
    height: clamp(420px, calc(100svh - 285px), 780px);
    min-height: 0;
    max-height: none;
  }

  /* 侧栏定宽：原为 clamp(200px, 22%, 260px)，会跟着窗口等比缩放——窗口一窄，
     内容区本就不够用，侧栏还占 200px。定宽后伸缩全部让给内容区。 */
  .app-store-window-shell:not(.is-store-window-fullscreen) .sidebar {
    flex: 0 0 220px;
    width: 220px;
    max-width: 220px;
  }
}

/* —— 阶段2：首页 · 仅把「推荐」从图标排升级为 2 张大故事卡（对标 探索），其余保持原样 ——
   仅作用于非全屏窗口内；全屏与 ≤768px 沿用既有规则。核心能力已按需求移除。 */

/* 段落标题（应用）统一 */
.app-store-window-shell:not(.is-store-window-fullscreen) .apps-section h2 {
  font-size: var(--t-15, 15px); font-weight: 600; margin-bottom: 14px;
  color: var(--mm-store-text-primary, #1d1d1f);
}
/* 应用列表：按可用宽度自动分栏。窗口改宽度优先后内容区约 1020px，会自动排 3 栏，
   标题不再折行；窄窗自动退回 2 栏。 */
.app-store-window-shell:not(.is-store-window-fullscreen) .apps-grid--paged {
  /* 280 而非 300：1280 视口下窗口内容宽 912px，300 会差 12px 掉成两列、应用区高度多出 164px */
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px;
}

/* 关键修复：内容多于窗口高度时，让首页栈以「内容高度」存在、由 store-main 内部滚动，
   禁止 flex 压缩子区块——否则带 overflow:hidden 的 .premium-section 会被压成 0 高、脱出重叠。 */
.app-store-window-shell:not(.is-store-window-fullscreen) #storeHomeStack { flex: 0 0 auto; }
.app-store-window-shell:not(.is-store-window-fullscreen) #storeHomeStack > section { flex-shrink: 0; }

/* ===== 「推荐」= 2 张大故事卡 + 定时轮播（内容由后端「推荐」动态驱动，>2 个则轮播） ===== */
/* 覆盖旧 shelf 的横向 flex / overflow-x */
#recommendShelf { display: block; overflow: visible; padding-bottom: 0; }
.mm-stories-carousel { position: relative; }
.mm-stories-viewport { overflow: hidden; }
.mm-stories-track { display: flex; transition: transform .55s cubic-bezier(.4, 0, .2, 1); }
.mm-stories-slide { box-sizing: border-box; }
.mm-stories-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.mm-stories-grid--single { grid-template-columns: minmax(0, 1fr); }
.mm-stories-dots { display: flex; justify-content: center; gap: 7px; margin-top: 12px; }
.mm-stories-dot { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--mm-store-text-tertiary, #86868b); opacity: .35;
  transition: opacity .2s ease, width .2s ease, background .2s ease; }
.mm-stories-dot.on { opacity: 1; width: 18px; background: var(--mm-store-accent, #5e6ad2); }

/* 故事卡本体 */
.mm-story-card {
  position: relative; display: block; min-height: 132px; border-radius: 16px; overflow: hidden;
  text-decoration: none; isolation: isolate;
  border: 1px solid var(--mm-store-border-soft, rgba(0,0,0,.06));
  transition: transform .18s ease, box-shadow .18s ease;
}
.mm-story-card:hover { transform: translateY(-2px); box-shadow: 0 16px 38px rgba(0,0,0,.36); }
.mm-story-card:focus-visible { outline: 2px solid var(--mm-store-accent, #5e6ad2); outline-offset: 3px; }
.mm-story-bg { position: absolute; inset: 0; z-index: 0; }
.mm-story-bg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mm-story-scrim { position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(150deg, rgba(0,0,0,.10) 0%, rgba(0,0,0,.68) 100%); }
.mm-story-card--plain { background: radial-gradient(130% 130% at 10% 0%, #3b4180 0%, #23273d 48%, #16171e 100%); }
.mm-story-card--accent-purple {
  background:
    radial-gradient(120% 100% at 100% 0%, rgba(167, 139, 250, .28) 0%, rgba(167, 139, 250, 0) 58%),
    radial-gradient(130% 130% at 8% 0%, #4c4588 0%, #2a2650 52%, #14151c 100%);
}
.mm-story-card--accent-teal {
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(45, 212, 191, .22) 0%, rgba(45, 212, 191, 0) 55%),
    radial-gradient(130% 130% at 92% 8%, #2a6670 0%, #1a3d48 50%, #10161a 100%);
}
.mm-story-card--accent-slate {
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(148, 163, 184, .2) 0%, rgba(148, 163, 184, 0) 55%),
    radial-gradient(130% 130% at 12% 0%, #3d4454 0%, #252830 48%, #14151c 100%);
}
/* 品牌占位卡：略带主色调，和真实应用卡区分开 */
.mm-story-card--brand { background:
  radial-gradient(120% 120% at 85% 10%, rgba(94,106,210,.55) 0%, rgba(94,106,210,0) 55%),
  radial-gradient(130% 130% at 12% 0%, #40477f 0%, #262a44 48%, #15161f 100%); }
.mm-story-inner {
  position: relative; z-index: 2; height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
  padding: 14px 18px; color: #fff;
}
.mm-story-appicon { width: 40px; height: 40px; border-radius: 10px; object-fit: contain;
  margin-bottom: auto; background: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.3); }
.mm-story-appicon--ph {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--t-20, 20px); font-weight: 700; color: #5e6ad2;
}
.mm-story-eyebrow { font-size: var(--t-11, 11px); font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.82); }
.mm-story-title { font-size: var(--t-20, 20px); font-weight: 700; line-height: 1.2; color: #fff;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mm-story-desc { font-size: var(--t-13, 13px); line-height: 1.5; color: rgba(255,255,255,.88); max-width: 94%;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.mm-story-title { -webkit-line-clamp: 1; }

/* —— 阶段2.5：「全站会员」促销横幅 · Discord Nitro（尺寸结构与旧版一致） —— */
.mm-member-ad {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  width: 100%;
  min-width: 100%;
  min-height: 184px;
  border-radius: 16px;
  background: #1a1b2e;
  color: #fff;
}
.mm-member-ad__fx {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(70% 100% at 80% 20%, rgba(88, 101, 242, 0.5), transparent 55%),
    radial-gradient(50% 70% at 10% 90%, rgba(235, 69, 158, 0.25), transparent 50%),
    #12131f;
}
/* 旧装饰层占位：避免历史缓存 HTML 残留节点影响布局 */
.mm-member-ad__holo,
.mm-member-ad__sweep,
.mm-member-ad__frame,
.mm-member-ad__frame-gleam,
.mm-member-ad__ticket-shine {
  display: none !important;
}
.mm-member-ad__inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr minmax(240px, 320px);
  min-height: 184px;
  padding: 20px 24px;
  align-items: center;
  gap: 16px;
}
.mm-member-ad__left { min-width: 0; }
.mm-member-ad__title {
  margin: 0 0 10px;
  font-size: var(--t-24, 24px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: #fff;
  text-shadow: none;
}
.mm-member-ad__subtitle {
  display: block;
  margin-top: 6px;
  font-size: var(--t-13, 13px);
  font-weight: 500;
  color: #b5b8d6;
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  animation: none;
}
.mm-member-ad__pills { display: flex; flex-wrap: wrap; gap: 8px; }
.mm-member-ad__pill {
  position: relative;
  overflow: hidden;
  font-size: var(--t-11, 11px);
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(88, 101, 242, 0.2);
  border: 1px solid rgba(88, 101, 242, 0.4);
  color: #d5d8ff;
  box-shadow: none;
}
.mm-member-ad__pill::after { content: none; }
.mm-member-ad__pill--hot {
  background: rgba(88, 101, 242, 0.2);
  border-color: rgba(88, 101, 242, 0.4);
  box-shadow: none;
}
.mm-member-ad__ticket {
  position: relative;
  justify-self: end;
  width: 100%;
  max-width: 320px;
  padding: 16px 18px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(88, 101, 242, 0.35);
  box-shadow: none;
}
.mm-member-ad__ticket-row {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.mm-member-ad__tier { flex: 1; text-align: center; }
.mm-member-ad__tier-lbl {
  font-size: var(--t-11, 11px);
  color: #9aa0c8;
  font-weight: 600;
}
.mm-member-ad__tier-amt {
  font-size: var(--t-24, 24px);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 4px 0 0;
  color: #fff;
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  filter: none;
  animation: none;
}
.mm-member-ad__tier-amt small { font-size: var(--t-12, 12px); font-weight: 600; opacity: .75; }
.mm-member-ad__ticket-divider {
  width: 1px;
  height: 48px;
  background: rgba(88, 101, 242, 0.4);
  box-shadow: none;
  flex-shrink: 0;
}
.mm-member-ad__cta {
  position: relative;
  z-index: 2;
  overflow: hidden;
  cursor: pointer;
  border: 0;
  width: 100%;
  margin-top: 12px;
  padding: 11px;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  font-size: var(--t-13, 13px);
  background: #5865f2;
  color: #fff;
  box-shadow: none;
  transition: transform .15s ease, filter .15s ease;
}
.mm-member-ad__cta::before { content: none; }
.mm-member-ad__cta:hover { transform: translateY(-1px); filter: brightness(1.08); }
.mm-member-ad__cta:focus-visible { outline: 2px solid rgba(88, 101, 242, 0.7); outline-offset: 3px; }
.mm-member-ad__cta.is-copied {
  background: linear-gradient(180deg, #34d399, #10b981);
  color: #fff;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}
.mm-member-ad__cta-label {
  position: relative;
  display: block;
  font-size: var(--t-13, 13px);
  font-weight: 700;
  line-height: 1.2;
}
.mm-member-ad__cta-hint {
  position: relative;
  display: block;
  font-size: var(--t-11, 11px);
  font-weight: 500;
  opacity: .75;
  margin-top: 2px;
}
.mm-member-ad__cta.is-copied .mm-member-ad__cta-label,
.mm-member-ad__cta.is-copied .mm-member-ad__cta-hint { color: #fff; opacity: 1; }

/* —— 「全站会员」细条：挂在应用列表下方，一行排完 ——
   184px 的大方块换成 ~60px 的横条：先让访客看到软件，再出现付费入口。 */
.member-strip-section { margin-top: 2px; }
.mm-member-ad--strip { min-height: 0; border-radius: 14px; }
.mm-member-ad--strip .mm-member-ad__inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 0;
  padding: 12px 20px;
}
.mm-member-ad--strip .mm-member-ad__left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 auto;
  min-width: 0;
}
.mm-member-ad--strip .mm-member-ad__title {
  margin: 0;
  font-size: var(--t-17, 17px);
  white-space: nowrap;
}
.mm-member-ad--strip .mm-member-ad__subtitle {
  display: inline;
  margin: 0 0 0 10px;
  font-size: var(--t-13, 13px);
}
.mm-member-ad--strip .mm-member-ad__pills { flex-wrap: nowrap; flex-shrink: 0; }
.mm-member-ad--strip .mm-member-ad__ticket {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  padding: 0;
  background: none;
  border: 0;
}
.mm-member-ad--strip .mm-member-ad__ticket-row { gap: 14px; }
.mm-member-ad--strip .mm-member-ad__tier {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.mm-member-ad--strip .mm-member-ad__tier-lbl { font-size: var(--t-12, 12px); }
.mm-member-ad--strip .mm-member-ad__tier-amt { font-size: var(--t-20, 20px); margin: 0; }
.mm-member-ad--strip .mm-member-ad__ticket-divider { height: 24px; }
.mm-member-ad--strip .mm-member-ad__cta {
  width: auto;
  margin-top: 0;
  padding: 9px 18px;
  border-radius: 999px;
  white-space: nowrap;
}
.mm-member-ad--strip .mm-member-ad__cta-hint { display: inline; margin: 0 0 0 8px; }
/* 窗口变窄后先舍弃卖点标签，保住「标题 + 价格 + 按钮」这条主线 */
@media (max-width: 1180px) {
  .mm-member-ad--strip .mm-member-ad__pills { display: none; }
}
@media (max-width: 900px) {
  .mm-member-ad--strip .mm-member-ad__inner { flex-wrap: wrap; gap: 12px; }
  .mm-member-ad--strip .mm-member-ad__title { white-space: normal; }
  .mm-member-ad--strip .mm-member-ad__ticket { width: 100%; justify-content: space-between; }
}

@media (max-width: 900px) {
  .mm-member-ad__inner {
    grid-template-columns: 1fr;
    padding: 18px 20px;
    gap: 14px;
  }
  .mm-member-ad__title { font-size: var(--t-20, 20px); }
  .mm-member-ad__ticket { max-width: none; justify-self: stretch; }
}

/* —— 阶段3：详情页单栏（对标官方 App Store），排版/层级/截图/阅读宽升级 —— */
#storeDetailStack .detail-section-card { padding: 18px 20px; }
#storeDetailStack .detail-section-card h2 { font-size: var(--t-15, 15px); margin-bottom: 12px; }
#storeDetailStack .screenshot-item { width: min(52vw, 480px); max-width: 480px; }
/* 阅读宽由 detail-appstore.css 的 .store-detail-body > * 统一控制，正文自身不再单独设限 */
#sd-detailDescription.detail-rich { max-width: none; }
#storeDetailStack .detail-block-body,
#storeDetailStack .detail-section-card .detail-text { font-size: var(--t-14, 14px); line-height: 1.72; }
