/* ============================================================
   流冰镜 — icyrus-design 现代版
   主色: 冰川蓝 #0ea5e9 · 渐变 · 圆角 8/12/16 · 4px 间距网格
   ============================================================ */

:root {
  /* 主色（现代版 · 冰川蓝） */
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --primary-light: #e0f2fe;
  --primary-dark: #0c4a6e;
  --secondary: #67e8f9;
  --accent: #a5f3fc;
  --ice: #cffafe;

  /* 中性色 */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* 语义字色（现代版 Semantic Token） */
  --text-emphasis: #000000;
  --text-title: #1e293b;
  --text-body: #475569;
  --text-secondary: #64748b;
  --text-theme: #0ea5e9;
  --text-danger: #ef4444;
  --text-alert: #f59e0b;
  --text-inverse: #ffffff;

  /* 功能色 */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(14, 165, 233, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(14, 165, 233, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(14, 165, 233, 0.1);
  --shadow-ice: 0 8px 32px rgba(103, 232, 249, 0.15);

  /* 圆角（现代版） */
  --r-sm: 4px;
  --r-md: 8px;   /* 卡片/输入框 */
  --r-btn: 12px; /* 按钮 */
  --r-lg: 16px;  /* 大容器 */
  --r-xl: 20px;
  --r-max: 24px; /* 头像 */

  /* 间距（4px 基准网格） */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  --s10: 40px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #cffafe 100%);
  color: var(--text-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh; /* iOS Safari 地址栏伸缩 */
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* 冰晶背景光晕 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(103, 232, 249, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(14, 165, 233, 0.10) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(165, 243, 252, 0.10) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* ============ 头部 ============ */
.site-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--text-inverse);
  padding: var(--s10) var(--s4) var(--s8);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.site-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.10) 0%, transparent 70%);
  animation: iceFlow 24s linear infinite;
}

@keyframes iceFlow {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.header-inner { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; }

.site-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 2px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  margin-bottom: var(--s1);
}

.site-sub {
  font-size: 14px;
  font-weight: 300;
  opacity: 0.95;
}

/* ============ Tab 导航 ============ */
.tabs-wrap {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(103, 232, 249, 0.25);
  box-shadow: var(--shadow-sm);
}

.tabs {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
}

.tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px var(--s2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
  min-width: 0; /* 允许 flex 收缩，防止内容截断 */
}

.tab > span { overflow: hidden; text-overflow: ellipsis; }

.tab:hover { color: var(--text-theme); background: rgba(224, 242, 254, 0.4); }

.tab.active {
  color: var(--text-theme);
  font-weight: 600;
  border-bottom-color: var(--primary);
  background: linear-gradient(180deg, transparent 60%, rgba(224, 242, 254, 0.6) 100%);
}

.feed-meta {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--s1) var(--s4) var(--s2);
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
}

/* ============ 内容流 ============ */
.feed {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: var(--s6) var(--s4) var(--s10);
}

.state-tip {
  text-align: center;
  color: var(--text-secondary);
  padding: var(--s10) var(--s4);
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--r-lg);
  border: 1px dashed var(--gray-300);
}

.state-tip .retry-btn { margin-top: var(--s3); }

.state-icon {
  display: inline-flex;
  margin-right: var(--s2);
  color: var(--gray-400);
  vertical-align: -4px;
}
.state-icon .icon { width: 18px; height: 18px; }

/* 图标基类（SVG symbol 引用） */
.icon {
  width: 16px;
  height: 16px;
  flex: none;
  vertical-align: -2px;
}

/* 日期分组 */
.day { margin-bottom: var(--s8); }

.day-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s4);
}

.day-date {
  display: inline-block;
  padding: var(--s1) var(--s3);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-inverse);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}

.day-sub { font-size: 12px; color: var(--text-secondary); }

.day-divider {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(103, 232, 249, 0.5), transparent);
}

/* 卡片 */
.card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(103, 232, 249, 0.2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: var(--s4) var(--s5) var(--s4);
  margin-bottom: var(--s4);
  transition: transform 0.3s, box-shadow 0.3s;
  animation: cardIn 0.5s ease both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg), var(--shadow-ice); }

.card.cat-ai    { border-left: 3px solid var(--primary); }
.card.cat-life  { border-left: 3px solid var(--warning); }

.card-tags { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s2); flex-wrap: wrap; }

/* 分类图标（替代文字标签）：小圆角图标底 + 来源小字 */
.cat-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
}
.cat-ic .icon { width: 14px; height: 14px; }
.cat-ic-ai   { color: var(--primary); background: var(--primary-light); }
.cat-ic-life { color: #b45309; background: #fef3c7; }

.src-text { font-size: 12px; color: var(--text-secondary); }

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-title);
  line-height: 1.5;
  margin-bottom: var(--s2);
  word-break: break-word;
}

