/* ============================================================
   ui-blocks.css —— JifuSkin 统一卡片设计系统
   方向：Apple 的干净克制（白底 / 留白 / 近黑文字）
        + Canva 的功能分区（明确区块 / 大卡片 / 真按钮 / 清晰 CTA）
   只建立视觉语言，不复制任何品牌的配色与排版。
   ============================================================ */

:root {
  --jb-bg: #ffffff;
  --jb-soft: #f5f5f7;          /* 浅灰分区背景 */
  --jb-soft-2: #fbfbfd;
  --jb-ink: #1d1d1f;           /* 主文字 */
  --jb-ink-2: #424245;         /* 次级标题 */
  --jb-muted: #6e6e73;         /* 次级正文 */
  --jb-faint: #86868b;
  --jb-line: rgba(0, 0, 0, .10);
  --jb-line-soft: rgba(0, 0, 0, .06);
  --jb-brand: #0066cc;         /* 统一品牌强调色（Primary Button / Active / Tag） */
  --jb-brand-hover: #0077ed;
  --jb-brand-dark: #0057b0;
  --jb-brand-soft: #eaf2fd;    /* 品牌浅色底（Pill / Tag） */
  --jb-r-lg: 24px;
  --jb-r: 18px;
  --jb-r-sm: 12px;
  --jb-maxw: 1180px;
  --jb-pad: clamp(20px, 5vw, 64px);
  --jb-ease: cubic-bezier(.22, 1, .36, 1);
  --jb-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 30px rgba(0, 0, 0, .05);
}

/* hidden 属性必须真正生效（板块开关靠它隐藏整块内容） */
[hidden] { display: none !important; }

/* ---------- Section：大区域 ---------- */
.jb-section { padding: clamp(48px, 7vw, 96px) 0; background: var(--jb-bg); }
.jb-section--soft { background: var(--jb-soft); }
.jb-wrap { width: 100%; max-width: var(--jb-maxw); margin: 0 auto; padding: 0 var(--jb-pad); }

/* ---------- 区块标题 ---------- */
.jb-head { display: grid; gap: 18px; margin-bottom: clamp(28px, 4vw, 44px); }
.jb-head__text { display: grid; gap: 12px; }
.jb-title {
  margin: 0;
  font-size: clamp(28px, 4.4vw, 46px);
  line-height: 1.12;
  letter-spacing: -.02em;
  font-weight: 700;
  color: var(--jb-ink);
}
.jb-lede { margin: 0; font-size: clamp(15px, 1.6vw, 18px); line-height: 1.6; color: var(--jb-muted); max-width: 60ch; }
.jb-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Pill：栏目标签（不再是小蓝字） ---------- */
.jb-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--jb-brand);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
  width: fit-content;
}
.jb-pill--ink { background: rgba(0, 0, 0, .05); color: var(--jb-ink-2); }

/* ---------- Button：真正的按钮 ---------- */
.jb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .18s var(--jb-ease), border-color .18s var(--jb-ease), transform .18s var(--jb-ease), color .18s var(--jb-ease);
  -webkit-tap-highlight-color: transparent;
}
.jb-btn:active { transform: scale(.98); }
.jb-btn--primary { background: var(--jb-brand); color: #fff; }
.jb-btn--primary:hover { background: var(--jb-brand-hover); }
.jb-btn--dark { background: var(--jb-ink); color: #fff; }
.jb-btn--dark:hover { background: #000; }
.jb-btn--secondary { background: #fff; color: var(--jb-ink); border-color: var(--jb-line); }
.jb-btn--secondary:hover { border-color: rgba(0, 0, 0, .22); }
.jb-btn--sm { min-height: 38px; padding: 0 16px; font-size: 14px; border-radius: 10px; }

/* ---------- 大搜索框 ---------- */
.jb-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 18px;
  background: #fff;
  border: 1px solid var(--jb-line);
  border-radius: 999px;
  box-shadow: var(--jb-shadow);
  max-width: 620px;
}
.jb-search__ico { color: var(--jb-faint); font-size: 20px; line-height: 1; }
.jb-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--jb-ink);
  padding: 8px 0;
}
.jb-search input::placeholder { color: var(--jb-faint); }
.jb-search button { flex: none; border-radius: 999px; }

/* ---------- 卡片网格 ---------- */
.jb-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2.2vw, 26px); }

