/* ==========================================================
   ihtv.online —— 样式
   配色取自背景图本身：近白底 + 粉紫主色 + 玫红强调
   ========================================================== */

:root {
  /* 文字 */
  --ink:        #3B3140;   /* 主文字（图里最深的颜色） */
  --ink-soft:   #6E5C69;   /* 次要文字 */
  --ink-faint:  #9A8894;   /* 更淡的辅助文字 */

  /* 品牌色 */
  --rose:       #9F5172;   /* 强调色 */
  --rose-deep:  #7C4460;
  --rose-soft:  #DCA0AE;
  --mauve:      #C5A7C1;

  /* 底色 */
  --paper:      #F8EDF1;   /* 页面底色（图里的近白） */
  --card:       rgba(255, 255, 255, 0.74);
  --card-hover: rgba(255, 255, 255, 0.92);
  --line:       rgba(59, 49, 64, 0.12);

  --shadow-s: 0 2px 10px rgba(90, 60, 80, 0.08);
  --shadow-m: 0 10px 30px rgba(90, 60, 80, 0.16);
  --shadow-l: 0 24px 60px rgba(50, 30, 45, 0.30);

  --radius:   16px;
  --radius-l: 22px;
  --maxw:     1180px;

  /* 背景图透明度，可被 data.js 里的 bgOpacity 覆盖 */
  --bg-opacity: 0.42;
}

/* ---------- 基础 ---------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC",
               "Source Han Sans SC", "Microsoft YaHei", system-ui, -apple-system,
               "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

img, video { display: block; max-width: 100%; }

button { font: inherit; color: inherit; }

a { color: var(--rose); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--rose);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- 半透明背景图 ---------- */

/* 最底层：你那张图，opacity 控制"半透明"程度 */
.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-color: var(--paper);
  background-repeat: no-repeat;
  background-position: center 28%;
  background-size: cover;
  opacity: var(--bg-opacity);
  pointer-events: none;
  /* 图片自带 jpg 回退，再优先用体积更小的 webp */
  background-image: url('../../media/bg/background.jpg');
  background-image: image-set(
    url('../../media/bg/background.webp') type('image/webp'),
    url('../../media/bg/background.jpg')  type('image/jpeg')
  );
}

/* 中间层：给文字让出对比度，同时又别把图盖死 */
.bg-scrim {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 0%,   rgba(248,237,241,0.34) 0%, rgba(248,237,241,0.06) 55%, rgba(248,237,241,0.62) 100%),
    linear-gradient(180deg, rgba(248,237,241,0.72) 0%, rgba(248,237,241,0.18) 26%,
                            rgba(248,237,241,0.20) 62%, rgba(248,237,241,0.80) 100%);
}

@media (max-width: 760px) {
  .bg {
    background-position: center 22%;
    /* 手机换小图，省流量 */
    background-image: url('../../media/bg/background-mobile.jpg');
    background-image: url('../../media/bg/background-mobile.webp');
  }
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  background: rgba(250, 242, 246, 0.72);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--rose-soft), var(--rose-deep));
  box-shadow: var(--shadow-s);
  flex: none;
}

.brand-text { font-size: 15px; }
.brand-text small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-faint);
  letter-spacing: 0.12em;
  line-height: 1.2;
}

.topnav {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.topnav a {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--ink-soft);
  transition: background 0.18s, color 0.18s;
}
.topnav a:hover {
  background: rgba(255, 255, 255, 0.8);
  color: var(--rose);
  text-decoration: none;
}

/* ---------- 通用容器 ---------- */

main { position: relative; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

.section { padding: 46px 0 8px; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.04em;
}

.section-note {
  margin: 0;
  font-size: 13px;
  color: var(--ink-faint);
}

/* ---------- 首屏 ---------- */

.hero {
  padding: 72px 0 30px;
  text-align: center;
}

.hero-kicker {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--rose);
  font-weight: 600;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(38px, 9vw, 76px);
  line-height: 1.1;
  letter-spacing: 0.04em;
  font-weight: 800;
  color: var(--ink);
  /* 图很亮，给标题一点白晕保证可读 */
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85), 0 6px 26px rgba(255, 255, 255, 0.7);
}

.hero-tagline {
  margin: 0 auto 12px;
  font-size: clamp(15px, 3.4vw, 19px);
  color: var(--rose-deep);
  letter-spacing: 0.14em;
  font-weight: 500;
}

