/* ==========================================================================
   首页样式 — tl-home-* 命名空间
   Mobile-first，断点：<768 / ≥768 / ≥1080
   ========================================================================== */

/* -- 容器覆盖：首页使用 1200px 居中 ------------------------------------ */
.tl-home-shell {
  max-width: 1200px;
  margin: 0 auto;
}

/* 首页 `<main>` 外层容器（.tl-container .tl-main）同步放宽，
   否则 .tl-home-shell 会被 64rem 的父级容器卡住。 */
main.tl-main:has(.tl-home-shell) {
  max-width: 1200px;
}

/* -- Hero ---------------------------------------------------------------- */
.tl-home-hero {
  text-align: center;
  background: linear-gradient(135deg, #1d4ed8, #2563eb, #3b82f6);
  color: #fff;
  padding: clamp(0.75rem, 2vw, 1.25rem) 0;
  border-radius: 0 0 1.5rem 1.5rem;
}
.tl-home-hero-inner {
  max-width: 50rem;
  margin: 0 auto;
}
.tl-home-kicker {
  font-size: clamp(0.9rem, 3vw, 1.05rem);
  font-weight: 700;
  opacity: 0.85;
  margin: 0 0 0.5rem;
}
.tl-home-hero h1 {
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 800;
  line-height: 1.2;
  margin: 0;
  color: #fff;
}
.tl-home-subtitle {
  font-size: clamp(0.9rem, 3vw, 1.05rem);
  margin: 0.75rem auto 0;
  opacity: 0.9;
  line-height: 1.5;
}

/* -- Search -------------------------------------------------------------- */
.tl-home-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  margin: 0.75rem 0 0.75rem;
}
.tl-home-search-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.5rem 1.25rem;
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.tl-home-search-input:focus {
  border-color: #3d61f5;
  box-shadow: 0 0 0 3px rgba(61, 97, 245, 0.15);
}
.tl-home-search-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.5rem 1.1rem;
  border: 1px solid #3d61f5;
  border-radius: 999px;
  background: #3d61f5;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.tl-home-search-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
/* 仅对真正支持悬停的设备显示 hover 高亮；触屏设备免粘滞 */
@media (hover: hover) {
  .tl-home-search-btn:hover {
    background: #2f4bc4;
    border-color: #2f4bc4;
  }
}

/* -- Category rail ------------------------------------------------------- */
.tl-home-rails {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  padding: 0;
  margin-bottom: 0.6rem;
}
@media (min-width: 768px) {
  .tl-home-rails {
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
  }
}
.tl-home-rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.65rem 0.3rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 64px;
}
/* 仅对真正支持悬停的设备显示 hover 高亮；触屏设备免粘滞（点选/取消后颜色可恢复） */
@media (hover: hover) {
  .tl-home-rail-btn:hover {
    border-color: #93aaf7;
    background: #eef1fe;
  }
}
.tl-home-rail-btn[aria-pressed="true"] {
  border-color: #3d61f5;
  background: #eef1fe;
  color: #2f4bc4;
}
.tl-home-rail-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tl-home-rail-icon svg {
  width: 100%;
  height: 100%;
}
.tl-home-rail-label {
  line-height: 1.2;
  text-align: center;
}
.tl-home-rail-count {
  font-size: 0.65rem;
  color: #64748b;
  font-weight: 500;
}

