/* ============================================================
   流光小筑 · 案例模块（/works/ 案例墙 + /works/{slug}/ 详情页）
   2026-10-19
   - 只在这两类页面引入，不拖累全站
   - 复用 style.css 的 CSS 变量与 .chips/.chip/.lightbox
   ============================================================ */

/* ---------- 案例墙：工具条 ---------- */
.cases-toolbar {
  position: sticky;
  top: 56px;
  z-index: 30;
  margin: 0 0 20px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius);
}
.case-search {
  position: relative;
  margin-bottom: 10px;
}
.case-search input {
  width: 100%;
  height: 40px;
  padding: 0 38px 0 36px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.case-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.case-search .cs-ico {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-2); pointer-events: none; display: flex;
}
.case-search .cs-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; display: none; place-items: center;
  border: 0; border-radius: 50%; background: transparent;
  color: var(--text-2); font-size: 15px; cursor: pointer;
}
.case-search.has-value .cs-clear { display: grid; }
.case-search .cs-clear:hover { background: var(--hover); color: var(--text); }

.cases-filters { display: flex; flex-direction: column; gap: 8px; }
.filter-row { display: flex; align-items: flex-start; gap: 10px; }
.filter-label {
  flex: 0 0 34px; padding-top: 5px;
  font-size: 12px; color: var(--text-2); letter-spacing: .04em;
}
.filter-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  flex: 1 1 auto; min-width: 0;
}

/* ---------- 案例墙：卡片网格 ---------- */
.case-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
}
.case-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
@media (hover: hover) {
  .case-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
    box-shadow: 0 10px 28px rgba(16, 24, 40, .11);
  }
  .case-card:hover .case-media img { transform: scale(1.035); }
}
.case-media {
  position: relative; display: block;
  aspect-ratio: 4 / 3; overflow: hidden;
  background: var(--hover);
}
.case-media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s cubic-bezier(.22, .61, .36, 1);
}
.case-media::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 42%;
  background: linear-gradient(to top, rgba(8, 12, 20, .52), transparent);
  pointer-events: none;
}
.case-badge {
  position: absolute; left: 11px; top: 11px; z-index: 2;
  padding: 3px 9px;
  font-size: 11.5px; font-weight: 500; letter-spacing: .02em;
  color: #fff; background: rgba(12, 18, 28, .56);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.case-badge.is-pano { background: rgba(47, 125, 232, .82); border-color: transparent; }
.case-media .case-style {
  position: absolute; right: 11px; bottom: 10px; z-index: 2;
  font-size: 12px; color: #fff; opacity: .92; letter-spacing: .04em;
}

.case-body { display: flex; flex-direction: column; gap: 5px; padding: 13px 15px 15px; }
.case-title { font-size: 16px; font-weight: 600; letter-spacing: .01em; }
.case-lead {
  font-size: 12.8px; line-height: 1.55; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.case-facts {
  display: flex; flex-wrap: wrap; gap: 4px 8px;
  margin-top: 2px; font-size: 11.5px; color: var(--text-2);
}
.case-facts span + span::before {
  content: "·"; margin-right: 6px; opacity: .5;
}
.case-spaces {
  margin-top: 6px; padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 11.5px; color: var(--text-2); opacity: .9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.cases-empty {
  grid-column: 1 / -1;
  padding: 46px 0; text-align: center;
  color: var(--text-2); font-size: 14px;
}

/* ---------- 详情页 ---------- */
.case-page { padding-bottom: 10px; }
.crumbs {
  display: flex; align-items: center; gap: 6px;
  margin: 4px 0 14px; font-size: 12.5px; color: var(--text-2);
}
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: .45; }

.case-hero {
  position: relative; overflow: hidden;
  border-radius: calc(var(--radius) + 4px);
  background: #0d1119;
  aspect-ratio: 2 / 1;
  margin-bottom: 18px;
}
.case-hero > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: .92;
}
.case-hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(6, 10, 18, .88) 0%, rgba(6, 10, 18, .34) 46%, transparent 78%);
}
.hero-info {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 22px 26px 24px; color: #fff;
}
.hero-info h1 {
  font-size: 28px; font-weight: 600; letter-spacing: .02em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .3);
}
.hero-lead {
  margin-top: 4px; font-size: 14px; opacity: .88;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .35);
}
.hero-facts {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 12px; list-style: none;
}
.hero-facts li {
  padding: 3px 10px; font-size: 12px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px; backdrop-filter: blur(6px);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hero-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 15px;
  font-size: 13px; font-weight: 500;
  color: #fff; background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 999px; cursor: pointer;
  transition: background .18s, transform .18s;
}
.hero-btn:hover { background: rgba(255, 255, 255, .26); }
.hero-btn.primary { background: var(--accent); border-color: transparent; }
.hero-btn.primary:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }

.case-intro {
  display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px;
  margin-bottom: 22px; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.case-intro p { font-size: 13.8px; line-height: 1.85; color: var(--text-2); }
.case-tags { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.case-tags li {
  list-style: none; padding: 3px 10px;
  font-size: 12px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 999px;
}

/* 空间锚点：吸顶 */
.space-nav {
  position: sticky; top: 56px; z-index: 25;
  display: flex; gap: 6px; overflow-x: auto;
  padding: 9px 4px;
  margin: 0 0 20px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.space-nav::-webkit-scrollbar { display: none; }
.space-nav a {
  flex: 0 0 auto; padding: 4px 12px;
  font-size: 12.5px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; white-space: nowrap;
  transition: color .16s, border-color .16s, background .16s;
}
.space-nav a:hover { color: var(--text); border-color: var(--accent); }
.space-nav a.active {
  color: var(--accent-text); background: var(--accent); border-color: var(--accent);
}
.space-nav a .n { opacity: .62; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* 空间分组 */
.space-sec { margin-bottom: 30px; scroll-margin-top: 110px; }
.space-sec > h2 {
  display: flex; align-items: baseline; gap: 9px;
  margin-bottom: 12px; font-size: 17px; font-weight: 600;
}
.space-sec > h2 .n {
  font-size: 12px; font-weight: 400; color: var(--text-2); opacity: .8;
}
.pg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.pg-item {
  position: relative; display: block;
  aspect-ratio: 4 / 3; overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--hover);
  cursor: zoom-in;
}
.pg-item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .45s cubic-bezier(.22, .61, .36, 1);
}
@media (hover: hover) {
  .pg-item:hover img { transform: scale(1.05); }
  .pg-item::after {
    content: "放大"; position: absolute; right: 9px; bottom: 9px;
    padding: 2px 8px; font-size: 11px; color: #fff;
    background: rgba(10, 16, 26, .55); border-radius: 999px;
    opacity: 0; transition: opacity .2s;
  }
  .pg-item:hover::after { opacity: 1; }
}
.pg-item.wide { grid-column: span 2; aspect-ratio: 16 / 9; }
@media (max-width: 720px) {
  .pg-item.wide { grid-column: span 1; aspect-ratio: 4 / 3; }
}

/* 全景入口 */
.pano-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px;
}
.pano-item {
  position: relative; display: block; padding: 0; overflow: hidden;
  aspect-ratio: 2 / 1; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--hover);
}
.pano-item img { width: 100%; height: 100%; object-fit: cover; }
.pano-item .pv-tip {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; gap: 7px;
  color: #fff; font-size: 13px; font-weight: 500;
  background: rgba(8, 12, 20, .34);
  transition: background .2s;
}
.pano-item:hover .pv-tip { background: rgba(8, 12, 20, .12); }
.pano-item .pv-space {
  position: absolute; left: 9px; top: 9px;
  padding: 2px 9px; font-size: 11.5px; color: #fff;
  background: rgba(8, 12, 20, .5); border-radius: 999px;
}