.card-title a { color: inherit; text-decoration: none; }
.card-title a:hover { color: var(--text-theme); }

/* 受限 markdown 渲染区 */
.md { color: var(--text-body); overflow-wrap: break-word; }
.md h2 { font-size: 15px; font-weight: 600; color: var(--text-title); margin: var(--s3) 0 var(--s1); }
.md h3 { font-size: 14px; font-weight: 600; color: var(--text-title); margin: var(--s3) 0 var(--s1); }
.md p  { margin: var(--s1) 0; }
.md ul { margin: var(--s1) 0; padding-left: 20px; }
.md li { margin: 4px 0; }
.md li::marker { color: var(--text-theme); }
.md blockquote {
  margin: var(--s2) 0;
  padding: var(--s1) var(--s3);
  border-left: 3px solid var(--secondary);
  background: rgba(207, 250, 254, 0.35);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--text-secondary);
  font-size: 13px;
}

/* 长文折叠 */
.card-content { position: relative; }
.card-content.collapsed .md {
  max-height: 168px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 60%, transparent 100%);
}
.expand-btn {
  display: inline-block;
  margin-top: var(--s1);
  padding: 4px var(--s3);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-theme);
  background: var(--primary-light);
  border: none;
  border-radius: var(--r-btn);
  cursor: pointer;
  transition: all 0.3s;
}
.expand-btn:hover { background: var(--primary); color: var(--text-inverse); }

/* 卡片图片 */
.card-images { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s3); }
.card-images img {
  width: 100%;
  max-width: 480px;
  border-radius: var(--r-md);
  border: 1px solid rgba(103, 232, 249, 0.3);
  cursor: zoom-in;
  transition: opacity 0.3s;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  margin-top: var(--s3);
  font-size: 12px;
  color: var(--text-secondary);
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-theme);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s;
}
.card-link .icon { width: 13px; height: 13px; }
.card-link:hover { color: var(--primary-hover); text-decoration: underline; }

/* ============ 按钮（现代版规范：高36 / 圆角12） ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 var(--s4);
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: var(--r-btn);
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  color: var(--text-inverse);
  background: linear-gradient(135deg, var(--primary), #38bdf8);
  box-shadow: var(--shadow-md);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-hover), var(--primary)); }

/* ============ 页脚 ============ */
.site-footer {
  text-align: center;
  padding: var(--s6) var(--s4);
  /* iPhone 底部安全区（Home 指示条） */
  padding-bottom: calc(var(--s6) + env(safe-area-inset-bottom, 0px));
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid rgba(103, 232, 249, 0.2);
  background: rgba(255, 255, 255, 0.6);
}

.site-footer a { color: var(--text-secondary); text-decoration: none; }
.site-footer a:hover { color: var(--text-theme); }

/* ============ 加载动画 ============ */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  margin-right: var(--s2);
  border: 2px solid var(--accent);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 图片灯箱 ============ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s6);
  cursor: zoom-out;
  animation: fadeIn 0.3s ease;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-ice);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============ 响应式（手机 H5） ============ */
@media (max-width: 480px) {
  .site-title { font-size: 24px; }
  .site-header { padding: var(--s8) var(--s3) var(--s6); }
  .site-sub { font-size: 13px; padding: 0 var(--s2); }

  .tabs { gap: 2px; }
  .tab { font-size: 13px; gap: 4px; padding: 12px 2px; }
  .tab .icon { width: 14px; height: 14px; }
  .feed-meta { text-align: center; padding-left: var(--s3); padding-right: var(--s3); }

  .feed { padding: var(--s4) var(--s3) var(--s8); }
  .day-date { font-size: 13px; }
  .card { padding: var(--s4); border-radius: var(--r-md); }
  .card-title { font-size: 15px; }
  .card-images img { max-width: 100%; }

  /* 触摸目标加大（现代版规范：小按钮 32px） */
  .expand-btn { padding: 7px var(--s3); }
  .card-foot { font-size: 12px; }
  .card-link .icon { width: 12px; height: 12px; }
}

/* 更窄的小屏（iPhone SE 一代等） */
@media (max-width: 360px) {
  .tab { font-size: 12px; gap: 3px; }
  .tab .icon { width: 13px; height: 13px; }
}

/* 低动效偏好：关闭装饰动画 */
@media (prefers-reduced-motion: reduce) {
  .site-header::before { animation: none; }
  .card { animation: none; }
  .tab, .card, .expand-btn, .card-link { transition: none; }
}
