/* ============================================================
   沈孙丰个人主页 — Clean Design System v3
   设计参考:Apple HIG · 飞书设计规范
   核心原则:克制 · 清晰 · 简洁
   ============================================================ */

/* ========================================
   DESIGN TOKENS
   ======================================== */
:root {
  /* ---- Background (飞书暗色:实色,非半透明) ---- */
  --bg-base:      #17171A;
  --bg-elevated:  #232324;
  --bg-card:      #232324;
  --bg-hover:     #2A2A2B;

  /* ---- Border ---- */
  --border-color: rgba(255,255,255,0.10);

  /* ---- Text ---- */
  --text-primary:   rgba(255,255,255,0.92);
  --text-secondary: rgba(255,255,255,0.70);
  --text-tertiary:  rgba(255,255,255,0.50);
  --text-muted:     rgba(255,255,255,0.30);

  /* ---- Accent (飞书色板) ---- */
  --c-blue:   #3370FF;
  --c-green:  #00B42A;
  --c-orange: #FF7D00;
  --c-purple: #722ED1;
  --c-cyan:   #14C9C9;
  --c-rose:   #F53F3F;
  --c-amber:  #FFB400;
  --c-slate:  #86909C;

  /* ---- Radius (飞书:8 的倍数) ---- */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* ---- Shadow ---- */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);

  /* ---- Motion ---- */
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --dur:  200ms;

  /* ---- Layout (8 的倍数) ---- */
  --max-w: 1200px;
  --gap: 16px;
  --pad-x: 24px;
}

/* ========================================
   RESET
   ======================================== */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

html { -webkit-font-smoothing: antialiased; }

body {
  font-family: -apple-system,BlinkMacSystemFont,'SF Pro Display','SF Pro Text','PingFang SC','Hiragino Sans GB','Microsoft YaHei',sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  padding: 24px var(--pad-x) 48px;
  position: relative;
}

/* 极淡的静态背景渐变(无动画) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255,255,255,0.025), transparent);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }

::selection { background: rgba(51,112,255,0.3); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 2px; border-radius: 4px; }

/* ========================================
   搜索栏
   ======================================== */
.search-container {
  max-width: 600px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-pill);
  padding: 6px 6px 6px 20px;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.search-container:focus-within {
  border-color: var(--c-blue);
  background: var(--bg-hover);
}

.search-icon {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  font-size: 0.95rem;
  color: var(--text-primary);
  font-family: inherit;
  padding: 11px 0;
}
.search-input::placeholder { color: var(--text-muted); }

.search-provider-icons {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  padding: 3px;
  background: rgba(0,0,0,0.25);
  border-radius: var(--r-pill);
}
.search-provider-icons span {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--dur) var(--ease);
}
.search-provider-icons span:hover { color: var(--text-secondary); background: rgba(255,255,255,0.08); }
.search-provider-icons span.active { color: #fff; background: var(--c-blue); }

/* ========================================
   热门搜索标签
   ======================================== */
.search-tags {
  max-width: 600px;
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding: 0 4px;
}
.st-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  margin-right: 2px;
}
.st-tag {
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: all var(--dur) var(--ease);
}
.st-tag:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* ========================================
   信息栏
   ======================================== */
.info-bar {
  max-width: var(--max-w);
  margin: 0 auto 32px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.info-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-md);
  transition: background var(--dur) var(--ease);
}
.info-card:hover { background: var(--bg-hover); }

.info-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}
.info-icon-wrap.greeting { background: rgba(255,159,10,0.12); }
.info-icon-wrap.time     { background: rgba(10,132,255,0.12); color: var(--c-blue); }
.info-icon-wrap.weather  { background: rgba(48,209,88,0.12); }

.info-body { flex: 1; min-width: 0; }
.info-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}
.info-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 8px;
}
.info-value small { font-size: 0.7em; font-weight: 500; color: var(--text-tertiary); }

.temp-bar {
  flex: 1;
  min-width: 36px;
  max-width: 72px;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.temp-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--c-cyan), var(--c-green), var(--c-amber));
  transition: width 0.8s var(--ease);
}

/* ========================================
   章节标题
   ======================================== */
.section-label {
  max-width: var(--max-w);
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-line {
  flex: 1;
  height: 1px;
  background: var(--border-color);
}
.section-text {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.section-text iconify-icon { color: var(--text-tertiary); }

.page-section + .page-section { margin-top: 28px; }

/* ========================================
   网格
   ======================================== */
.grid-container {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: var(--gap);
}
.bookmark-grid {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

/* ========================================
   服务分组卡片
   ======================================== */
.service-group {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-md);
  padding: 16px;
  transition: background var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
}

/* 顶部细线(静态,无发光) */
.service-group::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--group-color, var(--c-blue));
  opacity: 0.6;
}