/* ---------- 视频卡片 ---------- */
.jb-vcard {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--jb-line-soft);
  border-radius: var(--jb-r);
  overflow: hidden;
  box-shadow: var(--jb-shadow);
  transition: transform .2s var(--jb-ease), box-shadow .2s var(--jb-ease);
  text-align: left;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.jb-vcard:hover { transform: translateY(-3px); box-shadow: 0 4px 14px rgba(0, 0, 0, .07), 0 22px 48px rgba(0, 0, 0, .08); }
.jb-vcard__cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #e8eaed, #d3d7dd);
  overflow: hidden;
}
.jb-vcard__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 没有封面但有 BV 号时，直接用 B 站播放器当封面：播放器闲时会显示该视频真实封面 */
.jb-vcard__cover iframe.jb-vcard__iframe {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0; display: block; pointer-events: none; background: #0b0b0c;
}
/* 有自托管原视频时，用视频首帧当封面（只预加载元数据，几乎不耗流量） */
.jb-vcard__cover video.jb-vcard__iframe {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block; pointer-events: none; background: #0b0b0c;
}
/* 详情页原生播放器：object-fit 保持画面不变形，黑边由播放器底色填充 */
.jb-player__video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; display: block; background: #000; border: 0;
}
.jb-vcard__cover.has-player { background: #0b0b0c; }
.jb-vcard__cover.has-player .jb-vcard__play { display: none; }
.jb-vcard__ph { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 13px; letter-spacing: .04em; }
.jb-vcard__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.jb-vcard__play span {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  padding-left: 4px;
  transition: transform .2s var(--jb-ease), background-color .2s var(--jb-ease);
}
.jb-vcard:hover .jb-vcard__play span { transform: scale(1.08); background: rgba(0, 0, 0, .7); }
.jb-vcard__dur {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .7);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
}
.jb-vcard__tag {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: var(--jb-ink-2);
  font-size: 12px;
  font-weight: 600;
}
.jb-vcard__body { display: grid; gap: 6px; padding: 16px 18px 18px; }
.jb-vcard__title { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.35; color: var(--jb-ink); }
.jb-vcard__meta { font-size: 13px; color: var(--jb-muted); }
.jb-vcard__cta {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  background: var(--jb-brand-soft);
  color: var(--jb-brand-dark);
  font-size: 14px;
  font-weight: 600;
  width: fit-content;
}
.jb-vcard:hover .jb-vcard__cta { background: var(--jb-brand); color: #fff; }

/* ---------- 站内播放器（16:9 自适应 / 可全屏 / 移动端不溢出） ---------- */
.jb-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--jb-r);
  overflow: hidden;
}
.jb-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.jb-player__ph { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, .8); font-size: 14px; }

/* ---------- 全屏播放 ---------- */
.jb-fsbtn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 15px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, .58);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.jb-fsbtn:active { background: rgba(0, 0, 0, .8); transform: scale(.97); }
/* 真全屏：去掉 16:9 约束，铺满整屏 */
.jb-player:fullscreen,
.jb-player:-webkit-full-screen,
.jb-player:-ms-fullscreen {
  aspect-ratio: auto;
  width: 100vw;
  height: 100vh;
  max-height: none;
  border-radius: 0;
}
.jb-player:fullscreen iframe,
.jb-player:-webkit-full-screen iframe,
.jb-player:-ms-fullscreen iframe { width: 100%; height: 100%; }
.jb-player:fullscreen .jb-fsbtn,
.jb-player:-webkit-full-screen .jb-fsbtn { display: none; }
/* 兜底全屏遮罩（iOS 等不支持元素全屏时使用） */
.jb-fs { position: fixed; inset: 0; z-index: 300; background: #000; display: flex; flex-direction: column; }
.jb-fs__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  background: #000; color: #fff;
}
.jb-fs__bar strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jb-fs__close {
  flex: none; width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}
