/* 时安小站 · 首页样式（独立于贷款备忘录的 styles.css，避免互相影响） */
:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #17212f;
  --text-2: #4b5768;
  --muted: #8a97a8;
  --line: #e3e9f2;
  --primary: #2f6bf6;
  --primary-soft: #eaf1ff;
  --accent: #16a34a;
  --accent-soft: #e8f7ee;
  --warn: #b7791f;
  --radius: 20px;
  --shadow: 0 18px 40px -28px rgba(23, 33, 47, .45);
  --shadow-lg: 0 26px 60px -34px rgba(23, 33, 47, .5);
  --card-2: #fbfcfe;
  --chip-bg: #eff3f9;
}

:root[data-theme="dark"] {
  --bg: #0e1218;
  --card: #161d27;
  --text: #e9eff8;
  --text-2: #aab6c7;
  --muted: #7d8b9e;
  --line: #232c39;
  --primary: #5b8cff;
  --primary-soft: #1b2740;
  --accent: #34d399;
  --accent-soft: #12291f;
  --warn: #e3b341;
  --shadow: 0 18px 40px -28px rgba(0, 0, 0, .65);
  --shadow-lg: 0 26px 60px -34px rgba(0, 0, 0, .75);
  --card-2: #131922;
  --chip-bg: #1b232f;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.wrap {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 18px;
}

/* ------------------------------- 顶部 -------------------------------- */
/* app shell：顶栏不参与滚动，样式见 index.html 里的 #lc-critical */
/* 顶栏 = 页面第一行：普通文档流，跟着页面一起滚走；底色与页面一致 */
.site-head {
  border-bottom: 0;
  background: var(--bg);
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

.brand-mark {
  width: 40px; height: 40px; flex: none;
  border-radius: 13px;
  display: grid; place-items: center;
  color: #fff; font-size: 19px; font-weight: 700;
  background: linear-gradient(150deg, #4c86ff, #1c3fb8);
  box-shadow: 0 12px 22px -14px rgba(47, 107, 246, .9);
}

.brand-text strong { display: block; font-size: 16px; letter-spacing: -.2px; }
.brand-text span { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }

.head-link {
  flex: none;
  font-size: 13px; font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 8px 14px;
  transition: transform .15s, background .15s;
}
.head-link:hover { background: var(--primary-soft); filter: brightness(.97); }
.head-link:active { transform: scale(.97); }

.head-link-ghost {
  color: var(--text-2);
  background: var(--card);
  border: 1px solid var(--line);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}

.head-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.head-actions .icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 0; border-radius: 11px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background .18s, color .18s;
  text-decoration: none;
}
.head-actions .icon-btn:hover { background: var(--card); color: var(--text); }
.head-actions .icon-btn svg { width: 20px; height: 20px; }
.head-actions [hidden] { display: none !important; }

/* ------------------------------- hero -------------------------------- */
.hero { padding: 34px 0 10px; }
.hero h1 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: -.6px;
  line-height: 1.3;
}
.hero p { margin: 0; color: var(--text-2); font-size: 14px; max-width: 34em; }

/* ------------------------------- 分组 -------------------------------- */
.group { margin-top: 26px; }

.group-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.group-head h2 { margin: 0; font-size: 16px; letter-spacing: -.2px; }
.group-note { font-size: 12.5px; color: var(--muted); }

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* ------------------------------- 卡片 -------------------------------- */
.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.card-icon {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  margin-bottom: 10px;
}
.card-icon svg { width: 21px; height: 21px; }

.card h3 { margin: 0 0 5px; font-size: 16px; letter-spacing: -.2px; }
.card p { margin: 0; font-size: 13.5px; color: var(--text-2); line-height: 1.6; }

.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  min-height: 26px;
}