/* 强调色 */
.accent-blue   { --group-color: var(--c-blue); }
.accent-purple { --group-color: var(--c-purple); }
.accent-green  { --group-color: var(--c-green); }
.accent-cyan   { --group-color: var(--c-cyan); }
.accent-orange { --group-color: var(--c-orange); }
.accent-rose   { --group-color: var(--c-rose); }
.accent-amber  { --group-color: var(--c-amber); }
.accent-slate  { --group-color: var(--c-slate); }

.service-group:hover { background: var(--bg-hover); }

.group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}
.group-accent-bar {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--group-color);
  flex-shrink: 0;
  opacity: 0.8;
}
.group-name {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* ========================================
   服务条目
   ======================================== */
.service-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-radius: var(--r-sm);
  transition: background var(--dur) var(--ease);
  margin-bottom: 1px;
}
.service-item:hover { background: var(--bg-hover); }
.service-item:active { background: var(--bg-elevated); }

.service-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  color: var(--group-color);
  transition: transform var(--dur) var(--ease);
}
.service-item:hover .service-icon { transform: scale(1.05); }
.service-icon img,
.service-icon iconify-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.service-text { flex: 1; min-width: 0; }
.service-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.3;
}
.service-desc {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-arrow {
  opacity: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: opacity var(--dur) var(--ease);
}
.service-item:hover .service-arrow { opacity: 1; }

/* ========================================
   书签分组
   ======================================== */
.bookmark-group {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-md);
  padding: 16px;
  transition: background var(--dur) var(--ease);
}
.bookmark-group:hover { background: var(--bg-hover); }

.bookmark-group-label {
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
}
.bookmark-group-label::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--group-color, var(--text-muted));
  opacity: 0.8;
}

.bookmark-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.bookmark-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,0.05);
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
}
.bookmark-chip:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--border-color);
  color: var(--text-primary);
}
.bookmark-chip:active { background: rgba(255,255,255,0.12); }

.bookmark-chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--group-color, var(--text-secondary));
}
.bookmark-chip-icon iconify-icon { width: 16px; height: 16px; }

.bookmark-chip-name { line-height: 1; }

/* ========================================
   页脚
   ======================================== */
.footer {
  max-width: var(--max-w);
  margin: 48px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-left {
  font-size: 0.76rem;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.footer-brand { font-weight: 600; color: var(--text-secondary); }
.footer-left b { color: var(--text-secondary); font-weight: 600; }
.footer-sep { color: var(--text-muted); opacity: 0.5; }

.footer-socials { display: flex; gap: 4px; }
.footer-socials a {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  background: rgba(255,255,255,0.05);
  transition: all var(--dur) var(--ease);
}
.footer-socials a:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.1);
}

.footer-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

/* ========================================
   入场动画(一次性,简洁)
   ======================================== */
.service-group, .bookmark-group {
  animation: fadeIn 0.4s var(--ease) backwards;
}
.service-group:nth-child(1) { animation-delay: 0s; }
.service-group:nth-child(2) { animation-delay: 0.05s; }
.service-group:nth-child(3) { animation-delay: 0.1s; }
.service-group:nth-child(4) { animation-delay: 0.15s; }
.service-group:nth-child(5) { animation-delay: 0.2s; }
.service-group:nth-child(6) { animation-delay: 0.25s; }

.bookmark-group:nth-child(1) { animation-delay: 0.05s; }
.bookmark-group:nth-child(2) { animation-delay: 0.1s; }
.bookmark-group:nth-child(3) { animation-delay: 0.15s; }
.bookmark-group:nth-child(4) { animation-delay: 0.2s; }
.bookmark-group:nth-child(5) { animation-delay: 0.25s; }
.bookmark-group:nth-child(6) { animation-delay: 0.3s; }
.bookmark-group:nth-child(7) { animation-delay: 0.35s; }
.bookmark-group:nth-child(8) { animation-delay: 0.4s; }

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

/* ========================================
   响应式
   ======================================== */
@media (max-width: 768px) {
  :root { --pad-x: 16px; --gap: 10px; }
  body { padding: 16px var(--pad-x) 32px; }

  .search-container { padding: 5px 5px 5px 16px; gap: 8px; }
  .search-input { font-size: 0.9rem; padding: 10px 0; }
  .search-provider-icons span { width: 28px; height: 28px; font-size: 0.64rem; }

  .info-bar { grid-template-columns: 1fr; gap: 8px; margin-bottom: 24px; }
  .info-card { padding: 12px 14px; }

  .grid-container { grid-template-columns: 1fr; }
  .bookmark-grid { grid-template-columns: 1fr; }

  .footer-row { flex-direction: column; align-items: center; text-align: center; }
}

@media (min-width: 1440px) {
  .grid-container { grid-template-columns: repeat(3, 1fr); }
}

/* ========================================
   无障碍:减少动效
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