/* 上一案 / 下一案 */
.case-pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin: 34px 0 6px;
}
.case-pager a {
  display: flex; flex-direction: column; gap: 2px;
  padding: 13px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .18s, transform .18s;
}
.case-pager a:hover { border-color: var(--accent); transform: translateY(-1px); }
.case-pager .pg-dir { font-size: 11.5px; color: var(--text-2); }
.case-pager .pg-name { font-size: 14px; font-weight: 500; }
.case-pager a.next { text-align: right; }

/* ---------- 全景查看器 ---------- */
.pano-viewer {
  position: fixed; inset: 0; z-index: 300;
  background: #06080d;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  touch-action: none;
}
.pano-viewer[hidden] { display: none !important; }
.pano-stage {
  position: relative; width: 100%; height: 100%;
  overflow: hidden; cursor: grab;
}
.pano-stage.dragging { cursor: grabbing; }
.pano-stage img {
  position: absolute; top: 0; left: 0;
  height: 100%; width: auto; max-width: none;
  user-select: none; -webkit-user-drag: none;
  will-change: transform;
}
.pano-hud {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  color: #fff;
  background: linear-gradient(to top, rgba(4, 7, 12, .82), transparent);
}
.pano-hud .pv-title { font-size: 14px; font-weight: 500; }
.pano-hud .pv-hint { font-size: 12px; opacity: .62; }
.pano-hud .pv-spacer { flex: 1 1 auto; }
.pano-ctl {
  display: flex; align-items: center; gap: 6px;
}
.pano-ctl button {
  height: 32px; min-width: 32px; padding: 0 11px;
  font-size: 12.5px; color: #fff;
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 8px; cursor: pointer;
  transition: background .16s;
}
.pano-ctl button:hover { background: rgba(255, 255, 255, .24); }
.pano-ctl button.on { background: var(--accent); border-color: transparent; }
.pano-close {
  position: absolute; right: 14px; top: 14px; z-index: 4;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  color: #fff; font-size: 17px;
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 50%; cursor: pointer;
}
.pano-close:hover { background: rgba(255, 255, 255, .26); }
.pano-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: rgba(255, 255, 255, .7); font-size: 13px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .case-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .case-intro { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 860px) {
  .cases-toolbar { top: 56px; padding: 10px 11px; }
  .filter-row { gap: 8px; }
  .filter-label { flex-basis: 30px; font-size: 11.5px; }
  .case-hero { aspect-ratio: 4 / 3; }
  .hero-info { padding: 16px 16px 18px; }
  .hero-info h1 { font-size: 22px; }
  .hero-lead { font-size: 12.8px; }
  .hero-facts li { font-size: 11px; padding: 2px 8px; }
  .space-nav { top: 56px; }
  .space-sec { scroll-margin-top: 100px; }
  .pg-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .pano-grid { grid-template-columns: 1fr; }
  .case-pager { grid-template-columns: 1fr; }
  .case-pager a.next { text-align: left; }
}
@media (max-width: 560px) {
  .case-grid { grid-template-columns: 1fr; gap: 14px; }
  .case-title { font-size: 15px; }
  .case-intro { padding: 14px 15px; }
  .case-intro p { font-size: 13px; line-height: 1.8; }
  .pano-hud { flex-wrap: wrap; gap: 8px; padding: 11px 12px; }
  .pano-hud .pv-hint { display: none; }
}

/* 筛选胶囊内的计数（沿用 .chip 基础样式，只补计数与间距） */
.chip { display: inline-flex; align-items: center; gap: 5px; }
.chip-n {
  font-size: 11px; opacity: .58;
  font-variant-numeric: tabular-nums;
}
.chip.active .chip-n { opacity: .82; }

/* ============================================================
   视觉修正（2026-10-19 实拍后调整）
   ============================================================ */