/* -- Flagship Big Five --------------------------------------------------- */
.tl-home-flagship {
  position: relative;
  background: linear-gradient(135deg, #312e81 0%, #4338ca 55%, #4f46e5 100%);
  border-radius: 1rem;
  padding: clamp(0.5rem, 1.2vw, 0.8rem) clamp(1.5rem, 5vw, 2.25rem);
  margin: 0 0 1.25rem;
  color: #fff;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.tl-home-flagship-inner {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.tl-home-flagship-text {
  flex: 1;
  min-width: 0;
}
.tl-home-flagship-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}
.tl-home-flagship-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.95);
  color: #312e81;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.tl-home-flagship-title {
  font-size: clamp(1.15rem, 4vw, 1.4rem);
  font-weight: 800;
  margin: 0;
  color: #fff;
}
.tl-home-flagship-meta {
  font-size: 0.82rem;
  opacity: 0.85;
  margin: 0 0 0.6rem;
}
.tl-home-flagship-desc {
  font-size: 0.9rem;
  opacity: 0.8;
  max-width: 44rem;
  margin: 0;
}
.tl-home-flagship-btn {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 50px;
  background: #fff;
  color: #312e81;
  font-weight: 700;
  font-size: 1.02rem;
  border-radius: 0.75rem;
  padding: 0.75rem 1.75rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s;
}
.tl-home-flagship-btn:hover {
  background: #f1f5f9;
}
.tl-home-flagship-radar {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  opacity: 0.22;
  margin-left: 1rem;
}
@media (max-width: 600px) {
  .tl-home-flagship-radar { display: none; }
  /* 窄屏下恢复堆叠 */
  .tl-home-flagship-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  /* 徽章与标题也堆叠，标题占满整行 */
  .tl-home-flagship-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .tl-home-flagship-btn {
    font-size: 0.85rem;
    padding: 0.5rem 0.9rem;
    min-height: 44px;
    width: 100%;
    justify-content: center;
  }
}

/* -- Sections (Popular / Explore) ---------------------------------------- */
.tl-home-section {
  padding: 0;
  margin-bottom: 1.75rem;
}
.tl-home-secbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.tl-home-secbar h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}
.tl-home-seeall {
  /* 按钮重置：该类同时用于 <button>（由原 <a> 改造），抹平 UA 默认按钮样式 */
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  /* 共用视觉样式；须置于 font 简写之后，否则 font-size/font-weight 会被 inherit 覆盖 */
  font-size: 0.85rem;
  font-weight: 600;
  color: #3d61f5;
  text-decoration: none;
  white-space: nowrap;
}
.tl-home-seeall:hover { text-decoration: underline; }

/* -- Card grid ----------------------------------------------------------- */
.tl-home-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
@media (min-width: 768px) {
  .tl-home-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1200px) {
  .tl-home-grid { grid-template-columns: repeat(4, 1fr); }
}

/* -- Card ---------------------------------------------------------------- */
.tl-home-card {
  border-radius: 0.75rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e2e8f0;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.tl-home-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 24, 40, 0.08);
  border-color: #b9c6f8;
}
/* 折叠工具类：由 home.js 的 applyCollapse() 在过滤/展开时增删，
   移除该类即为展开，因此不需要展开态覆盖规则 */
.tl-home-card--collapse {
  display: none;
}
.tl-home-card.is-coming-soon {
  opacity: 0.6;
}
.tl-home-card-body {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--ink);
  height: 100%;
}

/* -- Thumbnail ----------------------------------------------------------- */
.tl-home-thumb {
  position: relative;
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.tl-home-thumb-glyph {
  font-size: 1.5rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.tl-home-hot {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #ef4444;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.tl-home-soon-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* -- Card text ----------------------------------------------------------- */
.tl-home-card-text {
  padding: 0.65rem 0.75rem 0.85rem;
}
/* 分类胶囊：缩略图左上角的分类标签（与右上角 HOT 对称）；
   半透明白底深色字，适配所有 rail 渐变；窄屏限宽防溢出 */
.tl-home-card-cat {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  max-width: calc(100% - 12px);
  white-space: normal;
}
.tl-home-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tl-home-card-meta {
  font-size: 0.75rem;
  color: #3d61f5;
  font-weight: 600;
  margin: 0.35rem 0 0;
}

/* -- Empty state --------------------------------------------------------- */
.tl-home-empty {
  text-align: center;
  padding: 2rem 0;
  color: #64748b;
  font-size: 0.95rem;
}

/* -- Disclaimer ---------------------------------------------------------- */
.tl-home-disclaimer {
  text-align: center;
  font-size: 0.78rem;
  color: #64748b;
  max-width: 52rem;
  margin: 1.5rem auto 0;
  padding: 0 0 2rem;
  line-height: 1.5;
}

/* -- Banner (suggest locale) --------------------------------------------- */
.tl-banner {
  margin: 0 0 1.25rem;
}

/* -- 首页主区贴齐 header：去掉 .tl-main 默认顶部 padding，避免与 Hero 之间的留白 -- */
.tl-main { padding-top: 0; }