.pill {
  display: inline-block;
  font-size: 12px; font-weight: 600;
  color: var(--muted);
  background: var(--chip-bg, #f1f4f9);
  border-radius: 999px;
  padding: 4px 10px;
}
.pill-live { color: var(--accent); background: var(--accent-soft); }

.arrow { width: 18px; height: 18px; color: var(--muted); }

/* 已上线：可点的卡片 */
.card.is-live { border-color: #cfe0ff; }
.card.is-live .card-icon { color: #fff; background: linear-gradient(150deg, #4c86ff, #1c3fb8); }
.card.is-live:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: #b6d0ff;
}
.card.is-live:hover .arrow { color: var(--primary); }

/* 正在做：不可点 */
.card.is-soon { background: var(--card-2, #fbfcfe); box-shadow: none; }
.card.is-soon .card-icon { color: var(--muted); background: var(--chip-bg, #eff3f9); }
.card.is-soon h3 { color: var(--text-2); }

/* ------------------------------- 页脚 -------------------------------- */
.site-foot {
  margin-top: 44px;
  padding: 22px 0 34px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.site-foot p { margin: 0; font-size: 12.5px; color: var(--muted); }
.site-foot .foot-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }
.site-foot .foot-icp { margin-top: 10px; font-size: 12px; }
.site-foot .foot-icp a { color: var(--muted); }

/* ------------------------------- 桌面 -------------------------------- */
@media (min-width: 620px) {
  .hero { padding-top: 46px; }
  .hero h1 { font-size: 32px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 14px; }
  .card { padding: 18px; }

  /* 已上线的卡片在宽屏上横过来，占满一行，更像「主推」 */
  .card.is-live {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 56px 1fr 24px;
    grid-template-areas:
      "icon title arrow"
      "icon text  arrow"
      "icon foot  arrow";
    column-gap: 18px;
    align-items: center;
    padding: 22px 24px;
  }
  .card.is-live .card-icon {
    grid-area: icon;
    width: 52px; height: 52px;
    border-radius: 16px;
    margin: 0;
  }
  .card.is-live .card-icon svg { width: 26px; height: 26px; }
  .card.is-live h3 { grid-area: title; margin: 0; font-size: 18px; }
  .card.is-live p { grid-area: text; margin: 3px 0 0; max-width: 46em; }
  .card.is-live .card-foot {
    grid-area: foot;
    margin: 10px 0 0;
    justify-content: flex-start;
    gap: 14px;
    min-height: 0;
  }
  .card.is-live .arrow { grid-area: arrow; width: 22px; height: 22px; }
}

@media (min-width: 900px) {
  .hero h1 { font-size: 36px; }
  .cards { grid-template-columns: repeat(3, 1fr); }
}

/* ------------------------------- 广告位 ------------------------------- */
/* 一块固定比例的原生卡片：图片按 cover 填满，永不拉变形；没广告时是一块克制的虚线位。 */
.ad-slot { margin: 22px 0; }
.ad-slot[hidden] { display: none !important; }

.ad-card {
  position: relative;
  isolation: isolate;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  aspect-ratio: var(--ad-ratio, 4 / 1);
  transition: transform .16s ease, box-shadow .16s ease;
}
.ad-card .ad-link { display: block; width: 100%; height: 100%; }
.ad-card img {
  position: relative;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.ad-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.ad-card:has(.ad-link):hover { cursor: pointer; }

/* 「推广」角标：永远压在图片上面（动图也一样），不参与鼠标事件 */
.ad-badge {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 3;
  font-size: 11px; line-height: 1;
  color: #fff;
  background: rgba(15, 23, 42, .55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  padding: 5px 9px;
  border-radius: 999px;
  letter-spacing: .04em;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .18);
}

.ad-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 76px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(246, 249, 253, .6);
  color: var(--muted);
  font-size: 12.5px;
}
.ad-empty-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(47, 107, 246, .1);
  color: var(--primary);
}
.ad-empty-text { opacity: .9; }

/* ------------------- 左右两侧跟随滚动的广告位（宽屏才出现） ------------------- */
.ad-rail {
  position: fixed;
  top: 92px;
  width: 176px;
  display: none;
  flex-direction: column;
  gap: 16px;
  z-index: 5;
  pointer-events: auto;
}
.ad-rail-left { left: max(16px, calc((100vw - 1180px) / 2 - 196px)); }
.ad-rail-right { right: max(16px, calc((100vw - 1180px) / 2 - 196px)); }
/* 竖栏广告：默认按 176 × 440 显示（2:5），屏幕不够高时自动缩短，保证两条都完整可见 */
.ad-rail { top: 24px; gap: 16px; }
.ad-rail .ad-slot {
  width: 176px;
  aspect-ratio: auto;
  height: min(440px, calc((100dvh - 132px) / 2 - 8px));
}

/* 只有两侧真能腾出位置时才显示（窄屏藏起来，别糊在内容上） */
@media (min-width: 1600px) {
  .ad-rail { display: flex; }
}

/* ------------------------------- 友情链接 ------------------------------- */
.links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 30px auto 6px;
}
.links-label {
  font-size: 12.5px;
  color: var(--muted-2, #6d819c);
  margin-right: 2px;
}
.link-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line, rgba(0, 0, 0, .08));
  font-size: 13px;
  color: var(--muted, #6b7c93);
  text-decoration: none;
  transition: color .16s, border-color .16s, background .16s;
}
.link-chip:hover {
  color: var(--primary, #4b8bf5);
  border-color: var(--primary, #4b8bf5);
  background: rgba(75, 139, 245, .08);
}

/* 内容区广告位按设计尺寸封顶，超宽屏不再无限放大 */
.ad-slot { max-width: 960px; margin-left: auto; margin-right: auto; }
.loan-list .ad-slot { max-width: none; }

/* 竖栏里的空闲位：窄一点，改成竖排居中 */
.ad-rail .ad-empty {
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  text-align: center;
  height: 100%;
}
.ad-rail .ad-empty-text { font-size: 11.5px; line-height: 1.5; }
.ad-rail .ad-empty-tag { font-size: 10.5px; }