.hero-intro {
  margin: 0 auto;
  max-width: 34em;
  font-size: 15px;
  color: var(--ink-soft);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.hero-stats {
  margin: 26px 0 0;
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
}

.stat { text-align: center; }

.stat b {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: var(--rose-deep);
  line-height: 1.2;
}

.stat span {
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
}

.hero-actions {
  margin-top: 30px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
  background: linear-gradient(135deg, var(--rose-soft), var(--rose));
  color: #fff;
  box-shadow: var(--shadow-m);
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(124, 68, 96, 0.34);
  text-decoration: none;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--rose-deep);
  border-color: rgba(159, 81, 114, 0.28);
  box-shadow: var(--shadow-s);
}
.btn--ghost:hover { background: #fff; }

/* ---------- 工具条：筛选 + 搜索 ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.tab {
  border: 0;
  background: transparent;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
}

.tab:hover { color: var(--rose); }

.tab[aria-selected="true"] {
  background: linear-gradient(135deg, var(--rose-soft), var(--rose));
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-s);
}

.tab .count {
  font-size: 11px;
  opacity: 0.75;
  margin-left: 4px;
}

.search {
  margin-left: auto;
  position: relative;
  display: flex;
  align-items: center;
}

.search input {
  width: 220px;
  max-width: 60vw;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.18s, box-shadow 0.18s, width 0.2s;
}
.search input::placeholder { color: var(--ink-faint); }
.search input:focus {
  outline: none;
  border-color: var(--rose-soft);
  box-shadow: 0 0 0 4px rgba(220, 160, 174, 0.28);
  width: 260px;
}

/* ---------- 网格 ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--tone, rgba(255, 255, 255, 0.6));
  box-shadow: var(--shadow-s);
  aspect-ratio: 3 / 4;
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.3, 1),
              box-shadow 0.22s, border-color 0.22s;
  text-align: left;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-5px);
  box-shadow: var(--shadow-m);
  border-color: rgba(255, 255, 255, 0.95);
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.card:hover .card-img { transform: scale(1.06); }

/* 底部渐变 + 标题 */
.card-meta {
  position: absolute;
  inset: auto 0 0 0;
  padding: 34px 14px 12px;
  background: linear-gradient(180deg, rgba(40, 26, 36, 0) 0%, rgba(40, 26, 36, 0.62) 100%);
  color: #fff;
  pointer-events: none;
}

.card-meta strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.card-meta small {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  opacity: 0.8;
  margin-top: 1px;
}

/* 视频卡：播放键 */
.card-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: rgba(30, 18, 26, 0.42);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: transform 0.22s, background 0.22s;
}

.card-play::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-40%, -50%);
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent #fff;
}

.card:hover .card-play {
  transform: scale(1.12);
  background: rgba(159, 81, 114, 0.72);
}

.empty {
  padding: 60px 0;
  text-align: center;
  color: var(--ink-faint);
  font-size: 14px;
}

/* ---------- 关于 ---------- */

.about {
  margin-top: 40px;
  padding: 34px 30px;
  border-radius: var(--radius-l);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-s);
}

.about h2 { margin: 0 0 12px; font-size: 20px; }
.about p  { margin: 0 0 10px; font-size: 15px; color: var(--ink-soft); }
.about p:last-child { margin-bottom: 0; }

/* ---------- 页脚 ---------- */

.footer {
  margin-top: 60px;
  padding: 30px 20px 40px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  background: rgba(250, 242, 246, 0.5);
}
.footer a { color: var(--rose); }

/* ==========================================================
   灯箱（点击查看大图 / 播放视频）
   ========================================================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s ease, visibility 0.24s;
}

.lightbox[hidden] { display: none; }

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(38, 24, 33, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: zoom-out;
}

.lb-stage {
  position: relative;
  z-index: 1;
  max-width: min(1100px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transform: scale(0.96);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.lightbox.is-open .lb-stage { transform: scale(1); }

.lb-media {
  display: flex;
  align-items: center;
  justify-content: center;
  /* 给下方的翻页按钮 + 标题留出空间 */
  max-height: calc(100vh - 250px);
}

.lb-img,
.lb-video {
  max-width: 100%;
  max-height: calc(100vh - 250px);
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: var(--shadow-l);
  background: #1b1219;
}

.lb-video { min-width: min(720px, 88vw); }

/* 翻页按钮那一行：图片下方，居中 */
.lb-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex: none;
}

.lb-caption {
  text-align: center;
  color: #fff;
  max-width: 42em;
}

.lb-caption h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.lb-caption p {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.66);
}

/* 计数器现在在翻页按钮中间 */
.lb-count {
  font-size: 12px;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.6);
  min-width: 5em;
  text-align: center;
}

/* 灯箱按钮 */
.lb-btn {
  position: relative;
  z-index: 2;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.18s, transform 0.18s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lb-btn:hover { background: rgba(255, 255, 255, 0.26); transform: scale(1.06); }
.lb-btn[hidden] { display: none; }

/* 关闭键：固定在屏幕右上角，跟图片完全分开，绝不遮挡 */
.lb-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  font-size: 26px;
}

.lb-prev,
.lb-next { font-size: 28px; }

@media (max-width: 900px) {
  .lightbox { padding: 16px; }
  .lb-close { top: 12px; right: 12px; }
  .lb-nav { gap: 16px; }
}

/* ---------- 手机 ---------- */

@media (max-width: 760px) {
  .hero { padding: 46px 0 18px; }
  .topnav { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .section { padding: 34px 0 6px; }
  .search { margin-left: 0; width: 100%; }
  .search input, .search input:focus { width: 100%; max-width: none; }
  .toolbar { gap: 10px; }
  .tabs { width: 100%; justify-content: space-between; }
  .tab { flex: 1; text-align: center; padding: 8px 10px; }
  .about { margin-top: 30px; padding: 26px 20px; }
  .hero-stats { gap: 20px; }
}

/* ---------- 动效偏好 ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .card:hover { transform: none; }
  .card:hover .card-img { transform: none; }
}

/* 打印：不要背景图 */
@media print {
  .bg, .bg-scrim, .topbar, .toolbar, .footer { display: none !important; }
}
