/* ==========================================================================
   SI163 首页小工具（天气 / 日期农历 / 节日倒计时）
   仅作用于 .sidebar 内的 .si163-hw，不影响主题其它区域
   ========================================================================== */

/* 卡片之间的上下间距。
   注意：widget 包裹层在 dynamic_sidebar_params 里已被替换成 .si163-hw，
   所以选择器必须打在 .si163-hw 上，写 .si163-hw-widget 是不会命中的。
   只改 margin，不动 padding —— .si163-hw-wx / -dt / -fs 各自有内边距。 */
.sidebar .si163-hw-widget {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}

.sidebar .si163-hw {
  margin: 0 0 14px;
}

.sidebar .si163-hw-widget:last-child,
.sidebar .si163-hw:last-child {
  margin-bottom: 0;
}

.si163-hw-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.si163-hw {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(24, 35, 63, .11);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

.si163-hw-ico {
  flex: none;
  display: block;
}

/* ------------------------------------------------------------ ① 实时天气 */

.si163-hw-wx {
  padding: 15px 16px 13px;
  color: #fff;
  background: linear-gradient(150deg, #63729c 0%, #46536f 52%, #303a54 100%);
}

.si163-hw-wx-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.si163-hw-wx-city {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  letter-spacing: .2px;
  opacity: .96;
}

.si163-hw-wx-city b {
  font-weight: 500;
}

.si163-hw-wx-cond {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  opacity: .92;
}

.si163-hw-wx-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 4px 0 0;
}

.si163-hw-wx-temp {
  font-size: 46px;
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -1.5px;
}

.si163-hw-wx-temp i {
  font-style: normal;
  font-size: 21px;
  font-weight: 400;
  vertical-align: 15px;
  letter-spacing: 0;
}

.si163-hw-wx-range {
  font-size: 12.5px;
  opacity: .88;
  padding-bottom: 7px;
  white-space: nowrap;
}

.si163-hw-wx-days {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px solid rgba(255, 255, 255, .18);
}

.si163-hw-wx-day {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  line-height: 1.15;
  white-space: nowrap;
}

.si163-hw-wx-day .lbl {
  opacity: .92;
}

.si163-hw-wx-day .rg {
  opacity: .78;
  font-size: 10.5px;
  letter-spacing: -.3px;
}

/* ------------------------------------------------------------ ② 日期 / 农历 */

.si163-hw-dt {
  background: #fff;
}

.si163-hw-dt-main {
  display: flex;
  min-height: 116px;
}

.si163-hw-dt-left {
  flex: 0 0 41%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 13px 14px 15px;
  color: #fff;
  background: linear-gradient(158deg, #ef4358 0%, #d82943 100%);
}

.si163-hw-dt-ym {
  font-size: 13px;
  opacity: .95;
  letter-spacing: .2px;
}

.si163-hw-dt-day {
  font-size: 50px;
  line-height: .92;
  font-weight: 600;
  letter-spacing: -2px;
}

.si163-hw-dt-right {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 13px 13px 12px;
}

.si163-hw-dt-meta {
  font-size: 12.5px;
  color: #8b94a7;
  white-space: nowrap;
}

.si163-hw-dt-meta b {
  font-size: 13.5px;
  font-weight: 600;
  color: #1f2937;
  margin-right: 5px;
}

.si163-hw-dt-lunar {
  font-size: 12px;
  color: #9aa3b4;
  margin-top: 3px;
  white-space: nowrap;
}

.si163-hw-dt-clock {
  display: flex;
  align-items: baseline;
  margin-top: 5px;
  color: #111827;
  line-height: 1;
}

.si163-hw-dt-clock b {
  font-size: 29px;
  font-weight: 600;
  letter-spacing: -1px;
}

.si163-hw-dt-clock i {
  font-style: normal;
  font-size: 25px;
  margin: 0 1px;
  opacity: .85;
}

.si163-hw-dt-clock .ss {
  font-size: 14.5px;
  color: #9aa3b4;
  margin-left: 4px;
  letter-spacing: -.5px;
}

.si163-hw-dt-bar {
  height: 3px;
  background: #f0f1f5;
}

.si163-hw-dt-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ef4358, #fb7f6f);
  transition: width .5s linear;
}

/* ------------------------------------------------------------ ③ 节日倒计时 */

.si163-hw-fs {
  padding: 15px 15px 13px;
  background: linear-gradient(158deg, #e9f1ff 0%, #f7fbff 58%, #ffffff 100%);
}

.si163-hw-fs-top {
  display: flex;
  align-items: center;
  gap: 13px;
}

.si163-hw-fs-ring {
  position: relative;
  flex: none;
  width: 74px;
  height: 74px;
}

.si163-hw-fs-ring svg {
  display: block;
  width: 100%;
  height: 100%;
}

.si163-hw-fs-ring .bg {
  stroke: #dae6fb;
}

.si163-hw-fs-ring .fg {
  stroke: #3b82f6;
}

.si163-hw-fs-num {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.si163-hw-fs-num b {
  font-size: 21px;
  line-height: 1;
  font-weight: 600;
  color: #1d4ed8;
  letter-spacing: -.5px;
}

.si163-hw-fs-num span {
  font-size: 10px;
  color: #8398bb;
  margin-top: 3px;
}

.si163-hw-fs-info {
  min-width: 0;
  flex: 1 1 auto;
}

.si163-hw-fs-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  color: #3b82f6;
  background: rgba(59, 130, 246, .12);
  white-space: nowrap;
}

.si163-hw-fs-name {
  margin: 5px 0 1px;
  font-size: 21px;
  font-weight: 600;
  color: #16233c;
  letter-spacing: -.3px;
  white-space: nowrap;
}

.si163-hw-fs-date {
  font-size: 12px;
  color: #8b9bb4;
  white-space: nowrap;
}

.si163-hw-fs-grid {
  display: flex;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px dashed #d9e5f9;
}

.si163-hw-fs-cell {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.si163-hw-fs-cell + .si163-hw-fs-cell::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 1px;
  background: #e3edfb;
}

.si163-hw-fs-cell .ic {
  color: #3b82f6;
  height: 18px;
}

.si163-hw-fs-cell b {
  font-size: 14.5px;
  font-weight: 600;
  color: #1d4ed8;
  line-height: 1.1;
}

.si163-hw-fs-cell .nm {
  font-size: 10.5px;
  color: #8b9bb4;
  white-space: nowrap;
}

/* ------------------------------------------------------------ 侧栏跟随滚动 */

@media (min-width: 992px) {
  /* 侧栏只有 477px 高、主区数千像素，不跟随滚动右侧会大片留白。
     主题给 .sidebar 设了 position:relative，这里需要压过它。 */
  .home-container.sidebar_right .sidebar.sidebar-tools,
  .home-container.sidebar_left .sidebar.sidebar-tools,
  .sidebar.sidebar-tools {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 92px;
    align-self: flex-start;
  }
}

/* ------------------------------------------------------------ 窄屏 / 暗色兼容 */

@media (max-width: 991px) {
  /* 主题侧栏在 <992 已隐藏，这里只兜底 */
  .sidebar .si163-hw-widget {
    display: none;
  }
}

/* 深色模式：主题把 io-black-mode 加在 <html> 上（main.js: IO.html.toggleClass） */
html.io-black-mode .si163-hw-dt,
html.io-black-mode .si163-hw-dt-main {
  background: #1e2230;
}

html.io-black-mode .si163-hw-dt-meta {
  color: #96a0b5;
}

html.io-black-mode .si163-hw-dt-meta b,
html.io-black-mode .si163-hw-dt-clock {
  color: #eef1f7;
}

html.io-black-mode .si163-hw-dt-lunar,
html.io-black-mode .si163-hw-dt-clock .ss {
  color: #78839a;
}

html.io-black-mode .si163-hw-dt-bar {
  background: #2b3040;
}

html.io-black-mode .si163-hw-fs {
  background: linear-gradient(158deg, #1c2739 0%, #1a2130 60%, #1a1f2b 100%);
}

html.io-black-mode .si163-hw-fs-tag {
  color: #8ab4ff;
  background: rgba(59, 130, 246, .2);
}

html.io-black-mode .si163-hw-fs-name {
  color: #eef1f7;
}

html.io-black-mode .si163-hw-fs-date,
html.io-black-mode .si163-hw-fs-cell .nm,
html.io-black-mode .si163-hw-fs-num span {
  color: #8b96ac;
}

html.io-black-mode .si163-hw-fs-cell b,
html.io-black-mode .si163-hw-fs-num b {
  color: #8ab4ff;
}

html.io-black-mode .si163-hw-fs-ring .bg {
  stroke: #2c3648;
}

html.io-black-mode .si163-hw-fs-grid {
  border-top-color: #2c3648;
}

html.io-black-mode .si163-hw-fs-cell + .si163-hw-fs-cell::before {
  background: #2c3648;
}