.jb-fs__body { position: relative; flex: 1; min-height: 0; }
.jb-fs__body iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.jb-fs__tip {
  padding: 8px 14px calc(10px + env(safe-area-inset-bottom));
  background: #000; color: rgba(255, 255, 255, .7); font-size: 12px; text-align: center;
}

/* ---------- 空状态 ---------- */
.jb-empty {
  grid-column: 1 / -1;
  padding: 40px 24px;
  text-align: center;
  border: 1px dashed var(--jb-line);
  border-radius: var(--jb-r);
  color: var(--jb-muted);
  background: #fff;
}
.jb-empty strong { display: block; color: var(--jb-ink); margin-bottom: 6px; }

/* ---------- 板块关闭页（隐藏不是删除） ---------- */
.sec-closed { min-height: 62vh; display: grid; place-items: center; padding: 60px var(--jb-pad); background: var(--jb-soft); }
.sec-closed-card {
  display: grid;
  gap: 16px;
  justify-items: center;
  text-align: center;
  max-width: 560px;
  padding: clamp(32px, 5vw, 54px);
  background: #fff;
  border-radius: var(--jb-r-lg);
  box-shadow: var(--jb-shadow);
}
.sec-closed-card h1 { margin: 0; font-size: clamp(22px, 3.4vw, 32px); letter-spacing: -.02em; }
.sec-closed-card p { margin: 0; color: var(--jb-muted); line-height: 1.65; }

/* ---------- 详情页：返回 / 标签 / 白色面板 ---------- */
.jb-back {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-bottom: 14px;
  color: var(--jb-brand);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.jb-back:hover { color: var(--jb-brand-hover); }
.jb-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.jb-tags span {
  height: 30px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(0, 0, 0, .05);
  color: var(--jb-ink-2);
  font-size: 13px;
  font-weight: 600;
}
.jb-note { margin: 12px 0 0; font-size: 13px; color: var(--jb-faint); }
.jb-panel {
  margin-top: clamp(28px, 4vw, 44px);
  padding: clamp(20px, 3vw, 32px);
  background: #fff;
  border: 1px solid var(--jb-line-soft);
  border-radius: var(--jb-r);
  box-shadow: var(--jb-shadow);
}
.jb-panel h2 { margin: 0 0 18px; font-size: clamp(18px, 2.4vw, 22px); letter-spacing: -.01em; }
.jb-prep { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.jb-prep__item { display: flex; gap: 12px; align-items: flex-start; }
.jb-prep__item .ico {
  flex: none;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--jb-soft);
  display: grid; place-items: center;
  font-size: 18px;
}
.jb-prep__item strong { display: block; font-size: 15px; margin-bottom: 3px; }
.jb-prep__item p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--jb-muted); }

/* 详情页主体：内容居中、层级靠留白与圆角建立 */
.jb-wrap > .jb-title { margin-top: 6px; }
.jb-wrap > .jb-player { margin-top: 22px; }

/* ---------- 响应式：移动端优先（375 / 390 / 430） ---------- */
@media (max-width: 900px) {
  .jb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jb-prep { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .jb-grid { grid-template-columns: 1fr; }
  .jb-section { padding: 44px 0; }
  .jb-title { font-size: clamp(25px, 7vw, 32px); }
  /* 移动端按钮全宽，足够大，好点 */
  .jb-actions { flex-direction: column; align-items: stretch; }
  .jb-btn { width: 100%; min-height: 50px; font-size: 16px; }
  .jb-search { flex-wrap: nowrap; padding: 6px 6px 6px 14px; border-radius: 14px; }
  .jb-search button { min-height: 44px; padding: 0 18px; }
  .jb-vcard__cta { width: 100%; min-height: 44px; }
}
@media (max-width: 380px) {
  .jb-search input { font-size: 15px; }
}