/* 1) 灯箱：遮罩更实、计数移到底部说明右侧（原来在顶部居中，视线要跳两次） */
.case-page ~ .lightbox,
.lightbox { background: rgba(6, 9, 15, .95); }
.lightbox .lb-count {
  top: auto; left: auto; right: 22px; bottom: 18px; transform: none;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .16);
}
.lightbox .lb-caption {
  bottom: 18px; text-align: left; padding: 0 96px 0 24px;
}
@media (max-width: 720px) {
  .lightbox .lb-caption { padding: 0 20px 26px; text-align: center; }
  .lightbox .lb-count { left: 0; right: 0; bottom: 6px; margin: 0 auto; width: fit-content; }
}

/* 2) 全景 HUD：图片底部常是浅色（床/地板），白字完全看不清 → 给实底条 */
.pano-hud {
  background: linear-gradient(to top, rgba(4, 7, 12, .92) 0%, rgba(4, 7, 12, .72) 58%, transparent 100%);
  padding-top: 34px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .6);
}
.pano-hud .pv-title { font-size: 14.5px; letter-spacing: .02em; }
.pano-hud #pv-space {
  padding: 2px 9px; font-size: 11.5px;
  background: rgba(255, 255, 255, .16);
  border-radius: 999px; opacity: .92 !important;
}
.pano-ctl button { background: rgba(255, 255, 255, .18); }
.pano-close { background: rgba(8, 12, 20, .5); border-color: rgba(255, 255, 255, .28); }

/* 3) 详情页顶部：面包屑与主图之间收紧一点 */
.crumbs { margin: 2px 0 10px; }

/* ============================================================
   移动端修正（2026-10-19）
   1) 导航：7 项在 390px 下换行成三行 → 改单行横滚（下拉面板用 fixed 避开裁剪）
   2) 筛选：风格 7 个 + 空间 15 个占了半屏 → 各压成一行横滚
   3) 全景加载提示：hidden 对 display:grid 无效（老坑）
   ============================================================ */
.pano-loading[hidden] { display: none !important; }

@media (max-width: 860px) {
  .nav-inner {
    flex-wrap: nowrap; height: 56px;
    padding: 0 12px; gap: 10px;
  }
  .nav-links {
    flex: 1 1 auto; min-width: 0;
    flex-wrap: nowrap; justify-content: flex-start;
    overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links > a, .nav-links > span, .nav-links > .nav-more { flex: 0 0 auto; }
  /* 下拉面板改成整宽浮层：fixed 不受滚动容器的 overflow 裁剪 */
  .nav-more-panel {
    position: fixed;
    top: 56px; left: 8px; right: 8px;
    width: auto; min-width: 0;
    justify-content: center; flex-wrap: wrap;
  }

  /* 筛选条：一行横滚，省掉两屏高度 */
  .filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1px;
  }
  .filter-chips::-webkit-scrollbar { display: none; }
  .filter-chips .chip { flex: 0 0 auto; }
  .filter-row { align-items: center; }
  .filter-label { padding-top: 0; }
}

/* 移动端品牌不被导航挤压（会被压成两行「流光小 / 筑」） */
@media (max-width: 860px) {
  .brand { flex: 0 0 auto; white-space: nowrap; font-size: 15px; }
  .theme-toggle { flex: 0 0 auto; }
  /* 右缘渐隐，暗示还能横向滑动 */
  .nav-links { -webkit-mask-image: linear-gradient(to right, #000 90%, transparent 100%);
               mask-image: linear-gradient(to right, #000 90%, transparent 100%); }
}

/* 小屏：导航项再压一档，让 7 项尽量放得下；筛选条右缘渐隐提示可滑 */
@media (max-width: 480px) {
  .nav-inner { gap: 8px; padding: 0 10px; }
  .nav-links { gap: 0; }
  .nav-links a, .nav-links .nav-more-btn { font-size: 12.5px; padding: 4px 7px; }
  .nav-links { -webkit-mask-image: linear-gradient(to right, #000 96%, transparent 100%);
               mask-image: linear-gradient(to right, #000 96%, transparent 100%); }
  .filter-chips { -webkit-mask-image: linear-gradient(to right, #000 92%, transparent 100%);
                  mask-image: linear-gradient(to right, #000 92%, transparent 100%); }
}
