/* 今日热榜 · news.93ie.com —— 无框架原生样式 */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1f2329;
  --text-secondary: #4b5563;
  --text-tertiary: #6b7280;
  --border: #e5e7eb;
  --accent: #1d4ed8;
  --accent-weak: #e8effc;
  --hot: #c2410c;
  --rank: #4b5563;
  --focus: #1d4ed8;
  --radius: 10px;
  --max-width: 980px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

/* 可访问性：跳转链接 */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: 0 0 6px 0;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
}

/* 头部 */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 16px 16px;
}
.site-title {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.3;
  letter-spacing: 0.02em;
}
.site-subtitle {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.site-meta {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

/* 主体容器 */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px;
  min-height: 60vh;
}
.container:focus {
  outline: none;
}

/* 加载骨架屏 */
.loading {
  padding: 8px 0;
}
.skeleton {
  background: linear-gradient(90deg, #e9ebee 25%, #f3f4f6 37%, #e9ebee 63%);
  background-size: 400% 100%;
  border-radius: 6px;
  margin-bottom: 12px;
  animation: skeleton-shimmer 1.4s ease infinite;
}
.skeleton-title {
  height: 24px;
  width: 40%;
}
.skeleton-tabs {
  height: 44px;
  width: 100%;
}
.skeleton-line {
  height: 20px;
  width: 100%;
}
.loading-text {
  margin: 16px 0 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
@keyframes skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* 错误面板 */
.error-panel {
  margin: 24px auto;
  max-width: 460px;
  text-align: center;
  padding: 32px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.error-title {
  margin: 0 0 8px;
  font-size: 1.2rem;
}
.error-msg {
  margin: 0 0 20px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}
.btn {
  min-height: 44px;
  padding: 8px 28px;
  font-size: 1rem;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
}
.btn:hover {
  background: #1a45c0;
}
.btn:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Tab 栏 */
.tabs-wrap {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 8px 0 4px;
  margin: 0 -4px;
}
.tablist {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px;
  scrollbar-width: thin;
}
.tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 18px;
  font-size: 0.95rem;
  line-height: 1.2;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.tab[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.tab:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* 面板 */
.panel {
  padding: 12px 0 8px;
}
.panel:focus {
  outline: none;
}

/* 条目列表 */
.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 900px) {
  .item-list {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}

.item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.item-rank {
  flex: 0 0 auto;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--rank);
  background: var(--bg);
  border-radius: 6px;
  margin-top: 1px;
}
.item:nth-child(-n+3) .item-rank {
  color: #fff;
  background: var(--hot);
}

.item-body {
  min-width: 0;
  flex: 1 1 auto;
}
.item-title-wrap {
  line-height: 1.45;
}
.item-title {
  display: inline-block;
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  overflow-wrap: break-word;
  word-break: break-word;
}
/* 整行可点击：用拉伸链接覆盖整张卡片（不引入嵌套 <a>），
   同时把触控目标放大到整卡（高度 > 44px，满足移动端 §8） */
a.item-title::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}
a.item-title:hover,
a.item-title:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}
.item-title-plain {
  font-size: 1rem;
  font-weight: 500;
}
.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}
.item-heat {
  color: var(--hot);
}
.item-source {
  color: var(--text-secondary);
}
.item-time {
  color: var(--text-tertiary);
}

/* 空/失败占位 */
.empty {
  padding: 40px 20px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
}
.empty-title {
  margin: 0 0 6px;
  font-weight: 600;
  color: var(--text);
}
.empty-error {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  word-break: break-word;
}

/* 页脚 */
.site-footer {
  margin-top: 32px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-tertiary);
  font-size: 0.85rem;
}
.site-footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px;
}
.site-footer p {
  margin: 4px 0;
}

/* 可见焦点环 */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
